layers-ui.js 5.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997
  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) {
  38. return value;
  39. };
  40. /******/
  41. /******/ // define getter function for harmony exports
  42. /******/ __webpack_require__.d = function (exports, name, getter) {
  43. /******/ if (!__webpack_require__.o(exports, name)) {
  44. /******/ Object.defineProperty(exports, name, {
  45. /******/ configurable: false,
  46. /******/ enumerable: true,
  47. /******/ get: getter
  48. /******/});
  49. /******/ }
  50. /******/ };
  51. /******/
  52. /******/ // getDefaultExport function for compatibility with non-harmony modules
  53. /******/ __webpack_require__.n = function (module) {
  54. /******/ var getter = module && module.__esModule ?
  55. /******/ function getDefault() {
  56. return module['default'];
  57. } :
  58. /******/ function getModuleExports() {
  59. return module;
  60. };
  61. /******/ __webpack_require__.d(getter, 'a', getter);
  62. /******/ return getter;
  63. /******/ };
  64. /******/
  65. /******/ // Object.prototype.hasOwnProperty.call
  66. /******/ __webpack_require__.o = function (object, property) {
  67. return Object.prototype.hasOwnProperty.call(object, property);
  68. };
  69. /******/
  70. /******/ // __webpack_public_path__
  71. /******/ __webpack_require__.p = "";
  72. /******/
  73. /******/ // Load entry module and return exports
  74. /******/ return __webpack_require__(__webpack_require__.s = 28);
  75. /******/ })
  76. /************************************************************************/
  77. /******/([
  78. /* 0 */
  79. /***/ (function (module, exports, __webpack_require__) {
  80. "use strict";
  81. Object.defineProperty(exports, "__esModule", {
  82. value: true
  83. });
  84. var _jquery = __webpack_require__(1);
  85. var _jquery2 = _interopRequireDefault(_jquery);
  86. function _interopRequireDefault(obj) {
  87. return obj && obj.__esModule ? obj : {default: obj};
  88. }
  89. /**
  90. * --------------------------------------------------------------------------
  91. * Bootstrap (v4.0.0-beta): util.js
  92. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  93. * --------------------------------------------------------------------------
  94. */
  95. var Util = function () {
  96. /**
  97. * ------------------------------------------------------------------------
  98. * Private TransitionEnd Helpers
  99. * ------------------------------------------------------------------------
  100. */
  101. var transition = false;
  102. var MAX_UID = 1000000;
  103. var TransitionEndEvent = {
  104. WebkitTransition: 'webkitTransitionEnd',
  105. MozTransition: 'transitionend',
  106. OTransition: 'oTransitionEnd otransitionend',
  107. transition: 'transitionend'
  108. // shoutout AngusCroll (https://goo.gl/pxwQGp)
  109. };
  110. function toType(obj) {
  111. return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
  112. }
  113. function getSpecialTransitionEndEvent() {
  114. return {
  115. bindType: transition.end,
  116. delegateType: transition.end,
  117. handle: function handle(event) {
  118. if ((0, _jquery2.default)(event.target).is(this)) {
  119. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  120. }
  121. return undefined; // eslint-disable-line no-undefined
  122. }
  123. };
  124. }
  125. function transitionEndTest() {
  126. if (window.QUnit) {
  127. return false;
  128. }
  129. var el = document.createElement('bootstrap');
  130. for (var name in TransitionEndEvent) {
  131. if (typeof el.style[name] !== 'undefined') {
  132. return {
  133. end: TransitionEndEvent[name]
  134. };
  135. }
  136. }
  137. return false;
  138. }
  139. function transitionEndEmulator(duration) {
  140. var _this = this;
  141. var called = false;
  142. (0, _jquery2.default)(this).one(Util.TRANSITION_END, function () {
  143. called = true;
  144. });
  145. setTimeout(function () {
  146. if (!called) {
  147. Util.triggerTransitionEnd(_this);
  148. }
  149. }, duration);
  150. return this;
  151. }
  152. function setTransitionEndSupport() {
  153. transition = transitionEndTest();
  154. _jquery2.default.fn.emulateTransitionEnd = transitionEndEmulator;
  155. if (Util.supportsTransitionEnd()) {
  156. _jquery2.default.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  157. }
  158. }
  159. function parseOption(item) {
  160. if ('true' === item) {
  161. return true;
  162. } else if ('false' === item) {
  163. return false;
  164. } else if (!isNaN(item * 1)) {
  165. return parseFloat(item);
  166. } else {
  167. return item;
  168. }
  169. }
  170. /**
  171. * --------------------------------------------------------------------------
  172. * Public Util Api
  173. * --------------------------------------------------------------------------
  174. */
  175. var Util = {
  176. TRANSITION_END: 'bsTransitionEnd',
  177. getUID: function getUID(prefix) {
  178. do {
  179. // eslint-disable-next-line no-bitwise
  180. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  181. } while (document.getElementById(prefix));
  182. return prefix;
  183. },
  184. getSelectorFromElement: function getSelectorFromElement(element) {
  185. var selector = element.getAttribute('data-target');
  186. if (!selector || selector === '#') {
  187. selector = element.getAttribute('href') || '';
  188. }
  189. try {
  190. var $selector = (0, _jquery2.default)(document).find(selector);
  191. return $selector.length > 0 ? selector : null;
  192. } catch (error) {
  193. return null;
  194. }
  195. },
  196. reflow: function reflow(element) {
  197. return element.offsetHeight;
  198. },
  199. triggerTransitionEnd: function triggerTransitionEnd(element) {
  200. (0, _jquery2.default)(element).trigger(transition.end);
  201. },
  202. supportsTransitionEnd: function supportsTransitionEnd() {
  203. return Boolean(transition);
  204. },
  205. isElement: function isElement(obj) {
  206. return (obj[0] || obj).nodeType;
  207. },
  208. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  209. for (var property in configTypes) {
  210. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  211. var expectedTypes = configTypes[property];
  212. var value = config[property];
  213. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  214. if (!new RegExp(expectedTypes).test(valueType)) {
  215. throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
  216. }
  217. }
  218. }
  219. },
  220. parseDataOptions: function parseDataOptions(dataOptions) {
  221. var options = [];
  222. var string = dataOptions.split(';');
  223. string.forEach(function (item, index) {
  224. var option = item.split(':');
  225. option = option.map(function (item) {
  226. return item.trim();
  227. });
  228. if (option[0]) {
  229. options[option[0]] = parseOption(option[1]);
  230. }
  231. });
  232. return options;
  233. }
  234. };
  235. setTransitionEndSupport();
  236. return Util;
  237. }(_jquery2.default);
  238. exports.default = Util;
  239. /***/ }),
  240. /* 1 */
  241. /***/ (function (module, exports) {
  242. module.exports = jQuery;
  243. /***/ }),
  244. /* 2 */,
  245. /* 3 */
  246. /***/ (function (module, exports, __webpack_require__) {
  247. "use strict";
  248. Object.defineProperty(exports, "__esModule", {
  249. value: true
  250. });
  251. var _createClass = function () {
  252. function defineProperties(target, props) {
  253. for (var i = 0; i < props.length; i++) {
  254. var descriptor = props[i];
  255. descriptor.enumerable = descriptor.enumerable || false;
  256. descriptor.configurable = true;
  257. if ("value" in descriptor)
  258. descriptor.writable = true;
  259. Object.defineProperty(target, descriptor.key, descriptor);
  260. }
  261. }
  262. return function (Constructor, protoProps, staticProps) {
  263. if (protoProps)
  264. defineProperties(Constructor.prototype, protoProps);
  265. if (staticProps)
  266. defineProperties(Constructor, staticProps);
  267. return Constructor;
  268. };
  269. }();
  270. function _classCallCheck(instance, Constructor) {
  271. if (!(instance instanceof Constructor)) {
  272. throw new TypeError("Cannot call a class as a function");
  273. }
  274. }
  275. var SELECTORS = {
  276. inputsContainer: '[data-inputs-container]',
  277. virtualInput: '[data-virtual-input]',
  278. isChecked: 'is-selected',
  279. inputTarget: '[data-input-target]',
  280. dataTargetId: '[data-target-id]',
  281. content: '[data-content]',
  282. contentTarget: '[data-content-target]'
  283. };
  284. var selectInput = function () {
  285. function selectInput(inputGroup, drop) {
  286. _classCallCheck(this, selectInput);
  287. this.inputGroup = inputGroup;
  288. this.type = this.inputGroup.data('inputs-container');
  289. this.drop = drop;
  290. this.virtualInputs = this.inputGroup.find(SELECTORS.virtualInput);
  291. this.bindEvents();
  292. }
  293. _createClass(selectInput, [{
  294. key: 'bindEvents',
  295. value: function bindEvents() {
  296. var _this = this;
  297. this.virtualInputs.on('click', function (event) {
  298. return _this.selectItem(event);
  299. });
  300. }
  301. }, {
  302. key: 'selectItem',
  303. value: function selectItem(event) {
  304. if (this.type == 'checkboxes') {
  305. if ($(event.currentTarget).hasClass('is-selected')) {
  306. $(event.currentTarget).removeClass(SELECTORS.isChecked);
  307. $(event.currentTarget).find('input').prop("checked", false);
  308. } else {
  309. $(event.currentTarget).addClass(SELECTORS.isChecked);
  310. $(event.currentTarget).find('input').prop("checked", true);
  311. }
  312. } else {
  313. this.virtualInputs.removeClass(SELECTORS.isChecked);
  314. this.virtualInputs.find('input').prop("checked", false);
  315. $(event.currentTarget).addClass(SELECTORS.isChecked);
  316. $(event.currentTarget).find('input').prop("checked", true);
  317. }
  318. if (this.drop) {
  319. this.getDropdownContent(event);
  320. this.setDropdownContent();
  321. this.drop.close();
  322. }
  323. }
  324. }, {
  325. key: 'setDropdownContent',
  326. value: function setDropdownContent() {
  327. for (var property in this.data) {
  328. $(this.drop.target).find('[data-view-' + property + ']').text(this.data[property]);
  329. }
  330. }
  331. }, {
  332. key: 'getDropdownContent',
  333. value: function getDropdownContent(event) {
  334. this.data = $(event.currentTarget).data('config');
  335. }
  336. }], [{
  337. key: 'init',
  338. value: function init(container, drop) {
  339. if (container) {
  340. new selectInput($(container).find(SELECTORS.inputsContainer), drop);
  341. } else {
  342. $(SELECTORS.inputsContainer).each(function () {
  343. new selectInput($(this), drop);
  344. });
  345. }
  346. }
  347. }]);
  348. return selectInput;
  349. }();
  350. exports.default = selectInput;
  351. /***/ }),
  352. /* 4 */
  353. /***/ (function (module, exports, __webpack_require__) {
  354. "use strict";
  355. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  356. return typeof obj;
  357. } : function (obj) {
  358. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  359. };
  360. /**
  361. * Swiper 3.4.2
  362. * Most modern mobile touch slider and framework with hardware accelerated transitions
  363. *
  364. * http://www.idangero.us/swiper/
  365. *
  366. * Copyright 2017, Vladimir Kharlampidi
  367. * The iDangero.us
  368. * http://www.idangero.us/
  369. *
  370. * Licensed under MIT
  371. *
  372. * Released on: March 10, 2017
  373. */
  374. (function () {
  375. 'use strict';
  376. var $;
  377. /*===========================
  378. Swiper
  379. ===========================*/
  380. var Swiper = function Swiper(container, params) {
  381. if (!(this instanceof Swiper))
  382. return new Swiper(container, params);
  383. var defaults = {
  384. direction: 'horizontal',
  385. touchEventsTarget: 'lu-container',
  386. initialSlide: 0,
  387. speed: 300,
  388. // autoplay
  389. autoplay: false,
  390. autoplayDisableOnInteraction: true,
  391. autoplayStopOnLast: false,
  392. // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
  393. iOSEdgeSwipeDetection: false,
  394. iOSEdgeSwipeThreshold: 20,
  395. // Free mode
  396. freeMode: false,
  397. freeModeMomentum: true,
  398. freeModeMomentumRatio: 1,
  399. freeModeMomentumBounce: true,
  400. freeModeMomentumBounceRatio: 1,
  401. freeModeMomentumVelocityRatio: 1,
  402. freeModeSticky: false,
  403. freeModeMinimumVelocity: 0.02,
  404. // Autoheight
  405. autoHeight: false,
  406. // Set wrapper width
  407. setWrapperSize: false,
  408. // Virtual Translate
  409. virtualTranslate: false,
  410. // Effects
  411. effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
  412. coverflow: {
  413. rotate: 50,
  414. stretch: 0,
  415. depth: 100,
  416. modifier: 1,
  417. slideShadows: true
  418. },
  419. flip: {
  420. slideShadows: true,
  421. limitRotation: true
  422. },
  423. cube: {
  424. slideShadows: true,
  425. shadow: true,
  426. shadowOffset: 20,
  427. shadowScale: 0.94
  428. },
  429. fade: {
  430. crossFade: false
  431. },
  432. // Parallax
  433. parallax: false,
  434. // Zoom
  435. zoom: false,
  436. zoomMax: 3,
  437. zoomMin: 1,
  438. zoomToggle: true,
  439. // Scrollbar
  440. scrollbar: null,
  441. scrollbarHide: true,
  442. scrollbarDraggable: false,
  443. scrollbarSnapOnRelease: false,
  444. // Keyboard Mousewheel
  445. keyboardControl: false,
  446. mousewheelControl: false,
  447. mousewheelReleaseOnEdges: false,
  448. mousewheelInvert: false,
  449. mousewheelForceToAxis: false,
  450. mousewheelSensitivity: 1,
  451. mousewheelEventsTarged: 'lu-container',
  452. // Hash Navigation
  453. hashnav: false,
  454. hashnavWatchState: false,
  455. // History
  456. history: false,
  457. // Commong Nav State
  458. replaceState: false,
  459. // Breakpoints
  460. breakpoints: undefined,
  461. // Slides grid
  462. spaceBetween: 0,
  463. slidesPerView: 1,
  464. slidesPerColumn: 1,
  465. slidesPerColumnFill: 'column',
  466. slidesPerGroup: 1,
  467. centeredSlides: false,
  468. slidesOffsetBefore: 0, // in px
  469. slidesOffsetAfter: 0, // in px
  470. // Round length
  471. roundLengths: false,
  472. // Touches
  473. touchRatio: 1,
  474. touchAngle: 45,
  475. simulateTouch: true,
  476. shortSwipes: true,
  477. longSwipes: true,
  478. longSwipesRatio: 0.5,
  479. longSwipesMs: 300,
  480. followFinger: true,
  481. onlyExternal: false,
  482. threshold: 0,
  483. touchMoveStopPropagation: true,
  484. touchReleaseOnEdges: false,
  485. // Unique Navigation Elements
  486. uniqueNavElements: true,
  487. // Pagination
  488. pagination: null,
  489. paginationElement: 'span',
  490. paginationClickable: false,
  491. paginationHide: false,
  492. paginationBulletRender: null,
  493. paginationProgressRender: null,
  494. paginationFractionRender: null,
  495. paginationCustomRender: null,
  496. paginationType: 'bullets', // 'bullets' or 'progress' or 'fraction' or 'custom'
  497. // Resistance
  498. resistance: true,
  499. resistanceRatio: 0.85,
  500. // Next/prev buttons
  501. nextButton: null,
  502. prevButton: null,
  503. // Progress
  504. watchSlidesProgress: false,
  505. watchSlidesVisibility: false,
  506. // Cursor
  507. grabCursor: false,
  508. // Clicks
  509. preventClicks: true,
  510. preventClicksPropagation: true,
  511. slideToClickedSlide: false,
  512. // Lazy Loading
  513. lazyLoading: false,
  514. lazyLoadingInPrevNext: false,
  515. lazyLoadingInPrevNextAmount: 1,
  516. lazyLoadingOnTransitionStart: false,
  517. // Images
  518. preloadImages: true,
  519. updateOnImagesReady: true,
  520. // loop
  521. loop: false,
  522. loopAdditionalSlides: 0,
  523. loopedSlides: null,
  524. // Control
  525. control: undefined,
  526. controlInverse: false,
  527. controlBy: 'slide', //or 'container'
  528. normalizeSlideIndex: true,
  529. // Swiping/no swiping
  530. allowSwipeToPrev: true,
  531. allowSwipeToNext: true,
  532. swipeHandler: null, //'.swipe-handler',
  533. noSwiping: true,
  534. noSwipingClass: 'swiper-no-swiping',
  535. // Passive Listeners
  536. passiveListeners: true,
  537. // NS
  538. containerModifierClass: 'swiper-container-', // NEW
  539. slideClass: 'swiper-slide',
  540. slideActiveClass: 'swiper-slide-active',
  541. slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
  542. slideVisibleClass: 'swiper-slide-visible',
  543. slideDuplicateClass: 'swiper-slide-duplicate',
  544. slideNextClass: 'swiper-slide-next',
  545. slideDuplicateNextClass: 'swiper-slide-duplicate-next',
  546. slidePrevClass: 'swiper-slide-prev',
  547. slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
  548. wrapperClass: 'swiper-wrapper',
  549. bulletClass: 'swiper-pagination-bullet',
  550. bulletActiveClass: 'swiper-pagination-bullet-active',
  551. buttonDisabledClass: 'swiper-button-disabled',
  552. paginationCurrentClass: 'swiper-pagination-current',
  553. paginationTotalClass: 'swiper-pagination-total',
  554. paginationHiddenClass: 'swiper-pagination-hidden',
  555. paginationProgressbarClass: 'swiper-pagination-progressbar',
  556. paginationClickableClass: 'swiper-pagination-clickable', // NEW
  557. paginationModifierClass: 'swiper-pagination-', // NEW
  558. lazyLoadingClass: 'swiper-lazy',
  559. lazyStatusLoadingClass: 'swiper-lazy-loading',
  560. lazyStatusLoadedClass: 'swiper-lazy-loaded',
  561. lazyPreloaderClass: 'swiper-lazy-preloader',
  562. notificationClass: 'swiper-notification',
  563. preloaderClass: 'preloader',
  564. zoomContainerClass: 'swiper-zoom-container',
  565. // Observer
  566. observer: false,
  567. observeParents: false,
  568. // Accessibility
  569. a11y: false,
  570. prevSlideMessage: 'Previous slide',
  571. nextSlideMessage: 'Next slide',
  572. firstSlideMessage: 'This is the first slide',
  573. lastSlideMessage: 'This is the last slide',
  574. paginationBulletMessage: 'Go to slide {{index}}',
  575. // Callbacks
  576. runCallbacksOnInit: true
  577. /*
  578. Callbacks:
  579. onInit: function (swiper)
  580. onDestroy: function (swiper)
  581. onBeforeResize: function (swiper)
  582. onAfterResize: function (swiper)
  583. onClick: function (swiper, e)
  584. onTap: function (swiper, e)
  585. onDoubleTap: function (swiper, e)
  586. onSliderMove: function (swiper, e)
  587. onSlideChangeStart: function (swiper)
  588. onSlideChangeEnd: function (swiper)
  589. onTransitionStart: function (swiper)
  590. onTransitionEnd: function (swiper)
  591. onImagesReady: function (swiper)
  592. onProgress: function (swiper, progress)
  593. onTouchStart: function (swiper, e)
  594. onTouchMove: function (swiper, e)
  595. onTouchMoveOpposite: function (swiper, e)
  596. onTouchEnd: function (swiper, e)
  597. onReachBeginning: function (swiper)
  598. onReachEnd: function (swiper)
  599. onSetTransition: function (swiper, duration)
  600. onSetTranslate: function (swiper, translate)
  601. onAutoplayStart: function (swiper)
  602. onAutoplayStop: function (swiper),
  603. onLazyImageLoad: function (swiper, slide, image)
  604. onLazyImageReady: function (swiper, slide, image)
  605. onKeyPress: function (swiper, keyCode)
  606. */
  607. };
  608. var initialVirtualTranslate = params && params.virtualTranslate;
  609. params = params || {};
  610. var originalParams = {};
  611. for (var param in params) {
  612. 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)) {
  613. originalParams[param] = {};
  614. for (var deepParam in params[param]) {
  615. originalParams[param][deepParam] = params[param][deepParam];
  616. }
  617. } else {
  618. originalParams[param] = params[param];
  619. }
  620. }
  621. for (var def in defaults) {
  622. if (typeof params[def] === 'undefined') {
  623. params[def] = defaults[def];
  624. } else if (_typeof(params[def]) === 'object') {
  625. for (var deepDef in defaults[def]) {
  626. if (typeof params[def][deepDef] === 'undefined') {
  627. params[def][deepDef] = defaults[def][deepDef];
  628. }
  629. }
  630. }
  631. }
  632. // Swiper
  633. var s = this;
  634. // Params
  635. s.params = params;
  636. s.originalParams = originalParams;
  637. // Classname
  638. s.classNames = [];
  639. /*=========================
  640. Dom Library and plugins
  641. ===========================*/
  642. if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined') {
  643. $ = Dom7;
  644. }
  645. if (typeof $ === 'undefined') {
  646. if (typeof Dom7 === 'undefined') {
  647. $ = window.Dom7 || window.Zepto || window.jQuery;
  648. } else {
  649. $ = Dom7;
  650. }
  651. if (!$)
  652. return;
  653. }
  654. // Export it to Swiper instance
  655. s.$ = $;
  656. /*=========================
  657. Breakpoints
  658. ===========================*/
  659. s.currentBreakpoint = undefined;
  660. s.getActiveBreakpoint = function () {
  661. //Get breakpoint for window width
  662. if (!s.params.breakpoints)
  663. return false;
  664. var breakpoint = false;
  665. var points = [],
  666. point;
  667. for (point in s.params.breakpoints) {
  668. if (s.params.breakpoints.hasOwnProperty(point)) {
  669. points.push(point);
  670. }
  671. }
  672. points.sort(function (a, b) {
  673. return parseInt(a, 10) > parseInt(b, 10);
  674. });
  675. for (var i = 0; i < points.length; i++) {
  676. point = points[i];
  677. if (point >= window.innerWidth && !breakpoint) {
  678. breakpoint = point;
  679. }
  680. }
  681. return breakpoint || 'max';
  682. };
  683. s.setBreakpoint = function () {
  684. //Set breakpoint for window width and update parameters
  685. var breakpoint = s.getActiveBreakpoint();
  686. if (breakpoint && s.currentBreakpoint !== breakpoint) {
  687. var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
  688. var needsReLoop = s.params.loop && breakPointsParams.slidesPerView !== s.params.slidesPerView;
  689. for (var param in breakPointsParams) {
  690. s.params[param] = breakPointsParams[param];
  691. }
  692. s.currentBreakpoint = breakpoint;
  693. if (needsReLoop && s.destroyLoop) {
  694. s.reLoop(true);
  695. }
  696. }
  697. };
  698. // Set breakpoint on load
  699. if (s.params.breakpoints) {
  700. s.setBreakpoint();
  701. }
  702. /*=========================
  703. Preparation - Define Container, Wrapper and Pagination
  704. ===========================*/
  705. s.container = $(container);
  706. if (s.container.length === 0)
  707. return;
  708. if (s.container.length > 1) {
  709. var swipers = [];
  710. s.container.each(function () {
  711. var container = this;
  712. swipers.push(new Swiper(this, params));
  713. });
  714. return swipers;
  715. }
  716. // Save instance in container HTML Element and in data
  717. s.container[0].swiper = s;
  718. s.container.data('swiper', s);
  719. s.classNames.push(s.params.containerModifierClass + s.params.direction);
  720. if (s.params.freeMode) {
  721. s.classNames.push(s.params.containerModifierClass + 'free-mode');
  722. }
  723. if (!s.support.flexbox) {
  724. s.classNames.push(s.params.containerModifierClass + 'no-flexbox');
  725. s.params.slidesPerColumn = 1;
  726. }
  727. if (s.params.autoHeight) {
  728. s.classNames.push(s.params.containerModifierClass + 'autoheight');
  729. }
  730. // Enable slides progress when required
  731. if (s.params.parallax || s.params.watchSlidesVisibility) {
  732. s.params.watchSlidesProgress = true;
  733. }
  734. // Max resistance when touchReleaseOnEdges
  735. if (s.params.touchReleaseOnEdges) {
  736. s.params.resistanceRatio = 0;
  737. }
  738. // Coverflow / 3D
  739. if (['cube', 'coverflow', 'flip'].indexOf(s.params.effect) >= 0) {
  740. if (s.support.transforms3d) {
  741. s.params.watchSlidesProgress = true;
  742. s.classNames.push(s.params.containerModifierClass + '3d');
  743. } else {
  744. s.params.effect = 'slide';
  745. }
  746. }
  747. if (s.params.effect !== 'slide') {
  748. s.classNames.push(s.params.containerModifierClass + s.params.effect);
  749. }
  750. if (s.params.effect === 'cube') {
  751. s.params.resistanceRatio = 0;
  752. s.params.slidesPerView = 1;
  753. s.params.slidesPerColumn = 1;
  754. s.params.slidesPerGroup = 1;
  755. s.params.centeredSlides = false;
  756. s.params.spaceBetween = 0;
  757. s.params.virtualTranslate = true;
  758. }
  759. if (s.params.effect === 'fade' || s.params.effect === 'flip') {
  760. s.params.slidesPerView = 1;
  761. s.params.slidesPerColumn = 1;
  762. s.params.slidesPerGroup = 1;
  763. s.params.watchSlidesProgress = true;
  764. s.params.spaceBetween = 0;
  765. if (typeof initialVirtualTranslate === 'undefined') {
  766. s.params.virtualTranslate = true;
  767. }
  768. }
  769. // Grab Cursor
  770. if (s.params.grabCursor && s.support.touch) {
  771. s.params.grabCursor = false;
  772. }
  773. // Wrapper
  774. s.wrapper = s.container.children('.' + s.params.wrapperClass);
  775. // Pagination
  776. if (s.params.pagination) {
  777. s.paginationContainer = $(s.params.pagination);
  778. if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
  779. s.paginationContainer = s.container.find(s.params.pagination);
  780. }
  781. if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
  782. s.paginationContainer.addClass(s.params.paginationModifierClass + 'clickable');
  783. } else {
  784. s.params.paginationClickable = false;
  785. }
  786. s.paginationContainer.addClass(s.params.paginationModifierClass + s.params.paginationType);
  787. }
  788. // Next/Prev Buttons
  789. if (s.params.nextButton || s.params.prevButton) {
  790. if (s.params.nextButton) {
  791. s.nextButton = $(s.params.nextButton);
  792. if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
  793. s.nextButton = s.container.find(s.params.nextButton);
  794. }
  795. }
  796. if (s.params.prevButton) {
  797. s.prevButton = $(s.params.prevButton);
  798. if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
  799. s.prevButton = s.container.find(s.params.prevButton);
  800. }
  801. }
  802. }
  803. // Is Horizontal
  804. s.isHorizontal = function () {
  805. return s.params.direction === 'horizontal';
  806. };
  807. // s.isH = isH;
  808. // RTL
  809. s.rtl = s.isHorizontal() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');
  810. if (s.rtl) {
  811. s.classNames.push(s.params.containerModifierClass + 'rtl');
  812. }
  813. // Wrong RTL support
  814. if (s.rtl) {
  815. s.wrongRTL = s.wrapper.css('display') === '-webkit-box';
  816. }
  817. // Columns
  818. if (s.params.slidesPerColumn > 1) {
  819. s.classNames.push(s.params.containerModifierClass + 'multirow');
  820. }
  821. // Check for Android
  822. if (s.device.android) {
  823. s.classNames.push(s.params.containerModifierClass + 'android');
  824. }
  825. // Add classes
  826. s.container.addClass(s.classNames.join(' '));
  827. // Translate
  828. s.translate = 0;
  829. // Progress
  830. s.progress = 0;
  831. // Velocity
  832. s.velocity = 0;
  833. /*=========================
  834. Locks, unlocks
  835. ===========================*/
  836. s.lockSwipeToNext = function () {
  837. s.params.allowSwipeToNext = false;
  838. if (s.params.allowSwipeToPrev === false && s.params.grabCursor) {
  839. s.unsetGrabCursor();
  840. }
  841. };
  842. s.lockSwipeToPrev = function () {
  843. s.params.allowSwipeToPrev = false;
  844. if (s.params.allowSwipeToNext === false && s.params.grabCursor) {
  845. s.unsetGrabCursor();
  846. }
  847. };
  848. s.lockSwipes = function () {
  849. s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;
  850. if (s.params.grabCursor)
  851. s.unsetGrabCursor();
  852. };
  853. s.unlockSwipeToNext = function () {
  854. s.params.allowSwipeToNext = true;
  855. if (s.params.allowSwipeToPrev === true && s.params.grabCursor) {
  856. s.setGrabCursor();
  857. }
  858. };
  859. s.unlockSwipeToPrev = function () {
  860. s.params.allowSwipeToPrev = true;
  861. if (s.params.allowSwipeToNext === true && s.params.grabCursor) {
  862. s.setGrabCursor();
  863. }
  864. };
  865. s.unlockSwipes = function () {
  866. s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;
  867. if (s.params.grabCursor)
  868. s.setGrabCursor();
  869. };
  870. /*=========================
  871. Round helper
  872. ===========================*/
  873. function round(a) {
  874. return Math.floor(a);
  875. }
  876. /*=========================
  877. Set grab cursor
  878. ===========================*/
  879. s.setGrabCursor = function (moving) {
  880. s.container[0].style.cursor = 'move';
  881. s.container[0].style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
  882. s.container[0].style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
  883. s.container[0].style.cursor = moving ? 'grabbing' : 'grab';
  884. };
  885. s.unsetGrabCursor = function () {
  886. s.container[0].style.cursor = '';
  887. };
  888. if (s.params.grabCursor) {
  889. s.setGrabCursor();
  890. }
  891. /*=========================
  892. Update on Images Ready
  893. ===========================*/
  894. s.imagesToLoad = [];
  895. s.imagesLoaded = 0;
  896. s.loadImage = function (imgElement, src, srcset, sizes, checkForComplete, callback) {
  897. var image;
  898. function onReady() {
  899. if (callback)
  900. callback();
  901. }
  902. if (!imgElement.complete || !checkForComplete) {
  903. if (src) {
  904. image = new window.Image();
  905. image.onload = onReady;
  906. image.onerror = onReady;
  907. if (sizes) {
  908. image.sizes = sizes;
  909. }
  910. if (srcset) {
  911. image.srcset = srcset;
  912. }
  913. if (src) {
  914. image.src = src;
  915. }
  916. } else {
  917. onReady();
  918. }
  919. } else {
  920. //image already loaded...
  921. onReady();
  922. }
  923. };
  924. s.preloadImages = function () {
  925. s.imagesToLoad = s.container.find('img');
  926. function _onReady() {
  927. if (typeof s === 'undefined' || s === null || !s)
  928. return;
  929. if (s.imagesLoaded !== undefined)
  930. s.imagesLoaded++;
  931. if (s.imagesLoaded === s.imagesToLoad.length) {
  932. if (s.params.updateOnImagesReady)
  933. s.update();
  934. s.emit('onImagesReady', s);
  935. }
  936. }
  937. for (var i = 0; i < s.imagesToLoad.length; i++) {
  938. 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);
  939. }
  940. };
  941. /*=========================
  942. Autoplay
  943. ===========================*/
  944. s.autoplayTimeoutId = undefined;
  945. s.autoplaying = false;
  946. s.autoplayPaused = false;
  947. function autoplay() {
  948. var autoplayDelay = s.params.autoplay;
  949. var activeSlide = s.slides.eq(s.activeIndex);
  950. if (activeSlide.attr('data-swiper-autoplay')) {
  951. autoplayDelay = activeSlide.attr('data-swiper-autoplay') || s.params.autoplay;
  952. }
  953. s.autoplayTimeoutId = setTimeout(function () {
  954. if (s.params.loop) {
  955. s.fixLoop();
  956. s._slideNext();
  957. s.emit('onAutoplay', s);
  958. } else {
  959. if (!s.isEnd) {
  960. s._slideNext();
  961. s.emit('onAutoplay', s);
  962. } else {
  963. if (!params.autoplayStopOnLast) {
  964. s._slideTo(0);
  965. s.emit('onAutoplay', s);
  966. } else {
  967. s.stopAutoplay();
  968. }
  969. }
  970. }
  971. }, autoplayDelay);
  972. }
  973. s.startAutoplay = function () {
  974. if (typeof s.autoplayTimeoutId !== 'undefined')
  975. return false;
  976. if (!s.params.autoplay)
  977. return false;
  978. if (s.autoplaying)
  979. return false;
  980. s.autoplaying = true;
  981. s.emit('onAutoplayStart', s);
  982. autoplay();
  983. };
  984. s.stopAutoplay = function (internal) {
  985. if (!s.autoplayTimeoutId)
  986. return;
  987. if (s.autoplayTimeoutId)
  988. clearTimeout(s.autoplayTimeoutId);
  989. s.autoplaying = false;
  990. s.autoplayTimeoutId = undefined;
  991. s.emit('onAutoplayStop', s);
  992. };
  993. s.pauseAutoplay = function (speed) {
  994. if (s.autoplayPaused)
  995. return;
  996. if (s.autoplayTimeoutId)
  997. clearTimeout(s.autoplayTimeoutId);
  998. s.autoplayPaused = true;
  999. if (speed === 0) {
  1000. s.autoplayPaused = false;
  1001. autoplay();
  1002. } else {
  1003. s.wrapper.transitionEnd(function () {
  1004. if (!s)
  1005. return;
  1006. s.autoplayPaused = false;
  1007. if (!s.autoplaying) {
  1008. s.stopAutoplay();
  1009. } else {
  1010. autoplay();
  1011. }
  1012. });
  1013. }
  1014. };
  1015. /*=========================
  1016. Min/Max Translate
  1017. ===========================*/
  1018. s.minTranslate = function () {
  1019. return - s.snapGrid[0];
  1020. };
  1021. s.maxTranslate = function () {
  1022. return - s.snapGrid[s.snapGrid.length - 1];
  1023. };
  1024. /*=========================
  1025. Slider/slides sizes
  1026. ===========================*/
  1027. s.updateAutoHeight = function () {
  1028. var activeSlides = [];
  1029. var newHeight = 0;
  1030. var i;
  1031. // Find slides currently in view
  1032. if (s.params.slidesPerView !== 'auto' && s.params.slidesPerView > 1) {
  1033. for (i = 0; i < Math.ceil(s.params.slidesPerView); i++) {
  1034. var index = s.activeIndex + i;
  1035. if (index > s.slides.length)
  1036. break;
  1037. activeSlides.push(s.slides.eq(index)[0]);
  1038. }
  1039. } else {
  1040. activeSlides.push(s.slides.eq(s.activeIndex)[0]);
  1041. }
  1042. // Find new height from heighest slide in view
  1043. for (i = 0; i < activeSlides.length; i++) {
  1044. if (typeof activeSlides[i] !== 'undefined') {
  1045. var height = activeSlides[i].offsetHeight;
  1046. newHeight = height > newHeight ? height : newHeight;
  1047. }
  1048. }
  1049. // Update Height
  1050. if (newHeight)
  1051. s.wrapper.css('height', newHeight + 'px');
  1052. };
  1053. s.updateContainerSize = function () {
  1054. var width, height;
  1055. if (typeof s.params.width !== 'undefined') {
  1056. width = s.params.width;
  1057. } else {
  1058. width = s.container[0].clientWidth;
  1059. }
  1060. if (typeof s.params.height !== 'undefined') {
  1061. height = s.params.height;
  1062. } else {
  1063. height = s.container[0].clientHeight;
  1064. }
  1065. if (width === 0 && s.isHorizontal() || height === 0 && !s.isHorizontal()) {
  1066. return;
  1067. }
  1068. //Subtract paddings
  1069. width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);
  1070. height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);
  1071. // Store values
  1072. s.width = width;
  1073. s.height = height;
  1074. s.size = s.isHorizontal() ? s.width : s.height;
  1075. };
  1076. s.updateSlidesSize = function () {
  1077. s.slides = s.wrapper.children('.' + s.params.slideClass);
  1078. s.snapGrid = [];
  1079. s.slidesGrid = [];
  1080. s.slidesSizesGrid = [];
  1081. var spaceBetween = s.params.spaceBetween,
  1082. slidePosition = - s.params.slidesOffsetBefore,
  1083. i,
  1084. prevSlideSize = 0,
  1085. index = 0;
  1086. if (typeof s.size === 'undefined')
  1087. return;
  1088. if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
  1089. spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
  1090. }
  1091. s.virtualSize = - spaceBetween;
  1092. // reset margins
  1093. if (s.rtl)
  1094. s.slides.css({marginLeft: '', marginTop: ''});
  1095. else
  1096. s.slides.css({marginRight: '', marginBottom: ''});
  1097. var slidesNumberEvenToRows;
  1098. if (s.params.slidesPerColumn > 1) {
  1099. if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {
  1100. slidesNumberEvenToRows = s.slides.length;
  1101. } else {
  1102. slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;
  1103. }
  1104. if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {
  1105. slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);
  1106. }
  1107. }
  1108. // Calc slides
  1109. var slideSize;
  1110. var slidesPerColumn = s.params.slidesPerColumn;
  1111. var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
  1112. var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);
  1113. for (i = 0; i < s.slides.length; i++) {
  1114. slideSize = 0;
  1115. var slide = s.slides.eq(i);
  1116. if (s.params.slidesPerColumn > 1) {
  1117. // Set slides order
  1118. var newSlideOrderIndex;
  1119. var column, row;
  1120. if (s.params.slidesPerColumnFill === 'column') {
  1121. column = Math.floor(i / slidesPerColumn);
  1122. row = i - column * slidesPerColumn;
  1123. if (column > numFullColumns || column === numFullColumns && row === slidesPerColumn - 1) {
  1124. if (++row >= slidesPerColumn) {
  1125. row = 0;
  1126. column++;
  1127. }
  1128. }
  1129. newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
  1130. slide.css({
  1131. '-webkit-box-ordinal-group': newSlideOrderIndex,
  1132. '-moz-box-ordinal-group': newSlideOrderIndex,
  1133. '-ms-flex-order': newSlideOrderIndex,
  1134. '-webkit-order': newSlideOrderIndex,
  1135. 'order': newSlideOrderIndex
  1136. });
  1137. } else {
  1138. row = Math.floor(i / slidesPerRow);
  1139. column = i - row * slidesPerRow;
  1140. }
  1141. 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);
  1142. }
  1143. if (slide.css('display') === 'none')
  1144. continue;
  1145. if (s.params.slidesPerView === 'auto') {
  1146. slideSize = s.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
  1147. if (s.params.roundLengths)
  1148. slideSize = round(slideSize);
  1149. } else {
  1150. slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;
  1151. if (s.params.roundLengths)
  1152. slideSize = round(slideSize);
  1153. if (s.isHorizontal()) {
  1154. s.slides[i].style.width = slideSize + 'px';
  1155. } else {
  1156. s.slides[i].style.height = slideSize + 'px';
  1157. }
  1158. }
  1159. s.slides[i].swiperSlideSize = slideSize;
  1160. s.slidesSizesGrid.push(slideSize);
  1161. if (s.params.centeredSlides) {
  1162. slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
  1163. if (prevSlideSize === 0 && i !== 0)
  1164. slidePosition = slidePosition - s.size / 2 - spaceBetween;
  1165. if (i === 0)
  1166. slidePosition = slidePosition - s.size / 2 - spaceBetween;
  1167. if (Math.abs(slidePosition) < 1 / 1000)
  1168. slidePosition = 0;
  1169. if (index % s.params.slidesPerGroup === 0)
  1170. s.snapGrid.push(slidePosition);
  1171. s.slidesGrid.push(slidePosition);
  1172. } else {
  1173. if (index % s.params.slidesPerGroup === 0)
  1174. s.snapGrid.push(slidePosition);
  1175. s.slidesGrid.push(slidePosition);
  1176. slidePosition = slidePosition + slideSize + spaceBetween;
  1177. }
  1178. s.virtualSize += slideSize + spaceBetween;
  1179. prevSlideSize = slideSize;
  1180. index++;
  1181. }
  1182. s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;
  1183. var newSlidesGrid;
  1184. if (s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {
  1185. s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
  1186. }
  1187. if (!s.support.flexbox || s.params.setWrapperSize) {
  1188. if (s.isHorizontal())
  1189. s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
  1190. else
  1191. s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'});
  1192. }
  1193. if (s.params.slidesPerColumn > 1) {
  1194. s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;
  1195. s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;
  1196. if (s.isHorizontal())
  1197. s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
  1198. else
  1199. s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'});
  1200. if (s.params.centeredSlides) {
  1201. newSlidesGrid = [];
  1202. for (i = 0; i < s.snapGrid.length; i++) {
  1203. if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0])
  1204. newSlidesGrid.push(s.snapGrid[i]);
  1205. }
  1206. s.snapGrid = newSlidesGrid;
  1207. }
  1208. }
  1209. // Remove last grid elements depending on width
  1210. if (!s.params.centeredSlides) {
  1211. newSlidesGrid = [];
  1212. for (i = 0; i < s.snapGrid.length; i++) {
  1213. if (s.snapGrid[i] <= s.virtualSize - s.size) {
  1214. newSlidesGrid.push(s.snapGrid[i]);
  1215. }
  1216. }
  1217. s.snapGrid = newSlidesGrid;
  1218. if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
  1219. s.snapGrid.push(s.virtualSize - s.size);
  1220. }
  1221. }
  1222. if (s.snapGrid.length === 0)
  1223. s.snapGrid = [0];
  1224. if (s.params.spaceBetween !== 0) {
  1225. if (s.isHorizontal()) {
  1226. if (s.rtl)
  1227. s.slides.css({marginLeft: spaceBetween + 'px'});
  1228. else
  1229. s.slides.css({marginRight: spaceBetween + 'px'});
  1230. } else
  1231. s.slides.css({marginBottom: spaceBetween + 'px'});
  1232. }
  1233. if (s.params.watchSlidesProgress) {
  1234. s.updateSlidesOffset();
  1235. }
  1236. };
  1237. s.updateSlidesOffset = function () {
  1238. for (var i = 0; i < s.slides.length; i++) {
  1239. s.slides[i].swiperSlideOffset = s.isHorizontal() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;
  1240. }
  1241. };
  1242. /*=========================
  1243. Dynamic Slides Per View
  1244. ===========================*/
  1245. s.currentSlidesPerView = function () {
  1246. var spv = 1,
  1247. i,
  1248. j;
  1249. if (s.params.centeredSlides) {
  1250. var size = s.slides[s.activeIndex].swiperSlideSize;
  1251. var breakLoop;
  1252. for (i = s.activeIndex + 1; i < s.slides.length; i++) {
  1253. if (s.slides[i] && !breakLoop) {
  1254. size += s.slides[i].swiperSlideSize;
  1255. spv++;
  1256. if (size > s.size)
  1257. breakLoop = true;
  1258. }
  1259. }
  1260. for (j = s.activeIndex - 1; j >= 0; j--) {
  1261. if (s.slides[j] && !breakLoop) {
  1262. size += s.slides[j].swiperSlideSize;
  1263. spv++;
  1264. if (size > s.size)
  1265. breakLoop = true;
  1266. }
  1267. }
  1268. } else {
  1269. for (i = s.activeIndex + 1; i < s.slides.length; i++) {
  1270. if (s.slidesGrid[i] - s.slidesGrid[s.activeIndex] < s.size) {
  1271. spv++;
  1272. }
  1273. }
  1274. }
  1275. return spv;
  1276. };
  1277. /*=========================
  1278. Slider/slides progress
  1279. ===========================*/
  1280. s.updateSlidesProgress = function (translate) {
  1281. if (typeof translate === 'undefined') {
  1282. translate = s.translate || 0;
  1283. }
  1284. if (s.slides.length === 0)
  1285. return;
  1286. if (typeof s.slides[0].swiperSlideOffset === 'undefined')
  1287. s.updateSlidesOffset();
  1288. var offsetCenter = - translate;
  1289. if (s.rtl)
  1290. offsetCenter = translate;
  1291. // Visible Slides
  1292. s.slides.removeClass(s.params.slideVisibleClass);
  1293. for (var i = 0; i < s.slides.length; i++) {
  1294. var slide = s.slides[i];
  1295. var slideProgress = (offsetCenter + (s.params.centeredSlides ? s.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);
  1296. if (s.params.watchSlidesVisibility) {
  1297. var slideBefore = - (offsetCenter - slide.swiperSlideOffset);
  1298. var slideAfter = slideBefore + s.slidesSizesGrid[i];
  1299. var isVisible = slideBefore >= 0 && slideBefore < s.size || slideAfter > 0 && slideAfter <= s.size || slideBefore <= 0 && slideAfter >= s.size;
  1300. if (isVisible) {
  1301. s.slides.eq(i).addClass(s.params.slideVisibleClass);
  1302. }
  1303. }
  1304. slide.progress = s.rtl ? - slideProgress : slideProgress;
  1305. }
  1306. };
  1307. s.updateProgress = function (translate) {
  1308. if (typeof translate === 'undefined') {
  1309. translate = s.translate || 0;
  1310. }
  1311. var translatesDiff = s.maxTranslate() - s.minTranslate();
  1312. var wasBeginning = s.isBeginning;
  1313. var wasEnd = s.isEnd;
  1314. if (translatesDiff === 0) {
  1315. s.progress = 0;
  1316. s.isBeginning = s.isEnd = true;
  1317. } else {
  1318. s.progress = (translate - s.minTranslate()) / translatesDiff;
  1319. s.isBeginning = s.progress <= 0;
  1320. s.isEnd = s.progress >= 1;
  1321. }
  1322. if (s.isBeginning && !wasBeginning)
  1323. s.emit('onReachBeginning', s);
  1324. if (s.isEnd && !wasEnd)
  1325. s.emit('onReachEnd', s);
  1326. if (s.params.watchSlidesProgress)
  1327. s.updateSlidesProgress(translate);
  1328. s.emit('onProgress', s, s.progress);
  1329. };
  1330. s.updateActiveIndex = function () {
  1331. var translate = s.rtl ? s.translate : - s.translate;
  1332. var newActiveIndex, i, snapIndex;
  1333. for (i = 0; i < s.slidesGrid.length; i++) {
  1334. if (typeof s.slidesGrid[i + 1] !== 'undefined') {
  1335. if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {
  1336. newActiveIndex = i;
  1337. } else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {
  1338. newActiveIndex = i + 1;
  1339. }
  1340. } else {
  1341. if (translate >= s.slidesGrid[i]) {
  1342. newActiveIndex = i;
  1343. }
  1344. }
  1345. }
  1346. // Normalize slideIndex
  1347. if (s.params.normalizeSlideIndex) {
  1348. if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined')
  1349. newActiveIndex = 0;
  1350. }
  1351. // for (i = 0; i < s.slidesGrid.length; i++) {
  1352. // if (- translate >= s.slidesGrid[i]) {
  1353. // newActiveIndex = i;
  1354. // }
  1355. // }
  1356. snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);
  1357. if (snapIndex >= s.snapGrid.length)
  1358. snapIndex = s.snapGrid.length - 1;
  1359. if (newActiveIndex === s.activeIndex) {
  1360. return;
  1361. }
  1362. s.snapIndex = snapIndex;
  1363. s.previousIndex = s.activeIndex;
  1364. s.activeIndex = newActiveIndex;
  1365. s.updateClasses();
  1366. s.updateRealIndex();
  1367. };
  1368. s.updateRealIndex = function () {
  1369. s.realIndex = parseInt(s.slides.eq(s.activeIndex).attr('data-swiper-slide-index') || s.activeIndex, 10);
  1370. };
  1371. /*=========================
  1372. Classes
  1373. ===========================*/
  1374. s.updateClasses = function () {
  1375. s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass + ' ' + s.params.slideDuplicateActiveClass + ' ' + s.params.slideDuplicateNextClass + ' ' + s.params.slideDuplicatePrevClass);
  1376. var activeSlide = s.slides.eq(s.activeIndex);
  1377. // Active classes
  1378. activeSlide.addClass(s.params.slideActiveClass);
  1379. if (params.loop) {
  1380. // Duplicate to all looped slides
  1381. if (activeSlide.hasClass(s.params.slideDuplicateClass)) {
  1382. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass);
  1383. } else {
  1384. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass);
  1385. }
  1386. }
  1387. // Next Slide
  1388. var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
  1389. if (s.params.loop && nextSlide.length === 0) {
  1390. nextSlide = s.slides.eq(0);
  1391. nextSlide.addClass(s.params.slideNextClass);
  1392. }
  1393. // Prev Slide
  1394. var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
  1395. if (s.params.loop && prevSlide.length === 0) {
  1396. prevSlide = s.slides.eq( - 1);
  1397. prevSlide.addClass(s.params.slidePrevClass);
  1398. }
  1399. if (params.loop) {
  1400. // Duplicate to all looped slides
  1401. if (nextSlide.hasClass(s.params.slideDuplicateClass)) {
  1402. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass);
  1403. } else {
  1404. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass);
  1405. }
  1406. if (prevSlide.hasClass(s.params.slideDuplicateClass)) {
  1407. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass);
  1408. } else {
  1409. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass);
  1410. }
  1411. }
  1412. // Pagination
  1413. if (s.paginationContainer && s.paginationContainer.length > 0) {
  1414. // Current/Total
  1415. var current,
  1416. total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
  1417. if (s.params.loop) {
  1418. current = Math.ceil((s.activeIndex - s.loopedSlides) / s.params.slidesPerGroup);
  1419. if (current > s.slides.length - 1 - s.loopedSlides * 2) {
  1420. current = current - (s.slides.length - s.loopedSlides * 2);
  1421. }
  1422. if (current > total - 1)
  1423. current = current - total;
  1424. if (current < 0 && s.params.paginationType !== 'bullets')
  1425. current = total + current;
  1426. } else {
  1427. if (typeof s.snapIndex !== 'undefined') {
  1428. current = s.snapIndex;
  1429. } else {
  1430. current = s.activeIndex || 0;
  1431. }
  1432. }
  1433. // Types
  1434. if (s.params.paginationType === 'bullets' && s.bullets && s.bullets.length > 0) {
  1435. s.bullets.removeClass(s.params.bulletActiveClass);
  1436. if (s.paginationContainer.length > 1) {
  1437. s.bullets.each(function () {
  1438. if ($(this).index() === current)
  1439. $(this).addClass(s.params.bulletActiveClass);
  1440. });
  1441. } else {
  1442. s.bullets.eq(current).addClass(s.params.bulletActiveClass);
  1443. }
  1444. }
  1445. if (s.params.paginationType === 'fraction') {
  1446. s.paginationContainer.find('.' + s.params.paginationCurrentClass).text(current + 1);
  1447. s.paginationContainer.find('.' + s.params.paginationTotalClass).text(total);
  1448. }
  1449. if (s.params.paginationType === 'progress') {
  1450. var scale = (current + 1) / total,
  1451. scaleX = scale,
  1452. scaleY = 1;
  1453. if (!s.isHorizontal()) {
  1454. scaleY = scale;
  1455. scaleX = 1;
  1456. }
  1457. s.paginationContainer.find('.' + s.params.paginationProgressbarClass).transform('translate3d(0,0,0) scaleX(' + scaleX + ') scaleY(' + scaleY + ')').transition(s.params.speed);
  1458. }
  1459. if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
  1460. s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
  1461. s.emit('onPaginationRendered', s, s.paginationContainer[0]);
  1462. }
  1463. }
  1464. // Next/active buttons
  1465. if (!s.params.loop) {
  1466. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  1467. if (s.isBeginning) {
  1468. s.prevButton.addClass(s.params.buttonDisabledClass);
  1469. if (s.params.a11y && s.a11y)
  1470. s.a11y.disable(s.prevButton);
  1471. } else {
  1472. s.prevButton.removeClass(s.params.buttonDisabledClass);
  1473. if (s.params.a11y && s.a11y)
  1474. s.a11y.enable(s.prevButton);
  1475. }
  1476. }
  1477. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  1478. if (s.isEnd) {
  1479. s.nextButton.addClass(s.params.buttonDisabledClass);
  1480. if (s.params.a11y && s.a11y)
  1481. s.a11y.disable(s.nextButton);
  1482. } else {
  1483. s.nextButton.removeClass(s.params.buttonDisabledClass);
  1484. if (s.params.a11y && s.a11y)
  1485. s.a11y.enable(s.nextButton);
  1486. }
  1487. }
  1488. }
  1489. };
  1490. /*=========================
  1491. Pagination
  1492. ===========================*/
  1493. s.updatePagination = function () {
  1494. if (!s.params.pagination)
  1495. return;
  1496. if (s.paginationContainer && s.paginationContainer.length > 0) {
  1497. var paginationHTML = '';
  1498. if (s.params.paginationType === 'bullets') {
  1499. var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
  1500. for (var i = 0; i < numberOfBullets; i++) {
  1501. if (s.params.paginationBulletRender) {
  1502. paginationHTML += s.params.paginationBulletRender(s, i, s.params.bulletClass);
  1503. } else {
  1504. paginationHTML += '<' + s.params.paginationElement + ' class="' + s.params.bulletClass + '"></' + s.params.paginationElement + '>';
  1505. }
  1506. }
  1507. s.paginationContainer.html(paginationHTML);
  1508. s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);
  1509. if (s.params.paginationClickable && s.params.a11y && s.a11y) {
  1510. s.a11y.initPagination();
  1511. }
  1512. }
  1513. if (s.params.paginationType === 'fraction') {
  1514. if (s.params.paginationFractionRender) {
  1515. paginationHTML = s.params.paginationFractionRender(s, s.params.paginationCurrentClass, s.params.paginationTotalClass);
  1516. } else {
  1517. paginationHTML = '<span class="' + s.params.paginationCurrentClass + '"></span>' + ' / ' + '<span class="' + s.params.paginationTotalClass + '"></span>';
  1518. }
  1519. s.paginationContainer.html(paginationHTML);
  1520. }
  1521. if (s.params.paginationType === 'progress') {
  1522. if (s.params.paginationProgressRender) {
  1523. paginationHTML = s.params.paginationProgressRender(s, s.params.paginationProgressbarClass);
  1524. } else {
  1525. paginationHTML = '<span class="' + s.params.paginationProgressbarClass + '"></span>';
  1526. }
  1527. s.paginationContainer.html(paginationHTML);
  1528. }
  1529. if (s.params.paginationType !== 'custom') {
  1530. s.emit('onPaginationRendered', s, s.paginationContainer[0]);
  1531. }
  1532. }
  1533. };
  1534. /*=========================
  1535. Common update method
  1536. ===========================*/
  1537. s.update = function (updateTranslate) {
  1538. if (!s)
  1539. return;
  1540. s.updateContainerSize();
  1541. s.updateSlidesSize();
  1542. s.updateProgress();
  1543. s.updatePagination();
  1544. s.updateClasses();
  1545. if (s.params.scrollbar && s.scrollbar) {
  1546. s.scrollbar.set();
  1547. }
  1548. var newTranslate;
  1549. function forceSetTranslate() {
  1550. var translate = s.rtl ? - s.translate : s.translate;
  1551. newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
  1552. s.setWrapperTranslate(newTranslate);
  1553. s.updateActiveIndex();
  1554. s.updateClasses();
  1555. }
  1556. if (updateTranslate) {
  1557. var translated;
  1558. if (s.controller && s.controller.spline) {
  1559. s.controller.spline = undefined;
  1560. }
  1561. if (s.params.freeMode) {
  1562. forceSetTranslate();
  1563. if (s.params.autoHeight) {
  1564. s.updateAutoHeight();
  1565. }
  1566. } else {
  1567. if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
  1568. translated = s.slideTo(s.slides.length - 1, 0, false, true);
  1569. } else {
  1570. translated = s.slideTo(s.activeIndex, 0, false, true);
  1571. }
  1572. if (!translated) {
  1573. forceSetTranslate();
  1574. }
  1575. }
  1576. } else if (s.params.autoHeight) {
  1577. s.updateAutoHeight();
  1578. }
  1579. };
  1580. /*=========================
  1581. Resize Handler
  1582. ===========================*/
  1583. s.onResize = function (forceUpdatePagination) {
  1584. if (s.params.onBeforeResize)
  1585. s.params.onBeforeResize(s);
  1586. //Breakpoints
  1587. if (s.params.breakpoints) {
  1588. s.setBreakpoint();
  1589. }
  1590. // Disable locks on resize
  1591. var allowSwipeToPrev = s.params.allowSwipeToPrev;
  1592. var allowSwipeToNext = s.params.allowSwipeToNext;
  1593. s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;
  1594. s.updateContainerSize();
  1595. s.updateSlidesSize();
  1596. if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination)
  1597. s.updatePagination();
  1598. if (s.params.scrollbar && s.scrollbar) {
  1599. s.scrollbar.set();
  1600. }
  1601. if (s.controller && s.controller.spline) {
  1602. s.controller.spline = undefined;
  1603. }
  1604. var slideChangedBySlideTo = false;
  1605. if (s.params.freeMode) {
  1606. var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
  1607. s.setWrapperTranslate(newTranslate);
  1608. s.updateActiveIndex();
  1609. s.updateClasses();
  1610. if (s.params.autoHeight) {
  1611. s.updateAutoHeight();
  1612. }
  1613. } else {
  1614. s.updateClasses();
  1615. if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
  1616. slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
  1617. } else {
  1618. slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
  1619. }
  1620. }
  1621. if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
  1622. s.lazy.load();
  1623. }
  1624. // Return locks after resize
  1625. s.params.allowSwipeToPrev = allowSwipeToPrev;
  1626. s.params.allowSwipeToNext = allowSwipeToNext;
  1627. if (s.params.onAfterResize)
  1628. s.params.onAfterResize(s);
  1629. };
  1630. /*=========================
  1631. Events
  1632. ===========================*/
  1633. //Define Touch Events
  1634. s.touchEventsDesktop = {start: 'mousedown', move: 'mousemove', end: 'mouseup'};
  1635. if (window.navigator.pointerEnabled)
  1636. s.touchEventsDesktop = {start: 'pointerdown', move: 'pointermove', end: 'pointerup'};
  1637. else if (window.navigator.msPointerEnabled)
  1638. s.touchEventsDesktop = {start: 'MSPointerDown', move: 'MSPointerMove', end: 'MSPointerUp'};
  1639. s.touchEvents = {
  1640. start: s.support.touch || !s.params.simulateTouch ? 'touchstart' : s.touchEventsDesktop.start,
  1641. move: s.support.touch || !s.params.simulateTouch ? 'touchmove' : s.touchEventsDesktop.move,
  1642. end: s.support.touch || !s.params.simulateTouch ? 'touchend' : s.touchEventsDesktop.end
  1643. };
  1644. // WP8 Touch Events Fix
  1645. if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {
  1646. //console.log('1669', s.params.touchEventsTarget);
  1647. (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);
  1648. }
  1649. // Attach/detach events
  1650. s.initEvents = function (detach) {
  1651. var actionDom = detach ? 'off' : 'on';
  1652. var action = detach ? 'removeEventListener' : 'addEventListener';
  1653. var touchEventsTarget = s.params.touchEventsTarget === 'lu-container' ? s.container[0] : s.wrapper[0];
  1654. var target = s.support.touch ? touchEventsTarget : document;
  1655. var moveCapture = s.params.nested ? true : false;
  1656. //Touch Events
  1657. if (s.browser.ie) {
  1658. touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
  1659. target[action](s.touchEvents.move, s.onTouchMove, moveCapture);
  1660. target[action](s.touchEvents.end, s.onTouchEnd, false);
  1661. } else {
  1662. if (s.support.touch) {
  1663. var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? {passive: true, capture: false} : false;
  1664. touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, passiveListener);
  1665. touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);
  1666. touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, passiveListener);
  1667. }
  1668. if (params.simulateTouch && !s.device.ios && !s.device.android || params.simulateTouch && !s.support.touch && s.device.ios) {
  1669. touchEventsTarget[action]('mousedown', s.onTouchStart, false);
  1670. document[action]('mousemove', s.onTouchMove, moveCapture);
  1671. document[action]('mouseup', s.onTouchEnd, false);
  1672. }
  1673. }
  1674. window[action]('resize', s.onResize);
  1675. // Next, Prev, Index
  1676. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  1677. s.nextButton[actionDom]('click', s.onClickNext);
  1678. if (s.params.a11y && s.a11y)
  1679. s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
  1680. }
  1681. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  1682. s.prevButton[actionDom]('click', s.onClickPrev);
  1683. if (s.params.a11y && s.a11y)
  1684. s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
  1685. }
  1686. if (s.params.pagination && s.params.paginationClickable) {
  1687. s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
  1688. if (s.params.a11y && s.a11y)
  1689. s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
  1690. }
  1691. // Prevent Links Clicks
  1692. if (s.params.preventClicks || s.params.preventClicksPropagation)
  1693. touchEventsTarget[action]('click', s.preventClicks, true);
  1694. };
  1695. s.attachEvents = function () {
  1696. s.initEvents();
  1697. };
  1698. s.detachEvents = function () {
  1699. s.initEvents(true);
  1700. };
  1701. /*=========================
  1702. Handle Clicks
  1703. ===========================*/
  1704. // Prevent Clicks
  1705. s.allowClick = true;
  1706. s.preventClicks = function (e) {
  1707. if (!s.allowClick) {
  1708. if (s.params.preventClicks)
  1709. e.preventDefault();
  1710. if (s.params.preventClicksPropagation && s.animating) {
  1711. e.stopPropagation();
  1712. e.stopImmediatePropagation();
  1713. }
  1714. }
  1715. };
  1716. // Clicks
  1717. s.onClickNext = function (e) {
  1718. e.preventDefault();
  1719. if (s.isEnd && !s.params.loop)
  1720. return;
  1721. s.slideNext();
  1722. };
  1723. s.onClickPrev = function (e) {
  1724. e.preventDefault();
  1725. if (s.isBeginning && !s.params.loop)
  1726. return;
  1727. s.slidePrev();
  1728. };
  1729. s.onClickIndex = function (e) {
  1730. e.preventDefault();
  1731. var index = $(this).index() * s.params.slidesPerGroup;
  1732. if (s.params.loop)
  1733. index = index + s.loopedSlides;
  1734. s.slideTo(index);
  1735. };
  1736. /*=========================
  1737. Handle Touches
  1738. ===========================*/
  1739. function findElementInEvent(e, selector) {
  1740. var el = $(e.target);
  1741. if (!el.is(selector)) {
  1742. if (typeof selector === 'string') {
  1743. el = el.parents(selector);
  1744. } else if (selector.nodeType) {
  1745. var found;
  1746. el.parents().each(function (index, _el) {
  1747. if (_el === selector)
  1748. found = selector;
  1749. });
  1750. if (!found)
  1751. return undefined;
  1752. else
  1753. return selector;
  1754. }
  1755. }
  1756. if (el.length === 0) {
  1757. return undefined;
  1758. }
  1759. return el[0];
  1760. }
  1761. s.updateClickedSlide = function (e) {
  1762. var slide = findElementInEvent(e, '.' + s.params.slideClass);
  1763. var slideFound = false;
  1764. if (slide) {
  1765. for (var i = 0; i < s.slides.length; i++) {
  1766. if (s.slides[i] === slide)
  1767. slideFound = true;
  1768. }
  1769. }
  1770. if (slide && slideFound) {
  1771. s.clickedSlide = slide;
  1772. s.clickedIndex = $(slide).index();
  1773. } else {
  1774. s.clickedSlide = undefined;
  1775. s.clickedIndex = undefined;
  1776. return;
  1777. }
  1778. if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {
  1779. var slideToIndex = s.clickedIndex,
  1780. realIndex,
  1781. duplicatedSlides,
  1782. slidesPerView = s.params.slidesPerView === 'auto' ? s.currentSlidesPerView() : s.params.slidesPerView;
  1783. if (s.params.loop) {
  1784. if (s.animating)
  1785. return;
  1786. realIndex = parseInt($(s.clickedSlide).attr('data-swiper-slide-index'), 10);
  1787. if (s.params.centeredSlides) {
  1788. if (slideToIndex < s.loopedSlides - slidesPerView / 2 || slideToIndex > s.slides.length - s.loopedSlides + slidesPerView / 2) {
  1789. s.fixLoop();
  1790. slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();
  1791. setTimeout(function () {
  1792. s.slideTo(slideToIndex);
  1793. }, 0);
  1794. } else {
  1795. s.slideTo(slideToIndex);
  1796. }
  1797. } else {
  1798. if (slideToIndex > s.slides.length - slidesPerView) {
  1799. s.fixLoop();
  1800. slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();
  1801. setTimeout(function () {
  1802. s.slideTo(slideToIndex);
  1803. }, 0);
  1804. } else {
  1805. s.slideTo(slideToIndex);
  1806. }
  1807. }
  1808. } else {
  1809. s.slideTo(slideToIndex);
  1810. }
  1811. }
  1812. };
  1813. var isTouched,
  1814. isMoved,
  1815. allowTouchCallbacks,
  1816. touchStartTime,
  1817. isScrolling,
  1818. currentTranslate,
  1819. startTranslate,
  1820. allowThresholdMove,
  1821. // Form elements to match
  1822. formElements = 'input, select, textarea, button, video',
  1823. // Last click time
  1824. lastClickTime = Date.now(),
  1825. clickTimeout,
  1826. //Velocities
  1827. velocities = [],
  1828. allowMomentumBounce;
  1829. // Animating Flag
  1830. s.animating = false;
  1831. // Touches information
  1832. s.touches = {
  1833. startX: 0,
  1834. startY: 0,
  1835. currentX: 0,
  1836. currentY: 0,
  1837. diff: 0
  1838. };
  1839. // Touch handlers
  1840. var isTouchEvent, startMoving;
  1841. s.onTouchStart = function (e) {
  1842. if (e.originalEvent)
  1843. e = e.originalEvent;
  1844. isTouchEvent = e.type === 'touchstart';
  1845. if (!isTouchEvent && 'which' in e && e.which === 3)
  1846. return;
  1847. if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {
  1848. s.allowClick = true;
  1849. return;
  1850. }
  1851. if (s.params.swipeHandler) {
  1852. if (!findElementInEvent(e, s.params.swipeHandler))
  1853. return;
  1854. }
  1855. var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  1856. var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  1857. // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
  1858. if (s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {
  1859. return;
  1860. }
  1861. isTouched = true;
  1862. isMoved = false;
  1863. allowTouchCallbacks = true;
  1864. isScrolling = undefined;
  1865. startMoving = undefined;
  1866. s.touches.startX = startX;
  1867. s.touches.startY = startY;
  1868. touchStartTime = Date.now();
  1869. s.allowClick = true;
  1870. s.updateContainerSize();
  1871. s.swipeDirection = undefined;
  1872. if (s.params.threshold > 0)
  1873. allowThresholdMove = false;
  1874. if (e.type !== 'touchstart') {
  1875. var preventDefault = true;
  1876. if ($(e.target).is(formElements))
  1877. preventDefault = false;
  1878. if (document.activeElement && $(document.activeElement).is(formElements)) {
  1879. document.activeElement.blur();
  1880. }
  1881. if (preventDefault) {
  1882. e.preventDefault();
  1883. }
  1884. }
  1885. s.emit('onTouchStart', s, e);
  1886. };
  1887. s.onTouchMove = function (e) {
  1888. if (e.originalEvent)
  1889. e = e.originalEvent;
  1890. if (isTouchEvent && e.type === 'mousemove')
  1891. return;
  1892. if (e.preventedByNestedSwiper) {
  1893. s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1894. s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1895. return;
  1896. }
  1897. if (s.params.onlyExternal) {
  1898. // isMoved = true;
  1899. s.allowClick = false;
  1900. if (isTouched) {
  1901. s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1902. s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1903. touchStartTime = Date.now();
  1904. }
  1905. return;
  1906. }
  1907. if (isTouchEvent && s.params.touchReleaseOnEdges && !s.params.loop) {
  1908. if (!s.isHorizontal()) {
  1909. // Vertical
  1910. if (s.touches.currentY < s.touches.startY && s.translate <= s.maxTranslate() || s.touches.currentY > s.touches.startY && s.translate >= s.minTranslate()) {
  1911. return;
  1912. }
  1913. } else {
  1914. if (s.touches.currentX < s.touches.startX && s.translate <= s.maxTranslate() || s.touches.currentX > s.touches.startX && s.translate >= s.minTranslate()) {
  1915. return;
  1916. }
  1917. }
  1918. }
  1919. if (isTouchEvent && document.activeElement) {
  1920. if (e.target === document.activeElement && $(e.target).is(formElements)) {
  1921. isMoved = true;
  1922. s.allowClick = false;
  1923. return;
  1924. }
  1925. }
  1926. if (allowTouchCallbacks) {
  1927. s.emit('onTouchMove', s, e);
  1928. }
  1929. if (e.targetTouches && e.targetTouches.length > 1)
  1930. return;
  1931. s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1932. s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1933. if (typeof isScrolling === 'undefined') {
  1934. var touchAngle;
  1935. if (s.isHorizontal() && s.touches.currentY === s.touches.startY || !s.isHorizontal() && s.touches.currentX === s.touches.startX) {
  1936. isScrolling = false;
  1937. } else {
  1938. touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;
  1939. isScrolling = s.isHorizontal() ? touchAngle > s.params.touchAngle : 90 - touchAngle > s.params.touchAngle;
  1940. }
  1941. }
  1942. if (isScrolling) {
  1943. s.emit('onTouchMoveOpposite', s, e);
  1944. }
  1945. if (typeof startMoving === 'undefined') {
  1946. if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {
  1947. startMoving = true;
  1948. }
  1949. }
  1950. if (!isTouched)
  1951. return;
  1952. if (isScrolling) {
  1953. isTouched = false;
  1954. return;
  1955. }
  1956. if (!startMoving) {
  1957. return;
  1958. }
  1959. s.allowClick = false;
  1960. s.emit('onSliderMove', s, e);
  1961. e.preventDefault();
  1962. if (s.params.touchMoveStopPropagation && !s.params.nested) {
  1963. e.stopPropagation();
  1964. }
  1965. if (!isMoved) {
  1966. if (params.loop) {
  1967. s.fixLoop();
  1968. }
  1969. startTranslate = s.getWrapperTranslate();
  1970. s.setWrapperTransition(0);
  1971. if (s.animating) {
  1972. s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');
  1973. }
  1974. if (s.params.autoplay && s.autoplaying) {
  1975. if (s.params.autoplayDisableOnInteraction) {
  1976. s.stopAutoplay();
  1977. } else {
  1978. s.pauseAutoplay();
  1979. }
  1980. }
  1981. allowMomentumBounce = false;
  1982. //Grab Cursor
  1983. if (s.params.grabCursor && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {
  1984. s.setGrabCursor(true);
  1985. }
  1986. }
  1987. isMoved = true;
  1988. var diff = s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
  1989. diff = diff * s.params.touchRatio;
  1990. if (s.rtl)
  1991. diff = - diff;
  1992. s.swipeDirection = diff > 0 ? 'prev' : 'next';
  1993. currentTranslate = diff + startTranslate;
  1994. var disableParentSwiper = true;
  1995. if (diff > 0 && currentTranslate > s.minTranslate()) {
  1996. disableParentSwiper = false;
  1997. if (s.params.resistance)
  1998. currentTranslate = s.minTranslate() - 1 + Math.pow( - s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);
  1999. } else if (diff < 0 && currentTranslate < s.maxTranslate()) {
  2000. disableParentSwiper = false;
  2001. if (s.params.resistance)
  2002. currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);
  2003. }
  2004. if (disableParentSwiper) {
  2005. e.preventedByNestedSwiper = true;
  2006. }
  2007. // Directions locks
  2008. if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {
  2009. currentTranslate = startTranslate;
  2010. }
  2011. if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {
  2012. currentTranslate = startTranslate;
  2013. }
  2014. // Threshold
  2015. if (s.params.threshold > 0) {
  2016. if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {
  2017. if (!allowThresholdMove) {
  2018. allowThresholdMove = true;
  2019. s.touches.startX = s.touches.currentX;
  2020. s.touches.startY = s.touches.currentY;
  2021. currentTranslate = startTranslate;
  2022. s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
  2023. return;
  2024. }
  2025. } else {
  2026. currentTranslate = startTranslate;
  2027. return;
  2028. }
  2029. }
  2030. if (!s.params.followFinger)
  2031. return;
  2032. // Update active index in free mode
  2033. if (s.params.freeMode || s.params.watchSlidesProgress) {
  2034. s.updateActiveIndex();
  2035. }
  2036. if (s.params.freeMode) {
  2037. //Velocity
  2038. if (velocities.length === 0) {
  2039. velocities.push({
  2040. position: s.touches[s.isHorizontal() ? 'startX' : 'startY'],
  2041. time: touchStartTime
  2042. });
  2043. }
  2044. velocities.push({
  2045. position: s.touches[s.isHorizontal() ? 'currentX' : 'currentY'],
  2046. time: new window.Date().getTime()
  2047. });
  2048. }
  2049. // Update progress
  2050. s.updateProgress(currentTranslate);
  2051. // Update translate
  2052. s.setWrapperTranslate(currentTranslate);
  2053. };
  2054. s.onTouchEnd = function (e) {
  2055. if (e.originalEvent)
  2056. e = e.originalEvent;
  2057. if (allowTouchCallbacks) {
  2058. s.emit('onTouchEnd', s, e);
  2059. }
  2060. allowTouchCallbacks = false;
  2061. if (!isTouched)
  2062. return;
  2063. //Return Grab Cursor
  2064. if (s.params.grabCursor && isMoved && isTouched && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {
  2065. s.setGrabCursor(false);
  2066. }
  2067. // Time diff
  2068. var touchEndTime = Date.now();
  2069. var timeDiff = touchEndTime - touchStartTime;
  2070. // Tap, doubleTap, Click
  2071. if (s.allowClick) {
  2072. s.updateClickedSlide(e);
  2073. s.emit('onTap', s, e);
  2074. if (timeDiff < 300 && touchEndTime - lastClickTime > 300) {
  2075. if (clickTimeout)
  2076. clearTimeout(clickTimeout);
  2077. clickTimeout = setTimeout(function () {
  2078. if (!s)
  2079. return;
  2080. if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {
  2081. s.paginationContainer.toggleClass(s.params.paginationHiddenClass);
  2082. }
  2083. s.emit('onClick', s, e);
  2084. }, 300);
  2085. }
  2086. if (timeDiff < 300 && touchEndTime - lastClickTime < 300) {
  2087. if (clickTimeout)
  2088. clearTimeout(clickTimeout);
  2089. s.emit('onDoubleTap', s, e);
  2090. }
  2091. }
  2092. lastClickTime = Date.now();
  2093. setTimeout(function () {
  2094. if (s)
  2095. s.allowClick = true;
  2096. }, 0);
  2097. if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {
  2098. isTouched = isMoved = false;
  2099. return;
  2100. }
  2101. isTouched = isMoved = false;
  2102. var currentPos;
  2103. if (s.params.followFinger) {
  2104. currentPos = s.rtl ? s.translate : - s.translate;
  2105. } else {
  2106. currentPos = - currentTranslate;
  2107. }
  2108. if (s.params.freeMode) {
  2109. if (currentPos < - s.minTranslate()) {
  2110. s.slideTo(s.activeIndex);
  2111. return;
  2112. } else if (currentPos > - s.maxTranslate()) {
  2113. if (s.slides.length < s.snapGrid.length) {
  2114. s.slideTo(s.snapGrid.length - 1);
  2115. } else {
  2116. s.slideTo(s.slides.length - 1);
  2117. }
  2118. return;
  2119. }
  2120. if (s.params.freeModeMomentum) {
  2121. if (velocities.length > 1) {
  2122. var lastMoveEvent = velocities.pop(),
  2123. velocityEvent = velocities.pop();
  2124. var distance = lastMoveEvent.position - velocityEvent.position;
  2125. var time = lastMoveEvent.time - velocityEvent.time;
  2126. s.velocity = distance / time;
  2127. s.velocity = s.velocity / 2;
  2128. if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {
  2129. s.velocity = 0;
  2130. }
  2131. // this implies that the user stopped moving a finger then released.
  2132. // There would be no events with distance zero, so the last event is stale.
  2133. if (time > 150 || new window.Date().getTime() - lastMoveEvent.time > 300) {
  2134. s.velocity = 0;
  2135. }
  2136. } else {
  2137. s.velocity = 0;
  2138. }
  2139. s.velocity = s.velocity * s.params.freeModeMomentumVelocityRatio;
  2140. velocities.length = 0;
  2141. var momentumDuration = 1000 * s.params.freeModeMomentumRatio;
  2142. var momentumDistance = s.velocity * momentumDuration;
  2143. var newPosition = s.translate + momentumDistance;
  2144. if (s.rtl)
  2145. newPosition = - newPosition;
  2146. var doBounce = false;
  2147. var afterBouncePosition;
  2148. var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;
  2149. if (newPosition < s.maxTranslate()) {
  2150. if (s.params.freeModeMomentumBounce) {
  2151. if (newPosition + s.maxTranslate() < - bounceAmount) {
  2152. newPosition = s.maxTranslate() - bounceAmount;
  2153. }
  2154. afterBouncePosition = s.maxTranslate();
  2155. doBounce = true;
  2156. allowMomentumBounce = true;
  2157. } else {
  2158. newPosition = s.maxTranslate();
  2159. }
  2160. } else if (newPosition > s.minTranslate()) {
  2161. if (s.params.freeModeMomentumBounce) {
  2162. if (newPosition - s.minTranslate() > bounceAmount) {
  2163. newPosition = s.minTranslate() + bounceAmount;
  2164. }
  2165. afterBouncePosition = s.minTranslate();
  2166. doBounce = true;
  2167. allowMomentumBounce = true;
  2168. } else {
  2169. newPosition = s.minTranslate();
  2170. }
  2171. } else if (s.params.freeModeSticky) {
  2172. var j = 0,
  2173. nextSlide;
  2174. for (j = 0; j < s.snapGrid.length; j += 1) {
  2175. if (s.snapGrid[j] > - newPosition) {
  2176. nextSlide = j;
  2177. break;
  2178. }
  2179. }
  2180. if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {
  2181. newPosition = s.snapGrid[nextSlide];
  2182. } else {
  2183. newPosition = s.snapGrid[nextSlide - 1];
  2184. }
  2185. if (!s.rtl)
  2186. newPosition = - newPosition;
  2187. }
  2188. //Fix duration
  2189. if (s.velocity !== 0) {
  2190. if (s.rtl) {
  2191. momentumDuration = Math.abs(( - newPosition - s.translate) / s.velocity);
  2192. } else {
  2193. momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
  2194. }
  2195. } else if (s.params.freeModeSticky) {
  2196. s.slideReset();
  2197. return;
  2198. }
  2199. if (s.params.freeModeMomentumBounce && doBounce) {
  2200. s.updateProgress(afterBouncePosition);
  2201. s.setWrapperTransition(momentumDuration);
  2202. s.setWrapperTranslate(newPosition);
  2203. s.onTransitionStart();
  2204. s.animating = true;
  2205. s.wrapper.transitionEnd(function () {
  2206. if (!s || !allowMomentumBounce)
  2207. return;
  2208. s.emit('onMomentumBounce', s);
  2209. s.setWrapperTransition(s.params.speed);
  2210. s.setWrapperTranslate(afterBouncePosition);
  2211. s.wrapper.transitionEnd(function () {
  2212. if (!s)
  2213. return;
  2214. s.onTransitionEnd();
  2215. });
  2216. });
  2217. } else if (s.velocity) {
  2218. s.updateProgress(newPosition);
  2219. s.setWrapperTransition(momentumDuration);
  2220. s.setWrapperTranslate(newPosition);
  2221. s.onTransitionStart();
  2222. if (!s.animating) {
  2223. s.animating = true;
  2224. s.wrapper.transitionEnd(function () {
  2225. if (!s)
  2226. return;
  2227. s.onTransitionEnd();
  2228. });
  2229. }
  2230. } else {
  2231. s.updateProgress(newPosition);
  2232. }
  2233. s.updateActiveIndex();
  2234. }
  2235. if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {
  2236. s.updateProgress();
  2237. s.updateActiveIndex();
  2238. }
  2239. return;
  2240. }
  2241. // Find current slide
  2242. var i,
  2243. stopIndex = 0,
  2244. groupSize = s.slidesSizesGrid[0];
  2245. for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {
  2246. if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {
  2247. if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {
  2248. stopIndex = i;
  2249. groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];
  2250. }
  2251. } else {
  2252. if (currentPos >= s.slidesGrid[i]) {
  2253. stopIndex = i;
  2254. groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];
  2255. }
  2256. }
  2257. }
  2258. // Find current slide size
  2259. var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;
  2260. if (timeDiff > s.params.longSwipesMs) {
  2261. // Long touches
  2262. if (!s.params.longSwipes) {
  2263. s.slideTo(s.activeIndex);
  2264. return;
  2265. }
  2266. if (s.swipeDirection === 'next') {
  2267. if (ratio >= s.params.longSwipesRatio)
  2268. s.slideTo(stopIndex + s.params.slidesPerGroup);
  2269. else
  2270. s.slideTo(stopIndex);
  2271. }
  2272. if (s.swipeDirection === 'prev') {
  2273. if (ratio > 1 - s.params.longSwipesRatio)
  2274. s.slideTo(stopIndex + s.params.slidesPerGroup);
  2275. else
  2276. s.slideTo(stopIndex);
  2277. }
  2278. } else {
  2279. // Short swipes
  2280. if (!s.params.shortSwipes) {
  2281. s.slideTo(s.activeIndex);
  2282. return;
  2283. }
  2284. if (s.swipeDirection === 'next') {
  2285. s.slideTo(stopIndex + s.params.slidesPerGroup);
  2286. }
  2287. if (s.swipeDirection === 'prev') {
  2288. s.slideTo(stopIndex);
  2289. }
  2290. }
  2291. };
  2292. /*=========================
  2293. Transitions
  2294. ===========================*/
  2295. s._slideTo = function (slideIndex, speed) {
  2296. return s.slideTo(slideIndex, speed, true, true);
  2297. };
  2298. s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
  2299. if (typeof runCallbacks === 'undefined')
  2300. runCallbacks = true;
  2301. if (typeof slideIndex === 'undefined')
  2302. slideIndex = 0;
  2303. if (slideIndex < 0)
  2304. slideIndex = 0;
  2305. s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);
  2306. if (s.snapIndex >= s.snapGrid.length)
  2307. s.snapIndex = s.snapGrid.length - 1;
  2308. var translate = - s.snapGrid[s.snapIndex];
  2309. // Stop autoplay
  2310. if (s.params.autoplay && s.autoplaying) {
  2311. if (internal || !s.params.autoplayDisableOnInteraction) {
  2312. s.pauseAutoplay(speed);
  2313. } else {
  2314. s.stopAutoplay();
  2315. }
  2316. }
  2317. // Update progress
  2318. s.updateProgress(translate);
  2319. // Normalize slideIndex
  2320. if (s.params.normalizeSlideIndex) {
  2321. for (var i = 0; i < s.slidesGrid.length; i++) {
  2322. if ( - Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {
  2323. slideIndex = i;
  2324. }
  2325. }
  2326. }
  2327. // Directions locks
  2328. if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {
  2329. return false;
  2330. }
  2331. if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {
  2332. if ((s.activeIndex || 0) !== slideIndex)
  2333. return false;
  2334. }
  2335. // Update Index
  2336. if (typeof speed === 'undefined')
  2337. speed = s.params.speed;
  2338. s.previousIndex = s.activeIndex || 0;
  2339. s.activeIndex = slideIndex;
  2340. s.updateRealIndex();
  2341. if (s.rtl && - translate === s.translate || !s.rtl && translate === s.translate) {
  2342. // Update Height
  2343. if (s.params.autoHeight) {
  2344. s.updateAutoHeight();
  2345. }
  2346. s.updateClasses();
  2347. if (s.params.effect !== 'slide') {
  2348. s.setWrapperTranslate(translate);
  2349. }
  2350. return false;
  2351. }
  2352. s.updateClasses();
  2353. s.onTransitionStart(runCallbacks);
  2354. if (speed === 0 || s.browser.lteIE9) {
  2355. s.setWrapperTranslate(translate);
  2356. s.setWrapperTransition(0);
  2357. s.onTransitionEnd(runCallbacks);
  2358. } else {
  2359. s.setWrapperTranslate(translate);
  2360. s.setWrapperTransition(speed);
  2361. if (!s.animating) {
  2362. s.animating = true;
  2363. s.wrapper.transitionEnd(function () {
  2364. if (!s)
  2365. return;
  2366. s.onTransitionEnd(runCallbacks);
  2367. });
  2368. }
  2369. }
  2370. return true;
  2371. };
  2372. s.onTransitionStart = function (runCallbacks) {
  2373. if (typeof runCallbacks === 'undefined')
  2374. runCallbacks = true;
  2375. if (s.params.autoHeight) {
  2376. s.updateAutoHeight();
  2377. }
  2378. if (s.lazy)
  2379. s.lazy.onTransitionStart();
  2380. if (runCallbacks) {
  2381. s.emit('onTransitionStart', s);
  2382. if (s.activeIndex !== s.previousIndex) {
  2383. s.emit('onSlideChangeStart', s);
  2384. if (s.activeIndex > s.previousIndex) {
  2385. s.emit('onSlideNextStart', s);
  2386. } else {
  2387. s.emit('onSlidePrevStart', s);
  2388. }
  2389. }
  2390. }
  2391. };
  2392. s.onTransitionEnd = function (runCallbacks) {
  2393. s.animating = false;
  2394. s.setWrapperTransition(0);
  2395. if (typeof runCallbacks === 'undefined')
  2396. runCallbacks = true;
  2397. if (s.lazy)
  2398. s.lazy.onTransitionEnd();
  2399. if (runCallbacks) {
  2400. s.emit('onTransitionEnd', s);
  2401. if (s.activeIndex !== s.previousIndex) {
  2402. s.emit('onSlideChangeEnd', s);
  2403. if (s.activeIndex > s.previousIndex) {
  2404. s.emit('onSlideNextEnd', s);
  2405. } else {
  2406. s.emit('onSlidePrevEnd', s);
  2407. }
  2408. }
  2409. }
  2410. if (s.params.history && s.history) {
  2411. s.history.setHistory(s.params.history, s.activeIndex);
  2412. }
  2413. if (s.params.hashnav && s.hashnav) {
  2414. s.hashnav.setHash();
  2415. }
  2416. };
  2417. s.slideNext = function (runCallbacks, speed, internal) {
  2418. if (s.params.loop) {
  2419. if (s.animating)
  2420. return false;
  2421. s.fixLoop();
  2422. var clientLeft = s.container[0].clientLeft;
  2423. return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
  2424. } else
  2425. return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
  2426. };
  2427. s._slideNext = function (speed) {
  2428. return s.slideNext(true, speed, true);
  2429. };
  2430. s.slidePrev = function (runCallbacks, speed, internal) {
  2431. if (s.params.loop) {
  2432. if (s.animating)
  2433. return false;
  2434. s.fixLoop();
  2435. var clientLeft = s.container[0].clientLeft;
  2436. return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
  2437. } else
  2438. return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
  2439. };
  2440. s._slidePrev = function (speed) {
  2441. return s.slidePrev(true, speed, true);
  2442. };
  2443. s.slideReset = function (runCallbacks, speed, internal) {
  2444. return s.slideTo(s.activeIndex, speed, runCallbacks);
  2445. };
  2446. s.disableTouchControl = function () {
  2447. s.params.onlyExternal = true;
  2448. return true;
  2449. };
  2450. s.enableTouchControl = function () {
  2451. s.params.onlyExternal = false;
  2452. return true;
  2453. };
  2454. /*=========================
  2455. Translate/transition helpers
  2456. ===========================*/
  2457. s.setWrapperTransition = function (duration, byController) {
  2458. s.wrapper.transition(duration);
  2459. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  2460. s.effects[s.params.effect].setTransition(duration);
  2461. }
  2462. if (s.params.parallax && s.parallax) {
  2463. s.parallax.setTransition(duration);
  2464. }
  2465. if (s.params.scrollbar && s.scrollbar) {
  2466. s.scrollbar.setTransition(duration);
  2467. }
  2468. if (s.params.control && s.controller) {
  2469. s.controller.setTransition(duration, byController);
  2470. }
  2471. s.emit('onSetTransition', s, duration);
  2472. };
  2473. s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {
  2474. var x = 0,
  2475. y = 0,
  2476. z = 0;
  2477. if (s.isHorizontal()) {
  2478. x = s.rtl ? - translate : translate;
  2479. } else {
  2480. y = translate;
  2481. }
  2482. if (s.params.roundLengths) {
  2483. x = round(x);
  2484. y = round(y);
  2485. }
  2486. if (!s.params.virtualTranslate) {
  2487. if (s.support.transforms3d)
  2488. s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');
  2489. else
  2490. s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');
  2491. }
  2492. s.translate = s.isHorizontal() ? x : y;
  2493. // Check if we need to update progress
  2494. var progress;
  2495. var translatesDiff = s.maxTranslate() - s.minTranslate();
  2496. if (translatesDiff === 0) {
  2497. progress = 0;
  2498. } else {
  2499. progress = (translate - s.minTranslate()) / translatesDiff;
  2500. }
  2501. if (progress !== s.progress) {
  2502. s.updateProgress(translate);
  2503. }
  2504. if (updateActiveIndex)
  2505. s.updateActiveIndex();
  2506. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  2507. s.effects[s.params.effect].setTranslate(s.translate);
  2508. }
  2509. if (s.params.parallax && s.parallax) {
  2510. s.parallax.setTranslate(s.translate);
  2511. }
  2512. if (s.params.scrollbar && s.scrollbar) {
  2513. s.scrollbar.setTranslate(s.translate);
  2514. }
  2515. if (s.params.control && s.controller) {
  2516. s.controller.setTranslate(s.translate, byController);
  2517. }
  2518. s.emit('onSetTranslate', s, s.translate);
  2519. };
  2520. s.getTranslate = function (el, axis) {
  2521. var matrix, curTransform, curStyle, transformMatrix;
  2522. // automatic axis detection
  2523. if (typeof axis === 'undefined') {
  2524. axis = 'x';
  2525. }
  2526. if (s.params.virtualTranslate) {
  2527. return s.rtl ? - s.translate : s.translate;
  2528. }
  2529. //console.log(el)
  2530. curStyle = window.getComputedStyle(el, null);
  2531. if (window.WebKitCSSMatrix) {
  2532. curTransform = curStyle.transform || curStyle.webkitTransform;
  2533. if (curTransform.split(',').length > 6) {
  2534. curTransform = curTransform.split(', ').map(function (a) {
  2535. return a.replace(',', '.');
  2536. }).join(', ');
  2537. }
  2538. // Some old versions of Webkit choke when 'none' is passed; pass
  2539. // empty string instead in this case
  2540. transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
  2541. } else {
  2542. transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
  2543. matrix = transformMatrix.toString().split(',');
  2544. }
  2545. if (axis === 'x') {
  2546. //Latest Chrome and webkits Fix
  2547. if (window.WebKitCSSMatrix)
  2548. curTransform = transformMatrix.m41;
  2549. //Crazy IE10 Matrix
  2550. else if (matrix.length === 16)
  2551. curTransform = parseFloat(matrix[12]);
  2552. //Normal Browsers
  2553. else
  2554. curTransform = parseFloat(matrix[4]);
  2555. }
  2556. if (axis === 'y') {
  2557. //Latest Chrome and webkits Fix
  2558. if (window.WebKitCSSMatrix)
  2559. curTransform = transformMatrix.m42;
  2560. //Crazy IE10 Matrix
  2561. else if (matrix.length === 16)
  2562. curTransform = parseFloat(matrix[13]);
  2563. //Normal Browsers
  2564. else
  2565. curTransform = parseFloat(matrix[5]);
  2566. }
  2567. if (s.rtl && curTransform)
  2568. curTransform = - curTransform;
  2569. return curTransform || 0;
  2570. };
  2571. s.getWrapperTranslate = function (axis) {
  2572. if (typeof axis === 'undefined') {
  2573. axis = s.isHorizontal() ? 'x' : 'y';
  2574. }
  2575. return s.getTranslate(s.wrapper[0], axis);
  2576. };
  2577. /*=========================
  2578. Observer
  2579. ===========================*/
  2580. s.observers = [];
  2581. function initObserver(target, options) {
  2582. options = options || {};
  2583. // create an observer instance
  2584. var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
  2585. var observer = new ObserverFunc(function (mutations) {
  2586. mutations.forEach(function (mutation) {
  2587. s.onResize(true);
  2588. s.emit('onObserverUpdate', s, mutation);
  2589. });
  2590. });
  2591. observer.observe(target, {
  2592. attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
  2593. childList: typeof options.childList === 'undefined' ? true : options.childList,
  2594. characterData: typeof options.characterData === 'undefined' ? true : options.characterData
  2595. });
  2596. s.observers.push(observer);
  2597. }
  2598. s.initObservers = function () {
  2599. if (s.params.observeParents) {
  2600. var containerParents = s.container.parents();
  2601. for (var i = 0; i < containerParents.length; i++) {
  2602. initObserver(containerParents[i]);
  2603. }
  2604. }
  2605. // Observe container
  2606. initObserver(s.container[0], {childList: false});
  2607. // Observe wrapper
  2608. initObserver(s.wrapper[0], {attributes: false});
  2609. };
  2610. s.disconnectObservers = function () {
  2611. for (var i = 0; i < s.observers.length; i++) {
  2612. s.observers[i].disconnect();
  2613. }
  2614. s.observers = [];
  2615. };
  2616. /*=========================
  2617. Loop
  2618. ===========================*/
  2619. // Create looped slides
  2620. s.createLoop = function () {
  2621. // Remove duplicated slides
  2622. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
  2623. var slides = s.wrapper.children('.' + s.params.slideClass);
  2624. if (s.params.slidesPerView === 'auto' && !s.params.loopedSlides)
  2625. s.params.loopedSlides = slides.length;
  2626. s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);
  2627. s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;
  2628. if (s.loopedSlides > slides.length) {
  2629. s.loopedSlides = slides.length;
  2630. }
  2631. var prependSlides = [],
  2632. appendSlides = [],
  2633. i;
  2634. slides.each(function (index, el) {
  2635. var slide = $(this);
  2636. if (index < s.loopedSlides)
  2637. appendSlides.push(el);
  2638. if (index < slides.length && index >= slides.length - s.loopedSlides)
  2639. prependSlides.push(el);
  2640. slide.attr('data-swiper-slide-index', index);
  2641. });
  2642. for (i = 0; i < appendSlides.length; i++) {
  2643. s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
  2644. }
  2645. for (i = prependSlides.length - 1; i >= 0; i--) {
  2646. s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
  2647. }
  2648. };
  2649. s.destroyLoop = function () {
  2650. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
  2651. s.slides.removeAttr('data-swiper-slide-index');
  2652. };
  2653. s.reLoop = function (updatePosition) {
  2654. var oldIndex = s.activeIndex - s.loopedSlides;
  2655. s.destroyLoop();
  2656. s.createLoop();
  2657. s.updateSlidesSize();
  2658. if (updatePosition) {
  2659. s.slideTo(oldIndex + s.loopedSlides, 0, false);
  2660. }
  2661. };
  2662. s.fixLoop = function () {
  2663. var newIndex;
  2664. //Fix For Negative Oversliding
  2665. if (s.activeIndex < s.loopedSlides) {
  2666. newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;
  2667. newIndex = newIndex + s.loopedSlides;
  2668. s.slideTo(newIndex, 0, false, true);
  2669. }
  2670. //Fix For Positive Oversliding
  2671. else if (s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2 || s.activeIndex > s.slides.length - s.params.slidesPerView * 2) {
  2672. newIndex = - s.slides.length + s.activeIndex + s.loopedSlides;
  2673. newIndex = newIndex + s.loopedSlides;
  2674. s.slideTo(newIndex, 0, false, true);
  2675. }
  2676. };
  2677. /*=========================
  2678. Append/Prepend/Remove Slides
  2679. ===========================*/
  2680. s.appendSlide = function (slides) {
  2681. if (s.params.loop) {
  2682. s.destroyLoop();
  2683. }
  2684. if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
  2685. for (var i = 0; i < slides.length; i++) {
  2686. if (slides[i])
  2687. s.wrapper.append(slides[i]);
  2688. }
  2689. } else {
  2690. s.wrapper.append(slides);
  2691. }
  2692. if (s.params.loop) {
  2693. s.createLoop();
  2694. }
  2695. if (!(s.params.observer && s.support.observer)) {
  2696. s.update(true);
  2697. }
  2698. };
  2699. s.prependSlide = function (slides) {
  2700. if (s.params.loop) {
  2701. s.destroyLoop();
  2702. }
  2703. var newActiveIndex = s.activeIndex + 1;
  2704. if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
  2705. for (var i = 0; i < slides.length; i++) {
  2706. if (slides[i])
  2707. s.wrapper.prepend(slides[i]);
  2708. }
  2709. newActiveIndex = s.activeIndex + slides.length;
  2710. } else {
  2711. s.wrapper.prepend(slides);
  2712. }
  2713. if (s.params.loop) {
  2714. s.createLoop();
  2715. }
  2716. if (!(s.params.observer && s.support.observer)) {
  2717. s.update(true);
  2718. }
  2719. s.slideTo(newActiveIndex, 0, false);
  2720. };
  2721. s.removeSlide = function (slidesIndexes) {
  2722. if (s.params.loop) {
  2723. s.destroyLoop();
  2724. s.slides = s.wrapper.children('.' + s.params.slideClass);
  2725. }
  2726. var newActiveIndex = s.activeIndex,
  2727. indexToRemove;
  2728. if ((typeof slidesIndexes === 'undefined' ? 'undefined' : _typeof(slidesIndexes)) === 'object' && slidesIndexes.length) {
  2729. for (var i = 0; i < slidesIndexes.length; i++) {
  2730. indexToRemove = slidesIndexes[i];
  2731. if (s.slides[indexToRemove])
  2732. s.slides.eq(indexToRemove).remove();
  2733. if (indexToRemove < newActiveIndex)
  2734. newActiveIndex--;
  2735. }
  2736. newActiveIndex = Math.max(newActiveIndex, 0);
  2737. } else {
  2738. indexToRemove = slidesIndexes;
  2739. if (s.slides[indexToRemove])
  2740. s.slides.eq(indexToRemove).remove();
  2741. if (indexToRemove < newActiveIndex)
  2742. newActiveIndex--;
  2743. newActiveIndex = Math.max(newActiveIndex, 0);
  2744. }
  2745. if (s.params.loop) {
  2746. s.createLoop();
  2747. }
  2748. if (!(s.params.observer && s.support.observer)) {
  2749. s.update(true);
  2750. }
  2751. if (s.params.loop) {
  2752. s.slideTo(newActiveIndex + s.loopedSlides, 0, false);
  2753. } else {
  2754. s.slideTo(newActiveIndex, 0, false);
  2755. }
  2756. };
  2757. s.removeAllSlides = function () {
  2758. var slidesIndexes = [];
  2759. for (var i = 0; i < s.slides.length; i++) {
  2760. slidesIndexes.push(i);
  2761. }
  2762. s.removeSlide(slidesIndexes);
  2763. };
  2764. /*=========================
  2765. Effects
  2766. ===========================*/
  2767. s.effects = {
  2768. fade: {
  2769. setTranslate: function setTranslate() {
  2770. for (var i = 0; i < s.slides.length; i++) {
  2771. var slide = s.slides.eq(i);
  2772. var offset = slide[0].swiperSlideOffset;
  2773. var tx = - offset;
  2774. if (!s.params.virtualTranslate)
  2775. tx = tx - s.translate;
  2776. var ty = 0;
  2777. if (!s.isHorizontal()) {
  2778. ty = tx;
  2779. tx = 0;
  2780. }
  2781. 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);
  2782. slide.css({
  2783. opacity: slideOpacity
  2784. }).transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');
  2785. }
  2786. },
  2787. setTransition: function setTransition(duration) {
  2788. s.slides.transition(duration);
  2789. if (s.params.virtualTranslate && duration !== 0) {
  2790. var eventTriggered = false;
  2791. s.slides.transitionEnd(function () {
  2792. if (eventTriggered)
  2793. return;
  2794. if (!s)
  2795. return;
  2796. eventTriggered = true;
  2797. s.animating = false;
  2798. var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
  2799. for (var i = 0; i < triggerEvents.length; i++) {
  2800. s.wrapper.trigger(triggerEvents[i]);
  2801. }
  2802. });
  2803. }
  2804. }
  2805. },
  2806. flip: {
  2807. setTranslate: function setTranslate() {
  2808. for (var i = 0; i < s.slides.length; i++) {
  2809. var slide = s.slides.eq(i);
  2810. var progress = slide[0].progress;
  2811. if (s.params.flip.limitRotation) {
  2812. progress = Math.max(Math.min(slide[0].progress, 1), - 1);
  2813. }
  2814. var offset = slide[0].swiperSlideOffset;
  2815. var rotate = - 180 * progress,
  2816. rotateY = rotate,
  2817. rotateX = 0,
  2818. tx = - offset,
  2819. ty = 0;
  2820. if (!s.isHorizontal()) {
  2821. ty = tx;
  2822. tx = 0;
  2823. rotateX = - rotateY;
  2824. rotateY = 0;
  2825. } else if (s.rtl) {
  2826. rotateY = - rotateY;
  2827. }
  2828. slide[0].style.zIndex = - Math.abs(Math.round(progress)) + s.slides.length;
  2829. if (s.params.flip.slideShadows) {
  2830. //Set shadows
  2831. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2832. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2833. if (shadowBefore.length === 0) {
  2834. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2835. slide.append(shadowBefore);
  2836. }
  2837. if (shadowAfter.length === 0) {
  2838. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2839. slide.append(shadowAfter);
  2840. }
  2841. if (shadowBefore.length)
  2842. shadowBefore[0].style.opacity = Math.max( - progress, 0);
  2843. if (shadowAfter.length)
  2844. shadowAfter[0].style.opacity = Math.max(progress, 0);
  2845. }
  2846. slide.transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');
  2847. }
  2848. },
  2849. setTransition: function setTransition(duration) {
  2850. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2851. if (s.params.virtualTranslate && duration !== 0) {
  2852. var eventTriggered = false;
  2853. s.slides.eq(s.activeIndex).transitionEnd(function () {
  2854. if (eventTriggered)
  2855. return;
  2856. if (!s)
  2857. return;
  2858. if (!$(this).hasClass(s.params.slideActiveClass))
  2859. return;
  2860. eventTriggered = true;
  2861. s.animating = false;
  2862. var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
  2863. for (var i = 0; i < triggerEvents.length; i++) {
  2864. s.wrapper.trigger(triggerEvents[i]);
  2865. }
  2866. });
  2867. }
  2868. }
  2869. },
  2870. cube: {
  2871. setTranslate: function setTranslate() {
  2872. var wrapperRotate = 0,
  2873. cubeShadow;
  2874. if (s.params.cube.shadow) {
  2875. if (s.isHorizontal()) {
  2876. cubeShadow = s.wrapper.find('.swiper-cube-shadow');
  2877. if (cubeShadow.length === 0) {
  2878. cubeShadow = $('<div class="swiper-cube-shadow"></div>');
  2879. s.wrapper.append(cubeShadow);
  2880. }
  2881. cubeShadow.css({height: s.width + 'px'});
  2882. } else {
  2883. cubeShadow = s.container.find('.swiper-cube-shadow');
  2884. if (cubeShadow.length === 0) {
  2885. cubeShadow = $('<div class="swiper-cube-shadow"></div>');
  2886. s.container.append(cubeShadow);
  2887. }
  2888. }
  2889. }
  2890. for (var i = 0; i < s.slides.length; i++) {
  2891. var slide = s.slides.eq(i);
  2892. var slideAngle = i * 90;
  2893. var round = Math.floor(slideAngle / 360);
  2894. if (s.rtl) {
  2895. slideAngle = - slideAngle;
  2896. round = Math.floor( - slideAngle / 360);
  2897. }
  2898. var progress = Math.max(Math.min(slide[0].progress, 1), - 1);
  2899. var tx = 0,
  2900. ty = 0,
  2901. tz = 0;
  2902. if (i % 4 === 0) {
  2903. tx = - round * 4 * s.size;
  2904. tz = 0;
  2905. } else if ((i - 1) % 4 === 0) {
  2906. tx = 0;
  2907. tz = - round * 4 * s.size;
  2908. } else if ((i - 2) % 4 === 0) {
  2909. tx = s.size + round * 4 * s.size;
  2910. tz = s.size;
  2911. } else if ((i - 3) % 4 === 0) {
  2912. tx = - s.size;
  2913. tz = 3 * s.size + s.size * 4 * round;
  2914. }
  2915. if (s.rtl) {
  2916. tx = - tx;
  2917. }
  2918. if (!s.isHorizontal()) {
  2919. ty = tx;
  2920. tx = 0;
  2921. }
  2922. var transform = 'rotateX(' + (s.isHorizontal() ? 0 : - slideAngle) + 'deg) rotateY(' + (s.isHorizontal() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
  2923. if (progress <= 1 && progress > - 1) {
  2924. wrapperRotate = i * 90 + progress * 90;
  2925. if (s.rtl)
  2926. wrapperRotate = - i * 90 - progress * 90;
  2927. }
  2928. slide.transform(transform);
  2929. if (s.params.cube.slideShadows) {
  2930. //Set shadows
  2931. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2932. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2933. if (shadowBefore.length === 0) {
  2934. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2935. slide.append(shadowBefore);
  2936. }
  2937. if (shadowAfter.length === 0) {
  2938. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2939. slide.append(shadowAfter);
  2940. }
  2941. if (shadowBefore.length)
  2942. shadowBefore[0].style.opacity = Math.max( - progress, 0);
  2943. if (shadowAfter.length)
  2944. shadowAfter[0].style.opacity = Math.max(progress, 0);
  2945. }
  2946. }
  2947. s.wrapper.css({
  2948. '-webkit-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2949. '-moz-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2950. '-ms-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2951. 'transform-origin': '50% 50% -' + s.size / 2 + 'px'
  2952. });
  2953. if (s.params.cube.shadow) {
  2954. if (s.isHorizontal()) {
  2955. 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 + ')');
  2956. } else {
  2957. var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
  2958. var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
  2959. var scale1 = s.params.cube.shadowScale,
  2960. scale2 = s.params.cube.shadowScale / multiplier,
  2961. offset = s.params.cube.shadowOffset;
  2962. cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + - s.height / 2 / scale2 + 'px) rotateX(-90deg)');
  2963. }
  2964. }
  2965. var zFactor = s.isSafari || s.isUiWebView ? - s.size / 2 : 0;
  2966. s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (s.isHorizontal() ? 0 : wrapperRotate) + 'deg) rotateY(' + (s.isHorizontal() ? - wrapperRotate : 0) + 'deg)');
  2967. },
  2968. setTransition: function setTransition(duration) {
  2969. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2970. if (s.params.cube.shadow && !s.isHorizontal()) {
  2971. s.container.find('.swiper-cube-shadow').transition(duration);
  2972. }
  2973. }
  2974. },
  2975. coverflow: {
  2976. setTranslate: function setTranslate() {
  2977. var transform = s.translate;
  2978. var center = s.isHorizontal() ? - transform + s.width / 2 : - transform + s.height / 2;
  2979. var rotate = s.isHorizontal() ? s.params.coverflow.rotate : - s.params.coverflow.rotate;
  2980. var translate = s.params.coverflow.depth;
  2981. //Each slide offset from center
  2982. for (var i = 0, length = s.slides.length; i < length; i++) {
  2983. var slide = s.slides.eq(i);
  2984. var slideSize = s.slidesSizesGrid[i];
  2985. var slideOffset = slide[0].swiperSlideOffset;
  2986. var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;
  2987. var rotateY = s.isHorizontal() ? rotate * offsetMultiplier : 0;
  2988. var rotateX = s.isHorizontal() ? 0 : rotate * offsetMultiplier;
  2989. // var rotateZ = 0
  2990. var translateZ = - translate * Math.abs(offsetMultiplier);
  2991. var translateY = s.isHorizontal() ? 0 : s.params.coverflow.stretch * offsetMultiplier;
  2992. var translateX = s.isHorizontal() ? s.params.coverflow.stretch * offsetMultiplier : 0;
  2993. //Fix for ultra small values
  2994. if (Math.abs(translateX) < 0.001)
  2995. translateX = 0;
  2996. if (Math.abs(translateY) < 0.001)
  2997. translateY = 0;
  2998. if (Math.abs(translateZ) < 0.001)
  2999. translateZ = 0;
  3000. if (Math.abs(rotateY) < 0.001)
  3001. rotateY = 0;
  3002. if (Math.abs(rotateX) < 0.001)
  3003. rotateX = 0;
  3004. var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';
  3005. slide.transform(slideTransform);
  3006. slide[0].style.zIndex = - Math.abs(Math.round(offsetMultiplier)) + 1;
  3007. if (s.params.coverflow.slideShadows) {
  3008. //Set shadows
  3009. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  3010. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  3011. if (shadowBefore.length === 0) {
  3012. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  3013. slide.append(shadowBefore);
  3014. }
  3015. if (shadowAfter.length === 0) {
  3016. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  3017. slide.append(shadowAfter);
  3018. }
  3019. if (shadowBefore.length)
  3020. shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
  3021. if (shadowAfter.length)
  3022. shadowAfter[0].style.opacity = - offsetMultiplier > 0 ? - offsetMultiplier : 0;
  3023. }
  3024. }
  3025. //Set correct perspective for IE10
  3026. if (s.browser.ie) {
  3027. var ws = s.wrapper[0].style;
  3028. ws.perspectiveOrigin = center + 'px 50%';
  3029. }
  3030. },
  3031. setTransition: function setTransition(duration) {
  3032. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  3033. }
  3034. }
  3035. };
  3036. /*=========================
  3037. Images Lazy Loading
  3038. ===========================*/
  3039. s.lazy = {
  3040. initialImageLoaded: false,
  3041. loadImageInSlide: function loadImageInSlide(index, loadInDuplicate) {
  3042. if (typeof index === 'undefined')
  3043. return;
  3044. if (typeof loadInDuplicate === 'undefined')
  3045. loadInDuplicate = true;
  3046. if (s.slides.length === 0)
  3047. return;
  3048. var slide = s.slides.eq(index);
  3049. var img = slide.find('.' + s.params.lazyLoadingClass + ':not(.' + s.params.lazyStatusLoadedClass + '):not(.' + s.params.lazyStatusLoadingClass + ')');
  3050. if (slide.hasClass(s.params.lazyLoadingClass) && !slide.hasClass(s.params.lazyStatusLoadedClass) && !slide.hasClass(s.params.lazyStatusLoadingClass)) {
  3051. img = img.add(slide[0]);
  3052. }
  3053. if (img.length === 0)
  3054. return;
  3055. img.each(function () {
  3056. var _img = $(this);
  3057. _img.addClass(s.params.lazyStatusLoadingClass);
  3058. var background = _img.attr('data-background');
  3059. var src = _img.attr('data-src'),
  3060. srcset = _img.attr('data-srcset'),
  3061. sizes = _img.attr('data-sizes');
  3062. s.loadImage(_img[0], src || background, srcset, sizes, false, function () {
  3063. if (typeof s === 'undefined' || s === null || !s)
  3064. return;
  3065. if (background) {
  3066. _img.css('background-image', 'url("' + background + '")');
  3067. _img.removeAttr('data-background');
  3068. } else {
  3069. if (srcset) {
  3070. _img.attr('srcset', srcset);
  3071. _img.removeAttr('data-srcset');
  3072. }
  3073. if (sizes) {
  3074. _img.attr('sizes', sizes);
  3075. _img.removeAttr('data-sizes');
  3076. }
  3077. if (src) {
  3078. _img.attr('src', src);
  3079. _img.removeAttr('data-src');
  3080. }
  3081. }
  3082. _img.addClass(s.params.lazyStatusLoadedClass).removeClass(s.params.lazyStatusLoadingClass);
  3083. slide.find('.' + s.params.lazyPreloaderClass + ', .' + s.params.preloaderClass).remove();
  3084. if (s.params.loop && loadInDuplicate) {
  3085. var slideOriginalIndex = slide.attr('data-swiper-slide-index');
  3086. if (slide.hasClass(s.params.slideDuplicateClass)) {
  3087. var originalSlide = s.wrapper.children('[data-swiper-slide-index="' + slideOriginalIndex + '"]:not(.' + s.params.slideDuplicateClass + ')');
  3088. s.lazy.loadImageInSlide(originalSlide.index(), false);
  3089. } else {
  3090. var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + slideOriginalIndex + '"]');
  3091. s.lazy.loadImageInSlide(duplicatedSlide.index(), false);
  3092. }
  3093. }
  3094. s.emit('onLazyImageReady', s, slide[0], _img[0]);
  3095. });
  3096. s.emit('onLazyImageLoad', s, slide[0], _img[0]);
  3097. });
  3098. },
  3099. load: function load() {
  3100. var i;
  3101. var slidesPerView = s.params.slidesPerView;
  3102. if (slidesPerView === 'auto') {
  3103. slidesPerView = 0;
  3104. }
  3105. if (!s.lazy.initialImageLoaded)
  3106. s.lazy.initialImageLoaded = true;
  3107. if (s.params.watchSlidesVisibility) {
  3108. s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {
  3109. s.lazy.loadImageInSlide($(this).index());
  3110. });
  3111. } else {
  3112. if (slidesPerView > 1) {
  3113. for (i = s.activeIndex; i < s.activeIndex + slidesPerView; i++) {
  3114. if (s.slides[i])
  3115. s.lazy.loadImageInSlide(i);
  3116. }
  3117. } else {
  3118. s.lazy.loadImageInSlide(s.activeIndex);
  3119. }
  3120. }
  3121. if (s.params.lazyLoadingInPrevNext) {
  3122. if (slidesPerView > 1 || s.params.lazyLoadingInPrevNextAmount && s.params.lazyLoadingInPrevNextAmount > 1) {
  3123. var amount = s.params.lazyLoadingInPrevNextAmount;
  3124. var spv = slidesPerView;
  3125. var maxIndex = Math.min(s.activeIndex + spv + Math.max(amount, spv), s.slides.length);
  3126. var minIndex = Math.max(s.activeIndex - Math.max(spv, amount), 0);
  3127. // Next Slides
  3128. for (i = s.activeIndex + slidesPerView; i < maxIndex; i++) {
  3129. if (s.slides[i])
  3130. s.lazy.loadImageInSlide(i);
  3131. }
  3132. // Prev Slides
  3133. for (i = minIndex; i < s.activeIndex; i++) {
  3134. if (s.slides[i])
  3135. s.lazy.loadImageInSlide(i);
  3136. }
  3137. } else {
  3138. var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);
  3139. if (nextSlide.length > 0)
  3140. s.lazy.loadImageInSlide(nextSlide.index());
  3141. var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);
  3142. if (prevSlide.length > 0)
  3143. s.lazy.loadImageInSlide(prevSlide.index());
  3144. }
  3145. }
  3146. },
  3147. onTransitionStart: function onTransitionStart() {
  3148. if (s.params.lazyLoading) {
  3149. if (s.params.lazyLoadingOnTransitionStart || !s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded) {
  3150. s.lazy.load();
  3151. }
  3152. }
  3153. },
  3154. onTransitionEnd: function onTransitionEnd() {
  3155. if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {
  3156. s.lazy.load();
  3157. }
  3158. }
  3159. };
  3160. /*=========================
  3161. Scrollbar
  3162. ===========================*/
  3163. s.scrollbar = {
  3164. isTouched: false,
  3165. setDragPosition: function setDragPosition(e) {
  3166. var sb = s.scrollbar;
  3167. var x = 0,
  3168. y = 0;
  3169. var translate;
  3170. 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;
  3171. var position = pointerPosition - sb.track.offset()[s.isHorizontal() ? 'left' : 'top'] - sb.dragSize / 2;
  3172. var positionMin = - s.minTranslate() * sb.moveDivider;
  3173. var positionMax = - s.maxTranslate() * sb.moveDivider;
  3174. if (position < positionMin) {
  3175. position = positionMin;
  3176. } else if (position > positionMax) {
  3177. position = positionMax;
  3178. }
  3179. position = - position / sb.moveDivider;
  3180. s.updateProgress(position);
  3181. s.setWrapperTranslate(position, true);
  3182. },
  3183. dragStart: function dragStart(e) {
  3184. var sb = s.scrollbar;
  3185. sb.isTouched = true;
  3186. e.preventDefault();
  3187. e.stopPropagation();
  3188. sb.setDragPosition(e);
  3189. clearTimeout(sb.dragTimeout);
  3190. sb.track.transition(0);
  3191. if (s.params.scrollbarHide) {
  3192. sb.track.css('opacity', 1);
  3193. }
  3194. s.wrapper.transition(100);
  3195. sb.drag.transition(100);
  3196. s.emit('onScrollbarDragStart', s);
  3197. },
  3198. dragMove: function dragMove(e) {
  3199. var sb = s.scrollbar;
  3200. if (!sb.isTouched)
  3201. return;
  3202. if (e.preventDefault)
  3203. e.preventDefault();
  3204. else
  3205. e.returnValue = false;
  3206. sb.setDragPosition(e);
  3207. s.wrapper.transition(0);
  3208. sb.track.transition(0);
  3209. sb.drag.transition(0);
  3210. s.emit('onScrollbarDragMove', s);
  3211. },
  3212. dragEnd: function dragEnd(e) {
  3213. var sb = s.scrollbar;
  3214. if (!sb.isTouched)
  3215. return;
  3216. sb.isTouched = false;
  3217. if (s.params.scrollbarHide) {
  3218. clearTimeout(sb.dragTimeout);
  3219. sb.dragTimeout = setTimeout(function () {
  3220. sb.track.css('opacity', 0);
  3221. sb.track.transition(400);
  3222. }, 1000);
  3223. }
  3224. s.emit('onScrollbarDragEnd', s);
  3225. if (s.params.scrollbarSnapOnRelease) {
  3226. s.slideReset();
  3227. }
  3228. },
  3229. draggableEvents: function () {
  3230. if (s.params.simulateTouch === false && !s.support.touch)
  3231. return s.touchEventsDesktop;
  3232. else
  3233. return s.touchEvents;
  3234. }(),
  3235. enableDraggable: function enableDraggable() {
  3236. var sb = s.scrollbar;
  3237. var target = s.support.touch ? sb.track : document;
  3238. $(sb.track).on(sb.draggableEvents.start, sb.dragStart);
  3239. $(target).on(sb.draggableEvents.move, sb.dragMove);
  3240. $(target).on(sb.draggableEvents.end, sb.dragEnd);
  3241. },
  3242. disableDraggable: function disableDraggable() {
  3243. var sb = s.scrollbar;
  3244. var target = s.support.touch ? sb.track : document;
  3245. $(sb.track).off(sb.draggableEvents.start, sb.dragStart);
  3246. $(target).off(sb.draggableEvents.move, sb.dragMove);
  3247. $(target).off(sb.draggableEvents.end, sb.dragEnd);
  3248. },
  3249. set: function set() {
  3250. if (!s.params.scrollbar)
  3251. return;
  3252. var sb = s.scrollbar;
  3253. sb.track = $(s.params.scrollbar);
  3254. if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
  3255. sb.track = s.container.find(s.params.scrollbar);
  3256. }
  3257. sb.drag = sb.track.find('.swiper-scrollbar-drag');
  3258. if (sb.drag.length === 0) {
  3259. sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
  3260. sb.track.append(sb.drag);
  3261. }
  3262. sb.drag[0].style.width = '';
  3263. sb.drag[0].style.height = '';
  3264. sb.trackSize = s.isHorizontal() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;
  3265. sb.divider = s.size / s.virtualSize;
  3266. sb.moveDivider = sb.divider * (sb.trackSize / s.size);
  3267. sb.dragSize = sb.trackSize * sb.divider;
  3268. if (s.isHorizontal()) {
  3269. sb.drag[0].style.width = sb.dragSize + 'px';
  3270. } else {
  3271. sb.drag[0].style.height = sb.dragSize + 'px';
  3272. }
  3273. if (sb.divider >= 1) {
  3274. sb.track[0].style.display = 'none';
  3275. } else {
  3276. sb.track[0].style.display = '';
  3277. }
  3278. if (s.params.scrollbarHide) {
  3279. sb.track[0].style.opacity = 0;
  3280. }
  3281. },
  3282. setTranslate: function setTranslate() {
  3283. if (!s.params.scrollbar)
  3284. return;
  3285. var diff;
  3286. var sb = s.scrollbar;
  3287. var translate = s.translate || 0;
  3288. var newPos;
  3289. var newSize = sb.dragSize;
  3290. newPos = (sb.trackSize - sb.dragSize) * s.progress;
  3291. if (s.rtl && s.isHorizontal()) {
  3292. newPos = - newPos;
  3293. if (newPos > 0) {
  3294. newSize = sb.dragSize - newPos;
  3295. newPos = 0;
  3296. } else if ( - newPos + sb.dragSize > sb.trackSize) {
  3297. newSize = sb.trackSize + newPos;
  3298. }
  3299. } else {
  3300. if (newPos < 0) {
  3301. newSize = sb.dragSize + newPos;
  3302. newPos = 0;
  3303. } else if (newPos + sb.dragSize > sb.trackSize) {
  3304. newSize = sb.trackSize - newPos;
  3305. }
  3306. }
  3307. if (s.isHorizontal()) {
  3308. if (s.support.transforms3d) {
  3309. sb.drag.transform('translate3d(' + newPos + 'px, 0, 0)');
  3310. } else {
  3311. sb.drag.transform('translateX(' + newPos + 'px)');
  3312. }
  3313. sb.drag[0].style.width = newSize + 'px';
  3314. } else {
  3315. if (s.support.transforms3d) {
  3316. sb.drag.transform('translate3d(0px, ' + newPos + 'px, 0)');
  3317. } else {
  3318. sb.drag.transform('translateY(' + newPos + 'px)');
  3319. }
  3320. sb.drag[0].style.height = newSize + 'px';
  3321. }
  3322. if (s.params.scrollbarHide) {
  3323. clearTimeout(sb.timeout);
  3324. sb.track[0].style.opacity = 1;
  3325. sb.timeout = setTimeout(function () {
  3326. sb.track[0].style.opacity = 0;
  3327. sb.track.transition(400);
  3328. }, 1000);
  3329. }
  3330. },
  3331. setTransition: function setTransition(duration) {
  3332. if (!s.params.scrollbar)
  3333. return;
  3334. s.scrollbar.drag.transition(duration);
  3335. }
  3336. };
  3337. /*=========================
  3338. Controller
  3339. ===========================*/
  3340. s.controller = {
  3341. LinearSpline: function LinearSpline(x, y) {
  3342. var binarySearch = function () {
  3343. var maxIndex, minIndex, guess;
  3344. return function (array, val) {
  3345. minIndex = - 1;
  3346. maxIndex = array.length;
  3347. while (maxIndex - minIndex > 1) {
  3348. if (array[guess = maxIndex + minIndex >> 1] <= val) {
  3349. minIndex = guess;
  3350. } else {
  3351. maxIndex = guess;
  3352. }
  3353. }
  3354. return maxIndex;
  3355. };
  3356. }();
  3357. this.x = x;
  3358. this.y = y;
  3359. this.lastIndex = x.length - 1;
  3360. // Given an x value (x2), return the expected y2 value:
  3361. // (x1,y1) is the known point before given value,
  3362. // (x3,y3) is the known point after given value.
  3363. var i1, i3;
  3364. var l = this.x.length;
  3365. this.interpolate = function (x2) {
  3366. if (!x2)
  3367. return 0;
  3368. // Get the indexes of x1 and x3 (the array indexes before and after given x2):
  3369. i3 = binarySearch(this.x, x2);
  3370. i1 = i3 - 1;
  3371. // We have our indexes i1 & i3, so we can calculate already:
  3372. // y2 := ((x2�x1) × (y3�y1)) ÷ (x3�x1) + y1
  3373. return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
  3374. };
  3375. },
  3376. //xxx: for now i will just save one spline function to to
  3377. getInterpolateFunction: function getInterpolateFunction(c) {
  3378. if (!s.controller.spline)
  3379. s.controller.spline = s.params.loop ? new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) : new s.controller.LinearSpline(s.snapGrid, c.snapGrid);
  3380. },
  3381. setTranslate: function setTranslate(translate, byController) {
  3382. var controlled = s.params.control;
  3383. var multiplier, controlledTranslate;
  3384. function setControlledTranslate(c) {
  3385. // this will create an Interpolate function based on the snapGrids
  3386. // x is the Grid of the scrolled scroller and y will be the controlled scroller
  3387. // it makes sense to create this only once and recall it for the interpolation
  3388. // the function does a lot of value caching for performance
  3389. translate = c.rtl && c.params.direction === 'horizontal' ? - s.translate : s.translate;
  3390. if (s.params.controlBy === 'slide') {
  3391. s.controller.getInterpolateFunction(c);
  3392. // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
  3393. // but it did not work out
  3394. controlledTranslate = - s.controller.spline.interpolate( - translate);
  3395. }
  3396. console.log('3402', s.params.controlBy);
  3397. if (!controlledTranslate || s.params.controlBy === 'container') {
  3398. multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());
  3399. controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();
  3400. }
  3401. if (s.params.controlInverse) {
  3402. controlledTranslate = c.maxTranslate() - controlledTranslate;
  3403. }
  3404. c.updateProgress(controlledTranslate);
  3405. c.setWrapperTranslate(controlledTranslate, false, s);
  3406. c.updateActiveIndex();
  3407. }
  3408. if (Array.isArray(controlled)) {
  3409. for (var i = 0; i < controlled.length; i++) {
  3410. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  3411. setControlledTranslate(controlled[i]);
  3412. }
  3413. }
  3414. } else if (controlled instanceof Swiper && byController !== controlled) {
  3415. setControlledTranslate(controlled);
  3416. }
  3417. },
  3418. setTransition: function setTransition(duration, byController) {
  3419. var controlled = s.params.control;
  3420. var i;
  3421. function setControlledTransition(c) {
  3422. c.setWrapperTransition(duration, s);
  3423. if (duration !== 0) {
  3424. c.onTransitionStart();
  3425. c.wrapper.transitionEnd(function () {
  3426. if (!controlled)
  3427. return;
  3428. if (c.params.loop && s.params.controlBy === 'slide') {
  3429. c.fixLoop();
  3430. }
  3431. c.onTransitionEnd();
  3432. });
  3433. }
  3434. }
  3435. if (Array.isArray(controlled)) {
  3436. for (i = 0; i < controlled.length; i++) {
  3437. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  3438. setControlledTransition(controlled[i]);
  3439. }
  3440. }
  3441. } else if (controlled instanceof Swiper && byController !== controlled) {
  3442. setControlledTransition(controlled);
  3443. }
  3444. }
  3445. };
  3446. /*=========================
  3447. Hash Navigation
  3448. ===========================*/
  3449. s.hashnav = {
  3450. onHashCange: function onHashCange(e, a) {
  3451. var newHash = document.location.hash.replace('#', '');
  3452. var activeSlideHash = s.slides.eq(s.activeIndex).attr('data-hash');
  3453. if (newHash !== activeSlideHash) {
  3454. s.slideTo(s.wrapper.children('.' + s.params.slideClass + '[data-hash="' + newHash + '"]').index());
  3455. }
  3456. },
  3457. attachEvents: function attachEvents(detach) {
  3458. var action = detach ? 'off' : 'on';
  3459. $(window)[action]('hashchange', s.hashnav.onHashCange);
  3460. },
  3461. setHash: function setHash() {
  3462. if (!s.hashnav.initialized || !s.params.hashnav)
  3463. return;
  3464. if (s.params.replaceState && window.history && window.history.replaceState) {
  3465. window.history.replaceState(null, null, '#' + s.slides.eq(s.activeIndex).attr('data-hash') || '');
  3466. } else {
  3467. var slide = s.slides.eq(s.activeIndex);
  3468. var hash = slide.attr('data-hash') || slide.attr('data-history');
  3469. document.location.hash = hash || '';
  3470. }
  3471. },
  3472. init: function init() {
  3473. if (!s.params.hashnav || s.params.history)
  3474. return;
  3475. s.hashnav.initialized = true;
  3476. var hash = document.location.hash.replace('#', '');
  3477. if (hash) {
  3478. var speed = 0;
  3479. for (var i = 0, length = s.slides.length; i < length; i++) {
  3480. var slide = s.slides.eq(i);
  3481. var slideHash = slide.attr('data-hash') || slide.attr('data-history');
  3482. if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) {
  3483. var index = slide.index();
  3484. s.slideTo(index, speed, s.params.runCallbacksOnInit, true);
  3485. }
  3486. }
  3487. }
  3488. if (s.params.hashnavWatchState)
  3489. s.hashnav.attachEvents();
  3490. },
  3491. destroy: function destroy() {
  3492. if (s.params.hashnavWatchState)
  3493. s.hashnav.attachEvents(true);
  3494. }
  3495. };
  3496. /*=========================
  3497. History Api with fallback to Hashnav
  3498. ===========================*/
  3499. s.history = {
  3500. init: function init() {
  3501. if (!s.params.history)
  3502. return;
  3503. if (!window.history || !window.history.pushState) {
  3504. s.params.history = false;
  3505. s.params.hashnav = true;
  3506. return;
  3507. }
  3508. s.history.initialized = true;
  3509. this.paths = this.getPathValues();
  3510. if (!this.paths.key && !this.paths.value)
  3511. return;
  3512. this.scrollToSlide(0, this.paths.value, s.params.runCallbacksOnInit);
  3513. if (!s.params.replaceState) {
  3514. window.addEventListener('popstate', this.setHistoryPopState);
  3515. }
  3516. },
  3517. setHistoryPopState: function setHistoryPopState() {
  3518. s.history.paths = s.history.getPathValues();
  3519. s.history.scrollToSlide(s.params.speed, s.history.paths.value, false);
  3520. },
  3521. getPathValues: function getPathValues() {
  3522. var pathArray = window.location.pathname.slice(1).split('/');
  3523. var total = pathArray.length;
  3524. var key = pathArray[total - 2];
  3525. var value = pathArray[total - 1];
  3526. return {key: key, value: value};
  3527. },
  3528. setHistory: function setHistory(key, index) {
  3529. if (!s.history.initialized || !s.params.history)
  3530. return;
  3531. var slide = s.slides.eq(index);
  3532. var value = this.slugify(slide.attr('data-history'));
  3533. if (!window.location.pathname.includes(key)) {
  3534. value = key + '/' + value;
  3535. }
  3536. if (s.params.replaceState) {
  3537. window.history.replaceState(null, null, value);
  3538. } else {
  3539. window.history.pushState(null, null, value);
  3540. }
  3541. },
  3542. slugify: function slugify(text) {
  3543. return text.toString().toLowerCase().replace(/\s+/g, '-').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
  3544. },
  3545. scrollToSlide: function scrollToSlide(speed, value, runCallbacks) {
  3546. if (value) {
  3547. for (var i = 0, length = s.slides.length; i < length; i++) {
  3548. var slide = s.slides.eq(i);
  3549. var slideHistory = this.slugify(slide.attr('data-history'));
  3550. if (slideHistory === value && !slide.hasClass(s.params.slideDuplicateClass)) {
  3551. var index = slide.index();
  3552. s.slideTo(index, speed, runCallbacks);
  3553. }
  3554. }
  3555. } else {
  3556. s.slideTo(0, speed, runCallbacks);
  3557. }
  3558. }
  3559. };
  3560. /*=========================
  3561. Keyboard Control
  3562. ===========================*/
  3563. function handleKeyboard(e) {
  3564. if (e.originalEvent)
  3565. e = e.originalEvent; //jquery fix
  3566. var kc = e.keyCode || e.charCode;
  3567. // Directions locks
  3568. if (!s.params.allowSwipeToNext && (s.isHorizontal() && kc === 39 || !s.isHorizontal() && kc === 40)) {
  3569. return false;
  3570. }
  3571. if (!s.params.allowSwipeToPrev && (s.isHorizontal() && kc === 37 || !s.isHorizontal() && kc === 38)) {
  3572. return false;
  3573. }
  3574. if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
  3575. return;
  3576. }
  3577. if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
  3578. return;
  3579. }
  3580. if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
  3581. var inView = false;
  3582. //Check that swiper should be inside of visible area of window
  3583. if (s.container.parents('.' + s.params.slideClass).length > 0 && s.container.parents('.' + s.params.slideActiveClass).length === 0) {
  3584. return;
  3585. }
  3586. var windowScroll = {
  3587. left: window.pageXOffset,
  3588. top: window.pageYOffset
  3589. };
  3590. var windowWidth = window.innerWidth;
  3591. var windowHeight = window.innerHeight;
  3592. var swiperOffset = s.container.offset();
  3593. if (s.rtl)
  3594. swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;
  3595. 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]];
  3596. for (var i = 0; i < swiperCoord.length; i++) {
  3597. var point = swiperCoord[i];
  3598. if (point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth && point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight) {
  3599. inView = true;
  3600. }
  3601. }
  3602. if (!inView)
  3603. return;
  3604. }
  3605. if (s.isHorizontal()) {
  3606. if (kc === 37 || kc === 39) {
  3607. if (e.preventDefault)
  3608. e.preventDefault();
  3609. else
  3610. e.returnValue = false;
  3611. }
  3612. if (kc === 39 && !s.rtl || kc === 37 && s.rtl)
  3613. s.slideNext();
  3614. if (kc === 37 && !s.rtl || kc === 39 && s.rtl)
  3615. s.slidePrev();
  3616. } else {
  3617. if (kc === 38 || kc === 40) {
  3618. if (e.preventDefault)
  3619. e.preventDefault();
  3620. else
  3621. e.returnValue = false;
  3622. }
  3623. if (kc === 40)
  3624. s.slideNext();
  3625. if (kc === 38)
  3626. s.slidePrev();
  3627. }
  3628. s.emit('onKeyPress', s, kc);
  3629. }
  3630. s.disableKeyboardControl = function () {
  3631. s.params.keyboardControl = false;
  3632. $(document).off('keydown', handleKeyboard);
  3633. };
  3634. s.enableKeyboardControl = function () {
  3635. s.params.keyboardControl = true;
  3636. $(document).on('keydown', handleKeyboard);
  3637. };
  3638. /*=========================
  3639. Mousewheel Control
  3640. ===========================*/
  3641. s.mousewheel = {
  3642. event: false,
  3643. lastScrollTime: new window.Date().getTime()
  3644. };
  3645. function isEventSupported() {
  3646. var eventName = 'onwheel';
  3647. var isSupported = eventName in document;
  3648. if (!isSupported) {
  3649. var element = document.createElement('div');
  3650. element.setAttribute(eventName, 'return;');
  3651. isSupported = typeof element[eventName] === 'function';
  3652. }
  3653. if (!isSupported && document.implementation && document.implementation.hasFeature &&
  3654. // always returns true in newer browsers as per the standard.
  3655. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  3656. document.implementation.hasFeature('', '') !== true) {
  3657. // This is the only way to test support for the `wheel` event in IE9+.
  3658. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  3659. }
  3660. return isSupported;
  3661. }
  3662. /**
  3663. * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is
  3664. * complicated, thus this doc is long and (hopefully) detailed enough to answer
  3665. * your questions.
  3666. *
  3667. * If you need to react to the mouse wheel in a predictable way, this code is
  3668. * like your bestest friend. * hugs *
  3669. *
  3670. * As of today, there are 4 DOM event types you can listen to:
  3671. *
  3672. * 'wheel' -- Chrome(31+), FF(17+), IE(9+)
  3673. * 'mousewheel' -- Chrome, IE(6+), Opera, Safari
  3674. * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother!
  3675. * 'DOMMouseScroll' -- FF(0.9.7+) since 2003
  3676. *
  3677. * So what to do? The is the best:
  3678. *
  3679. * normalizeWheel.getEventType();
  3680. *
  3681. * In your event callback, use this code to get sane interpretation of the
  3682. * deltas. This code will return an object with properties:
  3683. *
  3684. * spinX -- normalized spin speed (use for zoom) - x plane
  3685. * spinY -- " - y plane
  3686. * pixelX -- normalized distance (to pixels) - x plane
  3687. * pixelY -- " - y plane
  3688. *
  3689. * Wheel values are provided by the browser assuming you are using the wheel to
  3690. * scroll a web page by a number of lines or pixels (or pages). Values can vary
  3691. * significantly on different platforms and browsers, forgetting that you can
  3692. * scroll at different speeds. Some devices (like trackpads) emit more events
  3693. * at smaller increments with fine granularity, and some emit massive jumps with
  3694. * linear speed or acceleration.
  3695. *
  3696. * This code does its best to normalize the deltas for you:
  3697. *
  3698. * - spin is trying to normalize how far the wheel was spun (or trackpad
  3699. * dragged). This is super useful for zoom support where you want to
  3700. * throw away the chunky scroll steps on the PC and make those equal to
  3701. * the slow and smooth tiny steps on the Mac. Key data: This code tries to
  3702. * resolve a single slow step on a wheel to 1.
  3703. *
  3704. * - pixel is normalizing the desired scroll delta in pixel units. You'll
  3705. * get the crazy differences between browsers, but at least it'll be in
  3706. * pixels!
  3707. *
  3708. * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This
  3709. * should translate to positive value zooming IN, negative zooming OUT.
  3710. * This matches the newer 'wheel' event.
  3711. *
  3712. * Why are there spinX, spinY (or pixels)?
  3713. *
  3714. * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
  3715. * with a mouse. It results in side-scrolling in the browser by default.
  3716. *
  3717. * - spinY is what you expect -- it's the classic axis of a mouse wheel.
  3718. *
  3719. * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and
  3720. * probably is by browsers in conjunction with fancy 3D controllers .. but
  3721. * you know.
  3722. *
  3723. * Implementation info:
  3724. *
  3725. * Examples of 'wheel' event if you scroll slowly (down) by one step with an
  3726. * average mouse:
  3727. *
  3728. * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120)
  3729. * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12)
  3730. * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A)
  3731. * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120)
  3732. * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120)
  3733. *
  3734. * On the trackpad:
  3735. *
  3736. * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6)
  3737. * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A)
  3738. *
  3739. * On other/older browsers.. it's more complicated as there can be multiple and
  3740. * also missing delta values.
  3741. *
  3742. * The 'wheel' event is more standard:
  3743. *
  3744. * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
  3745. *
  3746. * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
  3747. * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain
  3748. * backward compatibility with older events. Those other values help us
  3749. * better normalize spin speed. Example of what the browsers provide:
  3750. *
  3751. * | event.wheelDelta | event.detail
  3752. * ------------------+------------------+--------------
  3753. * Safari v5/OS X | -120 | 0
  3754. * Safari v5/Win7 | -120 | 0
  3755. * Chrome v17/OS X | -120 | 0
  3756. * Chrome v17/Win7 | -120 | 0
  3757. * IE9/Win7 | -120 | undefined
  3758. * Firefox v4/OS X | undefined | 1
  3759. * Firefox v4/Win7 | undefined | 3
  3760. *
  3761. */
  3762. function normalizeWheel(/*object*/event) /*object*/ {
  3763. // Reasonable defaults
  3764. var PIXEL_STEP = 10;
  3765. var LINE_HEIGHT = 40;
  3766. var PAGE_HEIGHT = 800;
  3767. var sX = 0,
  3768. sY = 0,
  3769. // spinX, spinY
  3770. pX = 0,
  3771. pY = 0; // pixelX, pixelY
  3772. // Legacy
  3773. if ('detail' in event) {
  3774. sY = event.detail;
  3775. }
  3776. if ('wheelDelta' in event) {
  3777. sY = - event.wheelDelta / 120;
  3778. }
  3779. if ('wheelDeltaY' in event) {
  3780. sY = - event.wheelDeltaY / 120;
  3781. }
  3782. if ('wheelDeltaX' in event) {
  3783. sX = - event.wheelDeltaX / 120;
  3784. }
  3785. // side scrolling on FF with DOMMouseScroll
  3786. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  3787. sX = sY;
  3788. sY = 0;
  3789. }
  3790. pX = sX * PIXEL_STEP;
  3791. pY = sY * PIXEL_STEP;
  3792. if ('deltaY' in event) {
  3793. pY = event.deltaY;
  3794. }
  3795. if ('deltaX' in event) {
  3796. pX = event.deltaX;
  3797. }
  3798. if ((pX || pY) && event.deltaMode) {
  3799. if (event.deltaMode === 1) {
  3800. // delta in LINE units
  3801. pX *= LINE_HEIGHT;
  3802. pY *= LINE_HEIGHT;
  3803. } else {
  3804. // delta in PAGE units
  3805. pX *= PAGE_HEIGHT;
  3806. pY *= PAGE_HEIGHT;
  3807. }
  3808. }
  3809. // Fall-back if spin cannot be determined
  3810. if (pX && !sX) {
  3811. sX = pX < 1 ? - 1 : 1;
  3812. }
  3813. if (pY && !sY) {
  3814. sY = pY < 1 ? - 1 : 1;
  3815. }
  3816. return {
  3817. spinX: sX,
  3818. spinY: sY,
  3819. pixelX: pX,
  3820. pixelY: pY
  3821. };
  3822. }
  3823. if (s.params.mousewheelControl) {
  3824. /**
  3825. * The best combination if you prefer spinX + spinY normalization. It favors
  3826. * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with
  3827. * 'wheel' event, making spin speed determination impossible.
  3828. */
  3829. s.mousewheel.event = navigator.userAgent.indexOf('firefox') > - 1 ? 'DOMMouseScroll' : isEventSupported() ? 'wheel' : 'mousewheel';
  3830. }
  3831. function handleMousewheel(e) {
  3832. if (e.originalEvent)
  3833. e = e.originalEvent; //jquery fix
  3834. var delta = 0;
  3835. var rtlFactor = s.rtl ? - 1 : 1;
  3836. var data = normalizeWheel(e);
  3837. if (s.params.mousewheelForceToAxis) {
  3838. if (s.isHorizontal()) {
  3839. if (Math.abs(data.pixelX) > Math.abs(data.pixelY))
  3840. delta = data.pixelX * rtlFactor;
  3841. else
  3842. return;
  3843. } else {
  3844. if (Math.abs(data.pixelY) > Math.abs(data.pixelX))
  3845. delta = data.pixelY;
  3846. else
  3847. return;
  3848. }
  3849. } else {
  3850. delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? - data.pixelX * rtlFactor : - data.pixelY;
  3851. }
  3852. if (delta === 0)
  3853. return;
  3854. if (s.params.mousewheelInvert)
  3855. delta = - delta;
  3856. if (!s.params.freeMode) {
  3857. if (new window.Date().getTime() - s.mousewheel.lastScrollTime > 60) {
  3858. if (delta < 0) {
  3859. if ((!s.isEnd || s.params.loop) && !s.animating) {
  3860. s.slideNext();
  3861. s.emit('onScroll', s, e);
  3862. } else if (s.params.mousewheelReleaseOnEdges)
  3863. return true;
  3864. } else {
  3865. if ((!s.isBeginning || s.params.loop) && !s.animating) {
  3866. s.slidePrev();
  3867. s.emit('onScroll', s, e);
  3868. } else if (s.params.mousewheelReleaseOnEdges)
  3869. return true;
  3870. }
  3871. }
  3872. s.mousewheel.lastScrollTime = new window.Date().getTime();
  3873. } else {
  3874. //Freemode or scrollContainer:
  3875. var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity;
  3876. var wasBeginning = s.isBeginning,
  3877. wasEnd = s.isEnd;
  3878. if (position >= s.minTranslate())
  3879. position = s.minTranslate();
  3880. if (position <= s.maxTranslate())
  3881. position = s.maxTranslate();
  3882. s.setWrapperTransition(0);
  3883. s.setWrapperTranslate(position);
  3884. s.updateProgress();
  3885. s.updateActiveIndex();
  3886. if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) {
  3887. s.updateClasses();
  3888. }
  3889. if (s.params.freeModeSticky) {
  3890. clearTimeout(s.mousewheel.timeout);
  3891. s.mousewheel.timeout = setTimeout(function () {
  3892. s.slideReset();
  3893. }, 300);
  3894. } else {
  3895. if (s.params.lazyLoading && s.lazy) {
  3896. s.lazy.load();
  3897. }
  3898. }
  3899. // Emit event
  3900. s.emit('onScroll', s, e);
  3901. // Stop autoplay
  3902. if (s.params.autoplay && s.params.autoplayDisableOnInteraction)
  3903. s.stopAutoplay();
  3904. // Return page scroll on edge positions
  3905. if (position === 0 || position === s.maxTranslate())
  3906. return;
  3907. }
  3908. if (e.preventDefault)
  3909. e.preventDefault();
  3910. else
  3911. e.returnValue = false;
  3912. return false;
  3913. }
  3914. s.disableMousewheelControl = function () {
  3915. if (!s.mousewheel.event)
  3916. return false;
  3917. var target = s.container;
  3918. console.log('3913', s.params.mousewheelEventsTarged)
  3919. if (s.params.mousewheelEventsTarged !== 'container') {
  3920. target = $(s.params.mousewheelEventsTarged);
  3921. }
  3922. target.off(s.mousewheel.event, handleMousewheel);
  3923. s.params.mousewheelControl = false;
  3924. return true;
  3925. };
  3926. s.enableMousewheelControl = function () {
  3927. if (!s.mousewheel.event)
  3928. return false;
  3929. var target = s.container;
  3930. console.log('3925', s.params.mousewheelEventsTarged)
  3931. if (s.params.mousewheelEventsTarged !== 'container') {
  3932. target = $(s.params.mousewheelEventsTarged);
  3933. }
  3934. target.on(s.mousewheel.event, handleMousewheel);
  3935. s.params.mousewheelControl = true;
  3936. return true;
  3937. };
  3938. /*=========================
  3939. Parallax
  3940. ===========================*/
  3941. function setParallaxTransform(el, progress) {
  3942. el = $(el);
  3943. var p, pX, pY;
  3944. var rtlFactor = s.rtl ? - 1 : 1;
  3945. p = el.attr('data-swiper-parallax') || '0';
  3946. pX = el.attr('data-swiper-parallax-x');
  3947. pY = el.attr('data-swiper-parallax-y');
  3948. if (pX || pY) {
  3949. pX = pX || '0';
  3950. pY = pY || '0';
  3951. } else {
  3952. if (s.isHorizontal()) {
  3953. pX = p;
  3954. pY = '0';
  3955. } else {
  3956. pY = p;
  3957. pX = '0';
  3958. }
  3959. }
  3960. if (pX.indexOf('%') >= 0) {
  3961. pX = parseInt(pX, 10) * progress * rtlFactor + '%';
  3962. } else {
  3963. pX = pX * progress * rtlFactor + 'px';
  3964. }
  3965. if (pY.indexOf('%') >= 0) {
  3966. pY = parseInt(pY, 10) * progress + '%';
  3967. } else {
  3968. pY = pY * progress + 'px';
  3969. }
  3970. el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
  3971. }
  3972. s.parallax = {
  3973. setTranslate: function setTranslate() {
  3974. s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3975. setParallaxTransform(this, s.progress);
  3976. });
  3977. s.slides.each(function () {
  3978. var slide = $(this);
  3979. slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3980. var progress = Math.min(Math.max(slide[0].progress, - 1), 1);
  3981. setParallaxTransform(this, progress);
  3982. });
  3983. });
  3984. },
  3985. setTransition: function setTransition(duration) {
  3986. if (typeof duration === 'undefined')
  3987. duration = s.params.speed;
  3988. s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3989. var el = $(this);
  3990. var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;
  3991. if (duration === 0)
  3992. parallaxDuration = 0;
  3993. el.transition(parallaxDuration);
  3994. });
  3995. }
  3996. };
  3997. /*=========================
  3998. Zoom
  3999. ===========================*/
  4000. s.zoom = {
  4001. // "Global" Props
  4002. scale: 1,
  4003. currentScale: 1,
  4004. isScaling: false,
  4005. gesture: {
  4006. slide: undefined,
  4007. slideWidth: undefined,
  4008. slideHeight: undefined,
  4009. image: undefined,
  4010. imageWrap: undefined,
  4011. zoomMax: s.params.zoomMax
  4012. },
  4013. image: {
  4014. isTouched: undefined,
  4015. isMoved: undefined,
  4016. currentX: undefined,
  4017. currentY: undefined,
  4018. minX: undefined,
  4019. minY: undefined,
  4020. maxX: undefined,
  4021. maxY: undefined,
  4022. width: undefined,
  4023. height: undefined,
  4024. startX: undefined,
  4025. startY: undefined,
  4026. touchesStart: {},
  4027. touchesCurrent: {}
  4028. },
  4029. velocity: {
  4030. x: undefined,
  4031. y: undefined,
  4032. prevPositionX: undefined,
  4033. prevPositionY: undefined,
  4034. prevTime: undefined
  4035. },
  4036. // Calc Scale From Multi-touches
  4037. getDistanceBetweenTouches: function getDistanceBetweenTouches(e) {
  4038. if (e.targetTouches.length < 2)
  4039. return 1;
  4040. var x1 = e.targetTouches[0].pageX,
  4041. y1 = e.targetTouches[0].pageY,
  4042. x2 = e.targetTouches[1].pageX,
  4043. y2 = e.targetTouches[1].pageY;
  4044. var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  4045. return distance;
  4046. },
  4047. // Events
  4048. onGestureStart: function onGestureStart(e) {
  4049. var z = s.zoom;
  4050. if (!s.support.gestures) {
  4051. if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) {
  4052. return;
  4053. }
  4054. z.gesture.scaleStart = z.getDistanceBetweenTouches(e);
  4055. }
  4056. if (!z.gesture.slide || !z.gesture.slide.length) {
  4057. z.gesture.slide = $(this);
  4058. if (z.gesture.slide.length === 0)
  4059. z.gesture.slide = s.slides.eq(s.activeIndex);
  4060. z.gesture.image = z.gesture.slide.find('img, svg, canvas');
  4061. z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);
  4062. z.gesture.zoomMax = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;
  4063. if (z.gesture.imageWrap.length === 0) {
  4064. z.gesture.image = undefined;
  4065. return;
  4066. }
  4067. }
  4068. z.gesture.image.transition(0);
  4069. z.isScaling = true;
  4070. },
  4071. onGestureChange: function onGestureChange(e) {
  4072. var z = s.zoom;
  4073. if (!s.support.gestures) {
  4074. if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) {
  4075. return;
  4076. }
  4077. z.gesture.scaleMove = z.getDistanceBetweenTouches(e);
  4078. }
  4079. if (!z.gesture.image || z.gesture.image.length === 0)
  4080. return;
  4081. if (s.support.gestures) {
  4082. z.scale = e.scale * z.currentScale;
  4083. } else {
  4084. z.scale = z.gesture.scaleMove / z.gesture.scaleStart * z.currentScale;
  4085. }
  4086. if (z.scale > z.gesture.zoomMax) {
  4087. z.scale = z.gesture.zoomMax - 1 + Math.pow(z.scale - z.gesture.zoomMax + 1, 0.5);
  4088. }
  4089. if (z.scale < s.params.zoomMin) {
  4090. z.scale = s.params.zoomMin + 1 - Math.pow(s.params.zoomMin - z.scale + 1, 0.5);
  4091. }
  4092. z.gesture.image.transform('translate3d(0,0,0) scale(' + z.scale + ')');
  4093. },
  4094. onGestureEnd: function onGestureEnd(e) {
  4095. var z = s.zoom;
  4096. if (!s.support.gestures) {
  4097. if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2) {
  4098. return;
  4099. }
  4100. }
  4101. if (!z.gesture.image || z.gesture.image.length === 0)
  4102. return;
  4103. z.scale = Math.max(Math.min(z.scale, z.gesture.zoomMax), s.params.zoomMin);
  4104. z.gesture.image.transition(s.params.speed).transform('translate3d(0,0,0) scale(' + z.scale + ')');
  4105. z.currentScale = z.scale;
  4106. z.isScaling = false;
  4107. if (z.scale === 1)
  4108. z.gesture.slide = undefined;
  4109. },
  4110. onTouchStart: function onTouchStart(s, e) {
  4111. var z = s.zoom;
  4112. if (!z.gesture.image || z.gesture.image.length === 0)
  4113. return;
  4114. if (z.image.isTouched)
  4115. return;
  4116. if (s.device.os === 'android')
  4117. e.preventDefault();
  4118. z.image.isTouched = true;
  4119. z.image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  4120. z.image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  4121. },
  4122. onTouchMove: function onTouchMove(e) {
  4123. var z = s.zoom;
  4124. if (!z.gesture.image || z.gesture.image.length === 0)
  4125. return;
  4126. s.allowClick = false;
  4127. if (!z.image.isTouched || !z.gesture.slide)
  4128. return;
  4129. if (!z.image.isMoved) {
  4130. z.image.width = z.gesture.image[0].offsetWidth;
  4131. z.image.height = z.gesture.image[0].offsetHeight;
  4132. z.image.startX = s.getTranslate(z.gesture.imageWrap[0], 'x') || 0;
  4133. z.image.startY = s.getTranslate(z.gesture.imageWrap[0], 'y') || 0;
  4134. z.gesture.slideWidth = z.gesture.slide[0].offsetWidth;
  4135. z.gesture.slideHeight = z.gesture.slide[0].offsetHeight;
  4136. z.gesture.imageWrap.transition(0);
  4137. if (s.rtl)
  4138. z.image.startX = - z.image.startX;
  4139. if (s.rtl)
  4140. z.image.startY = - z.image.startY;
  4141. }
  4142. // Define if we need image drag
  4143. var scaledWidth = z.image.width * z.scale;
  4144. var scaledHeight = z.image.height * z.scale;
  4145. if (scaledWidth < z.gesture.slideWidth && scaledHeight < z.gesture.slideHeight)
  4146. return;
  4147. z.image.minX = Math.min(z.gesture.slideWidth / 2 - scaledWidth / 2, 0);
  4148. z.image.maxX = - z.image.minX;
  4149. z.image.minY = Math.min(z.gesture.slideHeight / 2 - scaledHeight / 2, 0);
  4150. z.image.maxY = - z.image.minY;
  4151. z.image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  4152. z.image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  4153. if (!z.image.isMoved && !z.isScaling) {
  4154. 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) {
  4155. z.image.isTouched = false;
  4156. return;
  4157. } 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) {
  4158. z.image.isTouched = false;
  4159. return;
  4160. }
  4161. }
  4162. e.preventDefault();
  4163. e.stopPropagation();
  4164. z.image.isMoved = true;
  4165. z.image.currentX = z.image.touchesCurrent.x - z.image.touchesStart.x + z.image.startX;
  4166. z.image.currentY = z.image.touchesCurrent.y - z.image.touchesStart.y + z.image.startY;
  4167. if (z.image.currentX < z.image.minX) {
  4168. z.image.currentX = z.image.minX + 1 - Math.pow(z.image.minX - z.image.currentX + 1, 0.8);
  4169. }
  4170. if (z.image.currentX > z.image.maxX) {
  4171. z.image.currentX = z.image.maxX - 1 + Math.pow(z.image.currentX - z.image.maxX + 1, 0.8);
  4172. }
  4173. if (z.image.currentY < z.image.minY) {
  4174. z.image.currentY = z.image.minY + 1 - Math.pow(z.image.minY - z.image.currentY + 1, 0.8);
  4175. }
  4176. if (z.image.currentY > z.image.maxY) {
  4177. z.image.currentY = z.image.maxY - 1 + Math.pow(z.image.currentY - z.image.maxY + 1, 0.8);
  4178. }
  4179. //Velocity
  4180. if (!z.velocity.prevPositionX)
  4181. z.velocity.prevPositionX = z.image.touchesCurrent.x;
  4182. if (!z.velocity.prevPositionY)
  4183. z.velocity.prevPositionY = z.image.touchesCurrent.y;
  4184. if (!z.velocity.prevTime)
  4185. z.velocity.prevTime = Date.now();
  4186. z.velocity.x = (z.image.touchesCurrent.x - z.velocity.prevPositionX) / (Date.now() - z.velocity.prevTime) / 2;
  4187. z.velocity.y = (z.image.touchesCurrent.y - z.velocity.prevPositionY) / (Date.now() - z.velocity.prevTime) / 2;
  4188. if (Math.abs(z.image.touchesCurrent.x - z.velocity.prevPositionX) < 2)
  4189. z.velocity.x = 0;
  4190. if (Math.abs(z.image.touchesCurrent.y - z.velocity.prevPositionY) < 2)
  4191. z.velocity.y = 0;
  4192. z.velocity.prevPositionX = z.image.touchesCurrent.x;
  4193. z.velocity.prevPositionY = z.image.touchesCurrent.y;
  4194. z.velocity.prevTime = Date.now();
  4195. z.gesture.imageWrap.transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
  4196. },
  4197. onTouchEnd: function onTouchEnd(s, e) {
  4198. var z = s.zoom;
  4199. if (!z.gesture.image || z.gesture.image.length === 0)
  4200. return;
  4201. if (!z.image.isTouched || !z.image.isMoved) {
  4202. z.image.isTouched = false;
  4203. z.image.isMoved = false;
  4204. return;
  4205. }
  4206. z.image.isTouched = false;
  4207. z.image.isMoved = false;
  4208. var momentumDurationX = 300;
  4209. var momentumDurationY = 300;
  4210. var momentumDistanceX = z.velocity.x * momentumDurationX;
  4211. var newPositionX = z.image.currentX + momentumDistanceX;
  4212. var momentumDistanceY = z.velocity.y * momentumDurationY;
  4213. var newPositionY = z.image.currentY + momentumDistanceY;
  4214. //Fix duration
  4215. if (z.velocity.x !== 0)
  4216. momentumDurationX = Math.abs((newPositionX - z.image.currentX) / z.velocity.x);
  4217. if (z.velocity.y !== 0)
  4218. momentumDurationY = Math.abs((newPositionY - z.image.currentY) / z.velocity.y);
  4219. var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
  4220. z.image.currentX = newPositionX;
  4221. z.image.currentY = newPositionY;
  4222. // Define if we need image drag
  4223. var scaledWidth = z.image.width * z.scale;
  4224. var scaledHeight = z.image.height * z.scale;
  4225. z.image.minX = Math.min(z.gesture.slideWidth / 2 - scaledWidth / 2, 0);
  4226. z.image.maxX = - z.image.minX;
  4227. z.image.minY = Math.min(z.gesture.slideHeight / 2 - scaledHeight / 2, 0);
  4228. z.image.maxY = - z.image.minY;
  4229. z.image.currentX = Math.max(Math.min(z.image.currentX, z.image.maxX), z.image.minX);
  4230. z.image.currentY = Math.max(Math.min(z.image.currentY, z.image.maxY), z.image.minY);
  4231. z.gesture.imageWrap.transition(momentumDuration).transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
  4232. },
  4233. onTransitionEnd: function onTransitionEnd(s) {
  4234. var z = s.zoom;
  4235. if (z.gesture.slide && s.previousIndex !== s.activeIndex) {
  4236. z.gesture.image.transform('translate3d(0,0,0) scale(1)');
  4237. z.gesture.imageWrap.transform('translate3d(0,0,0)');
  4238. z.gesture.slide = z.gesture.image = z.gesture.imageWrap = undefined;
  4239. z.scale = z.currentScale = 1;
  4240. }
  4241. },
  4242. // Toggle Zoom
  4243. toggleZoom: function toggleZoom(s, e) {
  4244. var z = s.zoom;
  4245. if (!z.gesture.slide) {
  4246. z.gesture.slide = s.clickedSlide ? $(s.clickedSlide) : s.slides.eq(s.activeIndex);
  4247. z.gesture.image = z.gesture.slide.find('img, svg, canvas');
  4248. z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);
  4249. }
  4250. if (!z.gesture.image || z.gesture.image.length === 0)
  4251. return;
  4252. var touchX, touchY, offsetX, offsetY, diffX, diffY, translateX, translateY, imageWidth, imageHeight, scaledWidth, scaledHeight, translateMinX, translateMinY, translateMaxX, translateMaxY, slideWidth, slideHeight;
  4253. if (typeof z.image.touchesStart.x === 'undefined' && e) {
  4254. touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;
  4255. touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;
  4256. } else {
  4257. touchX = z.image.touchesStart.x;
  4258. touchY = z.image.touchesStart.y;
  4259. }
  4260. if (z.scale && z.scale !== 1) {
  4261. // Zoom Out
  4262. z.scale = z.currentScale = 1;
  4263. z.gesture.imageWrap.transition(300).transform('translate3d(0,0,0)');
  4264. z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(1)');
  4265. z.gesture.slide = undefined;
  4266. } else {
  4267. // Zoom In
  4268. z.scale = z.currentScale = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;
  4269. if (e) {
  4270. slideWidth = z.gesture.slide[0].offsetWidth;
  4271. slideHeight = z.gesture.slide[0].offsetHeight;
  4272. offsetX = z.gesture.slide.offset().left;
  4273. offsetY = z.gesture.slide.offset().top;
  4274. diffX = offsetX + slideWidth / 2 - touchX;
  4275. diffY = offsetY + slideHeight / 2 - touchY;
  4276. imageWidth = z.gesture.image[0].offsetWidth;
  4277. imageHeight = z.gesture.image[0].offsetHeight;
  4278. scaledWidth = imageWidth * z.scale;
  4279. scaledHeight = imageHeight * z.scale;
  4280. translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);
  4281. translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);
  4282. translateMaxX = - translateMinX;
  4283. translateMaxY = - translateMinY;
  4284. translateX = diffX * z.scale;
  4285. translateY = diffY * z.scale;
  4286. if (translateX < translateMinX) {
  4287. translateX = translateMinX;
  4288. }
  4289. if (translateX > translateMaxX) {
  4290. translateX = translateMaxX;
  4291. }
  4292. if (translateY < translateMinY) {
  4293. translateY = translateMinY;
  4294. }
  4295. if (translateY > translateMaxY) {
  4296. translateY = translateMaxY;
  4297. }
  4298. } else {
  4299. translateX = 0;
  4300. translateY = 0;
  4301. }
  4302. z.gesture.imageWrap.transition(300).transform('translate3d(' + translateX + 'px, ' + translateY + 'px,0)');
  4303. z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(' + z.scale + ')');
  4304. }
  4305. },
  4306. // Attach/Detach Events
  4307. attachEvents: function attachEvents(detach) {
  4308. var action = detach ? 'off' : 'on';
  4309. if (s.params.zoom) {
  4310. var target = s.slides;
  4311. var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? {passive: true, capture: false} : false;
  4312. // Scale image
  4313. if (s.support.gestures) {
  4314. s.slides[action]('gesturestart', s.zoom.onGestureStart, passiveListener);
  4315. s.slides[action]('gesturechange', s.zoom.onGestureChange, passiveListener);
  4316. s.slides[action]('gestureend', s.zoom.onGestureEnd, passiveListener);
  4317. } else if (s.touchEvents.start === 'touchstart') {
  4318. s.slides[action](s.touchEvents.start, s.zoom.onGestureStart, passiveListener);
  4319. s.slides[action](s.touchEvents.move, s.zoom.onGestureChange, passiveListener);
  4320. s.slides[action](s.touchEvents.end, s.zoom.onGestureEnd, passiveListener);
  4321. }
  4322. // Move image
  4323. s[action]('touchStart', s.zoom.onTouchStart);
  4324. s.slides.each(function (index, slide) {
  4325. if ($(slide).find('.' + s.params.zoomContainerClass).length > 0) {
  4326. $(slide)[action](s.touchEvents.move, s.zoom.onTouchMove);
  4327. }
  4328. });
  4329. s[action]('touchEnd', s.zoom.onTouchEnd);
  4330. // Scale Out
  4331. s[action]('transitionEnd', s.zoom.onTransitionEnd);
  4332. if (s.params.zoomToggle) {
  4333. s.on('doubleTap', s.zoom.toggleZoom);
  4334. }
  4335. }
  4336. },
  4337. init: function init() {
  4338. s.zoom.attachEvents();
  4339. },
  4340. destroy: function destroy() {
  4341. s.zoom.attachEvents(true);
  4342. }
  4343. };
  4344. /*=========================
  4345. Plugins API. Collect all and init all plugins
  4346. ===========================*/
  4347. s._plugins = [];
  4348. for (var plugin in s.plugins) {
  4349. var p = s.plugins[plugin](s, s.params[plugin]);
  4350. if (p)
  4351. s._plugins.push(p);
  4352. }
  4353. // Method to call all plugins event/method
  4354. s.callPlugins = function (eventName) {
  4355. for (var i = 0; i < s._plugins.length; i++) {
  4356. if (eventName in s._plugins[i]) {
  4357. s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4358. }
  4359. }
  4360. };
  4361. /*=========================
  4362. Events/Callbacks/Plugins Emitter
  4363. ===========================*/
  4364. function normalizeEventName(eventName) {
  4365. if (eventName.indexOf('on') !== 0) {
  4366. if (eventName[0] !== eventName[0].toUpperCase()) {
  4367. eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);
  4368. } else {
  4369. eventName = 'on' + eventName;
  4370. }
  4371. }
  4372. return eventName;
  4373. }
  4374. s.emitterEventListeners = {};
  4375. s.emit = function (eventName) {
  4376. // Trigger callbacks
  4377. if (s.params[eventName]) {
  4378. s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4379. }
  4380. var i;
  4381. // Trigger events
  4382. if (s.emitterEventListeners[eventName]) {
  4383. for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
  4384. s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4385. }
  4386. }
  4387. // Trigger plugins
  4388. if (s.callPlugins)
  4389. s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4390. };
  4391. s.on = function (eventName, handler) {
  4392. eventName = normalizeEventName(eventName);
  4393. if (!s.emitterEventListeners[eventName])
  4394. s.emitterEventListeners[eventName] = [];
  4395. s.emitterEventListeners[eventName].push(handler);
  4396. return s;
  4397. };
  4398. s.off = function (eventName, handler) {
  4399. var i;
  4400. eventName = normalizeEventName(eventName);
  4401. if (typeof handler === 'undefined') {
  4402. // Remove all handlers for such event
  4403. s.emitterEventListeners[eventName] = [];
  4404. return s;
  4405. }
  4406. if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0)
  4407. return;
  4408. for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
  4409. if (s.emitterEventListeners[eventName][i] === handler)
  4410. s.emitterEventListeners[eventName].splice(i, 1);
  4411. }
  4412. return s;
  4413. };
  4414. s.once = function (eventName, handler) {
  4415. eventName = normalizeEventName(eventName);
  4416. var _handler = function _handler() {
  4417. handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
  4418. s.off(eventName, _handler);
  4419. };
  4420. s.on(eventName, _handler);
  4421. return s;
  4422. };
  4423. // Accessibility tools
  4424. s.a11y = {
  4425. makeFocusable: function makeFocusable($el) {
  4426. $el.attr('tabIndex', '0');
  4427. return $el;
  4428. },
  4429. addRole: function addRole($el, role) {
  4430. $el.attr('role', role);
  4431. return $el;
  4432. },
  4433. addLabel: function addLabel($el, label) {
  4434. $el.attr('aria-label', label);
  4435. return $el;
  4436. },
  4437. disable: function disable($el) {
  4438. $el.attr('aria-disabled', true);
  4439. return $el;
  4440. },
  4441. enable: function enable($el) {
  4442. $el.attr('aria-disabled', false);
  4443. return $el;
  4444. },
  4445. onEnterKey: function onEnterKey(event) {
  4446. if (event.keyCode !== 13)
  4447. return;
  4448. if ($(event.target).is(s.params.nextButton)) {
  4449. s.onClickNext(event);
  4450. if (s.isEnd) {
  4451. s.a11y.notify(s.params.lastSlideMessage);
  4452. } else {
  4453. s.a11y.notify(s.params.nextSlideMessage);
  4454. }
  4455. } else if ($(event.target).is(s.params.prevButton)) {
  4456. s.onClickPrev(event);
  4457. if (s.isBeginning) {
  4458. s.a11y.notify(s.params.firstSlideMessage);
  4459. } else {
  4460. s.a11y.notify(s.params.prevSlideMessage);
  4461. }
  4462. }
  4463. if ($(event.target).is('.' + s.params.bulletClass)) {
  4464. $(event.target)[0].click();
  4465. }
  4466. },
  4467. liveRegion: $('<span class="' + s.params.notificationClass + '" aria-live="assertive" aria-atomic="true"></span>'),
  4468. notify: function notify(message) {
  4469. var notification = s.a11y.liveRegion;
  4470. if (notification.length === 0)
  4471. return;
  4472. notification.html('');
  4473. notification.html(message);
  4474. },
  4475. init: function init() {
  4476. // Setup accessibility
  4477. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  4478. s.a11y.makeFocusable(s.nextButton);
  4479. s.a11y.addRole(s.nextButton, 'button');
  4480. s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
  4481. }
  4482. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  4483. s.a11y.makeFocusable(s.prevButton);
  4484. s.a11y.addRole(s.prevButton, 'button');
  4485. s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
  4486. }
  4487. $(s.container).append(s.a11y.liveRegion);
  4488. },
  4489. initPagination: function initPagination() {
  4490. if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {
  4491. s.bullets.each(function () {
  4492. var bullet = $(this);
  4493. s.a11y.makeFocusable(bullet);
  4494. s.a11y.addRole(bullet, 'button');
  4495. s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));
  4496. });
  4497. }
  4498. },
  4499. destroy: function destroy() {
  4500. if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0)
  4501. s.a11y.liveRegion.remove();
  4502. }
  4503. };
  4504. /*=========================
  4505. Init/Destroy
  4506. ===========================*/
  4507. s.init = function () {
  4508. if (s.params.loop)
  4509. s.createLoop();
  4510. s.updateContainerSize();
  4511. s.updateSlidesSize();
  4512. s.updatePagination();
  4513. if (s.params.scrollbar && s.scrollbar) {
  4514. s.scrollbar.set();
  4515. if (s.params.scrollbarDraggable) {
  4516. s.scrollbar.enableDraggable();
  4517. }
  4518. }
  4519. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  4520. if (!s.params.loop)
  4521. s.updateProgress();
  4522. s.effects[s.params.effect].setTranslate();
  4523. }
  4524. if (s.params.loop) {
  4525. s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);
  4526. } else {
  4527. s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);
  4528. if (s.params.initialSlide === 0) {
  4529. if (s.parallax && s.params.parallax)
  4530. s.parallax.setTranslate();
  4531. if (s.lazy && s.params.lazyLoading) {
  4532. s.lazy.load();
  4533. s.lazy.initialImageLoaded = true;
  4534. }
  4535. }
  4536. }
  4537. s.attachEvents();
  4538. if (s.params.observer && s.support.observer) {
  4539. s.initObservers();
  4540. }
  4541. if (s.params.preloadImages && !s.params.lazyLoading) {
  4542. s.preloadImages();
  4543. }
  4544. if (s.params.zoom && s.zoom) {
  4545. s.zoom.init();
  4546. }
  4547. if (s.params.autoplay) {
  4548. s.startAutoplay();
  4549. }
  4550. if (s.params.keyboardControl) {
  4551. if (s.enableKeyboardControl)
  4552. s.enableKeyboardControl();
  4553. }
  4554. if (s.params.mousewheelControl) {
  4555. if (s.enableMousewheelControl)
  4556. s.enableMousewheelControl();
  4557. }
  4558. // Deprecated hashnavReplaceState changed to replaceState for use in hashnav and history
  4559. if (s.params.hashnavReplaceState) {
  4560. s.params.replaceState = s.params.hashnavReplaceState;
  4561. }
  4562. if (s.params.history) {
  4563. if (s.history)
  4564. s.history.init();
  4565. }
  4566. if (s.params.hashnav) {
  4567. if (s.hashnav)
  4568. s.hashnav.init();
  4569. }
  4570. if (s.params.a11y && s.a11y)
  4571. s.a11y.init();
  4572. s.emit('onInit', s);
  4573. };
  4574. // Cleanup dynamic styles
  4575. s.cleanupStyles = function () {
  4576. // Container
  4577. s.container.removeClass(s.classNames.join(' ')).removeAttr('style');
  4578. // Wrapper
  4579. s.wrapper.removeAttr('style');
  4580. // Slides
  4581. if (s.slides && s.slides.length) {
  4582. 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');
  4583. }
  4584. // Pagination/Bullets
  4585. if (s.paginationContainer && s.paginationContainer.length) {
  4586. s.paginationContainer.removeClass(s.params.paginationHiddenClass);
  4587. }
  4588. if (s.bullets && s.bullets.length) {
  4589. s.bullets.removeClass(s.params.bulletActiveClass);
  4590. }
  4591. // Buttons
  4592. if (s.params.prevButton)
  4593. $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
  4594. if (s.params.nextButton)
  4595. $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
  4596. // Scrollbar
  4597. if (s.params.scrollbar && s.scrollbar) {
  4598. if (s.scrollbar.track && s.scrollbar.track.length)
  4599. s.scrollbar.track.removeAttr('style');
  4600. if (s.scrollbar.drag && s.scrollbar.drag.length)
  4601. s.scrollbar.drag.removeAttr('style');
  4602. }
  4603. };
  4604. // Destroy
  4605. s.destroy = function (deleteInstance, cleanupStyles) {
  4606. // Detach evebts
  4607. s.detachEvents();
  4608. // Stop autoplay
  4609. s.stopAutoplay();
  4610. // Disable draggable
  4611. if (s.params.scrollbar && s.scrollbar) {
  4612. if (s.params.scrollbarDraggable) {
  4613. s.scrollbar.disableDraggable();
  4614. }
  4615. }
  4616. // Destroy loop
  4617. if (s.params.loop) {
  4618. s.destroyLoop();
  4619. }
  4620. // Cleanup styles
  4621. if (cleanupStyles) {
  4622. s.cleanupStyles();
  4623. }
  4624. // Disconnect observer
  4625. s.disconnectObservers();
  4626. // Destroy zoom
  4627. if (s.params.zoom && s.zoom) {
  4628. s.zoom.destroy();
  4629. }
  4630. // Disable keyboard/mousewheel
  4631. if (s.params.keyboardControl) {
  4632. if (s.disableKeyboardControl)
  4633. s.disableKeyboardControl();
  4634. }
  4635. if (s.params.mousewheelControl) {
  4636. if (s.disableMousewheelControl)
  4637. s.disableMousewheelControl();
  4638. }
  4639. // Disable a11y
  4640. if (s.params.a11y && s.a11y)
  4641. s.a11y.destroy();
  4642. // Delete history popstate
  4643. if (s.params.history && !s.params.replaceState) {
  4644. window.removeEventListener('popstate', s.history.setHistoryPopState);
  4645. }
  4646. if (s.params.hashnav && s.hashnav) {
  4647. s.hashnav.destroy();
  4648. }
  4649. // Destroy callback
  4650. s.emit('onDestroy');
  4651. // Delete instance
  4652. if (deleteInstance !== false)
  4653. s = null;
  4654. };
  4655. s.init();
  4656. // Return swiper instance
  4657. return s;
  4658. };
  4659. /*==================================================
  4660. Prototype
  4661. ====================================================*/
  4662. Swiper.prototype = {
  4663. isSafari: function () {
  4664. var ua = window.navigator.userAgent.toLowerCase();
  4665. return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
  4666. }(),
  4667. isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent),
  4668. isArray: function isArray(arr) {
  4669. return Object.prototype.toString.apply(arr) === '[object Array]';
  4670. },
  4671. /*==================================================
  4672. Browser
  4673. ====================================================*/
  4674. browser: {
  4675. ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
  4676. ieTouch: window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1 || window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1,
  4677. lteIE9: function () {
  4678. // create temporary DIV
  4679. var div = document.createElement('div');
  4680. // add content to tmp DIV which is wrapped into the IE HTML conditional statement
  4681. div.innerHTML = '<!--[if lte IE 9]><i></i><![endif]-->';
  4682. // return true / false value based on what will browser render
  4683. return div.getElementsByTagName('i').length === 1;
  4684. }()
  4685. },
  4686. /*==================================================
  4687. Devices
  4688. ====================================================*/
  4689. device: function () {
  4690. var ua = window.navigator.userAgent;
  4691. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  4692. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  4693. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  4694. var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
  4695. return {
  4696. ios: ipad || iphone || ipod,
  4697. android: android
  4698. };
  4699. }(),
  4700. /*==================================================
  4701. Feature Detection
  4702. ====================================================*/
  4703. support: {
  4704. touch: window.Modernizr && Modernizr.touch === true || function () {
  4705. return !!('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch);
  4706. }(),
  4707. transforms3d: window.Modernizr && Modernizr.csstransforms3d === true || function () {
  4708. var div = document.createElement('div').style;
  4709. return 'webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div;
  4710. }(),
  4711. flexbox: function () {
  4712. var div = document.createElement('div').style;
  4713. var styles = 'alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient'.split(' ');
  4714. for (var i = 0; i < styles.length; i++) {
  4715. if (styles[i] in div)
  4716. return true;
  4717. }
  4718. }(),
  4719. observer: function () {
  4720. return 'MutationObserver' in window || 'WebkitMutationObserver' in window;
  4721. }(),
  4722. passiveListener: function () {
  4723. var supportsPassive = false;
  4724. try {
  4725. var opts = Object.defineProperty({}, 'passive', {
  4726. get: function get() {
  4727. supportsPassive = true;
  4728. }
  4729. });
  4730. window.addEventListener('testPassiveListener', null, opts);
  4731. } catch (e) {
  4732. }
  4733. return supportsPassive;
  4734. }(),
  4735. gestures: function () {
  4736. return 'ongesturestart' in window;
  4737. }()
  4738. },
  4739. /*==================================================
  4740. Plugins
  4741. ====================================================*/
  4742. plugins: {}
  4743. };
  4744. /*===========================
  4745. Dom7 Library
  4746. ===========================*/
  4747. var Dom7 = function () {
  4748. var Dom7 = function Dom7(arr) {
  4749. var _this = this,
  4750. i = 0;
  4751. // Create array-like object
  4752. for (i = 0; i < arr.length; i++) {
  4753. _this[i] = arr[i];
  4754. }
  4755. _this.length = arr.length;
  4756. // Return collection with methods
  4757. return this;
  4758. };
  4759. var $ = function $(selector, context) {
  4760. var arr = [],
  4761. i = 0;
  4762. if (selector && !context) {
  4763. if (selector instanceof Dom7) {
  4764. return selector;
  4765. }
  4766. }
  4767. if (selector) {
  4768. // String
  4769. if (typeof selector === 'string') {
  4770. var els,
  4771. tempParent,
  4772. html = selector.trim();
  4773. if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
  4774. var toCreate = 'div';
  4775. if (html.indexOf('<li') === 0)
  4776. toCreate = 'ul';
  4777. if (html.indexOf('<tr') === 0)
  4778. toCreate = 'tbody';
  4779. if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0)
  4780. toCreate = 'tr';
  4781. if (html.indexOf('<tbody') === 0)
  4782. toCreate = 'table';
  4783. if (html.indexOf('<option') === 0)
  4784. toCreate = 'select';
  4785. tempParent = document.createElement(toCreate);
  4786. tempParent.innerHTML = selector;
  4787. for (i = 0; i < tempParent.childNodes.length; i++) {
  4788. arr.push(tempParent.childNodes[i]);
  4789. }
  4790. } else {
  4791. if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
  4792. // Pure ID selector
  4793. els = [document.getElementById(selector.split('#')[1])];
  4794. } else {
  4795. // Other selectors
  4796. els = (context || document).querySelectorAll(selector);
  4797. }
  4798. for (i = 0; i < els.length; i++) {
  4799. if (els[i])
  4800. arr.push(els[i]);
  4801. }
  4802. }
  4803. }
  4804. // Node/element
  4805. else if (selector.nodeType || selector === window || selector === document) {
  4806. arr.push(selector);
  4807. }
  4808. //Array of elements or instance of Dom
  4809. else if (selector.length > 0 && selector[0].nodeType) {
  4810. for (i = 0; i < selector.length; i++) {
  4811. arr.push(selector[i]);
  4812. }
  4813. }
  4814. }
  4815. return new Dom7(arr);
  4816. };
  4817. Dom7.prototype = {
  4818. // Classes and attriutes
  4819. addClass: function addClass(className) {
  4820. if (typeof className === 'undefined') {
  4821. return this;
  4822. }
  4823. var classes = className.split(' ');
  4824. for (var i = 0; i < classes.length; i++) {
  4825. for (var j = 0; j < this.length; j++) {
  4826. this[j].classList.add(classes[i]);
  4827. }
  4828. }
  4829. return this;
  4830. },
  4831. removeClass: function removeClass(className) {
  4832. var classes = className.split(' ');
  4833. for (var i = 0; i < classes.length; i++) {
  4834. for (var j = 0; j < this.length; j++) {
  4835. this[j].classList.remove(classes[i]);
  4836. }
  4837. }
  4838. return this;
  4839. },
  4840. hasClass: function hasClass(className) {
  4841. if (!this[0])
  4842. return false;
  4843. else
  4844. return this[0].classList.contains(className);
  4845. },
  4846. toggleClass: function toggleClass(className) {
  4847. var classes = className.split(' ');
  4848. for (var i = 0; i < classes.length; i++) {
  4849. for (var j = 0; j < this.length; j++) {
  4850. this[j].classList.toggle(classes[i]);
  4851. }
  4852. }
  4853. return this;
  4854. },
  4855. attr: function attr(attrs, value) {
  4856. if (arguments.length === 1 && typeof attrs === 'string') {
  4857. // Get attr
  4858. if (this[0])
  4859. return this[0].getAttribute(attrs);
  4860. else
  4861. return undefined;
  4862. } else {
  4863. // Set attrs
  4864. for (var i = 0; i < this.length; i++) {
  4865. if (arguments.length === 2) {
  4866. // String
  4867. this[i].setAttribute(attrs, value);
  4868. } else {
  4869. // Object
  4870. for (var attrName in attrs) {
  4871. this[i][attrName] = attrs[attrName];
  4872. this[i].setAttribute(attrName, attrs[attrName]);
  4873. }
  4874. }
  4875. }
  4876. return this;
  4877. }
  4878. },
  4879. removeAttr: function removeAttr(attr) {
  4880. for (var i = 0; i < this.length; i++) {
  4881. this[i].removeAttribute(attr);
  4882. }
  4883. return this;
  4884. },
  4885. data: function data(key, value) {
  4886. if (typeof value === 'undefined') {
  4887. // Get value
  4888. if (this[0]) {
  4889. var dataKey = this[0].getAttribute('data-' + key);
  4890. if (dataKey)
  4891. return dataKey;
  4892. else if (this[0].dom7ElementDataStorage && key in this[0].dom7ElementDataStorage)
  4893. return this[0].dom7ElementDataStorage[key];
  4894. else
  4895. return undefined;
  4896. } else
  4897. return undefined;
  4898. } else {
  4899. // Set value
  4900. for (var i = 0; i < this.length; i++) {
  4901. var el = this[i];
  4902. if (!el.dom7ElementDataStorage)
  4903. el.dom7ElementDataStorage = {};
  4904. el.dom7ElementDataStorage[key] = value;
  4905. }
  4906. return this;
  4907. }
  4908. },
  4909. // Transforms
  4910. transform: function transform(_transform) {
  4911. for (var i = 0; i < this.length; i++) {
  4912. var elStyle = this[i].style;
  4913. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = _transform;
  4914. }
  4915. return this;
  4916. },
  4917. transition: function transition(duration) {
  4918. if (typeof duration !== 'string') {
  4919. duration = duration + 'ms';
  4920. }
  4921. for (var i = 0; i < this.length; i++) {
  4922. var elStyle = this[i].style;
  4923. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  4924. }
  4925. return this;
  4926. },
  4927. //Events
  4928. on: function on(eventName, targetSelector, listener, capture) {
  4929. function handleLiveEvent(e) {
  4930. var target = e.target;
  4931. if ($(target).is(targetSelector))
  4932. listener.call(target, e);
  4933. else {
  4934. var parents = $(target).parents();
  4935. for (var k = 0; k < parents.length; k++) {
  4936. if ($(parents[k]).is(targetSelector))
  4937. listener.call(parents[k], e);
  4938. }
  4939. }
  4940. }
  4941. var events = eventName.split(' ');
  4942. var i, j;
  4943. for (i = 0; i < this.length; i++) {
  4944. if (typeof targetSelector === 'function' || targetSelector === false) {
  4945. // Usual events
  4946. if (typeof targetSelector === 'function') {
  4947. listener = arguments[1];
  4948. capture = arguments[2] || false;
  4949. }
  4950. for (j = 0; j < events.length; j++) {
  4951. this[i].addEventListener(events[j], listener, capture);
  4952. }
  4953. } else {
  4954. //Live events
  4955. for (j = 0; j < events.length; j++) {
  4956. if (!this[i].dom7LiveListeners)
  4957. this[i].dom7LiveListeners = [];
  4958. this[i].dom7LiveListeners.push({listener: listener, liveListener: handleLiveEvent});
  4959. this[i].addEventListener(events[j], handleLiveEvent, capture);
  4960. }
  4961. }
  4962. }
  4963. return this;
  4964. },
  4965. off: function off(eventName, targetSelector, listener, capture) {
  4966. var events = eventName.split(' ');
  4967. for (var i = 0; i < events.length; i++) {
  4968. for (var j = 0; j < this.length; j++) {
  4969. if (typeof targetSelector === 'function' || targetSelector === false) {
  4970. // Usual events
  4971. if (typeof targetSelector === 'function') {
  4972. listener = arguments[1];
  4973. capture = arguments[2] || false;
  4974. }
  4975. this[j].removeEventListener(events[i], listener, capture);
  4976. } else {
  4977. // Live event
  4978. if (this[j].dom7LiveListeners) {
  4979. for (var k = 0; k < this[j].dom7LiveListeners.length; k++) {
  4980. if (this[j].dom7LiveListeners[k].listener === listener) {
  4981. this[j].removeEventListener(events[i], this[j].dom7LiveListeners[k].liveListener, capture);
  4982. }
  4983. }
  4984. }
  4985. }
  4986. }
  4987. }
  4988. return this;
  4989. },
  4990. once: function once(eventName, targetSelector, listener, capture) {
  4991. var dom = this;
  4992. if (typeof targetSelector === 'function') {
  4993. targetSelector = false;
  4994. listener = arguments[1];
  4995. capture = arguments[2];
  4996. }
  4997. function proxy(e) {
  4998. listener(e);
  4999. dom.off(eventName, targetSelector, proxy, capture);
  5000. }
  5001. dom.on(eventName, targetSelector, proxy, capture);
  5002. },
  5003. trigger: function trigger(eventName, eventData) {
  5004. for (var i = 0; i < this.length; i++) {
  5005. var evt;
  5006. try {
  5007. evt = new window.CustomEvent(eventName, {detail: eventData, bubbles: true, cancelable: true});
  5008. } catch (e) {
  5009. evt = document.createEvent('Event');
  5010. evt.initEvent(eventName, true, true);
  5011. evt.detail = eventData;
  5012. }
  5013. this[i].dispatchEvent(evt);
  5014. }
  5015. return this;
  5016. },
  5017. transitionEnd: function transitionEnd(callback) {
  5018. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  5019. i,
  5020. j,
  5021. dom = this;
  5022. function fireCallBack(e) {
  5023. /*jshint validthis:true */
  5024. if (e.target !== this)
  5025. return;
  5026. callback.call(this, e);
  5027. for (i = 0; i < events.length; i++) {
  5028. dom.off(events[i], fireCallBack);
  5029. }
  5030. }
  5031. if (callback) {
  5032. for (i = 0; i < events.length; i++) {
  5033. dom.on(events[i], fireCallBack);
  5034. }
  5035. }
  5036. return this;
  5037. },
  5038. // Sizing/Styles
  5039. width: function width() {
  5040. if (this[0] === window) {
  5041. return window.innerWidth;
  5042. } else {
  5043. if (this.length > 0) {
  5044. return parseFloat(this.css('width'));
  5045. } else {
  5046. return null;
  5047. }
  5048. }
  5049. },
  5050. outerWidth: function outerWidth(includeMargins) {
  5051. if (this.length > 0) {
  5052. if (includeMargins)
  5053. return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));
  5054. else
  5055. return this[0].offsetWidth;
  5056. } else
  5057. return null;
  5058. },
  5059. height: function height() {
  5060. if (this[0] === window) {
  5061. return window.innerHeight;
  5062. } else {
  5063. if (this.length > 0) {
  5064. return parseFloat(this.css('height'));
  5065. } else {
  5066. return null;
  5067. }
  5068. }
  5069. },
  5070. outerHeight: function outerHeight(includeMargins) {
  5071. if (this.length > 0) {
  5072. if (includeMargins)
  5073. return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));
  5074. else
  5075. return this[0].offsetHeight;
  5076. } else
  5077. return null;
  5078. },
  5079. offset: function offset() {
  5080. if (this.length > 0) {
  5081. var el = this[0];
  5082. var box = el.getBoundingClientRect();
  5083. var body = document.body;
  5084. var clientTop = el.clientTop || body.clientTop || 0;
  5085. var clientLeft = el.clientLeft || body.clientLeft || 0;
  5086. var scrollTop = window.pageYOffset || el.scrollTop;
  5087. var scrollLeft = window.pageXOffset || el.scrollLeft;
  5088. return {
  5089. top: box.top + scrollTop - clientTop,
  5090. left: box.left + scrollLeft - clientLeft
  5091. };
  5092. } else {
  5093. return null;
  5094. }
  5095. },
  5096. css: function css(props, value) {
  5097. var i;
  5098. if (arguments.length === 1) {
  5099. if (typeof props === 'string') {
  5100. if (this[0])
  5101. return window.getComputedStyle(this[0], null).getPropertyValue(props);
  5102. } else {
  5103. for (i = 0; i < this.length; i++) {
  5104. for (var prop in props) {
  5105. this[i].style[prop] = props[prop];
  5106. }
  5107. }
  5108. return this;
  5109. }
  5110. }
  5111. if (arguments.length === 2 && typeof props === 'string') {
  5112. for (i = 0; i < this.length; i++) {
  5113. this[i].style[props] = value;
  5114. }
  5115. return this;
  5116. }
  5117. return this;
  5118. },
  5119. //Dom manipulation
  5120. each: function each(callback) {
  5121. for (var i = 0; i < this.length; i++) {
  5122. callback.call(this[i], i, this[i]);
  5123. }
  5124. return this;
  5125. },
  5126. html: function html(_html) {
  5127. if (typeof _html === 'undefined') {
  5128. return this[0] ? this[0].innerHTML : undefined;
  5129. } else {
  5130. for (var i = 0; i < this.length; i++) {
  5131. this[i].innerHTML = _html;
  5132. }
  5133. return this;
  5134. }
  5135. },
  5136. text: function text(_text) {
  5137. if (typeof _text === 'undefined') {
  5138. if (this[0]) {
  5139. return this[0].textContent.trim();
  5140. } else
  5141. return null;
  5142. } else {
  5143. for (var i = 0; i < this.length; i++) {
  5144. this[i].textContent = _text;
  5145. }
  5146. return this;
  5147. }
  5148. },
  5149. is: function is(selector) {
  5150. if (!this[0])
  5151. return false;
  5152. var compareWith, i;
  5153. if (typeof selector === 'string') {
  5154. var el = this[0];
  5155. if (el === document)
  5156. return selector === document;
  5157. if (el === window)
  5158. return selector === window;
  5159. if (el.matches)
  5160. return el.matches(selector);
  5161. else if (el.webkitMatchesSelector)
  5162. return el.webkitMatchesSelector(selector);
  5163. else if (el.mozMatchesSelector)
  5164. return el.mozMatchesSelector(selector);
  5165. else if (el.msMatchesSelector)
  5166. return el.msMatchesSelector(selector);
  5167. else {
  5168. compareWith = $(selector);
  5169. for (i = 0; i < compareWith.length; i++) {
  5170. if (compareWith[i] === this[0])
  5171. return true;
  5172. }
  5173. return false;
  5174. }
  5175. } else if (selector === document)
  5176. return this[0] === document;
  5177. else if (selector === window)
  5178. return this[0] === window;
  5179. else {
  5180. if (selector.nodeType || selector instanceof Dom7) {
  5181. compareWith = selector.nodeType ? [selector] : selector;
  5182. for (i = 0; i < compareWith.length; i++) {
  5183. if (compareWith[i] === this[0])
  5184. return true;
  5185. }
  5186. return false;
  5187. }
  5188. return false;
  5189. }
  5190. },
  5191. index: function index() {
  5192. if (this[0]) {
  5193. var child = this[0];
  5194. var i = 0;
  5195. while ((child = child.previousSibling) !== null) {
  5196. if (child.nodeType === 1)
  5197. i++;
  5198. }
  5199. return i;
  5200. } else
  5201. return undefined;
  5202. },
  5203. eq: function eq(index) {
  5204. if (typeof index === 'undefined')
  5205. return this;
  5206. var length = this.length;
  5207. var returnIndex;
  5208. if (index > length - 1) {
  5209. return new Dom7([]);
  5210. }
  5211. if (index < 0) {
  5212. returnIndex = length + index;
  5213. if (returnIndex < 0)
  5214. return new Dom7([]);
  5215. else
  5216. return new Dom7([this[returnIndex]]);
  5217. }
  5218. return new Dom7([this[index]]);
  5219. },
  5220. append: function append(newChild) {
  5221. var i, j;
  5222. for (i = 0; i < this.length; i++) {
  5223. if (typeof newChild === 'string') {
  5224. var tempDiv = document.createElement('div');
  5225. tempDiv.innerHTML = newChild;
  5226. while (tempDiv.firstChild) {
  5227. this[i].appendChild(tempDiv.firstChild);
  5228. }
  5229. } else if (newChild instanceof Dom7) {
  5230. for (j = 0; j < newChild.length; j++) {
  5231. this[i].appendChild(newChild[j]);
  5232. }
  5233. } else {
  5234. this[i].appendChild(newChild);
  5235. }
  5236. }
  5237. return this;
  5238. },
  5239. prepend: function prepend(newChild) {
  5240. var i, j;
  5241. for (i = 0; i < this.length; i++) {
  5242. if (typeof newChild === 'string') {
  5243. var tempDiv = document.createElement('div');
  5244. tempDiv.innerHTML = newChild;
  5245. for (j = tempDiv.childNodes.length - 1; j >= 0; j--) {
  5246. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  5247. }
  5248. // this[i].insertAdjacentHTML('afterbegin', newChild);
  5249. } else if (newChild instanceof Dom7) {
  5250. for (j = 0; j < newChild.length; j++) {
  5251. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  5252. }
  5253. } else {
  5254. this[i].insertBefore(newChild, this[i].childNodes[0]);
  5255. }
  5256. }
  5257. return this;
  5258. },
  5259. insertBefore: function insertBefore(selector) {
  5260. var before = $(selector);
  5261. for (var i = 0; i < this.length; i++) {
  5262. if (before.length === 1) {
  5263. before[0].parentNode.insertBefore(this[i], before[0]);
  5264. } else if (before.length > 1) {
  5265. for (var j = 0; j < before.length; j++) {
  5266. before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
  5267. }
  5268. }
  5269. }
  5270. },
  5271. insertAfter: function insertAfter(selector) {
  5272. var after = $(selector);
  5273. for (var i = 0; i < this.length; i++) {
  5274. if (after.length === 1) {
  5275. after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
  5276. } else if (after.length > 1) {
  5277. for (var j = 0; j < after.length; j++) {
  5278. after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
  5279. }
  5280. }
  5281. }
  5282. },
  5283. next: function next(selector) {
  5284. if (this.length > 0) {
  5285. if (selector) {
  5286. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector))
  5287. return new Dom7([this[0].nextElementSibling]);
  5288. else
  5289. return new Dom7([]);
  5290. } else {
  5291. if (this[0].nextElementSibling)
  5292. return new Dom7([this[0].nextElementSibling]);
  5293. else
  5294. return new Dom7([]);
  5295. }
  5296. } else
  5297. return new Dom7([]);
  5298. },
  5299. nextAll: function nextAll(selector) {
  5300. var nextEls = [];
  5301. var el = this[0];
  5302. if (!el)
  5303. return new Dom7([]);
  5304. while (el.nextElementSibling) {
  5305. var next = el.nextElementSibling;
  5306. if (selector) {
  5307. if ($(next).is(selector))
  5308. nextEls.push(next);
  5309. } else
  5310. nextEls.push(next);
  5311. el = next;
  5312. }
  5313. return new Dom7(nextEls);
  5314. },
  5315. prev: function prev(selector) {
  5316. if (this.length > 0) {
  5317. if (selector) {
  5318. if (this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector))
  5319. return new Dom7([this[0].previousElementSibling]);
  5320. else
  5321. return new Dom7([]);
  5322. } else {
  5323. if (this[0].previousElementSibling)
  5324. return new Dom7([this[0].previousElementSibling]);
  5325. else
  5326. return new Dom7([]);
  5327. }
  5328. } else
  5329. return new Dom7([]);
  5330. },
  5331. prevAll: function prevAll(selector) {
  5332. var prevEls = [];
  5333. var el = this[0];
  5334. if (!el)
  5335. return new Dom7([]);
  5336. while (el.previousElementSibling) {
  5337. var prev = el.previousElementSibling;
  5338. if (selector) {
  5339. if ($(prev).is(selector))
  5340. prevEls.push(prev);
  5341. } else
  5342. prevEls.push(prev);
  5343. el = prev;
  5344. }
  5345. return new Dom7(prevEls);
  5346. },
  5347. parent: function parent(selector) {
  5348. var parents = [];
  5349. for (var i = 0; i < this.length; i++) {
  5350. if (selector) {
  5351. if ($(this[i].parentNode).is(selector))
  5352. parents.push(this[i].parentNode);
  5353. } else {
  5354. parents.push(this[i].parentNode);
  5355. }
  5356. }
  5357. return $($.unique(parents));
  5358. },
  5359. parents: function parents(selector) {
  5360. var parents = [];
  5361. for (var i = 0; i < this.length; i++) {
  5362. var parent = this[i].parentNode;
  5363. while (parent) {
  5364. if (selector) {
  5365. if ($(parent).is(selector))
  5366. parents.push(parent);
  5367. } else {
  5368. parents.push(parent);
  5369. }
  5370. parent = parent.parentNode;
  5371. }
  5372. }
  5373. return $($.unique(parents));
  5374. },
  5375. find: function find(selector) {
  5376. var foundElements = [];
  5377. for (var i = 0; i < this.length; i++) {
  5378. var found = this[i].querySelectorAll(selector);
  5379. for (var j = 0; j < found.length; j++) {
  5380. foundElements.push(found[j]);
  5381. }
  5382. }
  5383. return new Dom7(foundElements);
  5384. },
  5385. children: function children(selector) {
  5386. var children = [];
  5387. for (var i = 0; i < this.length; i++) {
  5388. var childNodes = this[i].childNodes;
  5389. for (var j = 0; j < childNodes.length; j++) {
  5390. if (!selector) {
  5391. if (childNodes[j].nodeType === 1)
  5392. children.push(childNodes[j]);
  5393. } else {
  5394. if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector))
  5395. children.push(childNodes[j]);
  5396. }
  5397. }
  5398. }
  5399. return new Dom7($.unique(children));
  5400. },
  5401. remove: function remove() {
  5402. for (var i = 0; i < this.length; i++) {
  5403. if (this[i].parentNode)
  5404. this[i].parentNode.removeChild(this[i]);
  5405. }
  5406. return this;
  5407. },
  5408. add: function add() {
  5409. var dom = this;
  5410. var i, j;
  5411. for (i = 0; i < arguments.length; i++) {
  5412. var toAdd = $(arguments[i]);
  5413. for (j = 0; j < toAdd.length; j++) {
  5414. dom[dom.length] = toAdd[j];
  5415. dom.length++;
  5416. }
  5417. }
  5418. return dom;
  5419. }
  5420. };
  5421. $.fn = Dom7.prototype;
  5422. $.unique = function (arr) {
  5423. var unique = [];
  5424. for (var i = 0; i < arr.length; i++) {
  5425. if (unique.indexOf(arr[i]) === - 1)
  5426. unique.push(arr[i]);
  5427. }
  5428. return unique;
  5429. };
  5430. return $;
  5431. }();
  5432. /*===========================
  5433. Get Dom libraries
  5434. ===========================*/
  5435. var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7'];
  5436. for (var i = 0; i < swiperDomPlugins.length; i++) {
  5437. if (window[swiperDomPlugins[i]]) {
  5438. addLibraryPlugin(window[swiperDomPlugins[i]]);
  5439. }
  5440. }
  5441. // Required DOM Plugins
  5442. var domLib;
  5443. if (typeof Dom7 === 'undefined') {
  5444. domLib = window.Dom7 || window.Zepto || window.jQuery;
  5445. } else {
  5446. domLib = Dom7;
  5447. }
  5448. /*===========================
  5449. Add .swiper plugin from Dom libraries
  5450. ===========================*/
  5451. function addLibraryPlugin(lib) {
  5452. lib.fn.swiper = function (params) {
  5453. var firstInstance;
  5454. lib(this).each(function () {
  5455. var s = new Swiper(this, params);
  5456. if (!firstInstance)
  5457. firstInstance = s;
  5458. });
  5459. return firstInstance;
  5460. };
  5461. }
  5462. if (domLib) {
  5463. if (!('transitionEnd' in domLib.fn)) {
  5464. domLib.fn.transitionEnd = function (callback) {
  5465. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  5466. i,
  5467. j,
  5468. dom = this;
  5469. function fireCallBack(e) {
  5470. /*jshint validthis:true */
  5471. if (e.target !== this)
  5472. return;
  5473. callback.call(this, e);
  5474. for (i = 0; i < events.length; i++) {
  5475. dom.off(events[i], fireCallBack);
  5476. }
  5477. }
  5478. if (callback) {
  5479. for (i = 0; i < events.length; i++) {
  5480. dom.on(events[i], fireCallBack);
  5481. }
  5482. }
  5483. return this;
  5484. };
  5485. }
  5486. if (!('transform' in domLib.fn)) {
  5487. domLib.fn.transform = function (transform) {
  5488. for (var i = 0; i < this.length; i++) {
  5489. var elStyle = this[i].style;
  5490. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;
  5491. }
  5492. return this;
  5493. };
  5494. }
  5495. if (!('transition' in domLib.fn)) {
  5496. domLib.fn.transition = function (duration) {
  5497. if (typeof duration !== 'string') {
  5498. duration = duration + 'ms';
  5499. }
  5500. for (var i = 0; i < this.length; i++) {
  5501. var elStyle = this[i].style;
  5502. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  5503. }
  5504. return this;
  5505. };
  5506. }
  5507. if (!('outerWidth' in domLib.fn)) {
  5508. domLib.fn.outerWidth = function (includeMargins) {
  5509. if (this.length > 0) {
  5510. if (includeMargins)
  5511. return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));
  5512. else
  5513. return this[0].offsetWidth;
  5514. } else
  5515. return null;
  5516. };
  5517. }
  5518. }
  5519. window.Swiper = Swiper;
  5520. })();
  5521. /*===========================
  5522. Swiper AMD Export
  5523. ===========================*/
  5524. if (true) {
  5525. module.exports = window.Swiper;
  5526. } else if (typeof define === 'function' && define.amd) {
  5527. define([], function () {
  5528. 'use strict';
  5529. return window.Swiper;
  5530. });
  5531. }
  5532. //# sourceMappingURL=maps/swiper.js.map
  5533. /***/ }),
  5534. /* 5 */
  5535. /***/ (function (module, exports, __webpack_require__) {
  5536. "use strict";
  5537. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5538. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  5539. return typeof obj;
  5540. } : function (obj) {
  5541. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  5542. };
  5543. /*! tether-drop 1.4.1 */
  5544. (function (root, factory) {
  5545. if (true) {
  5546. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(34)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  5547. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  5548. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  5549. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5550. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  5551. module.exports = factory(require('tether'));
  5552. } else {
  5553. root.Drop = factory(root.Tether);
  5554. }
  5555. })(undefined, function (Tether) {
  5556. /* global Tether */
  5557. 'use strict';
  5558. var _bind = Function.prototype.bind;
  5559. var _slicedToArray = function () {
  5560. function sliceIterator(arr, i) {
  5561. var _arr = [];
  5562. var _n = true;
  5563. var _d = false;
  5564. var _e = undefined;
  5565. try {
  5566. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  5567. _arr.push(_s.value);
  5568. if (i && _arr.length === i)
  5569. break;
  5570. }
  5571. } catch (err) {
  5572. _d = true;
  5573. _e = err;
  5574. } finally {
  5575. try {
  5576. if (!_n && _i['return'])
  5577. _i['return']();
  5578. } finally {
  5579. if (_d)
  5580. throw _e;
  5581. }
  5582. }
  5583. return _arr;
  5584. }
  5585. return function (arr, i) {
  5586. if (Array.isArray(arr)) {
  5587. return arr;
  5588. } else if (Symbol.iterator in Object(arr)) {
  5589. return sliceIterator(arr, i);
  5590. } else {
  5591. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  5592. }
  5593. };
  5594. }();
  5595. var _createClass = function () {
  5596. function defineProperties(target, props) {
  5597. for (var i = 0; i < props.length; i++) {
  5598. var descriptor = props[i];
  5599. descriptor.enumerable = descriptor.enumerable || false;
  5600. descriptor.configurable = true;
  5601. if ('value' in descriptor)
  5602. descriptor.writable = true;
  5603. Object.defineProperty(target, descriptor.key, descriptor);
  5604. }
  5605. }
  5606. return function (Constructor, protoProps, staticProps) {
  5607. if (protoProps)
  5608. defineProperties(Constructor.prototype, protoProps);
  5609. if (staticProps)
  5610. defineProperties(Constructor, staticProps);
  5611. return Constructor;
  5612. };
  5613. }();
  5614. var _get = function get(_x2, _x3, _x4) {
  5615. var _again = true;
  5616. _function: while (_again) {
  5617. var object = _x2,
  5618. property = _x3,
  5619. receiver = _x4;
  5620. _again = false;
  5621. if (object === null)
  5622. object = Function.prototype;
  5623. var desc = Object.getOwnPropertyDescriptor(object, property);
  5624. if (desc === undefined) {
  5625. var parent = Object.getPrototypeOf(object);
  5626. if (parent === null) {
  5627. return undefined;
  5628. } else {
  5629. _x2 = parent;
  5630. _x3 = property;
  5631. _x4 = receiver;
  5632. _again = true;
  5633. desc = parent = undefined;
  5634. continue _function;
  5635. }
  5636. } else if ('value' in desc) {
  5637. return desc.value;
  5638. } else {
  5639. var getter = desc.get;
  5640. if (getter === undefined) {
  5641. return undefined;
  5642. }
  5643. return getter.call(receiver);
  5644. }
  5645. }
  5646. };
  5647. function _classCallCheck(instance, Constructor) {
  5648. if (!(instance instanceof Constructor)) {
  5649. throw new TypeError('Cannot call a class as a function');
  5650. }
  5651. }
  5652. function _inherits(subClass, superClass) {
  5653. if (typeof superClass !== 'function' && superClass !== null) {
  5654. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  5655. }
  5656. subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {value: subClass, enumerable: false, writable: true, configurable: true}});
  5657. if (superClass)
  5658. Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  5659. }
  5660. var _Tether$Utils = Tether.Utils;
  5661. var extend = _Tether$Utils.extend;
  5662. var addClass = _Tether$Utils.addClass;
  5663. var removeClass = _Tether$Utils.removeClass;
  5664. var hasClass = _Tether$Utils.hasClass;
  5665. var Evented = _Tether$Utils.Evented;
  5666. function sortAttach(str) {
  5667. var _str$split = str.split(' ');
  5668. var _str$split2 = _slicedToArray(_str$split, 2);
  5669. var first = _str$split2[0];
  5670. var second = _str$split2[1];
  5671. if (['left', 'right'].indexOf(first) >= 0) {
  5672. var _ref = [second, first];
  5673. first = _ref[0];
  5674. second = _ref[1];
  5675. }
  5676. return [first, second].join(' ');
  5677. }
  5678. function removeFromArray(arr, item) {
  5679. var index = undefined;
  5680. var results = [];
  5681. while ((index = arr.indexOf(item)) !== - 1) {
  5682. results.push(arr.splice(index, 1));
  5683. }
  5684. return results;
  5685. }
  5686. var clickEvents = ['click'];
  5687. var transitionEndEvents = {
  5688. 'WebkitTransition': 'webkitTransitionEnd',
  5689. 'MozTransition': 'transitionend',
  5690. 'OTransition': 'otransitionend',
  5691. 'transition': 'transitionend'
  5692. };
  5693. var transitionEndEvent = '';
  5694. for (var _name in transitionEndEvents) {
  5695. if ({}.hasOwnProperty.call(transitionEndEvents, _name)) {
  5696. var tempEl = document.createElement('p');
  5697. if (typeof tempEl.style[_name] !== 'undefined') {
  5698. transitionEndEvent = transitionEndEvents[_name];
  5699. }
  5700. }
  5701. }
  5702. var MIRROR_ATTACH = {
  5703. left: 'right',
  5704. right: 'left',
  5705. top: 'bottom',
  5706. bottom: 'top',
  5707. middle: 'middle',
  5708. center: 'center'
  5709. };
  5710. var allDrops = {};
  5711. // Drop can be included in external libraries. Calling createContext gives you a fresh
  5712. // copy of drop which won't interact with other copies on the page (beyond calling the document events).
  5713. function createContext() {
  5714. var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  5715. var drop = function drop() {
  5716. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  5717. args[_key] = arguments[_key];
  5718. }
  5719. return new (_bind.apply(DropInstance, [null].concat(args)))();
  5720. };
  5721. extend(drop, {
  5722. createContext: createContext,
  5723. drops: [],
  5724. defaults: {}
  5725. });
  5726. var defaultOptions = {
  5727. classPrefix: 'drop',
  5728. defaults: {
  5729. position: 'bottom left',
  5730. openOn: 'click',
  5731. beforeClose: null,
  5732. constrainToScrollParent: true,
  5733. constrainToWindow: true,
  5734. classes: '',
  5735. remove: false,
  5736. openDelay: 0,
  5737. closeDelay: 50,
  5738. // inherited from openDelay and closeDelay if not explicitly defined
  5739. focusDelay: null,
  5740. blurDelay: null,
  5741. hoverOpenDelay: null,
  5742. hoverCloseDelay: null,
  5743. tetherOptions: {}
  5744. }
  5745. };
  5746. extend(drop, defaultOptions, options);
  5747. extend(drop.defaults, defaultOptions.defaults, options.defaults);
  5748. if (typeof allDrops[drop.classPrefix] === 'undefined') {
  5749. allDrops[drop.classPrefix] = [];
  5750. }
  5751. drop.updateBodyClasses = function () {
  5752. // There is only one body, so despite the context concept, we still iterate through all
  5753. // drops which share our classPrefix.
  5754. var anyOpen = false;
  5755. var drops = allDrops[drop.classPrefix];
  5756. var len = drops.length;
  5757. for (var i = 0; i < len; ++i) {
  5758. if (drops[i].isOpened()) {
  5759. anyOpen = true;
  5760. break;
  5761. }
  5762. }
  5763. if (anyOpen) {
  5764. addClass(document.body, drop.classPrefix + '-open');
  5765. } else {
  5766. removeClass(document.body, drop.classPrefix + '-open');
  5767. }
  5768. };
  5769. var DropInstance = function (_Evented) {
  5770. _inherits(DropInstance, _Evented);
  5771. function DropInstance(opts) {
  5772. _classCallCheck(this, DropInstance);
  5773. _get(Object.getPrototypeOf(DropInstance.prototype), 'constructor', this).call(this);
  5774. this.options = extend({}, drop.defaults, opts);
  5775. this.target = this.options.target;
  5776. if (typeof this.target === 'undefined') {
  5777. throw new Error('Drop Error: You must provide a target.');
  5778. }
  5779. var dataPrefix = 'data-' + drop.classPrefix;
  5780. var contentAttr = this.target.getAttribute(dataPrefix);
  5781. if (contentAttr && this.options.content == null) {
  5782. this.options.content = contentAttr;
  5783. }
  5784. var attrsOverride = ['position', 'openOn'];
  5785. for (var i = 0; i < attrsOverride.length; ++i) {
  5786. var override = this.target.getAttribute(dataPrefix + '-' + attrsOverride[i]);
  5787. if (override && this.options[attrsOverride[i]] == null) {
  5788. this.options[attrsOverride[i]] = override;
  5789. }
  5790. }
  5791. if (this.options.classes && this.options.addTargetClasses !== false) {
  5792. addClass(this.target, this.options.classes);
  5793. }
  5794. drop.drops.push(this);
  5795. allDrops[drop.classPrefix].push(this);
  5796. this._boundEvents = [];
  5797. this.bindMethods();
  5798. this.setupElements();
  5799. this.setupEvents();
  5800. this.setupTether();
  5801. }
  5802. _createClass(DropInstance, [{
  5803. key: '_on',
  5804. value: function _on(element, event, handler) {
  5805. this._boundEvents.push({element: element, event: event, handler: handler});
  5806. element.addEventListener(event, handler);
  5807. }
  5808. }, {
  5809. key: 'bindMethods',
  5810. value: function bindMethods() {
  5811. this.transitionEndHandler = this._transitionEndHandler.bind(this);
  5812. }
  5813. }, {
  5814. key: 'setupElements',
  5815. value: function setupElements() {
  5816. var _this = this;
  5817. this.drop = document.createElement('div');
  5818. addClass(this.drop, drop.classPrefix);
  5819. if (this.options.classes) {
  5820. addClass(this.drop, this.options.classes);
  5821. }
  5822. this.content = document.createElement('div');
  5823. addClass(this.content, drop.classPrefix + '-content');
  5824. if (typeof this.options.content === 'function') {
  5825. var generateAndSetContent = function generateAndSetContent() {
  5826. // content function might return a string or an element
  5827. var contentElementOrHTML = _this.options.content.call(_this, _this);
  5828. if (typeof contentElementOrHTML === 'string') {
  5829. _this.content.innerHTML = contentElementOrHTML;
  5830. } else if ((typeof contentElementOrHTML === 'undefined' ? 'undefined' : _typeof(contentElementOrHTML)) === 'object') {
  5831. _this.content.innerHTML = '';
  5832. _this.content.appendChild(contentElementOrHTML);
  5833. } else {
  5834. throw new Error('Drop Error: Content function should return a string or HTMLElement.');
  5835. }
  5836. };
  5837. generateAndSetContent();
  5838. this.on('open', generateAndSetContent.bind(this));
  5839. } else if (_typeof(this.options.content) === 'object') {
  5840. this.content.appendChild(this.options.content);
  5841. } else {
  5842. this.content.innerHTML = this.options.content;
  5843. }
  5844. this.drop.appendChild(this.content);
  5845. }
  5846. }, {
  5847. key: 'setupTether',
  5848. value: function setupTether() {
  5849. // Tether expects two attachment points, one in the target element, one in the
  5850. // drop. We use a single one, and use the order as well, to allow us to put
  5851. // the drop on either side of any of the four corners. This magic converts between
  5852. // the two:
  5853. var dropAttach = this.options.position.split(' ');
  5854. dropAttach[0] = MIRROR_ATTACH[dropAttach[0]];
  5855. dropAttach = dropAttach.join(' ');
  5856. var constraints = [];
  5857. if (this.options.constrainToScrollParent) {
  5858. constraints.push({
  5859. to: 'scrollParent',
  5860. pin: 'top, bottom',
  5861. attachment: 'together none'
  5862. });
  5863. } else {
  5864. // To get 'out of bounds' classes
  5865. constraints.push({
  5866. to: 'scrollParent'
  5867. });
  5868. }
  5869. if (this.options.constrainToWindow !== false) {
  5870. constraints.push({
  5871. to: 'window',
  5872. attachment: 'together'
  5873. });
  5874. } else {
  5875. // To get 'out of bounds' classes
  5876. constraints.push({
  5877. to: 'window'
  5878. });
  5879. }
  5880. var opts = {
  5881. element: this.drop,
  5882. target: this.target,
  5883. attachment: sortAttach(dropAttach),
  5884. targetAttachment: sortAttach(this.options.position),
  5885. classPrefix: drop.classPrefix,
  5886. offset: '0 0',
  5887. targetOffset: '0 0',
  5888. enabled: false,
  5889. constraints: constraints,
  5890. addTargetClasses: this.options.addTargetClasses
  5891. };
  5892. if (this.options.tetherOptions !== false) {
  5893. this.tether = new Tether(extend({}, opts, this.options.tetherOptions));
  5894. }
  5895. }
  5896. }, {
  5897. key: 'setupEvents',
  5898. value: function setupEvents() {
  5899. var _this2 = this;
  5900. if (!this.options.openOn) {
  5901. return;
  5902. }
  5903. if (this.options.openOn === 'always') {
  5904. setTimeout(this.open.bind(this));
  5905. return;
  5906. }
  5907. var events = this.options.openOn.split(' ');
  5908. if (events.indexOf('click') >= 0) {
  5909. var openHandler = function openHandler(event) {
  5910. _this2.toggle(event);
  5911. event.preventDefault();
  5912. };
  5913. var closeHandler = function closeHandler(event) {
  5914. if (!_this2.isOpened()) {
  5915. return;
  5916. }
  5917. // Clicking inside dropdown
  5918. if (event.target === _this2.drop || _this2.drop.contains(event.target)) {
  5919. return;
  5920. }
  5921. // Clicking target
  5922. if (event.target === _this2.target || _this2.target.contains(event.target)) {
  5923. return;
  5924. }
  5925. _this2.close(event);
  5926. };
  5927. for (var i = 0; i < clickEvents.length; ++i) {
  5928. var clickEvent = clickEvents[i];
  5929. this._on(this.target, clickEvent, openHandler);
  5930. this._on(document, clickEvent, closeHandler);
  5931. }
  5932. }
  5933. var inTimeout = null;
  5934. var outTimeout = null;
  5935. var inHandler = function inHandler(event) {
  5936. if (outTimeout !== null) {
  5937. clearTimeout(outTimeout);
  5938. } else {
  5939. inTimeout = setTimeout(function () {
  5940. _this2.open(event);
  5941. inTimeout = null;
  5942. }, (event.type === 'focus' ? _this2.options.focusDelay : _this2.options.hoverOpenDelay) || _this2.options.openDelay);
  5943. }
  5944. };
  5945. var outHandler = function outHandler(event) {
  5946. if (inTimeout !== null) {
  5947. clearTimeout(inTimeout);
  5948. } else {
  5949. outTimeout = setTimeout(function () {
  5950. _this2.close(event);
  5951. outTimeout = null;
  5952. }, (event.type === 'blur' ? _this2.options.blurDelay : _this2.options.hoverCloseDelay) || _this2.options.closeDelay);
  5953. }
  5954. };
  5955. if (events.indexOf('hover') >= 0) {
  5956. this._on(this.target, 'mouseover', inHandler);
  5957. this._on(this.drop, 'mouseover', inHandler);
  5958. this._on(this.target, 'mouseout', outHandler);
  5959. this._on(this.drop, 'mouseout', outHandler);
  5960. }
  5961. if (events.indexOf('focus') >= 0) {
  5962. this._on(this.target, 'focus', inHandler);
  5963. this._on(this.drop, 'focus', inHandler);
  5964. this._on(this.target, 'blur', outHandler);
  5965. this._on(this.drop, 'blur', outHandler);
  5966. }
  5967. }
  5968. }, {
  5969. key: 'isOpened',
  5970. value: function isOpened() {
  5971. if (this.drop) {
  5972. return hasClass(this.drop, drop.classPrefix + '-open');
  5973. }
  5974. }
  5975. }, {
  5976. key: 'toggle',
  5977. value: function toggle(event) {
  5978. if (this.isOpened()) {
  5979. this.close(event);
  5980. } else {
  5981. this.open(event);
  5982. }
  5983. }
  5984. }, {
  5985. key: 'open',
  5986. value: function open(event) {
  5987. var _this3 = this;
  5988. /* eslint no-unused-vars: 0 */
  5989. if (this.isOpened()) {
  5990. return;
  5991. }
  5992. if (!this.drop.parentNode) {
  5993. document.body.appendChild(this.drop);
  5994. }
  5995. if (typeof this.tether !== 'undefined') {
  5996. this.tether.enable();
  5997. }
  5998. addClass(this.drop, drop.classPrefix + '-open');
  5999. addClass(this.drop, drop.classPrefix + '-open-transitionend');
  6000. setTimeout(function () {
  6001. if (_this3.drop) {
  6002. addClass(_this3.drop, drop.classPrefix + '-after-open');
  6003. }
  6004. });
  6005. if (typeof this.tether !== 'undefined') {
  6006. this.tether.position();
  6007. }
  6008. this.trigger('open');
  6009. drop.updateBodyClasses();
  6010. }
  6011. }, {
  6012. key: '_transitionEndHandler',
  6013. value: function _transitionEndHandler(e) {
  6014. if (e.target !== e.currentTarget) {
  6015. return;
  6016. }
  6017. if (!hasClass(this.drop, drop.classPrefix + '-open')) {
  6018. removeClass(this.drop, drop.classPrefix + '-open-transitionend');
  6019. }
  6020. this.drop.removeEventListener(transitionEndEvent, this.transitionEndHandler);
  6021. }
  6022. }, {
  6023. key: 'beforeCloseHandler',
  6024. value: function beforeCloseHandler(event) {
  6025. var shouldClose = true;
  6026. if (!this.isClosing && typeof this.options.beforeClose === 'function') {
  6027. this.isClosing = true;
  6028. shouldClose = this.options.beforeClose(event, this) !== false;
  6029. }
  6030. this.isClosing = false;
  6031. return shouldClose;
  6032. }
  6033. }, {
  6034. key: 'close',
  6035. value: function close(event) {
  6036. if (!this.isOpened()) {
  6037. return;
  6038. }
  6039. if (!this.beforeCloseHandler(event)) {
  6040. return;
  6041. }
  6042. removeClass(this.drop, drop.classPrefix + '-open');
  6043. removeClass(this.drop, drop.classPrefix + '-after-open');
  6044. this.drop.addEventListener(transitionEndEvent, this.transitionEndHandler);
  6045. this.trigger('close');
  6046. if (typeof this.tether !== 'undefined') {
  6047. this.tether.disable();
  6048. }
  6049. drop.updateBodyClasses();
  6050. if (this.options.remove) {
  6051. this.remove(event);
  6052. }
  6053. }
  6054. }, {
  6055. key: 'remove',
  6056. value: function remove(event) {
  6057. this.close(event);
  6058. if (this.drop.parentNode) {
  6059. this.drop.parentNode.removeChild(this.drop);
  6060. }
  6061. }
  6062. }, {
  6063. key: 'position',
  6064. value: function position() {
  6065. if (this.isOpened() && typeof this.tether !== 'undefined') {
  6066. this.tether.position();
  6067. }
  6068. }
  6069. }, {
  6070. key: 'destroy',
  6071. value: function destroy() {
  6072. this.remove();
  6073. if (typeof this.tether !== 'undefined') {
  6074. this.tether.destroy();
  6075. }
  6076. for (var i = 0; i < this._boundEvents.length; ++i) {
  6077. var _boundEvents$i = this._boundEvents[i];
  6078. var element = _boundEvents$i.element;
  6079. var _event = _boundEvents$i.event;
  6080. var handler = _boundEvents$i.handler;
  6081. element.removeEventListener(_event, handler);
  6082. }
  6083. this._boundEvents = [];
  6084. this.tether = null;
  6085. this.drop = null;
  6086. this.content = null;
  6087. this.target = null;
  6088. removeFromArray(allDrops[drop.classPrefix], this);
  6089. removeFromArray(drop.drops, this);
  6090. }
  6091. }]);
  6092. return DropInstance;
  6093. }(Evented);
  6094. return drop;
  6095. }
  6096. var Drop = createContext();
  6097. document.addEventListener('DOMContentLoaded', function () {
  6098. Drop.updateBodyClasses();
  6099. });
  6100. return Drop;
  6101. });
  6102. /***/ }),
  6103. /* 6 */
  6104. /***/ (function (module, exports, __webpack_require__) {
  6105. "use strict";
  6106. Object.defineProperty(exports, "__esModule", {
  6107. value: true
  6108. });
  6109. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  6110. return typeof obj;
  6111. } : function (obj) {
  6112. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  6113. };
  6114. var _createClass = function () {
  6115. function defineProperties(target, props) {
  6116. for (var i = 0; i < props.length; i++) {
  6117. var descriptor = props[i];
  6118. descriptor.enumerable = descriptor.enumerable || false;
  6119. descriptor.configurable = true;
  6120. if ("value" in descriptor)
  6121. descriptor.writable = true;
  6122. Object.defineProperty(target, descriptor.key, descriptor);
  6123. }
  6124. }
  6125. return function (Constructor, protoProps, staticProps) {
  6126. if (protoProps)
  6127. defineProperties(Constructor.prototype, protoProps);
  6128. if (staticProps)
  6129. defineProperties(Constructor, staticProps);
  6130. return Constructor;
  6131. };
  6132. }();
  6133. var _jquery = __webpack_require__(1);
  6134. var _jquery2 = _interopRequireDefault(_jquery);
  6135. var _util = __webpack_require__(0);
  6136. var _util2 = _interopRequireDefault(_util);
  6137. function _interopRequireDefault(obj) {
  6138. return obj && obj.__esModule ? obj : {default: obj};
  6139. }
  6140. function _classCallCheck(instance, Constructor) {
  6141. if (!(instance instanceof Constructor)) {
  6142. throw new TypeError("Cannot call a class as a function");
  6143. }
  6144. }
  6145. /**
  6146. * --------------------------------------------------------------------------
  6147. * Bootstrap (v4.0.0-beta): collapse.js
  6148. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  6149. * --------------------------------------------------------------------------
  6150. */
  6151. var Collapse = function () {
  6152. /**
  6153. * ------------------------------------------------------------------------
  6154. * Constants
  6155. * ------------------------------------------------------------------------
  6156. */
  6157. var NAME = 'collapse';
  6158. var VERSION = '4.0.0-beta';
  6159. var DATA_KEY = 'bs.collapse';
  6160. var EVENT_KEY = '.' + DATA_KEY;
  6161. var DATA_API_KEY = '.data-api';
  6162. var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
  6163. var TRANSITION_DURATION = 600;
  6164. var Default = {
  6165. toggle: true,
  6166. parent: ''
  6167. };
  6168. var DefaultType = {
  6169. toggle: 'boolean',
  6170. parent: '(string|element)'
  6171. };
  6172. var Event = {
  6173. SHOW: 'show' + EVENT_KEY,
  6174. SHOWN: 'shown' + EVENT_KEY,
  6175. HIDE: 'hide' + EVENT_KEY,
  6176. HIDDEN: 'hidden' + EVENT_KEY,
  6177. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  6178. };
  6179. var ClassName = {
  6180. SHOW: 'show',
  6181. COLLAPSE: 'collapse',
  6182. COLLAPSING: 'collapsing',
  6183. COLLAPSED: 'collapsed'
  6184. };
  6185. var Dimension = {
  6186. WIDTH: 'width',
  6187. HEIGHT: 'height'
  6188. };
  6189. var Selector = {
  6190. ACTIVES: '.show, .collapsing',
  6191. DATA_TOGGLE: '[data-toggle="lu-collapse"]'
  6192. /**
  6193. * ------------------------------------------------------------------------
  6194. * Class Definition
  6195. * ------------------------------------------------------------------------
  6196. */
  6197. };
  6198. var Collapse = function () {
  6199. function Collapse(element, config) {
  6200. _classCallCheck(this, Collapse);
  6201. this._isTransitioning = false;
  6202. this._element = element;
  6203. this._config = this._getConfig(config);
  6204. this._triggerArray = _jquery2.default.makeArray((0, _jquery2.default)('[data-toggle="lu-collapse"][href="#' + element.id + '"],' + ('[data-toggle="lu-collapse"][data-target="#' + element.id + '"]')));
  6205. var tabToggles = (0, _jquery2.default)(Selector.DATA_TOGGLE);
  6206. for (var i = 0; i < tabToggles.length; i++) {
  6207. var elem = tabToggles[i];
  6208. var selector = _util2.default.getSelectorFromElement(elem);
  6209. if (selector !== null && (0, _jquery2.default)(selector).filter(element).length > 0) {
  6210. this._triggerArray.push(elem);
  6211. }
  6212. }
  6213. this._parent = this._config.parent ? this._getParent() : null;
  6214. if (!this._config.parent) {
  6215. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  6216. }
  6217. if (this._config.toggle) {
  6218. this.toggle();
  6219. }
  6220. }
  6221. // getters
  6222. _createClass(Collapse, [{
  6223. key: 'toggle',
  6224. // public
  6225. value: function toggle() {
  6226. if ((0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  6227. this.hide();
  6228. } else {
  6229. this.show();
  6230. }
  6231. }
  6232. }, {
  6233. key: 'show',
  6234. value: function show() {
  6235. var _this = this;
  6236. if (this._isTransitioning || (0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  6237. return;
  6238. }
  6239. var actives = void 0;
  6240. var activesData = void 0;
  6241. if (this._parent) {
  6242. actives = _jquery2.default.makeArray((0, _jquery2.default)(this._parent).children().children(Selector.ACTIVES));
  6243. if (!actives.length) {
  6244. actives = null;
  6245. }
  6246. }
  6247. if (actives) {
  6248. activesData = (0, _jquery2.default)(actives).data(DATA_KEY);
  6249. if (activesData && activesData._isTransitioning) {
  6250. return;
  6251. }
  6252. }
  6253. var startEvent = _jquery2.default.Event(Event.SHOW);
  6254. (0, _jquery2.default)(this._element).trigger(startEvent);
  6255. if (startEvent.isDefaultPrevented()) {
  6256. return;
  6257. }
  6258. if (actives) {
  6259. Collapse._jQueryInterface.call((0, _jquery2.default)(actives), 'hide');
  6260. if (!activesData) {
  6261. (0, _jquery2.default)(actives).data(DATA_KEY, null);
  6262. }
  6263. }
  6264. var dimension = this._getDimension();
  6265. (0, _jquery2.default)(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
  6266. this._element.style[dimension] = 0;
  6267. if (this._triggerArray.length) {
  6268. (0, _jquery2.default)(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
  6269. }
  6270. this.setTransitioning(true);
  6271. var complete = function complete() {
  6272. (0, _jquery2.default)(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
  6273. _this._element.style[dimension] = '';
  6274. _this.setTransitioning(false);
  6275. (0, _jquery2.default)(_this._element).trigger(Event.SHOWN);
  6276. };
  6277. if (!_util2.default.supportsTransitionEnd()) {
  6278. complete();
  6279. return;
  6280. }
  6281. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  6282. var scrollSize = 'scroll' + capitalizedDimension;
  6283. (0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  6284. this._element.style[dimension] = this._element[scrollSize] + 'px';
  6285. }
  6286. }, {
  6287. key: 'hide',
  6288. value: function hide() {
  6289. var _this2 = this;
  6290. if (this._isTransitioning || !(0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  6291. return;
  6292. }
  6293. var startEvent = _jquery2.default.Event(Event.HIDE);
  6294. (0, _jquery2.default)(this._element).trigger(startEvent);
  6295. if (startEvent.isDefaultPrevented()) {
  6296. return;
  6297. }
  6298. var dimension = this._getDimension();
  6299. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + 'px';
  6300. _util2.default.reflow(this._element);
  6301. (0, _jquery2.default)(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
  6302. if (this._triggerArray.length) {
  6303. for (var i = 0; i < this._triggerArray.length; i++) {
  6304. var trigger = this._triggerArray[i];
  6305. var selector = _util2.default.getSelectorFromElement(trigger);
  6306. if (selector !== null) {
  6307. var $elem = (0, _jquery2.default)(selector);
  6308. if (!$elem.hasClass(ClassName.SHOW)) {
  6309. (0, _jquery2.default)(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
  6310. }
  6311. }
  6312. }
  6313. }
  6314. this.setTransitioning(true);
  6315. var complete = function complete() {
  6316. _this2.setTransitioning(false);
  6317. (0, _jquery2.default)(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
  6318. };
  6319. this._element.style[dimension] = '';
  6320. if (!_util2.default.supportsTransitionEnd()) {
  6321. complete();
  6322. return;
  6323. }
  6324. (0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  6325. }
  6326. }, {
  6327. key: 'setTransitioning',
  6328. value: function setTransitioning(isTransitioning) {
  6329. this._isTransitioning = isTransitioning;
  6330. }
  6331. }, {
  6332. key: 'dispose',
  6333. value: function dispose() {
  6334. _jquery2.default.removeData(this._element, DATA_KEY);
  6335. this._config = null;
  6336. this._parent = null;
  6337. this._element = null;
  6338. this._triggerArray = null;
  6339. this._isTransitioning = null;
  6340. }
  6341. // private
  6342. }, {
  6343. key: '_getConfig',
  6344. value: function _getConfig(config) {
  6345. config = _jquery2.default.extend({}, Default, config);
  6346. config.toggle = Boolean(config.toggle); // coerce string values
  6347. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  6348. return config;
  6349. }
  6350. }, {
  6351. key: '_getDimension',
  6352. value: function _getDimension() {
  6353. var hasWidth = (0, _jquery2.default)(this._element).hasClass(Dimension.WIDTH);
  6354. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  6355. }
  6356. }, {
  6357. key: '_getParent',
  6358. value: function _getParent() {
  6359. var _this3 = this;
  6360. var parent = null;
  6361. if (_util2.default.isElement(this._config.parent)) {
  6362. parent = this._config.parent;
  6363. // it's a jQuery object
  6364. if (typeof this._config.parent.jquery !== 'undefined') {
  6365. parent = this._config.parent[0];
  6366. }
  6367. } else {
  6368. parent = (0, _jquery2.default)(this._config.parent)[0];
  6369. }
  6370. var selector = '[data-toggle="lu-collapse"][data-parent="' + this._config.parent + '"]';
  6371. (0, _jquery2.default)(parent).find(selector).each(function (i, element) {
  6372. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  6373. });
  6374. return parent;
  6375. }
  6376. }, {
  6377. key: '_addAriaAndCollapsedClass',
  6378. value: function _addAriaAndCollapsedClass(element, triggerArray) {
  6379. if (element) {
  6380. var isOpen = (0, _jquery2.default)(element).hasClass(ClassName.SHOW);
  6381. if (triggerArray.length) {
  6382. (0, _jquery2.default)(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  6383. }
  6384. }
  6385. }
  6386. // static
  6387. }], [{
  6388. key: '_getTargetFromElement',
  6389. value: function _getTargetFromElement(element) {
  6390. var selector = _util2.default.getSelectorFromElement(element);
  6391. return selector ? (0, _jquery2.default)(selector)[0] : null;
  6392. }
  6393. }, {
  6394. key: '_jQueryInterface',
  6395. value: function _jQueryInterface(config) {
  6396. return this.each(function () {
  6397. var $this = (0, _jquery2.default)(this);
  6398. var data = $this.data(DATA_KEY);
  6399. var _config = _jquery2.default.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  6400. if (!data && _config.toggle && /show|hide/.test(config)) {
  6401. _config.toggle = false;
  6402. }
  6403. if (!data) {
  6404. data = new Collapse(this, _config);
  6405. $this.data(DATA_KEY, data);
  6406. }
  6407. if (typeof config === 'string') {
  6408. if (typeof data[config] === 'undefined') {
  6409. throw new Error('No method named "' + config + '"');
  6410. }
  6411. data[config]();
  6412. }
  6413. });
  6414. }
  6415. }, {
  6416. key: 'VERSION',
  6417. get: function get() {
  6418. return VERSION;
  6419. }
  6420. }, {
  6421. key: 'Default',
  6422. get: function get() {
  6423. return Default;
  6424. }
  6425. }]);
  6426. return Collapse;
  6427. }();
  6428. /**
  6429. * ------------------------------------------------------------------------
  6430. * Data Api implementation
  6431. * ------------------------------------------------------------------------
  6432. */
  6433. (0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  6434. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  6435. if (event.currentTarget.tagName === 'A') {
  6436. event.preventDefault();
  6437. }
  6438. var $trigger = (0, _jquery2.default)(this);
  6439. var selector = _util2.default.getSelectorFromElement(this);
  6440. (0, _jquery2.default)(selector).each(function () {
  6441. var $target = (0, _jquery2.default)(this);
  6442. var data = $target.data(DATA_KEY);
  6443. var config = data ? 'toggle' : $trigger.data();
  6444. Collapse._jQueryInterface.call($target, config);
  6445. });
  6446. });
  6447. /**
  6448. * ------------------------------------------------------------------------
  6449. * jQuery
  6450. * ------------------------------------------------------------------------
  6451. */
  6452. _jquery2.default.fn[NAME] = Collapse._jQueryInterface;
  6453. _jquery2.default.fn[NAME].Constructor = Collapse;
  6454. _jquery2.default.fn[NAME].noConflict = function () {
  6455. _jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
  6456. return Collapse._jQueryInterface;
  6457. };
  6458. return Collapse;
  6459. }(_jquery2.default);
  6460. exports.default = Collapse;
  6461. /***/ }),
  6462. /* 7 */
  6463. /***/ (function (module, exports, __webpack_require__) {
  6464. "use strict";
  6465. Object.defineProperty(exports, "__esModule", {
  6466. value: true
  6467. });
  6468. var _createClass = function () {
  6469. function defineProperties(target, props) {
  6470. for (var i = 0; i < props.length; i++) {
  6471. var descriptor = props[i];
  6472. descriptor.enumerable = descriptor.enumerable || false;
  6473. descriptor.configurable = true;
  6474. if ("value" in descriptor)
  6475. descriptor.writable = true;
  6476. Object.defineProperty(target, descriptor.key, descriptor);
  6477. }
  6478. }
  6479. return function (Constructor, protoProps, staticProps) {
  6480. if (protoProps)
  6481. defineProperties(Constructor.prototype, protoProps);
  6482. if (staticProps)
  6483. defineProperties(Constructor, staticProps);
  6484. return Constructor;
  6485. };
  6486. }();
  6487. var _Swiper = __webpack_require__(4);
  6488. var _Swiper2 = _interopRequireDefault(_Swiper);
  6489. var _util = __webpack_require__(0);
  6490. var _util2 = _interopRequireDefault(_util);
  6491. function _interopRequireDefault(obj) {
  6492. return obj && obj.__esModule ? obj : {default: obj};
  6493. }
  6494. function _classCallCheck(instance, Constructor) {
  6495. if (!(instance instanceof Constructor)) {
  6496. throw new TypeError("Cannot call a class as a function");
  6497. }
  6498. }
  6499. var SELECTORS = {
  6500. container: '[data-content-slider]'
  6501. };
  6502. var Default = {
  6503. slideToClickedSlide: false,
  6504. navStorage: 'normal'
  6505. };
  6506. var contentSlider = function () {
  6507. function contentSlider(container, options) {
  6508. _classCallCheck(this, contentSlider);
  6509. this.container = container;
  6510. this.options = options;
  6511. this.isInit = false;
  6512. this.getConfig();
  6513. this.initPLugin();
  6514. this.bindEvents();
  6515. }
  6516. _createClass(contentSlider, [{
  6517. key: 'getConfig',
  6518. value: function getConfig() {
  6519. var dataConfig = this.container.data();
  6520. if (dataConfig.options) {
  6521. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6522. } else {
  6523. this.dataOptions = {};
  6524. }
  6525. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6526. }
  6527. }, {
  6528. key: 'bindEvents',
  6529. value: function bindEvents() {}
  6530. }, {
  6531. key: 'initPLugin',
  6532. value: function initPLugin() {
  6533. var that = this;
  6534. this.swiperInstance = new _Swiper2.default(this.container, {
  6535. scrollbarHide: true,
  6536. effect: false,
  6537. resistance: true,
  6538. resistanceRatio: 0,
  6539. slidesPerView: 'auto',
  6540. watchSlidesVisibility: true,
  6541. onInit: function onInit(swiper) {
  6542. that.onInit(swiper);
  6543. },
  6544. onTap: function onTap(swiper, event) {
  6545. that.changeActiveSlide(swiper);
  6546. if (that.config.slideToClickedSlide) {
  6547. that.slideToClickedSlide(swiper, event);
  6548. }
  6549. that.onClick();
  6550. }
  6551. });
  6552. }
  6553. }, {
  6554. key: 'changeActiveSlide',
  6555. value: function changeActiveSlide(swiper) {
  6556. if (!this.isInit) {
  6557. return;
  6558. }
  6559. var slides = swiper.slides;
  6560. switch (this.config.navStorage) {
  6561. case 'normal':
  6562. break;
  6563. case 'hash':
  6564. break;
  6565. case 'localStorage':
  6566. $(slides).removeClass('is-active');
  6567. window.localStorage.setItem('content-slider-' + this.config.localStorageId, swiper.clickedIndex);
  6568. break;
  6569. }
  6570. }
  6571. }, {
  6572. key: 'slideToClickedSlide',
  6573. value: function slideToClickedSlide(swiper, event) {
  6574. var clickedIndex = swiper.clickedIndex,
  6575. slides = swiper.slides;
  6576. swiper.updateActiveIndex();
  6577. if (!$(slides[clickedIndex - 1]).hasClass('swiper-slide-visible')) {
  6578. swiper.slideTo(swiper.activeIndex - 1);
  6579. }
  6580. if (!$(slides[clickedIndex + 1]).hasClass('swiper-slide-visible')) {
  6581. swiper.slideTo(swiper.activeIndex + 1);
  6582. }
  6583. }
  6584. }, {
  6585. key: 'onInit',
  6586. value: function onInit(swiper) {
  6587. switch (this.config.navStorage) {
  6588. case 'normal':
  6589. var activeSlideIndex = 0,
  6590. slides = swiper.slides;
  6591. $(slides).each(function (index) {
  6592. if ($(this).hasClass('is-active')) {
  6593. activeSlideIndex = index;
  6594. }
  6595. });
  6596. swiper.slideTo(activeSlideIndex, 0);
  6597. break;
  6598. case 'hash':
  6599. if (window.location.hash) {
  6600. var slide = $(swiper.container).find('[href="' + window.location.hash + '"]'),
  6601. slideIndex = slide.closest('.swiper-slide').index();
  6602. slide.trigger('click');
  6603. swiper.slideTo(slideIndex, 0);
  6604. }
  6605. break;
  6606. case 'localStorage':
  6607. var index = window.localStorage.getItem('content-slider-' + this.config.localStorageId);
  6608. if (index) {
  6609. swiper.slideTo(index, 0);
  6610. } else {
  6611. swiper.slideTo(0, 0);
  6612. }
  6613. $(swiper.slides[index]).find('a').trigger('click');
  6614. break;
  6615. }
  6616. this.showSlider(swiper);
  6617. this.isInit = true;
  6618. }
  6619. }, {
  6620. key: 'showSlider',
  6621. value: function showSlider(swiper) {
  6622. swiper.container.css({
  6623. visibility: 'visible'
  6624. });
  6625. }
  6626. }, {
  6627. key: 'onClick',
  6628. value: function onClick() {}
  6629. }, {
  6630. key: 'onSlideChangeStart',
  6631. value: function onSlideChangeStart() {}
  6632. }, {
  6633. key: 'onSlideChangeEnd',
  6634. value: function onSlideChangeEnd() {}
  6635. }]);
  6636. return contentSlider;
  6637. }();
  6638. function initDataSelectors() {
  6639. $(SELECTORS.container).each(function () {
  6640. new contentSlider($(this));
  6641. });
  6642. }
  6643. function initJqueryPlugin() {
  6644. $.fn.luContentSlider = function (options) {
  6645. return this.each(function () {
  6646. new contentSlider($(this), options);
  6647. });
  6648. };
  6649. }
  6650. var init = {
  6651. initDataSelectors: initDataSelectors,
  6652. initJqueryPlugin: initJqueryPlugin
  6653. };
  6654. exports.default = init;
  6655. /***/ }),
  6656. /* 8 */
  6657. /***/ (function (module, exports, __webpack_require__) {
  6658. "use strict";
  6659. Object.defineProperty(exports, "__esModule", {
  6660. value: true
  6661. });
  6662. var _createClass = function () {
  6663. function defineProperties(target, props) {
  6664. for (var i = 0; i < props.length; i++) {
  6665. var descriptor = props[i];
  6666. descriptor.enumerable = descriptor.enumerable || false;
  6667. descriptor.configurable = true;
  6668. if ("value" in descriptor)
  6669. descriptor.writable = true;
  6670. Object.defineProperty(target, descriptor.key, descriptor);
  6671. }
  6672. }
  6673. return function (Constructor, protoProps, staticProps) {
  6674. if (protoProps)
  6675. defineProperties(Constructor.prototype, protoProps);
  6676. if (staticProps)
  6677. defineProperties(Constructor, staticProps);
  6678. return Constructor;
  6679. };
  6680. }();
  6681. var _drop = __webpack_require__(5);
  6682. var _drop2 = _interopRequireDefault(_drop);
  6683. var _selectInput = __webpack_require__(3);
  6684. var _selectInput2 = _interopRequireDefault(_selectInput);
  6685. var _util = __webpack_require__(0);
  6686. var _util2 = _interopRequireDefault(_util);
  6687. function _interopRequireDefault(obj) {
  6688. return obj && obj.__esModule ? obj : {default: obj};
  6689. }
  6690. function _classCallCheck(instance, Constructor) {
  6691. if (!(instance instanceof Constructor)) {
  6692. throw new TypeError("Cannot call a class as a function");
  6693. }
  6694. }
  6695. var SELECTORS = {
  6696. dropdownToggle: '[data-toggle="lu-dropdown"], [data-dropdown]',
  6697. dropdownParent: '.has-dropdown',
  6698. dropdownMenu: '[data-dropdown-menu]',
  6699. dropdownArrowTarget: '[data-arrow-target]',
  6700. dropdownPlacement: '[data-placement]',
  6701. dropdownOpen: '[data-open]',
  6702. dropdownClasses: '[data-class]',
  6703. width: '[data-width]'
  6704. };
  6705. var Default = {
  6706. open: 'click',
  6707. placement: 'bottom left',
  6708. width: null,
  6709. class: ''
  6710. };
  6711. var dropdown = function () {
  6712. function dropdown(_dropdown, options) {
  6713. _classCallCheck(this, dropdown);
  6714. this.dropdown = $(_dropdown);
  6715. this.options = options;
  6716. this.dropdownParent = this.dropdown.closest(SELECTORS.dropdownParent);
  6717. this.dropdownArrowTarget = $(this.dropdownParent).find(SELECTORS.dropdownArrowTarget);
  6718. this.dropdownToggle = $(this.dropdownParent).find(SELECTORS.dropdownToggle);
  6719. this.dropdownMenu = $(this.dropdownParent).find(SELECTORS.dropdownMenu);
  6720. this.getConfig();
  6721. this.initPlugin();
  6722. this.bindEvents();
  6723. if (this.dropdown.find('[data-input-content-target]').length) {
  6724. this.initSelect();
  6725. }
  6726. }
  6727. _createClass(dropdown, [{
  6728. key: 'bindEvents',
  6729. value: function bindEvents() {
  6730. this.dropdown.on('closeDropdown', this.close.bind(this));
  6731. this.dropdown.on('openDropdown', this.open.bind(this));
  6732. }
  6733. }, {
  6734. key: 'getConfig',
  6735. value: function getConfig() {
  6736. var dataConfig = this.dropdown.data();
  6737. if (dataConfig.options) {
  6738. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6739. } else {
  6740. this.dataOptions = {};
  6741. }
  6742. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6743. this.setDropdownWidth();
  6744. if (!this.dropdownArrowTarget.length) {
  6745. this.dropdownArrowTarget = this.dropdown;
  6746. }
  6747. }
  6748. }, {
  6749. key: 'initPlugin',
  6750. value: function initPlugin() {
  6751. this.drop = new _drop2.default({
  6752. target: this.dropdown[0],
  6753. content: this.dropdownMenu[0],
  6754. position: this.config.placement,
  6755. classes: this.config.class,
  6756. openOn: this.config.open
  6757. });
  6758. if (this.config.onInit) {
  6759. this.config.onInit(this.drop);
  6760. }
  6761. this.drop.on('open', this.onOpen.bind(this));
  6762. this.drop.on('close', this.onClose.bind(this));
  6763. }
  6764. }, {
  6765. key: 'getArrowTargetPoition',
  6766. value: function getArrowTargetPoition() {
  6767. var dropdownOffset = this.dropdown.offset();
  6768. var arrowTargetOffset = this.dropdownArrowTarget.offset();
  6769. var arrowTargetWidth = this.dropdownArrowTarget.outerWidth();
  6770. if (/left/i.test(this.config.placement)) {
  6771. this.arrowTargetPosition = arrowTargetOffset.left - dropdownOffset.left + arrowTargetWidth / 2;
  6772. } else if (/right/i.test(this.config.placement)) {
  6773. this.arrowTargetPosition = this.dropdown.outerWidth() - (arrowTargetOffset.left - dropdownOffset.left) - arrowTargetWidth / 2;
  6774. }
  6775. }
  6776. }, {
  6777. key: 'setArrowPostion',
  6778. value: function setArrowPostion() {
  6779. var arrow = $(this.drop.drop).find('[data-arrow]');
  6780. if (!arrow) {
  6781. return;
  6782. }
  6783. this.getArrowTargetPoition();
  6784. var arrowBorderWidth = arrow.outerWidth() / 2;
  6785. if (/center/i.test(this.config.placement)) {
  6786. arrow.css({
  6787. left: '0',
  6788. right: '0',
  6789. margin: 'auto'
  6790. });
  6791. } else if (/left/i.test(this.config.placement)) {
  6792. arrow.css({
  6793. left: this.arrowTargetPosition - arrowBorderWidth
  6794. });
  6795. } else if (/right/i.test(this.config.placement)) {
  6796. arrow.css({
  6797. left: 'auto',
  6798. right: this.arrowTargetPosition - arrowBorderWidth
  6799. });
  6800. }
  6801. }
  6802. }, {
  6803. key: 'setDropdownWidth',
  6804. value: function setDropdownWidth() {
  6805. if (!this.config.width) {
  6806. return;
  6807. }
  6808. $(this.dropdownMenu).css({opacity: 0, position: 'absolute', left: - 10000});
  6809. var width = parseInt(this.config.width);
  6810. var parentWidth = this.dropdownParent.outerWidth();
  6811. $(this.dropdownMenu).css({
  6812. width: width * parentWidth / 100,
  6813. 'min-width': width * parentWidth / 100
  6814. });
  6815. $(this.dropdownMenu).css({opacity: '', position: '', left: ''});
  6816. }
  6817. }, {
  6818. key: 'onOpen',
  6819. value: function onOpen() {
  6820. this.setArrowPostion();
  6821. this.setDropdownWidth();
  6822. if (typeof this.config.onOpen === 'function') {
  6823. this.config.onOpen(this.drop);
  6824. }
  6825. }
  6826. }, {
  6827. key: 'onClose',
  6828. value: function onClose() {
  6829. if (typeof this.config.onClose === 'function') {
  6830. this.config.onClose(this.drop);
  6831. }
  6832. }
  6833. }, {
  6834. key: 'open',
  6835. value: function open() {
  6836. this.drop.open();
  6837. }
  6838. }, {
  6839. key: 'close',
  6840. value: function close() {
  6841. this.drop.close();
  6842. }
  6843. }, {
  6844. key: 'initSelect',
  6845. value: function initSelect() {
  6846. _selectInput2.default.init($(this.drop.drop), this.drop);
  6847. }
  6848. }]);
  6849. return dropdown;
  6850. }();
  6851. function initDataSelectors() {
  6852. $(SELECTORS.dropdownToggle).each(function () {
  6853. new dropdown($(this));
  6854. });
  6855. }
  6856. function initJqueryPlugin() {
  6857. $.fn.luDropdown = function (options) {
  6858. return this.each(function () {
  6859. new dropdown($(this), options);
  6860. });
  6861. };
  6862. }
  6863. function closeAllDropdowns() {
  6864. for (var i = 0; i < _drop2.default.drops.length; i++) {
  6865. _drop2.default.drops[i].close();
  6866. }
  6867. }
  6868. var init = {
  6869. initDataSelectors: initDataSelectors,
  6870. initJqueryPlugin: initJqueryPlugin,
  6871. closeAllDropdowns: closeAllDropdowns
  6872. };
  6873. exports.default = init;
  6874. /***/ }),
  6875. /* 9 */
  6876. /***/ (function (module, exports, __webpack_require__) {
  6877. "use strict";
  6878. Object.defineProperty(exports, "__esModule", {
  6879. value: true
  6880. });
  6881. var _createClass = function () {
  6882. function defineProperties(target, props) {
  6883. for (var i = 0; i < props.length; i++) {
  6884. var descriptor = props[i];
  6885. descriptor.enumerable = descriptor.enumerable || false;
  6886. descriptor.configurable = true;
  6887. if ("value" in descriptor)
  6888. descriptor.writable = true;
  6889. Object.defineProperty(target, descriptor.key, descriptor);
  6890. }
  6891. }
  6892. return function (Constructor, protoProps, staticProps) {
  6893. if (protoProps)
  6894. defineProperties(Constructor.prototype, protoProps);
  6895. if (staticProps)
  6896. defineProperties(Constructor, staticProps);
  6897. return Constructor;
  6898. };
  6899. }();
  6900. var _drop = __webpack_require__(5);
  6901. var _drop2 = _interopRequireDefault(_drop);
  6902. var _util = __webpack_require__(0);
  6903. var _util2 = _interopRequireDefault(_util);
  6904. function _interopRequireDefault(obj) {
  6905. return obj && obj.__esModule ? obj : {default: obj};
  6906. }
  6907. function _classCallCheck(instance, Constructor) {
  6908. if (!(instance instanceof Constructor)) {
  6909. throw new TypeError("Cannot call a class as a function");
  6910. }
  6911. }
  6912. var SELECTORS = {
  6913. toggle: '[data-toggle="lu-tooltip"], [data-toggle="tooltip"], [data-tooltip]'
  6914. };
  6915. var Default = {
  6916. open: 'hover',
  6917. placement: 'top center',
  6918. class: 'lu-tooltip'
  6919. };
  6920. var tooltip = function () {
  6921. function tooltip(_tooltip, options) {
  6922. _classCallCheck(this, tooltip);
  6923. this.tooltip = $(_tooltip);
  6924. this.options = options;
  6925. this.getConfig();
  6926. this.getContent();
  6927. this.initPlugin();
  6928. }
  6929. _createClass(tooltip, [{
  6930. key: 'getConfig',
  6931. value: function getConfig() {
  6932. var dataConfig = this.tooltip.data();
  6933. if (dataConfig.options) {
  6934. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6935. } else {
  6936. this.dataOptions = {};
  6937. }
  6938. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6939. }
  6940. }, {
  6941. key: 'getContent',
  6942. value: function getContent() {
  6943. if ($(this.tooltip).attr('data-title')) {
  6944. this.tooltipContent = $(this.tooltip).attr('data-title');
  6945. } else {
  6946. $(this.tooltip).attr('data-title', $(this.tooltip).attr('title'));
  6947. $(this.tooltip).removeAttr('title');
  6948. this.tooltipContent = $(this.tooltip).attr('data-title');
  6949. }
  6950. }
  6951. }, {
  6952. key: 'initPlugin',
  6953. value: function initPlugin() {
  6954. this.drop = new _drop2.default({
  6955. target: this.tooltip[0],
  6956. content: this.tooltipContent,
  6957. position: this.config.placement,
  6958. classes: this.config.class,
  6959. openOn: this.config.open
  6960. });
  6961. this.drop.on('open', this.onOpen.bind(this));
  6962. }
  6963. }, {
  6964. key: 'getArrowTargetPoition',
  6965. value: function getArrowTargetPoition() {
  6966. var tooltipwitdh = this.tooltip.outerWidth();
  6967. if (/left/i.test(this.config.placement)) {
  6968. this.arrowTargetPosition = tooltipwitdh / 2;
  6969. } else if (/right/i.test(this.config.placement)) {
  6970. this.arrowTargetPosition = tooltipwitdh / 2;
  6971. }
  6972. }
  6973. }, {
  6974. key: 'setArrowPostion',
  6975. value: function setArrowPostion() {
  6976. $(this.drop.drop).find('.tooltip__arrow').remove();
  6977. $(this.drop.drop).append('<div class="lu-tooltip__arrow" data-arrow></div>');
  6978. var arrow = $(this.drop.drop).find('[data-arrow]');
  6979. if (!arrow) {
  6980. return;
  6981. }
  6982. this.getArrowTargetPoition();
  6983. var arrowBorderWidth = arrow.outerWidth() / 2;
  6984. if (/center/i.test(this.config.placement)) {
  6985. arrow.css({
  6986. left: '0',
  6987. right: '0',
  6988. margin: 'auto'
  6989. });
  6990. } else if (/left/i.test(this.config.placement)) {
  6991. arrow.css({
  6992. left: this.arrowTargetPosition,
  6993. marginLeft: - arrowBorderWidth
  6994. });
  6995. } else if (/right/i.test(this.config.placement)) {
  6996. arrow.css({
  6997. left: 'auto',
  6998. right: this.arrowTargetPosition,
  6999. marginRight: - arrowBorderWidth
  7000. });
  7001. }
  7002. }
  7003. }, {
  7004. key: 'onOpen',
  7005. value: function onOpen() {
  7006. this.setArrowPostion();
  7007. }
  7008. }]);
  7009. return tooltip;
  7010. }();
  7011. function initDataSelectors() {
  7012. $(SELECTORS.toggle).each(function () {
  7013. new tooltip($(this));
  7014. });
  7015. }
  7016. function initJqueryPlugin() {
  7017. $.fn.luTooltip = function (options) {
  7018. return this.each(function () {
  7019. new tooltip($(this), options);
  7020. });
  7021. };
  7022. }
  7023. var init = {
  7024. initDataSelectors: initDataSelectors,
  7025. initJqueryPlugin: initJqueryPlugin
  7026. };
  7027. exports.default = init;
  7028. /***/ }),
  7029. /* 10 */
  7030. /***/ (function (module, exports, __webpack_require__) {
  7031. "use strict";
  7032. Object.defineProperty(exports, "__esModule", {
  7033. value: true
  7034. });
  7035. var _createClass = function () {
  7036. function defineProperties(target, props) {
  7037. for (var i = 0; i < props.length; i++) {
  7038. var descriptor = props[i];
  7039. descriptor.enumerable = descriptor.enumerable || false;
  7040. descriptor.configurable = true;
  7041. if ("value" in descriptor)
  7042. descriptor.writable = true;
  7043. Object.defineProperty(target, descriptor.key, descriptor);
  7044. }
  7045. }
  7046. return function (Constructor, protoProps, staticProps) {
  7047. if (protoProps)
  7048. defineProperties(Constructor.prototype, protoProps);
  7049. if (staticProps)
  7050. defineProperties(Constructor, staticProps);
  7051. return Constructor;
  7052. };
  7053. }();
  7054. var _util = __webpack_require__(0);
  7055. var _util2 = _interopRequireDefault(_util);
  7056. function _interopRequireDefault(obj) {
  7057. return obj && obj.__esModule ? obj : {default: obj};
  7058. }
  7059. function _classCallCheck(instance, Constructor) {
  7060. if (!(instance instanceof Constructor)) {
  7061. throw new TypeError("Cannot call a class as a function");
  7062. }
  7063. }
  7064. var SELECTORS = {
  7065. container: '[data-check-container]',
  7066. checkAll: '[data-check-all]',
  7067. childs: 'input:checkbox.table-mass-action-check:enabled',
  7068. counterView: '[data-checkbox-counter]'
  7069. };
  7070. var Default = {};
  7071. var CheckAll = function () {
  7072. function CheckAll(container, options) {
  7073. _classCallCheck(this, CheckAll);
  7074. this.container = container;
  7075. this.checkAllBtn = this.container.find(SELECTORS.checkAll);
  7076. this.childs = this.container.find(SELECTORS.childs).not(SELECTORS.checkAll);
  7077. this.counterView = this.container.find(SELECTORS.counterView);
  7078. this.checkCounter = 0;
  7079. this.options = options;
  7080. this.getConfig();
  7081. this.initCounter();
  7082. this.bindEvents();
  7083. }
  7084. _createClass(CheckAll, [{
  7085. key: 'bindEvents',
  7086. value: function bindEvents() {
  7087. this.checkAllBtn.on('change', this.checkAll.bind(this));
  7088. this.childs.on('change', this.updateCounter.bind(this));
  7089. }
  7090. }, {
  7091. key: 'getConfig',
  7092. value: function getConfig() {
  7093. var dataConfig = this.container.data();
  7094. if (dataConfig.options) {
  7095. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  7096. } else {
  7097. this.dataOptions = {};
  7098. }
  7099. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7100. }
  7101. }, {
  7102. key: 'checkAll',
  7103. value: function checkAll(event) {
  7104. this.childs.prop('checked', event.target.checked);
  7105. if (event.target.checked) {
  7106. this.checkCounter = this.childs.length;
  7107. } else {
  7108. this.checkCounter = 0;
  7109. }
  7110. this.updateCounterView();
  7111. }
  7112. }, {
  7113. key: 'toggleCheckAllBtn',
  7114. value: function toggleCheckAllBtn() {
  7115. if (this.childs.length == this.checkCounter) {
  7116. this.checkAllBtn.prop('checked', true);
  7117. } else {
  7118. this.checkAllBtn.prop('checked', false);
  7119. }
  7120. if (typeof this.config.onCheckAll === 'function') {
  7121. this.config.onCheckAll(this.container, this.checkCounter);
  7122. }
  7123. }
  7124. }, {
  7125. key: 'initCounter',
  7126. value: function initCounter() {
  7127. if (this.checkAllBtn.is(':checked')) {
  7128. this.checkCounter = this.childs.length;
  7129. this.childs.prop('checked', true);
  7130. } else {
  7131. this.checkCounter = this.childs.filter(':checked').length;
  7132. }
  7133. }
  7134. }, {
  7135. key: 'updateCounter',
  7136. value: function updateCounter(event) {
  7137. if (event.target.checked) {
  7138. this.checkCounter++;
  7139. this.toggleCheckAllBtn();
  7140. } else {
  7141. this.checkCounter--;
  7142. this.toggleCheckAllBtn();
  7143. }
  7144. this.updateCounterView();
  7145. }
  7146. }, {
  7147. key: 'updateCounterView',
  7148. value: function updateCounterView() {
  7149. if (typeof this.config.onCheck === 'function') {
  7150. this.config.onCheck(this.container, this.checkCounter);
  7151. }
  7152. this.counterView.text(this.checkCounter);
  7153. }
  7154. }]);
  7155. return CheckAll;
  7156. }();
  7157. function initDataSelectors() {
  7158. $(SELECTORS.container).each(function () {
  7159. new CheckAll($(this));
  7160. });
  7161. }
  7162. function initJqueryPlugin() {
  7163. $.fn.luCheckAll = function (options) {
  7164. return this.each(function () {
  7165. new CheckAll($(this), options);
  7166. });
  7167. };
  7168. }
  7169. var init = {
  7170. initDataSelectors: initDataSelectors,
  7171. initJqueryPlugin: initJqueryPlugin
  7172. };
  7173. exports.default = init;
  7174. /***/ }),
  7175. /* 11 */
  7176. /***/ (function (module, exports, __webpack_require__) {
  7177. "use strict";
  7178. var forms = [].slice.call(document.querySelectorAll('.lu-form-control'));
  7179. forms.forEach(function (item) {
  7180. var $item = $(item);
  7181. item.addEventListener('focus', function () {
  7182. $item.closest('.lu-input-group').addClass('is-focus');
  7183. });
  7184. item.addEventListener('blur', function () {
  7185. $item.closest('.lu-input-group').removeClass('is-focus');
  7186. });
  7187. });
  7188. /***/ }),
  7189. /* 12 */
  7190. /***/ (function (module, exports, __webpack_require__) {
  7191. "use strict";
  7192. Object.defineProperty(exports, "__esModule", {
  7193. value: true
  7194. });
  7195. var _createClass = function () {
  7196. function defineProperties(target, props) {
  7197. for (var i = 0; i < props.length; i++) {
  7198. var descriptor = props[i];
  7199. descriptor.enumerable = descriptor.enumerable || false;
  7200. descriptor.configurable = true;
  7201. if ("value" in descriptor)
  7202. descriptor.writable = true;
  7203. Object.defineProperty(target, descriptor.key, descriptor);
  7204. }
  7205. }
  7206. return function (Constructor, protoProps, staticProps) {
  7207. if (protoProps)
  7208. defineProperties(Constructor.prototype, protoProps);
  7209. if (staticProps)
  7210. defineProperties(Constructor, staticProps);
  7211. return Constructor;
  7212. };
  7213. }();
  7214. __webpack_require__(32);
  7215. function _classCallCheck(instance, Constructor) {
  7216. if (!(instance instanceof Constructor)) {
  7217. throw new TypeError("Cannot call a class as a function");
  7218. }
  7219. }
  7220. var SELECTORS = {
  7221. container: '[data-range-slider]',
  7222. input: 'input',
  7223. slider: '[data-slider]'
  7224. };
  7225. var rangeSlider = function () {
  7226. function rangeSlider(container) {
  7227. _classCallCheck(this, rangeSlider);
  7228. this.container = container;
  7229. this.input = this.container.find(SELECTORS.input);
  7230. this.slider = this.container.find(SELECTORS.slider);
  7231. this.config = this.container.data();
  7232. this.value = this.input.val();
  7233. this.bindEvents();
  7234. this.initSlider();
  7235. }
  7236. _createClass(rangeSlider, [{
  7237. key: 'bindEvents',
  7238. value: function bindEvents() {
  7239. this.input.on('change', this.updateSlider.bind(this));
  7240. }
  7241. }, {
  7242. key: 'initSlider',
  7243. value: function initSlider() {
  7244. var that = this;
  7245. this.sliderInstance = $(this.slider).slider({
  7246. range: "min",
  7247. value: this.value,
  7248. min: this.config.min,
  7249. max: this.config.max,
  7250. step: this.config.step,
  7251. slide: function slide(event, ui) {
  7252. that.updateInput(ui.value);
  7253. }
  7254. });
  7255. }
  7256. }, {
  7257. key: 'updateInput',
  7258. value: function updateInput(value) {
  7259. this.input.val(value);
  7260. }
  7261. }, {
  7262. key: 'updateSlider',
  7263. value: function updateSlider(evnet) {
  7264. this.sliderInstance.slider("value", event.target.value);
  7265. }
  7266. }], [{
  7267. key: 'init',
  7268. value: function init(container) {
  7269. if (container) {
  7270. new rangeSlider($(container).find(SELECTORS.container));
  7271. } else {
  7272. $(SELECTORS.container).each(function () {
  7273. new rangeSlider($(this));
  7274. });
  7275. }
  7276. }
  7277. }, {
  7278. key: 'reload',
  7279. value: function reload(container) {}
  7280. }]);
  7281. return rangeSlider;
  7282. }();
  7283. function initDataSelectors() {
  7284. $(SELECTORS.select).each(function () {
  7285. new Select($(this));
  7286. });
  7287. }
  7288. function initJqueryPlugin() {
  7289. $.fn.luSelect = function (options) {
  7290. return this.each(function () {
  7291. new Select($(this), options);
  7292. });
  7293. };
  7294. }
  7295. var init = {
  7296. initDataSelectors: initDataSelectors,
  7297. initJqueryPlugin: initJqueryPlugin
  7298. };
  7299. exports.default = rangeSlider;
  7300. /***/ }),
  7301. /* 13 */
  7302. /***/ (function (module, exports, __webpack_require__) {
  7303. "use strict";
  7304. Object.defineProperty(exports, "__esModule", {
  7305. value: true
  7306. });
  7307. var _createClass = function () {
  7308. function defineProperties(target, props) {
  7309. for (var i = 0; i < props.length; i++) {
  7310. var descriptor = props[i];
  7311. descriptor.enumerable = descriptor.enumerable || false;
  7312. descriptor.configurable = true;
  7313. if ("value" in descriptor)
  7314. descriptor.writable = true;
  7315. Object.defineProperty(target, descriptor.key, descriptor);
  7316. }
  7317. }
  7318. return function (Constructor, protoProps, staticProps) {
  7319. if (protoProps)
  7320. defineProperties(Constructor.prototype, protoProps);
  7321. if (staticProps)
  7322. defineProperties(Constructor, staticProps);
  7323. return Constructor;
  7324. };
  7325. }();
  7326. var _Selectize = __webpack_require__(29);
  7327. var _Selectize2 = _interopRequireDefault(_Selectize);
  7328. var _util = __webpack_require__(0);
  7329. var _util2 = _interopRequireDefault(_util);
  7330. function _interopRequireDefault(obj) {
  7331. return obj && obj.__esModule ? obj : {default: obj};
  7332. }
  7333. function _classCallCheck(instance, Constructor) {
  7334. if (!(instance instanceof Constructor)) {
  7335. throw new TypeError("Cannot call a class as a function");
  7336. }
  7337. }
  7338. var SELECTORS = {
  7339. select: 'select',
  7340. rawSelect: '.lu-form-control--basic'
  7341. };
  7342. var Default = {
  7343. maxItems: 1,
  7344. removeButton: false,
  7345. resotreOnBackspace: false,
  7346. dragAndDrop: false
  7347. };
  7348. var Select = function () {
  7349. function Select(element, options) {
  7350. _classCallCheck(this, Select);
  7351. this.element = element;
  7352. this.options = options;
  7353. this.getConfig();
  7354. this.directionDetector();
  7355. this.additionalPlugins();
  7356. this.initPlugin();
  7357. }
  7358. _createClass(Select, [{
  7359. key: 'initPlugin',
  7360. value: function initPlugin() {
  7361. var plugins = this.additionalPlugins();
  7362. this.element.selectize({
  7363. placeholder: '',
  7364. maxItems: this.config.maxItems,
  7365. createOnBlur: true,
  7366. plugins: plugins,
  7367. copyClassesToDropdown: false
  7368. });
  7369. }
  7370. }, {
  7371. key: 'getConfig',
  7372. value: function getConfig() {
  7373. var dataConfig = this.element.data();
  7374. if (dataConfig.options) {
  7375. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  7376. } else {
  7377. this.dataOptions = {};
  7378. }
  7379. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7380. }
  7381. }, {
  7382. key: 'directionDetector',
  7383. value: function directionDetector() {
  7384. _Selectize2.default.define('directionDetector', function (options) {
  7385. var self = this;
  7386. this.positionDropdown = function () {
  7387. var original = self.positionDropdown;
  7388. return function () {
  7389. this.offset = this.settings.dropdownParent === 'body' ? this.$control.offset() : this.$control.position();
  7390. this.offset.top += this.$control.outerHeight(true);
  7391. var controlHeight = this.$control.innerHeight();
  7392. var controlPositon = $(this.$control).offset().top - $(window).scrollTop();
  7393. var dropdownOffset = controlHeight + controlPositon + this.$dropdown.outerHeight(true);
  7394. if ($(window).innerHeight() - dropdownOffset < 0) {
  7395. this.$dropdown.css({
  7396. 'top': 'auto',
  7397. 'bottom': 8 + controlHeight,
  7398. 'left': this.offset.left,
  7399. 'width': this.$control[0].getBoundingClientRect().width
  7400. });
  7401. } else {
  7402. this.$dropdown.css({
  7403. 'width': this.$control[0].getBoundingClientRect().width,
  7404. 'top': this.offset.top,
  7405. 'left': this.offset.left,
  7406. 'bottom': 'auto'
  7407. });
  7408. }
  7409. };
  7410. }();
  7411. });
  7412. }
  7413. }, {
  7414. key: 'additionalPlugins',
  7415. value: function additionalPlugins() {
  7416. var plugins = ['directionDetector'];
  7417. if (this.config.removeButton) {
  7418. plugins.push('remove_button');
  7419. }
  7420. if (this.config.resotreOnBackspace) {
  7421. plugins.push('restore_on_backspace');
  7422. }
  7423. if (this.config.drag_drop) {
  7424. plugins.push('drag_drop');
  7425. }
  7426. return plugins;
  7427. }
  7428. }]);
  7429. return Select;
  7430. }();
  7431. function initDataSelectors() {
  7432. $(SELECTORS.select).not(SELECTORS.rawSelect).each(function () {
  7433. new Select($(this));
  7434. });
  7435. }
  7436. function initJqueryPlugin() {
  7437. $.fn.luSelect = function (options) {
  7438. return this.each(function () {
  7439. new Select($(this), options);
  7440. });
  7441. };
  7442. }
  7443. var init = {
  7444. initDataSelectors: initDataSelectors,
  7445. initJqueryPlugin: initJqueryPlugin
  7446. };
  7447. exports.default = init;
  7448. /***/ }),
  7449. /* 14 */
  7450. /***/ (function (module, exports, __webpack_require__) {
  7451. "use strict";
  7452. Object.defineProperty(exports, "__esModule", {
  7453. value: true
  7454. });
  7455. var _createClass = function () {
  7456. function defineProperties(target, props) {
  7457. for (var i = 0; i < props.length; i++) {
  7458. var descriptor = props[i];
  7459. descriptor.enumerable = descriptor.enumerable || false;
  7460. descriptor.configurable = true;
  7461. if ("value" in descriptor)
  7462. descriptor.writable = true;
  7463. Object.defineProperty(target, descriptor.key, descriptor);
  7464. }
  7465. }
  7466. return function (Constructor, protoProps, staticProps) {
  7467. if (protoProps)
  7468. defineProperties(Constructor.prototype, protoProps);
  7469. if (staticProps)
  7470. defineProperties(Constructor, staticProps);
  7471. return Constructor;
  7472. };
  7473. }();
  7474. var _autosize = __webpack_require__(30);
  7475. var _autosize2 = _interopRequireDefault(_autosize);
  7476. function _interopRequireDefault(obj) {
  7477. return obj && obj.__esModule ? obj : {default: obj};
  7478. }
  7479. function _classCallCheck(instance, Constructor) {
  7480. if (!(instance instanceof Constructor)) {
  7481. throw new TypeError("Cannot call a class as a function");
  7482. }
  7483. }
  7484. var SELECTORS = {
  7485. container: '[data-editable-cell]',
  7486. input: '[data-editable-input]',
  7487. content: '[data-editable-contnet]',
  7488. init: '[data-init-edit]',
  7489. abort: '[data-abort-edit]',
  7490. accept: '[data-accept-edit]'
  7491. };
  7492. var Default = {};
  7493. var editableCell = function () {
  7494. function editableCell(container, options) {
  7495. _classCallCheck(this, editableCell);
  7496. this.container = container;
  7497. this.options = options;
  7498. this.input = this.container.find(SELECTORS.input);
  7499. this.content = this.container.find(SELECTORS.content);
  7500. this.init = this.container.find(SELECTORS.init);
  7501. this.abort = this.container.find(SELECTORS.abort);
  7502. this.accept = this.container.find(SELECTORS.accept);
  7503. this.oldInputValue = this.input.val().trim();
  7504. this.getConfig();
  7505. this.initEvents();
  7506. this.trimInputContent();
  7507. this.textareaAutosize();
  7508. this.blockNewLine();
  7509. }
  7510. _createClass(editableCell, [{
  7511. key: 'getConfig',
  7512. value: function getConfig() {
  7513. var dataConfig = this.container.data();
  7514. if (dataConfig.options) {
  7515. this.dataOptions = util.parseDataOptions(dataConfig.options);
  7516. } else {
  7517. this.dataOptions = {};
  7518. }
  7519. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7520. }
  7521. }, {
  7522. key: 'bindEvents',
  7523. value: function bindEvents() {
  7524. $(this.init).on('click', this.initEdit.bind(this));
  7525. $(this.abort).on('click', this.abortEdit.bind(this));
  7526. $(this.accept).on('click', this.acceptEdit.bind(this));
  7527. }
  7528. }, {
  7529. key: 'initEdit',
  7530. value: function initEdit(event) {
  7531. this.content.addClass('hidden');
  7532. this.init.addClass('hidden');
  7533. this.accept.removeClass('hidden');
  7534. this.abort.removeClass('hidden');
  7535. this.input.removeClass('hidden');
  7536. this.textareaAutosizeUpdate();
  7537. $(this.input).focus();
  7538. }
  7539. }, {
  7540. key: 'abortEdit',
  7541. value: function abortEdit(event) {
  7542. this.content.removeClass('hidden');
  7543. this.init.removeClass('hidden');
  7544. this.accept.addClass('hidden');
  7545. this.abort.addClass('hidden');
  7546. this.input.addClass('hidden');
  7547. this.input.val(this.oldInputValue);
  7548. }
  7549. }, {
  7550. key: 'textareaAutosize',
  7551. value: function textareaAutosize() {
  7552. (0, _autosize2.default)(this.input);
  7553. }
  7554. }, {
  7555. key: 'textareaAutosizeUpdate',
  7556. value: function textareaAutosizeUpdate() {
  7557. _autosize2.default.update(this.input);
  7558. }
  7559. }, {
  7560. key: 'trimInputContent',
  7561. value: function trimInputContent() {
  7562. $(this.input).val($(this.input).val().trim());
  7563. }
  7564. }, {
  7565. key: 'blockNewLine',
  7566. value: function blockNewLine() {
  7567. $(this.input).on('keypress', function (e) {
  7568. if ((e.keyCode || e.which) == 13) {
  7569. e.preventDefault();
  7570. }
  7571. });
  7572. }
  7573. }, {
  7574. key: 'acceptEdit',
  7575. value: function acceptEdit(event) {
  7576. this.content.text(this.input.val());
  7577. this.content.removeClass('hidden');
  7578. this.init.removeClass('hidden');
  7579. this.accept.addClass('hidden');
  7580. this.abort.addClass('hidden');
  7581. this.input.addClass('hidden');
  7582. }
  7583. }]);
  7584. return editableCell;
  7585. }();
  7586. function initDataSelectors() {
  7587. $(SELECTORS.container).each(function () {
  7588. new editableCell($(this));
  7589. });
  7590. }
  7591. function initJqueryPlugin() {
  7592. $.fn.luEditableCell = function (options) {
  7593. return this.each(function () {
  7594. new editableCell($(this), options);
  7595. });
  7596. };
  7597. }
  7598. var init = {
  7599. initDataSelectors: initDataSelectors,
  7600. initJqueryPlugin: initJqueryPlugin
  7601. };
  7602. exports.default = init;
  7603. /***/ }),
  7604. /* 15 */
  7605. /***/ (function (module, exports, __webpack_require__) {
  7606. "use strict";
  7607. Object.defineProperty(exports, "__esModule", {
  7608. value: true
  7609. });
  7610. var _toastr = __webpack_require__(35);
  7611. var _toastr2 = _interopRequireDefault(_toastr);
  7612. function _interopRequireDefault(obj) {
  7613. return obj && obj.__esModule ? obj : {default: obj};
  7614. }
  7615. /**
  7616. * --------------------------------------------------------------------------
  7617. * Bootstrap (v4.0.0-beta): alert.js
  7618. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7619. * --------------------------------------------------------------------------
  7620. */
  7621. var alert = {
  7622. init: function init() {
  7623. this.cacheDom();
  7624. this.bindEvents();
  7625. },
  7626. cacheDom: function cacheDom() {
  7627. this.$showAlert = $("[data-toggle='lu-alert']");
  7628. this.$alertFixedTop = $('.alert--fixed-top');
  7629. this.$alertFixedBottom = $('.alert--fixed-bottom');
  7630. },
  7631. bindEvents: function bindEvents() {
  7632. this.$showAlert.on('click', this.getData.bind(this));
  7633. },
  7634. //default settings
  7635. settings: function settings() {
  7636. // alert icon true by default
  7637. if (this.$alertIcon == false) {
  7638. this.$icon = '';
  7639. } else {
  7640. this.$icon = 'lu-alert--icon';
  7641. }
  7642. // default alert timeout if not defined in data attributes
  7643. if (!this.$alertTimeout) {
  7644. this.$alertTimeout = 100000;
  7645. }
  7646. if (this.$alertActions) {
  7647. this.$actions = this.$alertActions;
  7648. }
  7649. },
  7650. // create alert with data stored in array
  7651. create: function create(event) {
  7652. this.$alertPosition = event.$alertPosition;
  7653. this.$alertSize = event.$alertSize;
  7654. this.$alertStatus = event.$alertStatus;
  7655. this.$alertTitle = event.$alertTitle;
  7656. this.$alertBody = event.$alertBody;
  7657. this.$alertIcon = event.$alertIcon;
  7658. this.$alertActions = event.$alertActions;
  7659. this.$alertTimeout = event.$alertTimeout;
  7660. this.show(event);
  7661. },
  7662. // get data from data attributes
  7663. getData: function getData(event) {
  7664. var target = $(event.currentTarget);
  7665. this.$alertPosition = target.data('alert-position');
  7666. this.$alertSize = target.data('alert-size');
  7667. this.$alertStatus = target.data('alert-status');
  7668. this.$alertTitle = target.data('alert-title');
  7669. this.$alertBody = target.data('alert-body');
  7670. this.$alertIcon = target.data('alert-icon');
  7671. this.$alertActions = target.data('alert-actions');
  7672. this.$alertTimeout = target.data('alert-timeout');
  7673. this.show(event);
  7674. },
  7675. // main function that showing alerts
  7676. show: function show(event) {
  7677. this.settings();
  7678. if (this.$alertPosition == 'top' || this.$alertPosition == 'bottom') {
  7679. // animation delay
  7680. this.delay = 400;
  7681. var that = this;
  7682. if (this.$alertPosition == 'top') {
  7683. var that = this;
  7684. $('body').prepend(this.getTemplate());
  7685. this.$alertFixedTop = $('.alert--fixed-top');
  7686. this.$alertHeight = that.$alertFixedTop.outerHeight();
  7687. this.$alertFixedTop.css('margin-top', - this.$alertHeight).animate({'margin-top': 0}, this.delay);
  7688. $(window).resize(function () {
  7689. if (that.$alertFixedTop.hasClass('is-active')) {
  7690. this.$alertHeight = that.$alertFixedTop.outerHeight();
  7691. }
  7692. });
  7693. this.$hideAlert = this.$alertFixedTop.closest('.alert').find('.btn--close');
  7694. this.$hideAlert.on('click', this.hideT.bind(this));
  7695. } else {
  7696. $('body').append(this.getTemplate());
  7697. this.$alertFixedBottom = $('.alert--fixed-bottom');
  7698. this.$alertBottomHeight = this.$alertFixedBottom.outerHeight();
  7699. this.$alertFixedBottom.css('margin-bottom', - this.$alertBottomHeight).animate({'margin-bottom': '0'}, this.delay);
  7700. this.$hideAlert = this.$alertFixedBottom.closest('.alert').find('.btn--close');
  7701. this.$hideAlert.on('click', this.hideB.bind(this));
  7702. }
  7703. } else {
  7704. _toastr2.default.success(this.getTemplate());
  7705. }
  7706. },
  7707. hideT: function hideT(event) {
  7708. var that = this;
  7709. this.$alertHeight = this.$alertFixedTop.outerHeight();
  7710. this.$alertFixedTop.animate({'margin-top': - this.$alertHeight}, this.delay);
  7711. setTimeout(function () {
  7712. that.$alertFixedTop.removeClass('is-active').remove();
  7713. }, this.delay);
  7714. },
  7715. hideB: function hideB() {
  7716. var that = this;
  7717. this.$alertHeight = this.$alertFixedBottom.outerHeight();
  7718. this.$alertFixedBottom.animate({'margin-bottom': - this.$alertHeight}, this.delay);
  7719. setTimeout(function () {
  7720. that.$alertFixedBottom.removeClass('is-active').remove();
  7721. }, this.delay);
  7722. },
  7723. getTemplate: function getTemplate() {
  7724. _toastr2.default.options = {
  7725. "positionClass": "lu-toast--" + this.$alertPosition,
  7726. "timeOut": this.$alertTimeout
  7727. };
  7728. this.$actions = '';
  7729. if (this.$alertActions) {
  7730. this.$actions = '<div class="lu-alert__actions">' + this.$alertActions + '</div>';
  7731. }
  7732. var $titleTemplate = '';
  7733. if (this.$alertTitle) {
  7734. $titleTemplate = '<div class="lu-alert__title">' + this.$alertTitle + ' </div>';
  7735. }
  7736. // main alert template
  7737. 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>';
  7738. // template of top and bottom alert
  7739. 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>';
  7740. var $tmpl = $primaryTemplate;
  7741. if (this.$alertPosition == 'top' || this.$alertPosition == 'bottom') {
  7742. $tmpl = $secondaryTemplate;
  7743. }
  7744. return $tmpl;
  7745. }
  7746. };
  7747. exports.default = alert;
  7748. /***/ }),
  7749. /* 16 */
  7750. /***/ (function (module, exports, __webpack_require__) {
  7751. "use strict";
  7752. Object.defineProperty(exports, "__esModule", {
  7753. value: true
  7754. });
  7755. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  7756. return typeof obj;
  7757. } : function (obj) {
  7758. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  7759. };
  7760. var _createClass = function () {
  7761. function defineProperties(target, props) {
  7762. for (var i = 0; i < props.length; i++) {
  7763. var descriptor = props[i];
  7764. descriptor.enumerable = descriptor.enumerable || false;
  7765. descriptor.configurable = true;
  7766. if ("value" in descriptor)
  7767. descriptor.writable = true;
  7768. Object.defineProperty(target, descriptor.key, descriptor);
  7769. }
  7770. }
  7771. return function (Constructor, protoProps, staticProps) {
  7772. if (protoProps)
  7773. defineProperties(Constructor.prototype, protoProps);
  7774. if (staticProps)
  7775. defineProperties(Constructor, staticProps);
  7776. return Constructor;
  7777. };
  7778. }();
  7779. var _util = __webpack_require__(0);
  7780. var _util2 = _interopRequireDefault(_util);
  7781. function _interopRequireDefault(obj) {
  7782. return obj && obj.__esModule ? obj : {default: obj};
  7783. }
  7784. function _classCallCheck(instance, Constructor) {
  7785. if (!(instance instanceof Constructor)) {
  7786. throw new TypeError("Cannot call a class as a function");
  7787. }
  7788. }
  7789. /**
  7790. * --------------------------------------------------------------------------
  7791. * Bootstrap (v4.0.0-beta.2): modal.js
  7792. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7793. * --------------------------------------------------------------------------
  7794. */
  7795. var Modal = function () {
  7796. /**
  7797. * ------------------------------------------------------------------------
  7798. * Constants
  7799. * ------------------------------------------------------------------------
  7800. */
  7801. var NAME = 'modal';
  7802. var VERSION = '4.0.0-beta.2';
  7803. var DATA_KEY = 'bs.modal';
  7804. var EVENT_KEY = '.' + DATA_KEY;
  7805. var DATA_API_KEY = '.data-api';
  7806. var JQUERY_NO_CONFLICT = $.fn[NAME];
  7807. var TRANSITION_DURATION = 300;
  7808. var BACKDROP_TRANSITION_DURATION = 150;
  7809. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  7810. var Default = {
  7811. backdrop: true,
  7812. keyboard: true,
  7813. focus: true,
  7814. show: true
  7815. };
  7816. var DefaultType = {
  7817. backdrop: '(boolean|string)',
  7818. keyboard: 'boolean',
  7819. focus: 'boolean',
  7820. show: 'boolean'
  7821. };
  7822. var Event = {
  7823. HIDE: 'hide' + EVENT_KEY,
  7824. HIDDEN: 'hidden' + EVENT_KEY,
  7825. SHOW: 'show' + EVENT_KEY,
  7826. SHOWN: 'shown' + EVENT_KEY,
  7827. FOCUSIN: 'focusin' + EVENT_KEY,
  7828. RESIZE: 'resize' + EVENT_KEY,
  7829. CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
  7830. KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
  7831. MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
  7832. MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
  7833. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  7834. };
  7835. var ClassName = {
  7836. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  7837. BACKDROP: 'modal-backdrop',
  7838. OPEN: 'modal-open',
  7839. FADE: 'fade',
  7840. SHOW: 'show'
  7841. };
  7842. var Selector = {
  7843. DIALOG: '.modal-dialog, .lu-modal__dialog',
  7844. DATA_TOGGLE: '[data-toggle="lu-modal"], [data-lu-modal]',
  7845. DATA_DISMISS: '[data-dismiss="lu-modal"]',
  7846. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  7847. STICKY_CONTENT: '.sticky-top',
  7848. NAVBAR_TOGGLER: '.navbar-toggler'
  7849. /**
  7850. * ------------------------------------------------------------------------
  7851. * Class Definition
  7852. * ------------------------------------------------------------------------
  7853. */
  7854. };
  7855. var Modal = function () {
  7856. function Modal(element, config) {
  7857. _classCallCheck(this, Modal);
  7858. this._config = this._getConfig(config);
  7859. this._element = element;
  7860. this._dialog = $(element).find(Selector.DIALOG)[0];
  7861. this._backdrop = null;
  7862. this._isShown = false;
  7863. this._isBodyOverflowing = false;
  7864. this._ignoreBackdropClick = false;
  7865. this._originalBodyPadding = 0;
  7866. this._scrollbarWidth = 0;
  7867. }
  7868. // getters
  7869. _createClass(Modal, [{
  7870. key: 'toggle',
  7871. // public
  7872. value: function toggle(relatedTarget) {
  7873. return this._isShown ? this.hide() : this.show(relatedTarget);
  7874. }
  7875. }, {
  7876. key: 'show',
  7877. value: function show(relatedTarget) {
  7878. var _this = this;
  7879. if (this._isTransitioning || this._isShown) {
  7880. return;
  7881. }
  7882. if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  7883. this._isTransitioning = true;
  7884. }
  7885. var showEvent = $.Event(Event.SHOW, {
  7886. relatedTarget: relatedTarget
  7887. });
  7888. $(this._element).trigger(showEvent);
  7889. if (this._isShown || showEvent.isDefaultPrevented()) {
  7890. return;
  7891. }
  7892. this._isShown = true;
  7893. this._checkScrollbar();
  7894. this._setScrollbar();
  7895. this._adjustDialog();
  7896. $(document.body).addClass(ClassName.OPEN);
  7897. this._setEscapeEvent();
  7898. this._setResizeEvent();
  7899. $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
  7900. return _this.hide(event);
  7901. });
  7902. $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
  7903. $(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
  7904. if ($(event.target).is(_this._element)) {
  7905. _this._ignoreBackdropClick = true;
  7906. }
  7907. });
  7908. });
  7909. this._showBackdrop(function () {
  7910. return _this._showElement(relatedTarget);
  7911. });
  7912. }
  7913. }, {
  7914. key: 'hide',
  7915. value: function hide(event) {
  7916. var _this2 = this;
  7917. if (event) {
  7918. event.preventDefault();
  7919. }
  7920. if (this._isTransitioning || !this._isShown) {
  7921. return;
  7922. }
  7923. var hideEvent = $.Event(Event.HIDE);
  7924. $(this._element).trigger(hideEvent);
  7925. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  7926. return;
  7927. }
  7928. this._isShown = false;
  7929. var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  7930. if (transition) {
  7931. this._isTransitioning = true;
  7932. }
  7933. this._setEscapeEvent();
  7934. this._setResizeEvent();
  7935. $(document).off(Event.FOCUSIN);
  7936. $(this._element).removeClass(ClassName.SHOW);
  7937. $(this._element).off(Event.CLICK_DISMISS);
  7938. $(this._dialog).off(Event.MOUSEDOWN_DISMISS);
  7939. if (transition) {
  7940. $(this._element).one(_util2.default.TRANSITION_END, function (event) {
  7941. return _this2._hideModal(event);
  7942. }).emulateTransitionEnd(TRANSITION_DURATION);
  7943. } else {
  7944. this._hideModal();
  7945. }
  7946. }
  7947. }, {
  7948. key: 'dispose',
  7949. value: function dispose() {
  7950. $.removeData(this._element, DATA_KEY);
  7951. $(window, document, this._element, this._backdrop).off(EVENT_KEY);
  7952. this._config = null;
  7953. this._element = null;
  7954. this._dialog = null;
  7955. this._backdrop = null;
  7956. this._isShown = null;
  7957. this._isBodyOverflowing = null;
  7958. this._ignoreBackdropClick = null;
  7959. this._scrollbarWidth = null;
  7960. }
  7961. }, {
  7962. key: 'handleUpdate',
  7963. value: function handleUpdate() {
  7964. this._adjustDialog();
  7965. }
  7966. // private
  7967. }, {
  7968. key: '_getConfig',
  7969. value: function _getConfig(config) {
  7970. config = $.extend({}, Default, config);
  7971. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  7972. return config;
  7973. }
  7974. }, {
  7975. key: '_showElement',
  7976. value: function _showElement(relatedTarget) {
  7977. var _this3 = this;
  7978. var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  7979. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  7980. // don't move modals dom position
  7981. document.body.appendChild(this._element);
  7982. }
  7983. this._element.style.display = 'block';
  7984. this._element.removeAttribute('aria-hidden');
  7985. this._element.scrollTop = 0;
  7986. if (transition) {
  7987. _util2.default.reflow(this._element);
  7988. }
  7989. $(this._element).addClass(ClassName.SHOW);
  7990. if (this._config.focus) {
  7991. this._enforceFocus();
  7992. }
  7993. var shownEvent = $.Event(Event.SHOWN, {
  7994. relatedTarget: relatedTarget
  7995. });
  7996. var transitionComplete = function transitionComplete() {
  7997. if (_this3._config.focus) {
  7998. _this3._element.focus();
  7999. }
  8000. _this3._isTransitioning = false;
  8001. $(_this3._element).trigger(shownEvent);
  8002. };
  8003. if (transition) {
  8004. $(this._dialog).one(_util2.default.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
  8005. } else {
  8006. transitionComplete();
  8007. }
  8008. }
  8009. }, {
  8010. key: '_enforceFocus',
  8011. value: function _enforceFocus() {
  8012. var _this4 = this;
  8013. $(document).off(Event.FOCUSIN) // guard against infinite focus loop
  8014. .on(Event.FOCUSIN, function (event) {
  8015. if (document !== event.target && _this4._element !== event.target && !$(_this4._element).has(event.target).length) {
  8016. _this4._element.focus();
  8017. }
  8018. });
  8019. }
  8020. }, {
  8021. key: '_setEscapeEvent',
  8022. value: function _setEscapeEvent() {
  8023. var _this5 = this;
  8024. if (this._isShown && this._config.keyboard) {
  8025. $(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
  8026. if (event.which === ESCAPE_KEYCODE) {
  8027. event.preventDefault();
  8028. _this5.hide();
  8029. }
  8030. });
  8031. } else if (!this._isShown) {
  8032. $(this._element).off(Event.KEYDOWN_DISMISS);
  8033. }
  8034. }
  8035. }, {
  8036. key: '_setResizeEvent',
  8037. value: function _setResizeEvent() {
  8038. var _this6 = this;
  8039. if (this._isShown) {
  8040. $(window).on(Event.RESIZE, function (event) {
  8041. return _this6.handleUpdate(event);
  8042. });
  8043. } else {
  8044. $(window).off(Event.RESIZE);
  8045. }
  8046. }
  8047. }, {
  8048. key: '_hideModal',
  8049. value: function _hideModal() {
  8050. var _this7 = this;
  8051. this._element.style.display = 'none';
  8052. this._element.setAttribute('aria-hidden', true);
  8053. this._isTransitioning = false;
  8054. this._showBackdrop(function () {
  8055. $(document.body).removeClass(ClassName.OPEN);
  8056. _this7._resetAdjustments();
  8057. _this7._resetScrollbar();
  8058. $(_this7._element).trigger(Event.HIDDEN);
  8059. });
  8060. }
  8061. }, {
  8062. key: '_removeBackdrop',
  8063. value: function _removeBackdrop() {
  8064. if (this._backdrop) {
  8065. $(this._backdrop).remove();
  8066. this._backdrop = null;
  8067. }
  8068. }
  8069. }, {
  8070. key: '_showBackdrop',
  8071. value: function _showBackdrop(callback) {
  8072. var _this8 = this;
  8073. var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
  8074. if (this._isShown && this._config.backdrop) {
  8075. var doAnimate = _util2.default.supportsTransitionEnd() && animate;
  8076. this._backdrop = document.createElement('div');
  8077. this._backdrop.className = ClassName.BACKDROP;
  8078. if (animate) {
  8079. $(this._backdrop).addClass(animate);
  8080. }
  8081. $(this._backdrop).appendTo(document.body);
  8082. $(this._element).on(Event.CLICK_DISMISS, function (event) {
  8083. if (_this8._ignoreBackdropClick) {
  8084. _this8._ignoreBackdropClick = false;
  8085. return;
  8086. }
  8087. if (event.target !== event.currentTarget) {
  8088. return;
  8089. }
  8090. if (_this8._config.backdrop === 'static') {
  8091. _this8._element.focus();
  8092. } else {
  8093. _this8.hide();
  8094. }
  8095. });
  8096. if (doAnimate) {
  8097. _util2.default.reflow(this._backdrop);
  8098. }
  8099. $(this._backdrop).addClass(ClassName.SHOW);
  8100. if (!callback) {
  8101. return;
  8102. }
  8103. if (!doAnimate) {
  8104. callback();
  8105. return;
  8106. }
  8107. $(this._backdrop).one(_util2.default.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  8108. } else if (!this._isShown && this._backdrop) {
  8109. $(this._backdrop).removeClass(ClassName.SHOW);
  8110. var callbackRemove = function callbackRemove() {
  8111. _this8._removeBackdrop();
  8112. if (callback) {
  8113. callback();
  8114. }
  8115. };
  8116. if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  8117. $(this._backdrop).one(_util2.default.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  8118. } else {
  8119. callbackRemove();
  8120. }
  8121. } else if (callback) {
  8122. callback();
  8123. }
  8124. }
  8125. // ----------------------------------------------------------------------
  8126. // the following methods are used to handle overflowing modals
  8127. // todo (fat): these should probably be refactored out of modal.js
  8128. // ----------------------------------------------------------------------
  8129. }, {
  8130. key: '_adjustDialog',
  8131. value: function _adjustDialog() {
  8132. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  8133. if (!this._isBodyOverflowing && isModalOverflowing) {
  8134. this._element.style.paddingLeft = this._scrollbarWidth + 'px';
  8135. }
  8136. if (this._isBodyOverflowing && !isModalOverflowing) {
  8137. this._element.style.paddingRight = this._scrollbarWidth + 'px';
  8138. }
  8139. }
  8140. }, {
  8141. key: '_resetAdjustments',
  8142. value: function _resetAdjustments() {
  8143. this._element.style.paddingLeft = '';
  8144. this._element.style.paddingRight = '';
  8145. }
  8146. }, {
  8147. key: '_checkScrollbar',
  8148. value: function _checkScrollbar() {
  8149. var rect = document.body.getBoundingClientRect();
  8150. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  8151. this._scrollbarWidth = this._getScrollbarWidth();
  8152. }
  8153. }, {
  8154. key: '_setScrollbar',
  8155. value: function _setScrollbar() {
  8156. var _this9 = this;
  8157. if (this._isBodyOverflowing) {
  8158. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  8159. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  8160. // Adjust fixed content padding
  8161. $(Selector.FIXED_CONTENT).each(function (index, element) {
  8162. var actualPadding = $(element)[0].style.paddingRight;
  8163. var calculatedPadding = $(element).css('padding-right');
  8164. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + 'px');
  8165. });
  8166. // Adjust sticky content margin
  8167. $(Selector.STICKY_CONTENT).each(function (index, element) {
  8168. var actualMargin = $(element)[0].style.marginRight;
  8169. var calculatedMargin = $(element).css('margin-right');
  8170. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + 'px');
  8171. });
  8172. // Adjust navbar-toggler margin
  8173. $(Selector.NAVBAR_TOGGLER).each(function (index, element) {
  8174. var actualMargin = $(element)[0].style.marginRight;
  8175. var calculatedMargin = $(element).css('margin-right');
  8176. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + 'px');
  8177. });
  8178. // Adjust body padding
  8179. var actualPadding = document.body.style.paddingRight;
  8180. var calculatedPadding = $('body').css('padding-right');
  8181. $('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + 'px');
  8182. }
  8183. }
  8184. }, {
  8185. key: '_resetScrollbar',
  8186. value: function _resetScrollbar() {
  8187. // Restore fixed content padding
  8188. $(Selector.FIXED_CONTENT).each(function (index, element) {
  8189. var padding = $(element).data('padding-right');
  8190. if (typeof padding !== 'undefined') {
  8191. $(element).css('padding-right', padding).removeData('padding-right');
  8192. }
  8193. });
  8194. // Restore sticky content and navbar-toggler margin
  8195. $(Selector.STICKY_CONTENT + ', ' + Selector.NAVBAR_TOGGLER).each(function (index, element) {
  8196. var margin = $(element).data('margin-right');
  8197. if (typeof margin !== 'undefined') {
  8198. $(element).css('margin-right', margin).removeData('margin-right');
  8199. }
  8200. });
  8201. // Restore body padding
  8202. var padding = $('body').data('padding-right');
  8203. if (typeof padding !== 'undefined') {
  8204. $('body').css('padding-right', padding).removeData('padding-right');
  8205. }
  8206. }
  8207. }, {
  8208. key: '_getScrollbarWidth',
  8209. value: function _getScrollbarWidth() {
  8210. // thx d.walsh
  8211. var scrollDiv = document.createElement('div');
  8212. scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
  8213. document.body.appendChild(scrollDiv);
  8214. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  8215. document.body.removeChild(scrollDiv);
  8216. return scrollbarWidth;
  8217. }
  8218. // static
  8219. }], [{
  8220. key: '_jQueryInterface',
  8221. value: function _jQueryInterface(config, relatedTarget) {
  8222. return this.each(function () {
  8223. var data = $(this).data(DATA_KEY);
  8224. var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  8225. if (!data) {
  8226. data = new Modal(this, _config);
  8227. $(this).data(DATA_KEY, data);
  8228. }
  8229. if (typeof config === 'string') {
  8230. if (typeof data[config] === 'undefined') {
  8231. throw new Error('No method named "' + config + '"');
  8232. }
  8233. data[config](relatedTarget);
  8234. } else if (_config.show) {
  8235. data.show(relatedTarget);
  8236. }
  8237. });
  8238. }
  8239. }, {
  8240. key: 'VERSION',
  8241. get: function get() {
  8242. return VERSION;
  8243. }
  8244. }, {
  8245. key: 'Default',
  8246. get: function get() {
  8247. return Default;
  8248. }
  8249. }]);
  8250. return Modal;
  8251. }();
  8252. /**
  8253. * ------------------------------------------------------------------------
  8254. * Data Api implementation
  8255. * ------------------------------------------------------------------------
  8256. */
  8257. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  8258. var _this10 = this;
  8259. var target = void 0;
  8260. var selector = _util2.default.getSelectorFromElement(this);
  8261. if (selector) {
  8262. target = $(selector)[0];
  8263. }
  8264. var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
  8265. if (this.tagName === 'A' || this.tagName === 'AREA') {
  8266. event.preventDefault();
  8267. }
  8268. var $target = $(target).one(Event.SHOW, function (showEvent) {
  8269. if (showEvent.isDefaultPrevented()) {
  8270. // only register focus restorer if modal will actually get shown
  8271. return;
  8272. }
  8273. $target.one(Event.HIDDEN, function () {
  8274. if ($(_this10).is(':visible')) {
  8275. _this10.focus();
  8276. }
  8277. });
  8278. });
  8279. Modal._jQueryInterface.call($(target), config, this);
  8280. });
  8281. /**
  8282. * ------------------------------------------------------------------------
  8283. * jQuery
  8284. * ------------------------------------------------------------------------
  8285. */
  8286. $.fn[NAME] = Modal._jQueryInterface;
  8287. $.fn[NAME].Constructor = Modal;
  8288. $.fn[NAME].noConflict = function () {
  8289. $.fn[NAME] = JQUERY_NO_CONFLICT;
  8290. return Modal._jQueryInterface;
  8291. };
  8292. return Modal;
  8293. }(_util2.default.jQuery);
  8294. exports.default = Modal;
  8295. /***/ }),
  8296. /* 17 */
  8297. /***/ (function (module, exports, __webpack_require__) {
  8298. "use strict";
  8299. Object.defineProperty(exports, "__esModule", {
  8300. value: true
  8301. });
  8302. var _enquire = __webpack_require__(31);
  8303. var _enquire2 = _interopRequireDefault(_enquire);
  8304. function _interopRequireDefault(obj) {
  8305. return obj && obj.__esModule ? obj : {default: obj};
  8306. }
  8307. var layersNav = {
  8308. init: function init() {
  8309. this.cacheDom();
  8310. this.bindEvents();
  8311. },
  8312. cacheDom: function cacheDom() {
  8313. this.$nav = $('.lu-nav');
  8314. this.$navigationDroDownLi = this.$nav.find('.lu-nav__item.has-dropdown');
  8315. },
  8316. bindEvents: function bindEvents() {
  8317. var that = this;
  8318. this.$navigationDroDownLi.on('click', this.checkDropDownStatus.bind(this));
  8319. var isMobile = false; //initiate as false
  8320. // device detection
  8321. 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) {
  8322. isMobile = true;
  8323. }
  8324. ;
  8325. _enquire2.default.register("screen and (min-width: 0) and (max-width: 751px)", {
  8326. match: function match() {
  8327. $('.has-dropdown > a').on('click', function (event) {
  8328. event.preventDefault();
  8329. });
  8330. },
  8331. unmatch: function unmatch() {
  8332. $('.has-dropdown > a').on('click', function (event) {
  8333. if (isMobile == true || $(this).parents('.navbar--thin').length == 0) {
  8334. event.preventDefault(); // I need to change that
  8335. }
  8336. });
  8337. }
  8338. });
  8339. _enquire2.default.register("screen and (min-width: 752px)", {
  8340. match: function match(event) {
  8341. $('.has-dropdown > a').on('click', function (event) {
  8342. if ($(this).parents('.navigation').length == 0 &&
  8343. (isMobile == true || $(this).parents('.navbar--thin').length == 0)) {
  8344. event.preventDefault(); // I need to change that
  8345. }
  8346. });
  8347. },
  8348. unmatch: function unmatch() {
  8349. $('.has-dropdown > a').on('click', function (event) {
  8350. event.preventDefault();
  8351. });
  8352. }
  8353. });
  8354. $(window).on('click', function (event) {
  8355. $('.nav .has-dropdown').removeClass('is-open');
  8356. }.bind(this));
  8357. },
  8358. checkDropDownStatus: function checkDropDownStatus(event) {
  8359. var toggleBack = this.$nav.find('[data-toggle="back"]');
  8360. var toggleBackI = this.$nav.find('[data-toggle="back"] i');
  8361. if (toggleBack.is(event.target) || toggleBackI.is(event.target)) {
  8362. } else {
  8363. if ($(event.currentTarget).hasClass('is-open')) {
  8364. this.hideDropDown(event);
  8365. } else {
  8366. this.showDropDown(event);
  8367. }
  8368. }
  8369. },
  8370. showDropDown: function showDropDown(event) {
  8371. event.stopPropagation(); // I need to change that
  8372. var dropDownElement = $(event.currentTarget);
  8373. var dropDownContainer = $(event.currentTarget).find('.has-dropdown');
  8374. dropDownElement.closest('.lu-nav').find('.is-open').removeClass('is-open');
  8375. dropDownElement.addClass('is-open');
  8376. },
  8377. hideDropDown: function hideDropDown(event) {
  8378. var dropDownElement = $(event.currentTarget);
  8379. var dropDownContainer = $(event.currentTarget).find('.has-dropdown');
  8380. dropDownElement.removeClass('is-open');
  8381. }
  8382. }; // import enquire from 'enquire';
  8383. // import superfish from 'superfish';
  8384. // const SELECTORS = {
  8385. // container: '.nav',
  8386. // item: '.has-dropdown',
  8387. // };
  8388. // const Default = {
  8389. // active: '.is-open',
  8390. // open: 'hover'
  8391. // };
  8392. // class Nav{
  8393. // constructor(container, options){
  8394. // this.container = container;
  8395. // this.items = $(container).find(SELECTORS.item);
  8396. // this.options = options;
  8397. // this.getConfig();
  8398. // this.bindEvents();
  8399. // }
  8400. // bindEvents(){
  8401. // this.items.on('click', this.checkStatus.bind(this));
  8402. // $(document).on('click', this.clickOutside.bind(this));
  8403. // }
  8404. // getConfig(){
  8405. // var dataConfig = this.container.data();
  8406. // if(dataConfig.options){
  8407. // this.dataOptions = util.parseDataOptions(dataConfig.options);
  8408. // }else{
  8409. // this.dataOptions = {};
  8410. // }
  8411. // this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8412. // }
  8413. // checkStatus(event){
  8414. // if ($(event.currentTarget).hasClass('is-open')) {
  8415. // this.hide(event);
  8416. // } else {
  8417. // this.show(event);
  8418. // }
  8419. // }
  8420. // show(event) {
  8421. // let item = $(event.currentTarget);
  8422. // event.stopPropagation();
  8423. // if(this.config.open == 'click'){
  8424. // this.hideOld();
  8425. // item.addClass('is-open');
  8426. // }else if(this.config.open == 'hover'){
  8427. // this.initSuperFish();
  8428. // console.log('test');
  8429. // }
  8430. // }
  8431. // hide(event) {
  8432. // let item = $(event.currentTarget);
  8433. // item.removeClass('is-open');
  8434. // }
  8435. // hideOld(){
  8436. // this.container.find('.is-open').removeClass('is-open');
  8437. // }
  8438. // initSuperFish(){
  8439. // $(this.container).superfish({
  8440. // hoverClass: 'is-open',
  8441. // popUpSelector: '.has-dropdown',
  8442. // delay: 600,
  8443. // animation: {}
  8444. // });
  8445. // }
  8446. // clickOutside(){
  8447. // if(!$(event.target).closest(SELECTORS.container).length) {
  8448. // if($(SELECTORS.container).is(":visible")) {
  8449. // this.hideOld();
  8450. // }
  8451. // }
  8452. // }
  8453. // }
  8454. // function initDataSelectors(){
  8455. // $(SELECTORS.container).each(function(){
  8456. // new Nav($(this));
  8457. // });
  8458. // }
  8459. // function initJqueryPlugin(){
  8460. // $.fn.luNav = function( options ) {
  8461. // return this.each(function() {
  8462. // new Nav($(this), options);
  8463. // });
  8464. // };
  8465. // }
  8466. // const init = {
  8467. // initDataSelectors,
  8468. // initJqueryPlugin,
  8469. // };
  8470. // export default init;
  8471. exports.default = layersNav;
  8472. /***/ }),
  8473. /* 18 */
  8474. /***/ (function (module, exports, __webpack_require__) {
  8475. "use strict";
  8476. Object.defineProperty(exports, "__esModule", {
  8477. value: true
  8478. });
  8479. var _createClass = function () {
  8480. function defineProperties(target, props) {
  8481. for (var i = 0; i < props.length; i++) {
  8482. var descriptor = props[i];
  8483. descriptor.enumerable = descriptor.enumerable || false;
  8484. descriptor.configurable = true;
  8485. if ("value" in descriptor)
  8486. descriptor.writable = true;
  8487. Object.defineProperty(target, descriptor.key, descriptor);
  8488. }
  8489. }
  8490. return function (Constructor, protoProps, staticProps) {
  8491. if (protoProps)
  8492. defineProperties(Constructor.prototype, protoProps);
  8493. if (staticProps)
  8494. defineProperties(Constructor, staticProps);
  8495. return Constructor;
  8496. };
  8497. }();
  8498. function _classCallCheck(instance, Constructor) {
  8499. if (!(instance instanceof Constructor)) {
  8500. throw new TypeError("Cannot call a class as a function");
  8501. }
  8502. }
  8503. /**
  8504. * Switcher.js
  8505. * Copyright 2016, RSstudio
  8506. *
  8507. * http://rsstudio.net
  8508. *
  8509. * All rights reserved
  8510. *
  8511. */
  8512. var SELECTORS = {
  8513. container: '[data-switcher]',
  8514. item: '[data-switcher-item]',
  8515. itemHighlight: '[data-switcher-highlight]'
  8516. };
  8517. var Default = {
  8518. activeElement: 2,
  8519. transition: 'all 500ms cubic-bezier(.250, .250, .000, 1.015)'
  8520. };
  8521. var Switcher = function () {
  8522. function Switcher(element, options) {
  8523. _classCallCheck(this, Switcher);
  8524. this.element = $(element);
  8525. this.items = element.find(SELECTORS.item);
  8526. this.itemHighlight = this.element.find(SELECTORS.itemHighlight);
  8527. this.options = options;
  8528. this.activeItemData = {};
  8529. this.isInit = false;
  8530. this.getConfig();
  8531. this.setActiveItem(this.config.activeElement);
  8532. this.bindEvents();
  8533. }
  8534. _createClass(Switcher, [{
  8535. key: 'getConfig',
  8536. value: function getConfig() {
  8537. var dataConfig = this.element.data();
  8538. if (dataConfig.options) {
  8539. this.dataOptions = util.parseDataOptions(dataConfig.options);
  8540. } else {
  8541. this.dataOptions = {};
  8542. }
  8543. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8544. }
  8545. }, {
  8546. key: 'bindEvents',
  8547. value: function bindEvents() {
  8548. var _this = this;
  8549. this.items.on('click', function (event) {
  8550. return _this.slideToItem(event.currentTarget);
  8551. });
  8552. $(window).on('resize', function (event) {
  8553. return _this.onResize(event);
  8554. });
  8555. }
  8556. }, {
  8557. key: 'setActiveItem',
  8558. value: function setActiveItem(itemIndex) {
  8559. this.slideToItem(this.items[itemIndex]);
  8560. }
  8561. }, {
  8562. key: 'getItemPosition',
  8563. value: function getItemPosition(element) {
  8564. this.activeItemData.element = $(element);
  8565. this.activeItemData.width = $(this.activeItemData.element).outerWidth();
  8566. this.activeItemData.position = $(this.activeItemData.element).position().left;
  8567. }
  8568. }, {
  8569. key: 'slideToItem',
  8570. value: function slideToItem(element) {
  8571. if (this.activeItemData.element) {
  8572. this.activeItemData.element.removeClass('is-active');
  8573. }
  8574. this.getItemPosition(element);
  8575. this.itemHighlight.css({
  8576. 'transform': 'translateX(' + this.activeItemData.position + 'px)',
  8577. 'width': this.activeItemData.width
  8578. });
  8579. if (this.isInit) {
  8580. this.itemHighlight.css({
  8581. transition: this.config.transition
  8582. });
  8583. } else {
  8584. this.onInit();
  8585. this.isInit = true;
  8586. }
  8587. this.onSlide();
  8588. }
  8589. }, {
  8590. key: 'onInit',
  8591. value: function onInit() {
  8592. if (typeof this.config.onInit === 'function') {
  8593. this.config.onInit(this.element, this.activeItemData.element);
  8594. }
  8595. }
  8596. }, {
  8597. key: 'onSlide',
  8598. value: function onSlide() {
  8599. if (typeof this.config.onSlide === 'function') {
  8600. this.config.onSlide(this.element, this.activeItemData.element);
  8601. }
  8602. this.activeItemData.element.addClass('is-active');
  8603. }
  8604. }, {
  8605. key: 'onResize',
  8606. value: function onResize() {
  8607. if (typeof this.config.onSlide === 'function') {
  8608. this.config.onResize(this.element, this.activeItemData.element);
  8609. }
  8610. this.activeItemData.element.trigger('click');
  8611. }
  8612. }]);
  8613. return Switcher;
  8614. }();
  8615. function initDataSelectors() {
  8616. $(document).ready(function () {
  8617. $(SELECTORS.container).each(function () {
  8618. new Switcher($(this));
  8619. });
  8620. });
  8621. }
  8622. function initJqueryPlugin() {
  8623. $.fn.luSwitcher = function (options) {
  8624. return this.each(function () {
  8625. var switcher = new Switcher($(this), options);
  8626. });
  8627. };
  8628. }
  8629. var init = {
  8630. initDataSelectors: initDataSelectors,
  8631. initJqueryPlugin: initJqueryPlugin
  8632. };
  8633. exports.default = init;
  8634. /***/ }),
  8635. /* 19 */
  8636. /***/ (function (module, exports, __webpack_require__) {
  8637. "use strict";
  8638. Object.defineProperty(exports, "__esModule", {
  8639. value: true
  8640. });
  8641. var _createClass = function () {
  8642. function defineProperties(target, props) {
  8643. for (var i = 0; i < props.length; i++) {
  8644. var descriptor = props[i];
  8645. descriptor.enumerable = descriptor.enumerable || false;
  8646. descriptor.configurable = true;
  8647. if ("value" in descriptor)
  8648. descriptor.writable = true;
  8649. Object.defineProperty(target, descriptor.key, descriptor);
  8650. }
  8651. }
  8652. return function (Constructor, protoProps, staticProps) {
  8653. if (protoProps)
  8654. defineProperties(Constructor.prototype, protoProps);
  8655. if (staticProps)
  8656. defineProperties(Constructor, staticProps);
  8657. return Constructor;
  8658. };
  8659. }();
  8660. var _util = __webpack_require__(0);
  8661. var _util2 = _interopRequireDefault(_util);
  8662. function _interopRequireDefault(obj) {
  8663. return obj && obj.__esModule ? obj : {default: obj};
  8664. }
  8665. function _classCallCheck(instance, Constructor) {
  8666. if (!(instance instanceof Constructor)) {
  8667. throw new TypeError("Cannot call a class as a function");
  8668. }
  8669. }
  8670. /**
  8671. * --------------------------------------------------------------------------
  8672. * Bootstrap (v4.0.0-beta.2): tab.js
  8673. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  8674. * --------------------------------------------------------------------------
  8675. */
  8676. var Tab = function () {
  8677. /**
  8678. * ------------------------------------------------------------------------
  8679. * Constants
  8680. * ------------------------------------------------------------------------
  8681. */
  8682. var NAME = 'lu-tab';
  8683. var VERSION = '4.0.0-beta.2';
  8684. var DATA_KEY = 'bs.tab';
  8685. var EVENT_KEY = '.' + DATA_KEY;
  8686. var DATA_API_KEY = '.data-api';
  8687. var JQUERY_NO_CONFLICT = $.fn[NAME];
  8688. var TRANSITION_DURATION = 150;
  8689. var Event = {
  8690. HIDE: 'hide' + EVENT_KEY,
  8691. HIDDEN: 'hidden' + EVENT_KEY,
  8692. SHOW: 'show' + EVENT_KEY,
  8693. SHOWN: 'shown' + EVENT_KEY,
  8694. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  8695. };
  8696. var ClassName = {
  8697. DROPDOWN_MENU: 'dropdown-menu',
  8698. ACTIVE: 'is-active',
  8699. DISABLED: 'disabled',
  8700. FADE: 'fade',
  8701. SHOW: 'show'
  8702. };
  8703. var Selector = {
  8704. DROPDOWN: '.dropdown',
  8705. NAV_LIST_GROUP: '.lu-nav, .lu-list-group',
  8706. ACTIVE: '.is-active',
  8707. ACTIVE_UL: '> .is-active',
  8708. DATA_TOGGLE: '[data-toggle="lu-tab"], [data-toggle="pill"], [data-toggle="list"]',
  8709. DROPDOWN_TOGGLE: '.dropdown-toggle',
  8710. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .is-active'
  8711. /**
  8712. * ------------------------------------------------------------------------
  8713. * Class Definition
  8714. * ------------------------------------------------------------------------
  8715. */
  8716. };
  8717. var Tab = function () {
  8718. function Tab(element) {
  8719. _classCallCheck(this, Tab);
  8720. this._element = element;
  8721. }
  8722. // getters
  8723. _createClass(Tab, [{
  8724. key: 'show',
  8725. // public
  8726. value: function show() {
  8727. var _this = this;
  8728. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
  8729. return;
  8730. }
  8731. var target = void 0;
  8732. var previous = void 0;
  8733. var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
  8734. var selector = _util2.default.getSelectorFromElement(this._element);
  8735. if (listElement) {
  8736. var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
  8737. previous = $.makeArray($(listElement).find(itemSelector));
  8738. previous = previous[previous.length - 1];
  8739. }
  8740. var hideEvent = $.Event(Event.HIDE, {
  8741. relatedTarget: this._element
  8742. });
  8743. var showEvent = $.Event(Event.SHOW, {
  8744. relatedTarget: previous
  8745. });
  8746. if (previous) {
  8747. $(previous).trigger(hideEvent);
  8748. }
  8749. $(this._element).trigger(showEvent);
  8750. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  8751. return;
  8752. }
  8753. if (selector) {
  8754. target = $(selector)[0];
  8755. }
  8756. this._activate(this._element, listElement);
  8757. var complete = function complete() {
  8758. var hiddenEvent = $.Event(Event.HIDDEN, {
  8759. relatedTarget: _this._element
  8760. });
  8761. var shownEvent = $.Event(Event.SHOWN, {
  8762. relatedTarget: previous
  8763. });
  8764. $(previous).trigger(hiddenEvent);
  8765. $(_this._element).trigger(shownEvent);
  8766. };
  8767. if (target) {
  8768. this._activate(target, target.parentNode, complete);
  8769. } else {
  8770. complete();
  8771. }
  8772. }
  8773. }, {
  8774. key: 'dispose',
  8775. value: function dispose() {
  8776. $.removeData(this._element, DATA_KEY);
  8777. this._element = null;
  8778. }
  8779. // private
  8780. }, {
  8781. key: '_activate',
  8782. value: function _activate(element, container, callback) {
  8783. var _this2 = this;
  8784. var activeElements = void 0;
  8785. if (container.nodeName === 'UL') {
  8786. activeElements = $(container).find(Selector.ACTIVE_UL);
  8787. } else {
  8788. activeElements = $(container).children(Selector.ACTIVE);
  8789. }
  8790. var active = activeElements[0];
  8791. var isTransitioning = callback && _util2.default.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
  8792. var complete = function complete() {
  8793. return _this2._transitionComplete(element, active, isTransitioning, callback);
  8794. };
  8795. if (active && isTransitioning) {
  8796. $(active).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  8797. } else {
  8798. complete();
  8799. }
  8800. if (active) {
  8801. $(active).removeClass(ClassName.SHOW);
  8802. }
  8803. }
  8804. }, {
  8805. key: '_transitionComplete',
  8806. value: function _transitionComplete(element, active, isTransitioning, callback) {
  8807. if (active) {
  8808. $(active).removeClass(ClassName.ACTIVE);
  8809. var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
  8810. if (dropdownChild) {
  8811. $(dropdownChild).removeClass(ClassName.ACTIVE);
  8812. }
  8813. if (active.getAttribute('role') === 'tab') {
  8814. active.setAttribute('aria-selected', false);
  8815. }
  8816. }
  8817. if ($(element).is("a")) {
  8818. $(element).parent().addClass(ClassName.ACTIVE);
  8819. } else {
  8820. $(element).addClass(ClassName.ACTIVE);
  8821. }
  8822. if (element.getAttribute('role') === 'tab') {
  8823. element.setAttribute('aria-selected', true);
  8824. }
  8825. if (isTransitioning) {
  8826. _util2.default.reflow(element);
  8827. $(element).addClass(ClassName.SHOW);
  8828. } else {
  8829. $(element).removeClass(ClassName.FADE);
  8830. }
  8831. if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
  8832. var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
  8833. if (dropdownElement) {
  8834. $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  8835. }
  8836. element.setAttribute('aria-expanded', true);
  8837. }
  8838. if (callback) {
  8839. callback();
  8840. }
  8841. }
  8842. // static
  8843. }], [{
  8844. key: '_jQueryInterface',
  8845. value: function _jQueryInterface(config) {
  8846. return this.each(function () {
  8847. var $this = $(this);
  8848. var data = $this.data(DATA_KEY);
  8849. if (!data) {
  8850. data = new Tab(this);
  8851. $this.data(DATA_KEY, data);
  8852. }
  8853. if (typeof config === 'string') {
  8854. if (typeof data[config] === 'undefined') {
  8855. throw new Error('No method named "' + config + '"');
  8856. }
  8857. data[config]();
  8858. }
  8859. });
  8860. }
  8861. }, {
  8862. key: 'VERSION',
  8863. get: function get() {
  8864. return VERSION;
  8865. }
  8866. }]);
  8867. return Tab;
  8868. }();
  8869. /**
  8870. * ------------------------------------------------------------------------
  8871. * Data Api implementation
  8872. * ------------------------------------------------------------------------
  8873. */
  8874. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  8875. event.preventDefault();
  8876. Tab._jQueryInterface.call($(this), 'show');
  8877. });
  8878. /**
  8879. * ------------------------------------------------------------------------
  8880. * jQuery
  8881. * ------------------------------------------------------------------------
  8882. */
  8883. $.fn[NAME] = Tab._jQueryInterface;
  8884. $.fn[NAME].Constructor = Tab;
  8885. $.fn[NAME].noConflict = function () {
  8886. $.fn[NAME] = JQUERY_NO_CONFLICT;
  8887. return Tab._jQueryInterface;
  8888. };
  8889. return Tab;
  8890. }(_util2.default.jQuery);
  8891. exports.default = Tab;
  8892. /***/ }),
  8893. /* 20 */
  8894. /***/ (function (module, exports, __webpack_require__) {
  8895. "use strict";
  8896. Object.defineProperty(exports, "__esModule", {
  8897. value: true
  8898. });
  8899. var _createClass = function () {
  8900. function defineProperties(target, props) {
  8901. for (var i = 0; i < props.length; i++) {
  8902. var descriptor = props[i];
  8903. descriptor.enumerable = descriptor.enumerable || false;
  8904. descriptor.configurable = true;
  8905. if ("value" in descriptor)
  8906. descriptor.writable = true;
  8907. Object.defineProperty(target, descriptor.key, descriptor);
  8908. }
  8909. }
  8910. return function (Constructor, protoProps, staticProps) {
  8911. if (protoProps)
  8912. defineProperties(Constructor.prototype, protoProps);
  8913. if (staticProps)
  8914. defineProperties(Constructor, staticProps);
  8915. return Constructor;
  8916. };
  8917. }();
  8918. var _Swiper = __webpack_require__(4);
  8919. var _Swiper2 = _interopRequireDefault(_Swiper);
  8920. var _util = __webpack_require__(0);
  8921. var _util2 = _interopRequireDefault(_util);
  8922. function _interopRequireDefault(obj) {
  8923. return obj && obj.__esModule ? obj : {default: obj};
  8924. }
  8925. function _classCallCheck(instance, Constructor) {
  8926. if (!(instance instanceof Constructor)) {
  8927. throw new TypeError("Cannot call a class as a function");
  8928. }
  8929. }
  8930. var SELECTORS = {
  8931. button: '[data-toggle="offCanvas"]',
  8932. overlayers: '.overlayer',
  8933. dismiss: '[data-dismiss="offCanvas"]'
  8934. };
  8935. var Default = {
  8936. position: 'right',
  8937. activeClass: 'is-open',
  8938. mode: 'normal',
  8939. tranition: 400,
  8940. overlayer: false,
  8941. bodyClass: 'off-canvas-is-active'
  8942. };
  8943. var OffCanvas = function () {
  8944. function OffCanvas(element, options) {
  8945. _classCallCheck(this, OffCanvas);
  8946. this.element = element;
  8947. this.options = options;
  8948. this.getConfig();
  8949. this.bindEvents();
  8950. }
  8951. _createClass(OffCanvas, [{
  8952. key: 'getConfig',
  8953. value: function getConfig() {
  8954. var dataConfig = this.element.data();
  8955. if (dataConfig.options) {
  8956. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8957. } else {
  8958. this.dataOptions = {};
  8959. }
  8960. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8961. this.target = $(this.config.target);
  8962. this.dismiss = this.target.find(SELECTORS.dismiss);
  8963. }
  8964. }, {
  8965. key: 'bindEvents',
  8966. value: function bindEvents() {
  8967. var _this = this;
  8968. this.element.on('click', function (event) {
  8969. return _this.checkState(event);
  8970. });
  8971. this.dismiss.on('click', function () {
  8972. return _this.close();
  8973. });
  8974. $(document).on('click', function (event) {
  8975. return _this.addEventClickOutside(event);
  8976. });
  8977. }
  8978. }, {
  8979. key: 'checkState',
  8980. value: function checkState() {
  8981. if (this.target.hasClass(this.config.activeClass)) {
  8982. this.close();
  8983. } else {
  8984. this.open();
  8985. }
  8986. }
  8987. }, {
  8988. key: 'open',
  8989. value: function open(evnet) {
  8990. $(this.target).addClass(this.config.activeClass);
  8991. $('body').addClass(this.config.bodyClass);
  8992. }
  8993. }, {
  8994. key: 'close',
  8995. value: function close(event) {
  8996. $(this.target).removeClass(this.config.activeClass);
  8997. $('body').removeClass(this.config.bodyClass);
  8998. }
  8999. }, {
  9000. key: 'addEventClickOutside',
  9001. value: function addEventClickOutside(event) {
  9002. if (!$(event.target).closest(this.target).length && !$(event.target).closest(this.element).length) {
  9003. if ($(this.target).is(":visible")) {
  9004. this.close();
  9005. }
  9006. }
  9007. }
  9008. }]);
  9009. return OffCanvas;
  9010. }();
  9011. function initDataSelectors() {
  9012. $(SELECTORS.button).each(function () {
  9013. new OffCanvas($(this));
  9014. });
  9015. }
  9016. function initJqueryPlugin() {
  9017. $.fn.luOffCanvas = function (options) {
  9018. return this.each(function () {
  9019. new OffCanvas($(this), options);
  9020. });
  9021. };
  9022. }
  9023. var init = {
  9024. initDataSelectors: initDataSelectors,
  9025. initJqueryPlugin: initJqueryPlugin
  9026. };
  9027. exports.default = init;
  9028. /***/ }),
  9029. /* 21 */
  9030. /***/ (function (module, exports, __webpack_require__) {
  9031. "use strict";
  9032. Object.defineProperty(exports, "__esModule", {
  9033. value: true
  9034. });
  9035. var _createClass = function () {
  9036. function defineProperties(target, props) {
  9037. for (var i = 0; i < props.length; i++) {
  9038. var descriptor = props[i];
  9039. descriptor.enumerable = descriptor.enumerable || false;
  9040. descriptor.configurable = true;
  9041. if ("value" in descriptor)
  9042. descriptor.writable = true;
  9043. Object.defineProperty(target, descriptor.key, descriptor);
  9044. }
  9045. }
  9046. return function (Constructor, protoProps, staticProps) {
  9047. if (protoProps)
  9048. defineProperties(Constructor.prototype, protoProps);
  9049. if (staticProps)
  9050. defineProperties(Constructor, staticProps);
  9051. return Constructor;
  9052. };
  9053. }();
  9054. var _util = __webpack_require__(0);
  9055. var _util2 = _interopRequireDefault(_util);
  9056. function _interopRequireDefault(obj) {
  9057. return obj && obj.__esModule ? obj : {default: obj};
  9058. }
  9059. function _classCallCheck(instance, Constructor) {
  9060. if (!(instance instanceof Constructor)) {
  9061. throw new TypeError("Cannot call a class as a function");
  9062. }
  9063. }
  9064. var SELECTORS = {
  9065. link: '[data-scroll-to]'
  9066. };
  9067. var Default = {
  9068. topOffset: 10,
  9069. animation: 'normal',
  9070. speed: 400,
  9071. constantSpeed: false
  9072. };
  9073. var ScrollTo = function () {
  9074. function ScrollTo(element, options) {
  9075. _classCallCheck(this, ScrollTo);
  9076. this.element = element;
  9077. this.options = options;
  9078. this.hash = $(element).attr('href');
  9079. this.target = $(this.hash);
  9080. if (!this.target.length) {
  9081. return;
  9082. }
  9083. this.getConfig();
  9084. this.bindEvents();
  9085. this.targetVisibility();
  9086. }
  9087. _createClass(ScrollTo, [{
  9088. key: 'bindEvents',
  9089. value: function bindEvents() {
  9090. var _this = this;
  9091. $(this.element).on('click', function (event) {
  9092. return _this.startScroll(event);
  9093. });
  9094. $(window).on('scroll', function (event) {
  9095. return _this.targetVisibility(event);
  9096. });
  9097. }
  9098. }, {
  9099. key: 'getConfig',
  9100. value: function getConfig() {
  9101. var dataConfig = this.element.data();
  9102. if (dataConfig.options) {
  9103. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  9104. } else {
  9105. this.dataOptions = {};
  9106. }
  9107. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  9108. }
  9109. }, {
  9110. key: 'startScroll',
  9111. value: function startScroll(event) {
  9112. this.targetPosition = this.target.offset().top + this.config.topOffset;
  9113. console.log(this.getAnimationSpeed());
  9114. $("body, html").stop().animate({
  9115. scrollTop: this.targetPosition
  9116. }, this.config.speed);
  9117. }
  9118. }, {
  9119. key: 'isOnScreen',
  9120. value: function isOnScreen() {
  9121. var win = $(window);
  9122. var viewport = {
  9123. top: win.scrollTop(),
  9124. left: win.scrollLeft()
  9125. };
  9126. viewport.right = viewport.left + win.width();
  9127. viewport.bottom = viewport.top + win.height();
  9128. var bounds = this.target.offset();
  9129. bounds.right = bounds.left + this.target.outerWidth();
  9130. bounds.bottom = bounds.top + this.target.outerHeight();
  9131. return !(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom);
  9132. }
  9133. }, {
  9134. key: 'targetVisibility',
  9135. value: function targetVisibility() {
  9136. if (this.isOnScreen()) {
  9137. this.onScreen();
  9138. } else {
  9139. this.outScreen();
  9140. }
  9141. }
  9142. }, {
  9143. key: 'onScreen',
  9144. value: function onScreen() {
  9145. if (typeof this.config.onScreen === 'function') {
  9146. this.config.onScreen(this.element, this.target);
  9147. }
  9148. }
  9149. }, {
  9150. key: 'outScreen',
  9151. value: function outScreen() {
  9152. if (typeof this.config.outScreen === 'function') {
  9153. this.config.outScreen(this.element, this.target);
  9154. }
  9155. }
  9156. }, {
  9157. key: 'getOffset',
  9158. value: function getOffset() {
  9159. return Math.abs(this.target.offset().top - $(window).scrollTop());
  9160. }
  9161. }, {
  9162. key: 'getAnimationSpeed',
  9163. value: function getAnimationSpeed() {
  9164. return this.getOffset() / this.config.speed * this.config.speed;
  9165. }
  9166. }]);
  9167. return ScrollTo;
  9168. }();
  9169. function initDataSelectors() {
  9170. $(SELECTORS.link).each(function () {
  9171. new ScrollTo($(this));
  9172. });
  9173. }
  9174. function initJqueryPlugin() {
  9175. $.fn.luScrollTo = function (options) {
  9176. return this.each(function () {
  9177. new ScrollTo($(this), options);
  9178. });
  9179. };
  9180. }
  9181. var init = {
  9182. initDataSelectors: initDataSelectors,
  9183. initJqueryPlugin: initJqueryPlugin
  9184. };
  9185. exports.default = init;
  9186. /***/ }),
  9187. /* 22 */
  9188. /***/ (function (module, exports, __webpack_require__) {
  9189. "use strict";
  9190. Object.defineProperty(exports, "__esModule", {
  9191. value: true
  9192. });
  9193. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  9194. return typeof obj;
  9195. } : function (obj) {
  9196. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  9197. };
  9198. var _createClass = function () {
  9199. function defineProperties(target, props) {
  9200. for (var i = 0; i < props.length; i++) {
  9201. var descriptor = props[i];
  9202. descriptor.enumerable = descriptor.enumerable || false;
  9203. descriptor.configurable = true;
  9204. if ("value" in descriptor)
  9205. descriptor.writable = true;
  9206. Object.defineProperty(target, descriptor.key, descriptor);
  9207. }
  9208. }
  9209. return function (Constructor, protoProps, staticProps) {
  9210. if (protoProps)
  9211. defineProperties(Constructor.prototype, protoProps);
  9212. if (staticProps)
  9213. defineProperties(Constructor, staticProps);
  9214. return Constructor;
  9215. };
  9216. }();
  9217. var _jquery = __webpack_require__(1);
  9218. var _jquery2 = _interopRequireDefault(_jquery);
  9219. var _util = __webpack_require__(0);
  9220. var _util2 = _interopRequireDefault(_util);
  9221. function _interopRequireDefault(obj) {
  9222. return obj && obj.__esModule ? obj : {default: obj};
  9223. }
  9224. function _classCallCheck(instance, Constructor) {
  9225. if (!(instance instanceof Constructor)) {
  9226. throw new TypeError("Cannot call a class as a function");
  9227. }
  9228. }
  9229. /**
  9230. * --------------------------------------------------------------------------
  9231. * Bootstrap (v4.0.0-beta): scrollspy.js
  9232. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  9233. * --------------------------------------------------------------------------
  9234. */
  9235. var ScrollSpy = function () {
  9236. /**
  9237. * ------------------------------------------------------------------------
  9238. * Constants
  9239. * ------------------------------------------------------------------------
  9240. */
  9241. var NAME = 'scrollspy';
  9242. var VERSION = '4.0.0-beta';
  9243. var DATA_KEY = 'bs.scrollspy';
  9244. var EVENT_KEY = '.' + DATA_KEY;
  9245. var DATA_API_KEY = '.data-api';
  9246. var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
  9247. var Default = {
  9248. offset: 10,
  9249. method: 'auto',
  9250. target: ''
  9251. };
  9252. var DefaultType = {
  9253. offset: 'number',
  9254. method: 'string',
  9255. target: '(string|element)'
  9256. };
  9257. var Event = {
  9258. ACTIVATE: 'activate' + EVENT_KEY,
  9259. SCROLL: 'scroll' + EVENT_KEY,
  9260. LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
  9261. };
  9262. var ClassName = {
  9263. DROPDOWN_ITEM: 'dropdown-item',
  9264. DROPDOWN_MENU: 'dropdown-menu',
  9265. ACTIVE: 'is-active'
  9266. };
  9267. var Selector = {
  9268. DATA_SPY: '[data-spy="scroll"]',
  9269. ACTIVE: '.is-active',
  9270. NAV_LIST_GROUP: '.nav, .list-group',
  9271. NAV_LINKS: '.nav__link',
  9272. NAV_ITEMS: '.nav__item',
  9273. LIST_ITEMS: '.list-group-item',
  9274. DROPDOWN: '.dropdown',
  9275. DROPDOWN_ITEMS: '.dropdown-item',
  9276. DROPDOWN_TOGGLE: '.dropdown-toggle'
  9277. };
  9278. var OffsetMethod = {
  9279. OFFSET: 'offset',
  9280. POSITION: 'position'
  9281. /**
  9282. * ------------------------------------------------------------------------
  9283. * Class Definition
  9284. * ------------------------------------------------------------------------
  9285. */
  9286. };
  9287. var ScrollSpy = function () {
  9288. function ScrollSpy(element, config) {
  9289. var _this = this;
  9290. _classCallCheck(this, ScrollSpy);
  9291. this._element = element;
  9292. this._scrollElement = element.tagName === 'BODY' ? window : element;
  9293. this._config = this._getConfig(config);
  9294. this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
  9295. this._offsets = [];
  9296. this._targets = [];
  9297. this._activeTarget = null;
  9298. this._scrollHeight = 0;
  9299. (0, _jquery2.default)(this._scrollElement).on(Event.SCROLL, function (event) {
  9300. return _this._process(event);
  9301. });
  9302. this.refresh();
  9303. this._process();
  9304. }
  9305. // getters
  9306. _createClass(ScrollSpy, [{
  9307. key: 'refresh',
  9308. // public
  9309. value: function refresh() {
  9310. var _this2 = this;
  9311. var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
  9312. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  9313. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  9314. this._offsets = [];
  9315. this._targets = [];
  9316. this._scrollHeight = this._getScrollHeight();
  9317. var targets = _jquery2.default.makeArray((0, _jquery2.default)(this._selector));
  9318. targets.map(function (element) {
  9319. var target = void 0;
  9320. var targetSelector = _util2.default.getSelectorFromElement(element);
  9321. if (targetSelector) {
  9322. target = (0, _jquery2.default)(targetSelector)[0];
  9323. }
  9324. if (target) {
  9325. var targetBCR = target.getBoundingClientRect();
  9326. if (targetBCR.width || targetBCR.height) {
  9327. // todo (fat): remove sketch reliance on jQuery position/offset
  9328. return [(0, _jquery2.default)(target)[offsetMethod]().top + offsetBase, targetSelector];
  9329. }
  9330. }
  9331. return null;
  9332. }).filter(function (item) {
  9333. return item;
  9334. }).sort(function (a, b) {
  9335. return a[0] - b[0];
  9336. }).forEach(function (item) {
  9337. _this2._offsets.push(item[0]);
  9338. _this2._targets.push(item[1]);
  9339. });
  9340. }
  9341. }, {
  9342. key: 'dispose',
  9343. value: function dispose() {
  9344. _jquery2.default.removeData(this._element, DATA_KEY);
  9345. (0, _jquery2.default)(this._scrollElement).off(EVENT_KEY);
  9346. this._element = null;
  9347. this._scrollElement = null;
  9348. this._config = null;
  9349. this._selector = null;
  9350. this._offsets = null;
  9351. this._targets = null;
  9352. this._activeTarget = null;
  9353. this._scrollHeight = null;
  9354. }
  9355. // private
  9356. }, {
  9357. key: '_getConfig',
  9358. value: function _getConfig(config) {
  9359. config = _jquery2.default.extend({}, Default, config);
  9360. if (typeof config.target !== 'string') {
  9361. var id = (0, _jquery2.default)(config.target).attr('id');
  9362. if (!id) {
  9363. id = _util2.default.getUID(NAME);
  9364. (0, _jquery2.default)(config.target).attr('id', id);
  9365. }
  9366. config.target = '#' + id;
  9367. }
  9368. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  9369. return config;
  9370. }
  9371. }, {
  9372. key: '_getScrollTop',
  9373. value: function _getScrollTop() {
  9374. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  9375. }
  9376. }, {
  9377. key: '_getScrollHeight',
  9378. value: function _getScrollHeight() {
  9379. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  9380. }
  9381. }, {
  9382. key: '_getOffsetHeight',
  9383. value: function _getOffsetHeight() {
  9384. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  9385. }
  9386. }, {
  9387. key: '_process',
  9388. value: function _process() {
  9389. var scrollTop = this._getScrollTop() + this._config.offset;
  9390. var scrollHeight = this._getScrollHeight();
  9391. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  9392. if (this._scrollHeight !== scrollHeight) {
  9393. this.refresh();
  9394. }
  9395. if (scrollTop >= maxScroll) {
  9396. var target = this._targets[this._targets.length - 1];
  9397. if (this._activeTarget !== target) {
  9398. this._activate(target);
  9399. }
  9400. return;
  9401. }
  9402. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  9403. this._activeTarget = null;
  9404. this._clear();
  9405. return;
  9406. }
  9407. for (var i = this._offsets.length; i--; ) {
  9408. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  9409. if (isActiveTarget) {
  9410. this._activate(this._targets[i]);
  9411. }
  9412. }
  9413. }
  9414. }, {
  9415. key: '_activate',
  9416. value: function _activate(target) {
  9417. this._activeTarget = target;
  9418. this._clear();
  9419. var queries = this._selector.split(',');
  9420. // eslint-disable-next-line arrow-body-style
  9421. queries = queries.map(function (selector) {
  9422. return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
  9423. });
  9424. var $link = (0, _jquery2.default)(queries.join(','));
  9425. if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
  9426. $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  9427. $link.addClass(ClassName.ACTIVE);
  9428. } else {
  9429. // Set triggered link as active
  9430. $link.addClass(ClassName.ACTIVE);
  9431. // Set triggered links parents as active
  9432. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  9433. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE);
  9434. // Handle special case when .nav-link is inside .nav-item
  9435. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).addClass(ClassName.ACTIVE);
  9436. }
  9437. (0, _jquery2.default)(this._scrollElement).trigger(Event.ACTIVATE, {
  9438. relatedTarget: target
  9439. });
  9440. }
  9441. }, {
  9442. key: '_clear',
  9443. value: function _clear() {
  9444. (0, _jquery2.default)(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  9445. }
  9446. // static
  9447. }], [{
  9448. key: '_jQueryInterface',
  9449. value: function _jQueryInterface(config) {
  9450. return this.each(function () {
  9451. var data = (0, _jquery2.default)(this).data(DATA_KEY);
  9452. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
  9453. if (!data) {
  9454. data = new ScrollSpy(this, _config);
  9455. (0, _jquery2.default)(this).data(DATA_KEY, data);
  9456. }
  9457. if (typeof config === 'string') {
  9458. if (typeof data[config] === 'undefined') {
  9459. throw new Error('No method named "' + config + '"');
  9460. }
  9461. data[config]();
  9462. }
  9463. });
  9464. }
  9465. }, {
  9466. key: 'VERSION',
  9467. get: function get() {
  9468. return VERSION;
  9469. }
  9470. }, {
  9471. key: 'Default',
  9472. get: function get() {
  9473. return Default;
  9474. }
  9475. }]);
  9476. return ScrollSpy;
  9477. }();
  9478. /**
  9479. * ------------------------------------------------------------------------
  9480. * Data Api implementation
  9481. * ------------------------------------------------------------------------
  9482. */
  9483. (0, _jquery2.default)(window).on(Event.LOAD_DATA_API, function () {
  9484. var scrollSpys = _jquery2.default.makeArray((0, _jquery2.default)(Selector.DATA_SPY));
  9485. for (var i = scrollSpys.length; i--; ) {
  9486. var $spy = (0, _jquery2.default)(scrollSpys[i]);
  9487. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  9488. }
  9489. });
  9490. /**
  9491. * ------------------------------------------------------------------------
  9492. * jQuery
  9493. * ------------------------------------------------------------------------
  9494. */
  9495. _jquery2.default.fn[NAME] = ScrollSpy._jQueryInterface;
  9496. _jquery2.default.fn[NAME].Constructor = ScrollSpy;
  9497. _jquery2.default.fn[NAME].noConflict = function () {
  9498. _jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
  9499. return ScrollSpy._jQueryInterface;
  9500. };
  9501. return ScrollSpy;
  9502. }(_jquery2.default);
  9503. exports.default = ScrollSpy;
  9504. /***/ }),
  9505. /* 23 */
  9506. /***/ (function (module, exports, __webpack_require__) {
  9507. "use strict";
  9508. Object.defineProperty(exports, "__esModule", {
  9509. value: true
  9510. });
  9511. var _createClass = function () {
  9512. function defineProperties(target, props) {
  9513. for (var i = 0; i < props.length; i++) {
  9514. var descriptor = props[i];
  9515. descriptor.enumerable = descriptor.enumerable || false;
  9516. descriptor.configurable = true;
  9517. if ("value" in descriptor)
  9518. descriptor.writable = true;
  9519. Object.defineProperty(target, descriptor.key, descriptor);
  9520. }
  9521. }
  9522. return function (Constructor, protoProps, staticProps) {
  9523. if (protoProps)
  9524. defineProperties(Constructor.prototype, protoProps);
  9525. if (staticProps)
  9526. defineProperties(Constructor, staticProps);
  9527. return Constructor;
  9528. };
  9529. }();
  9530. var _stickySidebar = __webpack_require__(33);
  9531. var _stickySidebar2 = _interopRequireDefault(_stickySidebar);
  9532. var _util = __webpack_require__(0);
  9533. var _util2 = _interopRequireDefault(_util);
  9534. function _interopRequireDefault(obj) {
  9535. return obj && obj.__esModule ? obj : {default: obj};
  9536. }
  9537. function _classCallCheck(instance, Constructor) {
  9538. if (!(instance instanceof Constructor)) {
  9539. throw new TypeError("Cannot call a class as a function");
  9540. }
  9541. }
  9542. var SELECTORS = {
  9543. stickyElement: '[data-sticky]'
  9544. };
  9545. var Default = {
  9546. topOffset: 0,
  9547. bottomOffset: 0
  9548. };
  9549. var Sticky = function () {
  9550. function Sticky(element, options) {
  9551. _classCallCheck(this, Sticky);
  9552. this.element = element;
  9553. this.options = options;
  9554. this.getConfig();
  9555. this.initPlugn();
  9556. this.bindEvents();
  9557. }
  9558. _createClass(Sticky, [{
  9559. key: 'getConfig',
  9560. value: function getConfig() {
  9561. var dataConfig = this.element.data();
  9562. if (dataConfig.options) {
  9563. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  9564. } else {
  9565. this.dataOptions = {};
  9566. }
  9567. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  9568. }
  9569. }, {
  9570. key: 'initPlugn',
  9571. value: function initPlugn() {
  9572. this.stickyInstance = new _stickySidebar2.default(this.element[0], {
  9573. topSpacing: this.config.topOffset,
  9574. bottomSpacing: this.config.bottomOffset,
  9575. containerSelector: this.config.container,
  9576. resizeSensor: true,
  9577. stickyClass: 'is-sticky'
  9578. });
  9579. if (typeof this.config.onOpen === 'function') {
  9580. this.config.onInit(this.stickyInstance);
  9581. }
  9582. }
  9583. }, {
  9584. key: 'bindEvents',
  9585. value: function bindEvents() {}
  9586. }]);
  9587. return Sticky;
  9588. }();
  9589. function initDataSelectors() {
  9590. $(SELECTORS.stickyElement).each(function () {
  9591. new Sticky($(this));
  9592. });
  9593. }
  9594. function initJqueryPlugin() {
  9595. $.fn.luSticky = function (options) {
  9596. return this.each(function () {
  9597. new Sticky($(this), options);
  9598. });
  9599. };
  9600. }
  9601. var init = {
  9602. initDataSelectors: initDataSelectors,
  9603. initJqueryPlugin: initJqueryPlugin
  9604. };
  9605. exports.default = init;
  9606. /***/ }),
  9607. /* 24 */
  9608. /***/ (function (module, exports, __webpack_require__) {
  9609. "use strict";
  9610. Object.defineProperty(exports, "__esModule", {
  9611. value: true
  9612. });
  9613. var _createClass = function () {
  9614. function defineProperties(target, props) {
  9615. for (var i = 0; i < props.length; i++) {
  9616. var descriptor = props[i];
  9617. descriptor.enumerable = descriptor.enumerable || false;
  9618. descriptor.configurable = true;
  9619. if ("value" in descriptor)
  9620. descriptor.writable = true;
  9621. Object.defineProperty(target, descriptor.key, descriptor);
  9622. }
  9623. }
  9624. return function (Constructor, protoProps, staticProps) {
  9625. if (protoProps)
  9626. defineProperties(Constructor.prototype, protoProps);
  9627. if (staticProps)
  9628. defineProperties(Constructor, staticProps);
  9629. return Constructor;
  9630. };
  9631. }();
  9632. var _util = __webpack_require__(0);
  9633. var _util2 = _interopRequireDefault(_util);
  9634. function _interopRequireDefault(obj) {
  9635. return obj && obj.__esModule ? obj : {default: obj};
  9636. }
  9637. function _classCallCheck(instance, Constructor) {
  9638. if (!(instance instanceof Constructor)) {
  9639. throw new TypeError("Cannot call a class as a function");
  9640. }
  9641. }
  9642. var SELECTORS = {
  9643. toggler: '[data-toggler]',
  9644. togglerOptions: '[data-toggler-options]'
  9645. };
  9646. var Default = {
  9647. selectors: '',
  9648. container: 'body'
  9649. };
  9650. var Toggler = function () {
  9651. function Toggler(element, options) {
  9652. _classCallCheck(this, Toggler);
  9653. this.element = element;
  9654. this.targets = [];
  9655. this.getConfig();
  9656. this.targetsNames = this.config.selectors.split(',');
  9657. this.setTargetElements();
  9658. this.bindEvents();
  9659. }
  9660. _createClass(Toggler, [{
  9661. key: 'bindEvents',
  9662. value: function bindEvents() {
  9663. var _this = this;
  9664. this.config = this.element.on('click', function () {
  9665. return _this.toggle();
  9666. });
  9667. }
  9668. }, {
  9669. key: 'getConfig',
  9670. value: function getConfig() {
  9671. var dataToggler = this.getTogglerOptions(this.element.data('toggler'));
  9672. this.config = $.extend({}, Default, dataToggler);
  9673. }
  9674. }, {
  9675. key: 'getTogglerOptions',
  9676. value: function getTogglerOptions(options) {
  9677. if (options) {
  9678. return _util2.default.parseDataOptions(options);
  9679. } else {
  9680. return [];
  9681. }
  9682. }
  9683. }, {
  9684. key: 'setTargetElements',
  9685. value: function setTargetElements() {
  9686. this.container = this.element.closest(this.config.container);
  9687. if (this.targetsNames.length > 1) {
  9688. var _iteratorNormalCompletion = true;
  9689. var _didIteratorError = false;
  9690. var _iteratorError = undefined;
  9691. try {
  9692. for (var _iterator = this.targetsNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  9693. var target = _step.value;
  9694. var element = this.container.find(target);
  9695. this.targets.push({
  9696. element: element,
  9697. options: this.getTogglerOptions(element.data('toggler-options'))
  9698. });
  9699. }
  9700. } catch (err) {
  9701. _didIteratorError = true;
  9702. _iteratorError = err;
  9703. } finally {
  9704. try {
  9705. if (!_iteratorNormalCompletion && _iterator.return) {
  9706. _iterator.return();
  9707. }
  9708. } finally {
  9709. if (_didIteratorError) {
  9710. throw _iteratorError;
  9711. }
  9712. }
  9713. }
  9714. }
  9715. if (this.container) {
  9716. this.targets.push({
  9717. element: this.container,
  9718. options: this.getTogglerOptions(this.container.data('toggler-options'))
  9719. });
  9720. }
  9721. }
  9722. }, {
  9723. key: 'toggle',
  9724. value: function toggle() {
  9725. for (var targetName in this.targets) {
  9726. var _targets$targetName = this.targets[targetName],
  9727. element = _targets$targetName.element,
  9728. options = _targets$targetName.options;
  9729. if (options.addClass)
  9730. element.addClass(options.addClass);
  9731. if (options.removeClass)
  9732. element.removeClass(options.removeClass);
  9733. if (options.toggleClass)
  9734. element.toggleClass(options.toggleClass);
  9735. }
  9736. }
  9737. }]);
  9738. return Toggler;
  9739. }();
  9740. function initDataSelectors() {
  9741. $(SELECTORS.toggler).each(function () {
  9742. new Toggler($(this));
  9743. });
  9744. }
  9745. function initJqueryPlugin() {
  9746. $.fn.luToggler = function (options) {
  9747. return this.each(function () {
  9748. new Toggler($(this), options);
  9749. });
  9750. };
  9751. }
  9752. var init = {
  9753. initDataSelectors: initDataSelectors,
  9754. initJqueryPlugin: initJqueryPlugin
  9755. };
  9756. exports.default = init;
  9757. /***/ }),
  9758. /* 25 */,
  9759. /* 26 */,
  9760. /* 27 */,
  9761. /* 28 */
  9762. /***/ (function (module, exports, __webpack_require__) {
  9763. "use strict";
  9764. var _navs = __webpack_require__(17);
  9765. var _navs2 = _interopRequireDefault(_navs);
  9766. var _switcher = __webpack_require__(18);
  9767. var _switcher2 = _interopRequireDefault(_switcher);
  9768. __webpack_require__(19);
  9769. __webpack_require__(11);
  9770. var _selects = __webpack_require__(13);
  9771. var _selects2 = _interopRequireDefault(_selects);
  9772. var _selectInput = __webpack_require__(3);
  9773. var _selectInput2 = _interopRequireDefault(_selectInput);
  9774. var _CheckAll = __webpack_require__(10);
  9775. var _CheckAll2 = _interopRequireDefault(_CheckAll);
  9776. var _rangeSlider = __webpack_require__(12);
  9777. var _rangeSlider2 = _interopRequireDefault(_rangeSlider);
  9778. var _dropdown = __webpack_require__(8);
  9779. var _dropdown2 = _interopRequireDefault(_dropdown);
  9780. var _tooltips = __webpack_require__(9);
  9781. var _tooltips2 = _interopRequireDefault(_tooltips);
  9782. __webpack_require__(16);
  9783. var _alert = __webpack_require__(15);
  9784. var _alert2 = _interopRequireDefault(_alert);
  9785. var _contentSlider = __webpack_require__(7);
  9786. var _contentSlider2 = _interopRequireDefault(_contentSlider);
  9787. var _scrollTo = __webpack_require__(21);
  9788. var _scrollTo2 = _interopRequireDefault(_scrollTo);
  9789. var _offCanvas = __webpack_require__(20);
  9790. var _offCanvas2 = _interopRequireDefault(_offCanvas);
  9791. var _inlineEditor = __webpack_require__(14);
  9792. var _inlineEditor2 = _interopRequireDefault(_inlineEditor);
  9793. __webpack_require__(6);
  9794. var _sticky = __webpack_require__(23);
  9795. var _sticky2 = _interopRequireDefault(_sticky);
  9796. var _toggler = __webpack_require__(24);
  9797. var _toggler2 = _interopRequireDefault(_toggler);
  9798. __webpack_require__(22);
  9799. function _interopRequireDefault(obj) {
  9800. return obj && obj.__esModule ? obj : {default: obj};
  9801. }
  9802. $ = window.jQuery;
  9803. //navs
  9804. //forms
  9805. //dropdowns
  9806. //modals
  9807. //other
  9808. // *** Init plugin via data atributes ***
  9809. //init (old)
  9810. _selectInput2.default.init();
  9811. _rangeSlider2.default.init();
  9812. window.layers = {
  9813. alert: _alert2.default
  9814. };
  9815. $(document).ready(function () {
  9816. //navs
  9817. // navs.initDataSelectors();
  9818. // navs.initJqueryPlugin();
  9819. _navs2.default.init();
  9820. //Alerts
  9821. // alert.initDataSelectors();
  9822. // alert.initJqueryPlugin();
  9823. _alert2.default.init();
  9824. //Dropdown
  9825. _dropdown2.default.initDataSelectors();
  9826. //Tooltips
  9827. _tooltips2.default.initDataSelectors();
  9828. //Inline Editor
  9829. _inlineEditor2.default.initDataSelectors();
  9830. //Content Slider
  9831. _contentSlider2.default.initDataSelectors();
  9832. //Selects
  9833. _selects2.default.initDataSelectors();
  9834. //Check all
  9835. _CheckAll2.default.initDataSelectors();
  9836. //Sticky
  9837. _sticky2.default.initDataSelectors();
  9838. //Scroll To
  9839. _scrollTo2.default.initDataSelectors();
  9840. //off Canvas
  9841. _offCanvas2.default.initDataSelectors();
  9842. //toggler
  9843. _toggler2.default.initDataSelectors();
  9844. //Switcher
  9845. _switcher2.default.initDataSelectors();
  9846. });
  9847. //*** Add plugins to juqery interface ***
  9848. //Dropdown
  9849. _dropdown2.default.initJqueryPlugin();
  9850. //Tooltips
  9851. _tooltips2.default.initJqueryPlugin();
  9852. //Inline Editor
  9853. _inlineEditor2.default.initJqueryPlugin();
  9854. //Content Slider
  9855. _contentSlider2.default.initJqueryPlugin();
  9856. //Switcher
  9857. _switcher2.default.initJqueryPlugin();
  9858. //Selects
  9859. _selects2.default.initJqueryPlugin();
  9860. //Check all
  9861. _CheckAll2.default.initJqueryPlugin();
  9862. //Sticky
  9863. _sticky2.default.initJqueryPlugin();
  9864. //Scroll To
  9865. _scrollTo2.default.initJqueryPlugin();
  9866. //off Canvas
  9867. _offCanvas2.default.initJqueryPlugin();
  9868. //toggler
  9869. _toggler2.default.initJqueryPlugin();
  9870. /***/ }),
  9871. /* 29 */
  9872. /***/ (function (module, exports, __webpack_require__) {
  9873. "use strict";
  9874. var __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_0__factory, __WEBPACK_LOCAL_MODULE_0__module;
  9875. var __WEBPACK_LOCAL_MODULE_1__, __WEBPACK_LOCAL_MODULE_1__factory, __WEBPACK_LOCAL_MODULE_1__module;
  9876. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  9877. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  9878. return typeof obj;
  9879. } : function (obj) {
  9880. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  9881. };
  9882. /**
  9883. * sifter.js
  9884. * Copyright (c) 2013 Brian Reavis & contributors
  9885. *
  9886. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9887. * file except in compliance with the License. You may obtain a copy of the License at:
  9888. * http://www.apache.org/licenses/LICENSE-2.0
  9889. *
  9890. * Unless required by applicable law or agreed to in writing, software distributed under
  9891. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9892. * ANY KIND, either express or implied. See the License for the specific language
  9893. * governing permissions and limitations under the License.
  9894. *
  9895. * @author Brian Reavis <brian@thirdroute.com>
  9896. */
  9897. (function (root, factory) {
  9898. if (true) {
  9899. !(__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));
  9900. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9901. module.exports = factory();
  9902. } else {
  9903. root.Sifter = factory();
  9904. }
  9905. })(undefined, function () {
  9906. /**
  9907. * Textually searches arrays and hashes of objects
  9908. * by property (or multiple properties). Designed
  9909. * specifically for autocomplete.
  9910. *
  9911. * @constructor
  9912. * @param {array|object} items
  9913. * @param {object} items
  9914. */
  9915. var Sifter = function Sifter(items, settings) {
  9916. this.items = items;
  9917. this.settings = settings || {diacritics: true};
  9918. };
  9919. /**
  9920. * Splits a search string into an array of individual
  9921. * regexps to be used to match results.
  9922. *
  9923. * @param {string} query
  9924. * @returns {array}
  9925. */
  9926. Sifter.prototype.tokenize = function (query) {
  9927. query = trim(String(query || '').toLowerCase());
  9928. if (!query || !query.length)
  9929. return [];
  9930. var i, n, regex, letter;
  9931. var tokens = [];
  9932. var words = query.split(/ +/);
  9933. for (i = 0, n = words.length; i < n; i++) {
  9934. regex = escape_regex(words[i]);
  9935. if (this.settings.diacritics) {
  9936. for (letter in DIACRITICS) {
  9937. if (DIACRITICS.hasOwnProperty(letter)) {
  9938. regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);
  9939. }
  9940. }
  9941. }
  9942. tokens.push({
  9943. string: words[i],
  9944. regex: new RegExp(regex, 'i')
  9945. });
  9946. }
  9947. return tokens;
  9948. };
  9949. /**
  9950. * Iterates over arrays and hashes.
  9951. *
  9952. * ```
  9953. * this.iterator(this.items, function(item, id) {
  9954. * // invoked for each item
  9955. * });
  9956. * ```
  9957. *
  9958. * @param {array|object} object
  9959. */
  9960. Sifter.prototype.iterator = function (object, callback) {
  9961. var iterator;
  9962. if (is_array(object)) {
  9963. iterator = Array.prototype.forEach || function (callback) {
  9964. for (var i = 0, n = this.length; i < n; i++) {
  9965. callback(this[i], i, this);
  9966. }
  9967. };
  9968. } else {
  9969. iterator = function iterator(callback) {
  9970. for (var key in this) {
  9971. if (this.hasOwnProperty(key)) {
  9972. callback(this[key], key, this);
  9973. }
  9974. }
  9975. };
  9976. }
  9977. iterator.apply(object, [callback]);
  9978. };
  9979. /**
  9980. * Returns a function to be used to score individual results.
  9981. *
  9982. * Good matches will have a higher score than poor matches.
  9983. * If an item is not a match, 0 will be returned by the function.
  9984. *
  9985. * @param {object|string} search
  9986. * @param {object} options (optional)
  9987. * @returns {function}
  9988. */
  9989. Sifter.prototype.getScoreFunction = function (search, options) {
  9990. var self, fields, tokens, token_count, nesting;
  9991. self = this;
  9992. search = self.prepareSearch(search, options);
  9993. tokens = search.tokens;
  9994. fields = search.options.fields;
  9995. token_count = tokens.length;
  9996. nesting = search.options.nesting;
  9997. /**
  9998. * Calculates how close of a match the
  9999. * given value is against a search token.
  10000. *
  10001. * @param {mixed} value
  10002. * @param {object} token
  10003. * @return {number}
  10004. */
  10005. var scoreValue = function scoreValue(value, token) {
  10006. var score, pos;
  10007. if (!value)
  10008. return 0;
  10009. value = String(value || '');
  10010. pos = value.search(token.regex);
  10011. if (pos === - 1)
  10012. return 0;
  10013. score = token.string.length / value.length;
  10014. if (pos === 0)
  10015. score += 0.5;
  10016. return score;
  10017. };
  10018. /**
  10019. * Calculates the score of an object
  10020. * against the search query.
  10021. *
  10022. * @param {object} token
  10023. * @param {object} data
  10024. * @return {number}
  10025. */
  10026. var scoreObject = function () {
  10027. var field_count = fields.length;
  10028. if (!field_count) {
  10029. return function () {
  10030. return 0;
  10031. };
  10032. }
  10033. if (field_count === 1) {
  10034. return function (token, data) {
  10035. return scoreValue(getattr(data, fields[0], nesting), token);
  10036. };
  10037. }
  10038. return function (token, data) {
  10039. for (var i = 0, sum = 0; i < field_count; i++) {
  10040. sum += scoreValue(getattr(data, fields[i], nesting), token);
  10041. }
  10042. return sum / field_count;
  10043. };
  10044. }();
  10045. if (!token_count) {
  10046. return function () {
  10047. return 0;
  10048. };
  10049. }
  10050. if (token_count === 1) {
  10051. return function (data) {
  10052. return scoreObject(tokens[0], data);
  10053. };
  10054. }
  10055. if (search.options.conjunction === 'and') {
  10056. return function (data) {
  10057. var score;
  10058. for (var i = 0, sum = 0; i < token_count; i++) {
  10059. score = scoreObject(tokens[i], data);
  10060. if (score <= 0)
  10061. return 0;
  10062. sum += score;
  10063. }
  10064. return sum / token_count;
  10065. };
  10066. } else {
  10067. return function (data) {
  10068. for (var i = 0, sum = 0; i < token_count; i++) {
  10069. sum += scoreObject(tokens[i], data);
  10070. }
  10071. return sum / token_count;
  10072. };
  10073. }
  10074. };
  10075. /**
  10076. * Returns a function that can be used to compare two
  10077. * results, for sorting purposes. If no sorting should
  10078. * be performed, `null` will be returned.
  10079. *
  10080. * @param {string|object} search
  10081. * @param {object} options
  10082. * @return function(a,b)
  10083. */
  10084. Sifter.prototype.getSortFunction = function (search, options) {
  10085. var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
  10086. self = this;
  10087. search = self.prepareSearch(search, options);
  10088. sort = !search.query && options.sort_empty || options.sort;
  10089. /**
  10090. * Fetches the specified sort field value
  10091. * from a search result item.
  10092. *
  10093. * @param {string} name
  10094. * @param {object} result
  10095. * @return {mixed}
  10096. */
  10097. get_field = function get_field(name, result) {
  10098. if (name === '$score')
  10099. return result.score;
  10100. return getattr(self.items[result.id], name, options.nesting);
  10101. };
  10102. // parse options
  10103. fields = [];
  10104. if (sort) {
  10105. for (i = 0, n = sort.length; i < n; i++) {
  10106. if (search.query || sort[i].field !== '$score') {
  10107. fields.push(sort[i]);
  10108. }
  10109. }
  10110. }
  10111. // the "$score" field is implied to be the primary
  10112. // sort field, unless it's manually specified
  10113. if (search.query) {
  10114. implicit_score = true;
  10115. for (i = 0, n = fields.length; i < n; i++) {
  10116. if (fields[i].field === '$score') {
  10117. implicit_score = false;
  10118. break;
  10119. }
  10120. }
  10121. if (implicit_score) {
  10122. fields.unshift({field: '$score', direction: 'desc'});
  10123. }
  10124. } else {
  10125. for (i = 0, n = fields.length; i < n; i++) {
  10126. if (fields[i].field === '$score') {
  10127. fields.splice(i, 1);
  10128. break;
  10129. }
  10130. }
  10131. }
  10132. multipliers = [];
  10133. for (i = 0, n = fields.length; i < n; i++) {
  10134. multipliers.push(fields[i].direction === 'desc' ? - 1 : 1);
  10135. }
  10136. // build function
  10137. fields_count = fields.length;
  10138. if (!fields_count) {
  10139. return null;
  10140. } else if (fields_count === 1) {
  10141. field = fields[0].field;
  10142. multiplier = multipliers[0];
  10143. return function (a, b) {
  10144. return multiplier * cmp(get_field(field, a), get_field(field, b));
  10145. };
  10146. } else {
  10147. return function (a, b) {
  10148. var i, result, a_value, b_value, field;
  10149. for (i = 0; i < fields_count; i++) {
  10150. field = fields[i].field;
  10151. result = multipliers[i] * cmp(get_field(field, a), get_field(field, b));
  10152. if (result)
  10153. return result;
  10154. }
  10155. return 0;
  10156. };
  10157. }
  10158. };
  10159. /**
  10160. * Parses a search query and returns an object
  10161. * with tokens and fields ready to be populated
  10162. * with results.
  10163. *
  10164. * @param {string} query
  10165. * @param {object} options
  10166. * @returns {object}
  10167. */
  10168. Sifter.prototype.prepareSearch = function (query, options) {
  10169. if ((typeof query === 'undefined' ? 'undefined' : _typeof(query)) === 'object')
  10170. return query;
  10171. options = extend({}, options);
  10172. var option_fields = options.fields;
  10173. var option_sort = options.sort;
  10174. var option_sort_empty = options.sort_empty;
  10175. if (option_fields && !is_array(option_fields))
  10176. options.fields = [option_fields];
  10177. if (option_sort && !is_array(option_sort))
  10178. options.sort = [option_sort];
  10179. if (option_sort_empty && !is_array(option_sort_empty))
  10180. options.sort_empty = [option_sort_empty];
  10181. return {
  10182. options: options,
  10183. query: String(query || '').toLowerCase(),
  10184. tokens: this.tokenize(query),
  10185. total: 0,
  10186. items: []
  10187. };
  10188. };
  10189. /**
  10190. * Searches through all items and returns a sorted array of matches.
  10191. *
  10192. * The `options` parameter can contain:
  10193. *
  10194. * - fields {string|array}
  10195. * - sort {array}
  10196. * - score {function}
  10197. * - filter {bool}
  10198. * - limit {integer}
  10199. *
  10200. * Returns an object containing:
  10201. *
  10202. * - options {object}
  10203. * - query {string}
  10204. * - tokens {array}
  10205. * - total {int}
  10206. * - items {array}
  10207. *
  10208. * @param {string} query
  10209. * @param {object} options
  10210. * @returns {object}
  10211. */
  10212. Sifter.prototype.search = function (query, options) {
  10213. var self = this,
  10214. value,
  10215. score,
  10216. search,
  10217. calculateScore;
  10218. var fn_sort;
  10219. var fn_score;
  10220. search = this.prepareSearch(query, options);
  10221. options = search.options;
  10222. query = search.query;
  10223. // generate result scoring function
  10224. fn_score = options.score || self.getScoreFunction(search);
  10225. // perform search and sort
  10226. if (query.length) {
  10227. self.iterator(self.items, function (item, id) {
  10228. score = fn_score(item);
  10229. if (options.filter === false || score > 0) {
  10230. search.items.push({'score': score, 'id': id});
  10231. }
  10232. });
  10233. } else {
  10234. self.iterator(self.items, function (item, id) {
  10235. search.items.push({'score': 1, 'id': id});
  10236. });
  10237. }
  10238. fn_sort = self.getSortFunction(search, options);
  10239. if (fn_sort)
  10240. search.items.sort(fn_sort);
  10241. // apply limits
  10242. search.total = search.items.length;
  10243. if (typeof options.limit === 'number') {
  10244. search.items = search.items.slice(0, options.limit);
  10245. }
  10246. return search;
  10247. };
  10248. // utilities
  10249. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10250. var cmp = function cmp(a, b) {
  10251. if (typeof a === 'number' && typeof b === 'number') {
  10252. return a > b ? 1 : a < b ? - 1 : 0;
  10253. }
  10254. a = asciifold(String(a || ''));
  10255. b = asciifold(String(b || ''));
  10256. if (a > b)
  10257. return 1;
  10258. if (b > a)
  10259. return - 1;
  10260. return 0;
  10261. };
  10262. var extend = function extend(a, b) {
  10263. var i, n, k, object;
  10264. for (i = 1, n = arguments.length; i < n; i++) {
  10265. object = arguments[i];
  10266. if (!object)
  10267. continue;
  10268. for (k in object) {
  10269. if (object.hasOwnProperty(k)) {
  10270. a[k] = object[k];
  10271. }
  10272. }
  10273. }
  10274. return a;
  10275. };
  10276. /**
  10277. * A property getter resolving dot-notation
  10278. * @param {Object} obj The root object to fetch property on
  10279. * @param {String} name The optionally dotted property name to fetch
  10280. * @param {Boolean} nesting Handle nesting or not
  10281. * @return {Object} The resolved property value
  10282. */
  10283. var getattr = function getattr(obj, name, nesting) {
  10284. if (!obj || !name)
  10285. return;
  10286. if (!nesting)
  10287. return obj[name];
  10288. var names = name.split(".");
  10289. while (names.length && (obj = obj[names.shift()])) {
  10290. }
  10291. return obj;
  10292. };
  10293. var trim = function trim(str) {
  10294. return (str + '').replace(/^\s+|\s+$|/g, '');
  10295. };
  10296. var escape_regex = function escape_regex(str) {
  10297. return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
  10298. };
  10299. var is_array = Array.isArray || typeof $ !== 'undefined' && $.isArray || function (object) {
  10300. return Object.prototype.toString.call(object) === '[object Array]';
  10301. };
  10302. var DIACRITICS = {
  10303. 'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',
  10304. 'b': '[b␢βΒB฿𐌁ᛒ]',
  10305. 'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',
  10306. 'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',
  10307. 'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',
  10308. 'f': '[fƑƒḞḟ]',
  10309. 'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',
  10310. 'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',
  10311. 'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',
  10312. 'j': '[jȷĴĵɈɉʝɟʲ]',
  10313. 'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',
  10314. 'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',
  10315. 'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',
  10316. 'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',
  10317. 'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',
  10318. 'q': '[qꝖꝗʠɊɋꝘꝙq̃]',
  10319. 'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',
  10320. 's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',
  10321. 't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',
  10322. 'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',
  10323. 'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',
  10324. 'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',
  10325. 'x': '[xẌẍẊẋχ]',
  10326. 'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',
  10327. 'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'
  10328. };
  10329. var asciifold = function () {
  10330. var i, n, k, chunk;
  10331. var foreignletters = '';
  10332. var lookup = {};
  10333. for (k in DIACRITICS) {
  10334. if (DIACRITICS.hasOwnProperty(k)) {
  10335. chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);
  10336. foreignletters += chunk;
  10337. for (i = 0, n = chunk.length; i < n; i++) {
  10338. lookup[chunk.charAt(i)] = k;
  10339. }
  10340. }
  10341. }
  10342. var regexp = new RegExp('[' + foreignletters + ']', 'g');
  10343. return function (str) {
  10344. return str.replace(regexp, function (foreignletter) {
  10345. return lookup[foreignletter];
  10346. }).toLowerCase();
  10347. };
  10348. }();
  10349. // export
  10350. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10351. return Sifter;
  10352. });
  10353. /**
  10354. * microplugin.js
  10355. * Copyright (c) 2013 Brian Reavis & contributors
  10356. *
  10357. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  10358. * file except in compliance with the License. You may obtain a copy of the License at:
  10359. * http://www.apache.org/licenses/LICENSE-2.0
  10360. *
  10361. * Unless required by applicable law or agreed to in writing, software distributed under
  10362. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  10363. * ANY KIND, either express or implied. See the License for the specific language
  10364. * governing permissions and limitations under the License.
  10365. *
  10366. * @author Brian Reavis <brian@thirdroute.com>
  10367. */
  10368. (function (root, factory) {
  10369. if (true) {
  10370. !(__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));
  10371. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  10372. module.exports = factory();
  10373. } else {
  10374. root.MicroPlugin = factory();
  10375. }
  10376. })(undefined, function () {
  10377. var MicroPlugin = {};
  10378. MicroPlugin.mixin = function (Interface) {
  10379. Interface.plugins = {};
  10380. /**
  10381. * Initializes the listed plugins (with options).
  10382. * Acceptable formats:
  10383. *
  10384. * List (without options):
  10385. * ['a', 'b', 'c']
  10386. *
  10387. * List (with options):
  10388. * [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
  10389. *
  10390. * Hash (with options):
  10391. * {'a': { ... }, 'b': { ... }, 'c': { ... }}
  10392. *
  10393. * @param {mixed} plugins
  10394. */
  10395. Interface.prototype.initializePlugins = function (plugins) {
  10396. var i, n, key;
  10397. var self = this;
  10398. var queue = [];
  10399. self.plugins = {
  10400. names: [],
  10401. settings: {},
  10402. requested: {},
  10403. loaded: {}
  10404. };
  10405. if (utils.isArray(plugins)) {
  10406. for (i = 0, n = plugins.length; i < n; i++) {
  10407. if (typeof plugins[i] === 'string') {
  10408. queue.push(plugins[i]);
  10409. } else {
  10410. self.plugins.settings[plugins[i].name] = plugins[i].options;
  10411. queue.push(plugins[i].name);
  10412. }
  10413. }
  10414. } else if (plugins) {
  10415. for (key in plugins) {
  10416. if (plugins.hasOwnProperty(key)) {
  10417. self.plugins.settings[key] = plugins[key];
  10418. queue.push(key);
  10419. }
  10420. }
  10421. }
  10422. while (queue.length) {
  10423. self.require(queue.shift());
  10424. }
  10425. };
  10426. Interface.prototype.loadPlugin = function (name) {
  10427. var self = this;
  10428. var plugins = self.plugins;
  10429. var plugin = Interface.plugins[name];
  10430. if (!Interface.plugins.hasOwnProperty(name)) {
  10431. throw new Error('Unable to find "' + name + '" plugin');
  10432. }
  10433. plugins.requested[name] = true;
  10434. plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);
  10435. plugins.names.push(name);
  10436. };
  10437. /**
  10438. * Initializes a plugin.
  10439. *
  10440. * @param {string} name
  10441. */
  10442. Interface.prototype.require = function (name) {
  10443. var self = this;
  10444. var plugins = self.plugins;
  10445. if (!self.plugins.loaded.hasOwnProperty(name)) {
  10446. if (plugins.requested[name]) {
  10447. throw new Error('Plugin has circular dependency ("' + name + '")');
  10448. }
  10449. self.loadPlugin(name);
  10450. }
  10451. return plugins.loaded[name];
  10452. };
  10453. /**
  10454. * Registers a plugin.
  10455. *
  10456. * @param {string} name
  10457. * @param {function} fn
  10458. */
  10459. Interface.define = function (name, fn) {
  10460. Interface.plugins[name] = {
  10461. 'name': name,
  10462. 'fn': fn
  10463. };
  10464. };
  10465. };
  10466. var utils = {
  10467. isArray: Array.isArray || function (vArg) {
  10468. return Object.prototype.toString.call(vArg) === '[object Array]';
  10469. }
  10470. };
  10471. return MicroPlugin;
  10472. });
  10473. /**
  10474. * selectize.js (v0.12.4)
  10475. * Copyright (c) 2013–2015 Brian Reavis & contributors
  10476. *
  10477. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  10478. * file except in compliance with the License. You may obtain a copy of the License at:
  10479. * http://www.apache.org/licenses/LICENSE-2.0
  10480. *
  10481. * Unless required by applicable law or agreed to in writing, software distributed under
  10482. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  10483. * ANY KIND, either express or implied. See the License for the specific language
  10484. * governing permissions and limitations under the License.
  10485. *
  10486. * @author Brian Reavis <brian@thirdroute.com>
  10487. */
  10488. /*jshint curly:false */
  10489. /*jshint browser:true */
  10490. (function (root, factory) {
  10491. if (true) {
  10492. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_1__], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  10493. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  10494. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  10495. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  10496. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  10497. module.exports = factory(require('jquery'), require('sifter'), require('microplugin'));
  10498. } else {
  10499. root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
  10500. }
  10501. })(undefined, function ($, Sifter, MicroPlugin) {
  10502. 'use strict';
  10503. var highlight = function highlight($element, pattern) {
  10504. if (typeof pattern === 'string' && !pattern.length)
  10505. return;
  10506. var regex = typeof pattern === 'string' ? new RegExp(pattern, 'i') : pattern;
  10507. var highlight = function highlight(node) {
  10508. var skip = 0;
  10509. if (node.nodeType === 3) {
  10510. var pos = node.data.search(regex);
  10511. if (pos >= 0 && node.data.length > 0) {
  10512. var match = node.data.match(regex);
  10513. var spannode = document.createElement('span');
  10514. spannode.className = 'highlight';
  10515. var middlebit = node.splitText(pos);
  10516. var endbit = middlebit.splitText(match[0].length);
  10517. var middleclone = middlebit.cloneNode(true);
  10518. spannode.appendChild(middleclone);
  10519. middlebit.parentNode.replaceChild(spannode, middlebit);
  10520. skip = 1;
  10521. }
  10522. } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
  10523. for (var i = 0; i < node.childNodes.length; ++i) {
  10524. i += highlight(node.childNodes[i]);
  10525. }
  10526. }
  10527. return skip;
  10528. };
  10529. return $element.each(function () {
  10530. highlight(this);
  10531. });
  10532. };
  10533. /**
  10534. * removeHighlight fn copied from highlight v5 and
  10535. * edited to remove with() and pass js strict mode
  10536. */
  10537. $.fn.removeHighlight = function () {
  10538. return this.find("span.highlight").each(function () {
  10539. this.parentNode.firstChild.nodeName;
  10540. var parent = this.parentNode;
  10541. parent.replaceChild(this.firstChild, this);
  10542. parent.normalize();
  10543. }).end();
  10544. };
  10545. var MicroEvent = function MicroEvent() {};
  10546. MicroEvent.prototype = {
  10547. on: function on(event, fct) {
  10548. this._events = this._events || {};
  10549. this._events[event] = this._events[event] || [];
  10550. this._events[event].push(fct);
  10551. },
  10552. off: function off(event, fct) {
  10553. var n = arguments.length;
  10554. if (n === 0)
  10555. return delete this._events;
  10556. if (n === 1)
  10557. return delete this._events[event];
  10558. this._events = this._events || {};
  10559. if (event in this._events === false)
  10560. return;
  10561. this._events[event].splice(this._events[event].indexOf(fct), 1);
  10562. },
  10563. trigger: function trigger(event /* , args... */) {
  10564. this._events = this._events || {};
  10565. if (event in this._events === false)
  10566. return;
  10567. for (var i = 0; i < this._events[event].length; i++) {
  10568. this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
  10569. }
  10570. }
  10571. };
  10572. /**
  10573. * Mixin will delegate all MicroEvent.js function in the destination object.
  10574. *
  10575. * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent
  10576. *
  10577. * @param {object} the object which will support MicroEvent
  10578. */
  10579. MicroEvent.mixin = function (destObject) {
  10580. var props = ['on', 'off', 'trigger'];
  10581. for (var i = 0; i < props.length; i++) {
  10582. destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
  10583. }
  10584. };
  10585. var IS_MAC = /Mac/.test(navigator.userAgent);
  10586. var KEY_A = 65;
  10587. var KEY_COMMA = 188;
  10588. var KEY_RETURN = 13;
  10589. var KEY_ESC = 27;
  10590. var KEY_LEFT = 37;
  10591. var KEY_UP = 38;
  10592. var KEY_P = 80;
  10593. var KEY_RIGHT = 39;
  10594. var KEY_DOWN = 40;
  10595. var KEY_N = 78;
  10596. var KEY_BACKSPACE = 8;
  10597. var KEY_DELETE = 46;
  10598. var KEY_SHIFT = 16;
  10599. var KEY_CMD = IS_MAC ? 91 : 17;
  10600. var KEY_CTRL = IS_MAC ? 18 : 17;
  10601. var KEY_TAB = 9;
  10602. var TAG_SELECT = 1;
  10603. var TAG_INPUT = 2;
  10604. // for now, android support in general is too spotty to support validity
  10605. var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
  10606. var isset = function isset(object) {
  10607. return typeof object !== 'undefined';
  10608. };
  10609. /**
  10610. * Converts a scalar to its best string representation
  10611. * for hash keys and HTML attribute values.
  10612. *
  10613. * Transformations:
  10614. * 'str' -> 'str'
  10615. * null -> ''
  10616. * undefined -> ''
  10617. * true -> '1'
  10618. * false -> '0'
  10619. * 0 -> '0'
  10620. * 1 -> '1'
  10621. *
  10622. * @param {string} value
  10623. * @returns {string|null}
  10624. */
  10625. var hash_key = function hash_key(value) {
  10626. if (typeof value === 'undefined' || value === null)
  10627. return null;
  10628. if (typeof value === 'boolean')
  10629. return value ? '1' : '0';
  10630. return value + '';
  10631. };
  10632. /**
  10633. * Escapes a string for use within HTML.
  10634. *
  10635. * @param {string} str
  10636. * @returns {string}
  10637. */
  10638. var escape_html = function escape_html(str) {
  10639. return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  10640. };
  10641. /**
  10642. * Escapes "$" characters in replacement strings.
  10643. *
  10644. * @param {string} str
  10645. * @returns {string}
  10646. */
  10647. var escape_replace = function escape_replace(str) {
  10648. return (str + '').replace(/\$/g, '$$$$');
  10649. };
  10650. var hook = {};
  10651. /**
  10652. * Wraps `method` on `self` so that `fn`
  10653. * is invoked before the original method.
  10654. *
  10655. * @param {object} self
  10656. * @param {string} method
  10657. * @param {function} fn
  10658. */
  10659. hook.before = function (self, method, fn) {
  10660. var original = self[method];
  10661. self[method] = function () {
  10662. fn.apply(self, arguments);
  10663. return original.apply(self, arguments);
  10664. };
  10665. };
  10666. /**
  10667. * Wraps `method` on `self` so that `fn`
  10668. * is invoked after the original method.
  10669. *
  10670. * @param {object} self
  10671. * @param {string} method
  10672. * @param {function} fn
  10673. */
  10674. hook.after = function (self, method, fn) {
  10675. var original = self[method];
  10676. self[method] = function () {
  10677. var result = original.apply(self, arguments);
  10678. fn.apply(self, arguments);
  10679. return result;
  10680. };
  10681. };
  10682. /**
  10683. * Wraps `fn` so that it can only be invoked once.
  10684. *
  10685. * @param {function} fn
  10686. * @returns {function}
  10687. */
  10688. var once = function once(fn) {
  10689. var called = false;
  10690. return function () {
  10691. if (called)
  10692. return;
  10693. called = true;
  10694. fn.apply(this, arguments);
  10695. };
  10696. };
  10697. /**
  10698. * Wraps `fn` so that it can only be called once
  10699. * every `delay` milliseconds (invoked on the falling edge).
  10700. *
  10701. * @param {function} fn
  10702. * @param {int} delay
  10703. * @returns {function}
  10704. */
  10705. var debounce = function debounce(fn, delay) {
  10706. var timeout;
  10707. return function () {
  10708. var self = this;
  10709. var args = arguments;
  10710. window.clearTimeout(timeout);
  10711. timeout = window.setTimeout(function () {
  10712. fn.apply(self, args);
  10713. }, delay);
  10714. };
  10715. };
  10716. /**
  10717. * Debounce all fired events types listed in `types`
  10718. * while executing the provided `fn`.
  10719. *
  10720. * @param {object} self
  10721. * @param {array} types
  10722. * @param {function} fn
  10723. */
  10724. var debounce_events = function debounce_events(self, types, fn) {
  10725. var type;
  10726. var trigger = self.trigger;
  10727. var event_args = {};
  10728. // override trigger method
  10729. self.trigger = function () {
  10730. var type = arguments[0];
  10731. if (types.indexOf(type) !== - 1) {
  10732. event_args[type] = arguments;
  10733. } else {
  10734. return trigger.apply(self, arguments);
  10735. }
  10736. };
  10737. // invoke provided function
  10738. fn.apply(self, []);
  10739. self.trigger = trigger;
  10740. // trigger queued events
  10741. for (type in event_args) {
  10742. if (event_args.hasOwnProperty(type)) {
  10743. trigger.apply(self, event_args[type]);
  10744. }
  10745. }
  10746. };
  10747. /**
  10748. * A workaround for http://bugs.jquery.com/ticket/6696
  10749. *
  10750. * @param {object} $parent - Parent element to listen on.
  10751. * @param {string} event - Event name.
  10752. * @param {string} selector - Descendant selector to filter by.
  10753. * @param {function} fn - Event handler.
  10754. */
  10755. var watchChildEvent = function watchChildEvent($parent, event, selector, fn) {
  10756. $parent.on(event, selector, function (e) {
  10757. var child = e.target;
  10758. while (child && child.parentNode !== $parent[0]) {
  10759. child = child.parentNode;
  10760. }
  10761. e.currentTarget = child;
  10762. return fn.apply(this, [e]);
  10763. });
  10764. };
  10765. /**
  10766. * Determines the current selection within a text input control.
  10767. * Returns an object containing:
  10768. * - start
  10769. * - length
  10770. *
  10771. * @param {object} input
  10772. * @returns {object}
  10773. */
  10774. var getSelection = function getSelection(input) {
  10775. var result = {};
  10776. if ('selectionStart' in input) {
  10777. result.start = input.selectionStart;
  10778. result.length = input.selectionEnd - result.start;
  10779. } else if (document.selection) {
  10780. input.focus();
  10781. var sel = document.selection.createRange();
  10782. var selLen = document.selection.createRange().text.length;
  10783. sel.moveStart('character', - input.value.length);
  10784. result.start = sel.text.length - selLen;
  10785. result.length = selLen;
  10786. }
  10787. return result;
  10788. };
  10789. /**
  10790. * Copies CSS properties from one element to another.
  10791. *
  10792. * @param {object} $from
  10793. * @param {object} $to
  10794. * @param {array} properties
  10795. */
  10796. var transferStyles = function transferStyles($from, $to, properties) {
  10797. var i,
  10798. n,
  10799. styles = {};
  10800. if (properties) {
  10801. for (i = 0, n = properties.length; i < n; i++) {
  10802. styles[properties[i]] = $from.css(properties[i]);
  10803. }
  10804. } else {
  10805. styles = $from.css();
  10806. }
  10807. $to.css(styles);
  10808. };
  10809. /**
  10810. * Measures the width of a string within a
  10811. * parent element (in pixels).
  10812. *
  10813. * @param {string} str
  10814. * @param {object} $parent
  10815. * @returns {int}
  10816. */
  10817. var measureString = function measureString(str, $parent) {
  10818. if (!str) {
  10819. return 0;
  10820. }
  10821. var $test = $('<test>').css({
  10822. position: 'absolute',
  10823. top: - 99999,
  10824. left: - 99999,
  10825. width: 'auto',
  10826. padding: 0,
  10827. whiteSpace: 'pre'
  10828. }).text(str).appendTo('body');
  10829. transferStyles($parent, $test, ['letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform']);
  10830. var width = $test.width();
  10831. $test.remove();
  10832. return width;
  10833. };
  10834. /**
  10835. * Sets up an input to grow horizontally as the user
  10836. * types. If the value is changed manually, you can
  10837. * trigger the "update" handler to resize:
  10838. *
  10839. * $input.trigger('update');
  10840. *
  10841. * @param {object} $input
  10842. */
  10843. var autoGrow = function autoGrow($input) {
  10844. var currentWidth = null;
  10845. var update = function update(e, options) {
  10846. var value, keyCode, printable, placeholder, width;
  10847. var shift, character, selection;
  10848. e = e || window.event || {};
  10849. options = options || {};
  10850. if (e.metaKey || e.altKey)
  10851. return;
  10852. if (!options.force && $input.data('grow') === false)
  10853. return;
  10854. value = $input.val();
  10855. if (e.type && e.type.toLowerCase() === 'keydown') {
  10856. keyCode = e.keyCode;
  10857. printable = keyCode >= 97 && keyCode <= 122 || // a-z
  10858. keyCode >= 65 && keyCode <= 90 || // A-Z
  10859. keyCode >= 48 && keyCode <= 57 || // 0-9
  10860. keyCode === 32 // space
  10861. ;
  10862. if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
  10863. selection = getSelection($input[0]);
  10864. if (selection.length) {
  10865. value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
  10866. } else if (keyCode === KEY_BACKSPACE && selection.start) {
  10867. value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
  10868. } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
  10869. value = value.substring(0, selection.start) + value.substring(selection.start + 1);
  10870. }
  10871. } else if (printable) {
  10872. shift = e.shiftKey;
  10873. character = String.fromCharCode(e.keyCode);
  10874. if (shift)
  10875. character = character.toUpperCase();
  10876. else
  10877. character = character.toLowerCase();
  10878. value += character;
  10879. }
  10880. }
  10881. placeholder = $input.attr('placeholder');
  10882. if (!value && placeholder) {
  10883. value = placeholder;
  10884. }
  10885. width = measureString(value, $input) + 4;
  10886. if (width !== currentWidth) {
  10887. currentWidth = width;
  10888. $input.width(width);
  10889. $input.triggerHandler('resize');
  10890. }
  10891. };
  10892. $input.on('keydown keyup update blur', update);
  10893. update();
  10894. };
  10895. var domToString = function domToString(d) {
  10896. var tmp = document.createElement('div');
  10897. tmp.appendChild(d.cloneNode(true));
  10898. return tmp.innerHTML;
  10899. };
  10900. var logError = function logError(message, options) {
  10901. if (!options)
  10902. options = {};
  10903. var component = "Selectize";
  10904. console.error(component + ": " + message);
  10905. if (options.explanation) {
  10906. // console.group is undefined in <IE11
  10907. if (console.group)
  10908. console.group();
  10909. console.error(options.explanation);
  10910. if (console.group)
  10911. console.groupEnd();
  10912. }
  10913. };
  10914. var Selectize = function Selectize($input, settings) {
  10915. var key,
  10916. i,
  10917. n,
  10918. dir,
  10919. input,
  10920. self = this;
  10921. input = $input[0];
  10922. input.selectize = self;
  10923. // detect rtl environment
  10924. var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
  10925. dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
  10926. dir = dir || $input.parents('[dir]:first').attr('dir') || '';
  10927. // setup default state
  10928. $.extend(self, {
  10929. order: 0,
  10930. settings: settings,
  10931. $input: $input,
  10932. tabIndex: $input.attr('tabindex') || '',
  10933. tagType: input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
  10934. rtl: /rtl/i.test(dir),
  10935. eventNS: '.selectize' + ++Selectize.count,
  10936. highlightedValue: null,
  10937. isOpen: false,
  10938. isDisabled: false,
  10939. isRequired: $input.is('[required]'),
  10940. isInvalid: false,
  10941. isLocked: false,
  10942. isFocused: false,
  10943. isInputHidden: false,
  10944. isSetup: false,
  10945. isShiftDown: false,
  10946. isCmdDown: false,
  10947. isCtrlDown: false,
  10948. ignoreFocus: false,
  10949. ignoreBlur: false,
  10950. ignoreHover: false,
  10951. hasOptions: false,
  10952. currentResults: null,
  10953. lastValue: '',
  10954. caretPos: 0,
  10955. loading: 0,
  10956. loadedSearches: {},
  10957. $activeOption: null,
  10958. $activeItems: [],
  10959. optgroups: {},
  10960. options: {},
  10961. userOptions: {},
  10962. items: [],
  10963. renderCache: {},
  10964. onSearchChange: settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)
  10965. });
  10966. // search system
  10967. self.sifter = new Sifter(this.options, {diacritics: settings.diacritics});
  10968. // build options table
  10969. if (self.settings.options) {
  10970. for (i = 0, n = self.settings.options.length; i < n; i++) {
  10971. self.registerOption(self.settings.options[i]);
  10972. }
  10973. delete self.settings.options;
  10974. }
  10975. // build optgroup table
  10976. if (self.settings.optgroups) {
  10977. for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
  10978. self.registerOptionGroup(self.settings.optgroups[i]);
  10979. }
  10980. delete self.settings.optgroups;
  10981. }
  10982. // option-dependent defaults
  10983. self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');
  10984. if (typeof self.settings.hideSelected !== 'boolean') {
  10985. self.settings.hideSelected = self.settings.mode === 'multi';
  10986. }
  10987. self.initializePlugins(self.settings.plugins);
  10988. self.setupCallbacks();
  10989. self.setupTemplates();
  10990. self.setup();
  10991. };
  10992. // mixins
  10993. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10994. MicroEvent.mixin(Selectize);
  10995. if (typeof MicroPlugin !== "undefined") {
  10996. MicroPlugin.mixin(Selectize);
  10997. } else {
  10998. 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."});
  10999. }
  11000. // methods
  11001. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11002. $.extend(Selectize.prototype, {
  11003. /**
  11004. * Creates all elements and sets up event bindings.
  11005. */
  11006. setup: function setup() {
  11007. var self = this;
  11008. var settings = self.settings;
  11009. var eventNS = self.eventNS;
  11010. var $window = $(window);
  11011. var $document = $(document);
  11012. var $input = self.$input;
  11013. var $wrapper;
  11014. var $control;
  11015. var $control_input;
  11016. var $dropdown;
  11017. var $dropdown_content;
  11018. var $dropdown_parent;
  11019. var inputMode;
  11020. var timeout_blur;
  11021. var timeout_focus;
  11022. var classes;
  11023. var classes_plugins;
  11024. var inputId;
  11025. inputMode = self.settings.mode;
  11026. classes = $input.attr('class') || '';
  11027. $wrapper = $('<div>').addClass(settings.wrapperClass).addClass(inputMode);
  11028. $control = $('<div>').addClass(settings.inputClass + ' ' + classes).addClass('items').appendTo($wrapper);
  11029. $control_input = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
  11030. $dropdown_parent = $(settings.dropdownParent || $wrapper);
  11031. $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
  11032. $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
  11033. if (inputId = $input.attr('id')) {
  11034. $control_input.attr('id', inputId + '-selectized');
  11035. $("label[for='" + inputId + "']").attr('for', inputId + '-selectized');
  11036. }
  11037. if (self.settings.copyClassesToDropdown) {
  11038. $dropdown.addClass(classes);
  11039. }
  11040. $wrapper.css({
  11041. width: $input[0].style.width
  11042. });
  11043. if (self.plugins.names.length) {
  11044. classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
  11045. $wrapper.addClass(classes_plugins);
  11046. $dropdown.addClass(classes_plugins);
  11047. }
  11048. if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {
  11049. $input.attr('multiple', 'multiple');
  11050. }
  11051. if (self.settings.placeholder) {
  11052. $control_input.attr('placeholder', settings.placeholder);
  11053. }
  11054. // if splitOn was not passed in, construct it from the delimiter to allow pasting universally
  11055. if (!self.settings.splitOn && self.settings.delimiter) {
  11056. var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  11057. self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
  11058. }
  11059. if ($input.attr('autocorrect')) {
  11060. $control_input.attr('autocorrect', $input.attr('autocorrect'));
  11061. }
  11062. if ($input.attr('autocapitalize')) {
  11063. $control_input.attr('autocapitalize', $input.attr('autocapitalize'));
  11064. }
  11065. self.$wrapper = $wrapper;
  11066. self.$control = $control;
  11067. self.$control_input = $control_input;
  11068. self.$dropdown = $dropdown;
  11069. self.$dropdown_content = $dropdown_content;
  11070. $dropdown.on('mouseenter', '[data-selectable]', function () {
  11071. return self.onOptionHover.apply(self, arguments);
  11072. });
  11073. $dropdown.on('mousedown click', '[data-selectable]', function () {
  11074. return self.onOptionSelect.apply(self, arguments);
  11075. });
  11076. watchChildEvent($control, 'mousedown', '*:not(input)', function () {
  11077. return self.onItemSelect.apply(self, arguments);
  11078. });
  11079. autoGrow($control_input);
  11080. $control.on({
  11081. mousedown: function mousedown() {
  11082. return self.onMouseDown.apply(self, arguments);
  11083. },
  11084. click: function click() {
  11085. return self.onClick.apply(self, arguments);
  11086. }
  11087. });
  11088. $control_input.on({
  11089. mousedown: function mousedown(e) {
  11090. e.stopPropagation();
  11091. },
  11092. keydown: function keydown() {
  11093. return self.onKeyDown.apply(self, arguments);
  11094. },
  11095. keyup: function keyup() {
  11096. return self.onKeyUp.apply(self, arguments);
  11097. },
  11098. keypress: function keypress() {
  11099. return self.onKeyPress.apply(self, arguments);
  11100. },
  11101. resize: function resize() {
  11102. self.positionDropdown.apply(self, []);
  11103. },
  11104. blur: function blur() {
  11105. return self.onBlur.apply(self, arguments);
  11106. },
  11107. focus: function focus() {
  11108. self.ignoreBlur = false;
  11109. return self.onFocus.apply(self, arguments);
  11110. },
  11111. paste: function paste() {
  11112. return self.onPaste.apply(self, arguments);
  11113. }
  11114. });
  11115. $document.on('keydown' + eventNS, function (e) {
  11116. self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
  11117. self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
  11118. self.isShiftDown = e.shiftKey;
  11119. });
  11120. $document.on('keyup' + eventNS, function (e) {
  11121. if (e.keyCode === KEY_CTRL)
  11122. self.isCtrlDown = false;
  11123. if (e.keyCode === KEY_SHIFT)
  11124. self.isShiftDown = false;
  11125. if (e.keyCode === KEY_CMD)
  11126. self.isCmdDown = false;
  11127. });
  11128. $document.on('mousedown' + eventNS, function (e) {
  11129. if (self.isFocused) {
  11130. // prevent events on the dropdown scrollbar from causing the control to blur
  11131. if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
  11132. return false;
  11133. }
  11134. // blur on click outside
  11135. if (!self.$control.has(e.target).length && e.target !== self.$control[0]) {
  11136. self.blur(e.target);
  11137. }
  11138. }
  11139. });
  11140. $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function () {
  11141. if (self.isOpen) {
  11142. self.positionDropdown.apply(self, arguments);
  11143. }
  11144. });
  11145. $window.on('mousemove' + eventNS, function () {
  11146. self.ignoreHover = false;
  11147. });
  11148. // store original children and tab index so that they can be
  11149. // restored when the destroy() method is called.
  11150. this.revertSettings = {
  11151. $children: $input.children().detach(),
  11152. tabindex: $input.attr('tabindex')
  11153. };
  11154. $input.attr('tabindex', - 1).hide().after(self.$wrapper);
  11155. if ($.isArray(settings.items)) {
  11156. self.setValue(settings.items);
  11157. delete settings.items;
  11158. }
  11159. // feature detect for the validation API
  11160. if (SUPPORTS_VALIDITY_API) {
  11161. $input.on('invalid' + eventNS, function (e) {
  11162. e.preventDefault();
  11163. self.isInvalid = true;
  11164. self.refreshState();
  11165. });
  11166. }
  11167. self.updateOriginalInput();
  11168. self.refreshItems();
  11169. self.refreshState();
  11170. self.updatePlaceholder();
  11171. self.isSetup = true;
  11172. if ($input.is(':disabled')) {
  11173. self.disable();
  11174. }
  11175. self.on('change', this.onChange);
  11176. $input.data('selectize', self);
  11177. $input.addClass('selectized');
  11178. self.trigger('initialize');
  11179. // preload options
  11180. if (settings.preload === true) {
  11181. self.onSearchChange('');
  11182. }
  11183. },
  11184. /**
  11185. * Sets up default rendering functions.
  11186. */
  11187. setupTemplates: function setupTemplates() {
  11188. var self = this;
  11189. var field_label = self.settings.labelField;
  11190. var field_optgroup = self.settings.optgroupLabelField;
  11191. var templates = {
  11192. 'optgroup': function optgroup(data) {
  11193. return '<div class="optgroup">' + data.html + '</div>';
  11194. },
  11195. 'optgroup_header': function optgroup_header(data, escape) {
  11196. return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
  11197. },
  11198. 'option': function option(data, escape) {
  11199. return '<div class="option">' + escape(data[field_label]) + '</div>';
  11200. },
  11201. 'item': function item(data, escape) {
  11202. return '<div class="item">' + escape(data[field_label]) + '</div>';
  11203. },
  11204. 'option_create': function option_create(data, escape) {
  11205. return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
  11206. }
  11207. };
  11208. self.settings.render = $.extend({}, templates, self.settings.render);
  11209. },
  11210. /**
  11211. * Maps fired events to callbacks provided
  11212. * in the settings used when creating the control.
  11213. */
  11214. setupCallbacks: function setupCallbacks() {
  11215. var key,
  11216. fn,
  11217. callbacks = {
  11218. 'initialize': 'onInitialize',
  11219. 'change': 'onChange',
  11220. 'item_add': 'onItemAdd',
  11221. 'item_remove': 'onItemRemove',
  11222. 'clear': 'onClear',
  11223. 'option_add': 'onOptionAdd',
  11224. 'option_remove': 'onOptionRemove',
  11225. 'option_clear': 'onOptionClear',
  11226. 'optgroup_add': 'onOptionGroupAdd',
  11227. 'optgroup_remove': 'onOptionGroupRemove',
  11228. 'optgroup_clear': 'onOptionGroupClear',
  11229. 'dropdown_open': 'onDropdownOpen',
  11230. 'dropdown_close': 'onDropdownClose',
  11231. 'type': 'onType',
  11232. 'load': 'onLoad',
  11233. 'focus': 'onFocus',
  11234. 'blur': 'onBlur'
  11235. };
  11236. for (key in callbacks) {
  11237. if (callbacks.hasOwnProperty(key)) {
  11238. fn = this.settings[callbacks[key]];
  11239. if (fn)
  11240. this.on(key, fn);
  11241. }
  11242. }
  11243. },
  11244. /**
  11245. * Triggered when the main control element
  11246. * has a click event.
  11247. *
  11248. * @param {object} e
  11249. * @return {boolean}
  11250. */
  11251. onClick: function onClick(e) {
  11252. var self = this;
  11253. // necessary for mobile webkit devices (manual focus triggering
  11254. // is ignored unless invoked within a click event)
  11255. if (!self.isFocused) {
  11256. self.focus();
  11257. e.preventDefault();
  11258. }
  11259. },
  11260. /**
  11261. * Triggered when the main control element
  11262. * has a mouse down event.
  11263. *
  11264. * @param {object} e
  11265. * @return {boolean}
  11266. */
  11267. onMouseDown: function onMouseDown(e) {
  11268. var self = this;
  11269. var defaultPrevented = e.isDefaultPrevented();
  11270. var $target = $(e.target);
  11271. if (self.isFocused) {
  11272. // retain focus by preventing native handling. if the
  11273. // event target is the input it should not be modified.
  11274. // otherwise, text selection within the input won't work.
  11275. if (e.target !== self.$control_input[0]) {
  11276. if (self.settings.mode === 'single') {
  11277. // toggle dropdown
  11278. self.isOpen ? self.close() : self.open();
  11279. } else if (!defaultPrevented) {
  11280. self.setActiveItem(null);
  11281. }
  11282. return false;
  11283. }
  11284. } else {
  11285. // give control focus
  11286. if (!defaultPrevented) {
  11287. window.setTimeout(function () {
  11288. self.focus();
  11289. }, 0);
  11290. }
  11291. }
  11292. },
  11293. /**
  11294. * Triggered when the value of the control has been changed.
  11295. * This should propagate the event to the original DOM
  11296. * input / select element.
  11297. */
  11298. onChange: function onChange() {
  11299. this.$input.trigger('change');
  11300. },
  11301. /**
  11302. * Triggered on <input> paste.
  11303. *
  11304. * @param {object} e
  11305. * @returns {boolean}
  11306. */
  11307. onPaste: function onPaste(e) {
  11308. var self = this;
  11309. if (self.isFull() || self.isInputHidden || self.isLocked) {
  11310. e.preventDefault();
  11311. return;
  11312. }
  11313. // If a regex or string is included, this will split the pasted
  11314. // input and create Items for each separate value
  11315. if (self.settings.splitOn) {
  11316. // Wait for pasted text to be recognized in value
  11317. setTimeout(function () {
  11318. var pastedText = self.$control_input.val();
  11319. if (!pastedText.match(self.settings.splitOn)) {
  11320. return;
  11321. }
  11322. var splitInput = $.trim(pastedText).split(self.settings.splitOn);
  11323. for (var i = 0, n = splitInput.length; i < n; i++) {
  11324. self.createItem(splitInput[i]);
  11325. }
  11326. }, 0);
  11327. }
  11328. },
  11329. /**
  11330. * Triggered on <input> keypress.
  11331. *
  11332. * @param {object} e
  11333. * @returns {boolean}
  11334. */
  11335. onKeyPress: function onKeyPress(e) {
  11336. if (this.isLocked)
  11337. return e && e.preventDefault();
  11338. var character = String.fromCharCode(e.keyCode || e.which);
  11339. if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
  11340. this.createItem();
  11341. e.preventDefault();
  11342. return false;
  11343. }
  11344. },
  11345. /**
  11346. * Triggered on <input> keydown.
  11347. *
  11348. * @param {object} e
  11349. * @returns {boolean}
  11350. */
  11351. onKeyDown: function onKeyDown(e) {
  11352. var isInput = e.target === this.$control_input[0];
  11353. var self = this;
  11354. if (self.isLocked) {
  11355. if (e.keyCode !== KEY_TAB) {
  11356. e.preventDefault();
  11357. }
  11358. return;
  11359. }
  11360. switch (e.keyCode) {
  11361. case KEY_A:
  11362. if (self.isCmdDown) {
  11363. self.selectAll();
  11364. return;
  11365. }
  11366. break;
  11367. case KEY_ESC:
  11368. if (self.isOpen) {
  11369. e.preventDefault();
  11370. e.stopPropagation();
  11371. self.close();
  11372. }
  11373. return;
  11374. case KEY_N:
  11375. if (!e.ctrlKey || e.altKey)
  11376. break;
  11377. case KEY_DOWN:
  11378. if (!self.isOpen && self.hasOptions) {
  11379. self.open();
  11380. } else if (self.$activeOption) {
  11381. self.ignoreHover = true;
  11382. var $next = self.getAdjacentOption(self.$activeOption, 1);
  11383. if ($next.length)
  11384. self.setActiveOption($next, true, true);
  11385. }
  11386. e.preventDefault();
  11387. return;
  11388. case KEY_P:
  11389. if (!e.ctrlKey || e.altKey)
  11390. break;
  11391. case KEY_UP:
  11392. if (self.$activeOption) {
  11393. self.ignoreHover = true;
  11394. var $prev = self.getAdjacentOption(self.$activeOption, - 1);
  11395. if ($prev.length)
  11396. self.setActiveOption($prev, true, true);
  11397. }
  11398. e.preventDefault();
  11399. return;
  11400. case KEY_RETURN:
  11401. if (self.isOpen && self.$activeOption) {
  11402. self.onOptionSelect({currentTarget: self.$activeOption});
  11403. e.preventDefault();
  11404. }
  11405. return;
  11406. case KEY_LEFT:
  11407. self.advanceSelection( - 1, e);
  11408. return;
  11409. case KEY_RIGHT:
  11410. self.advanceSelection(1, e);
  11411. return;
  11412. case KEY_TAB:
  11413. if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
  11414. self.onOptionSelect({currentTarget: self.$activeOption});
  11415. // Default behaviour is to jump to the next field, we only want this
  11416. // if the current field doesn't accept any more entries
  11417. if (!self.isFull()) {
  11418. e.preventDefault();
  11419. }
  11420. }
  11421. if (self.settings.create && self.createItem()) {
  11422. e.preventDefault();
  11423. }
  11424. return;
  11425. case KEY_BACKSPACE:
  11426. case KEY_DELETE:
  11427. self.deleteSelection(e);
  11428. return;
  11429. }
  11430. if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
  11431. e.preventDefault();
  11432. return;
  11433. }
  11434. },
  11435. /**
  11436. * Triggered on <input> keyup.
  11437. *
  11438. * @param {object} e
  11439. * @returns {boolean}
  11440. */
  11441. onKeyUp: function onKeyUp(e) {
  11442. var self = this;
  11443. if (self.isLocked)
  11444. return e && e.preventDefault();
  11445. var value = self.$control_input.val() || '';
  11446. if (self.lastValue !== value) {
  11447. self.lastValue = value;
  11448. self.onSearchChange(value);
  11449. self.refreshOptions();
  11450. self.trigger('type', value);
  11451. }
  11452. },
  11453. /**
  11454. * Invokes the user-provide option provider / loader.
  11455. *
  11456. * Note: this function is debounced in the Selectize
  11457. * constructor (by `settings.loadThrottle` milliseconds)
  11458. *
  11459. * @param {string} value
  11460. */
  11461. onSearchChange: function onSearchChange(value) {
  11462. var self = this;
  11463. var fn = self.settings.load;
  11464. if (!fn)
  11465. return;
  11466. if (self.loadedSearches.hasOwnProperty(value))
  11467. return;
  11468. self.loadedSearches[value] = true;
  11469. self.load(function (callback) {
  11470. fn.apply(self, [value, callback]);
  11471. });
  11472. },
  11473. /**
  11474. * Triggered on <input> focus.
  11475. *
  11476. * @param {object} e (optional)
  11477. * @returns {boolean}
  11478. */
  11479. onFocus: function onFocus(e) {
  11480. var self = this;
  11481. var wasFocused = self.isFocused;
  11482. if (self.isDisabled) {
  11483. self.blur();
  11484. e && e.preventDefault();
  11485. return false;
  11486. }
  11487. if (self.ignoreFocus)
  11488. return;
  11489. self.isFocused = true;
  11490. if (self.settings.preload === 'focus')
  11491. self.onSearchChange('');
  11492. if (!wasFocused)
  11493. self.trigger('focus');
  11494. if (!self.$activeItems.length) {
  11495. self.showInput();
  11496. self.setActiveItem(null);
  11497. self.refreshOptions(!!self.settings.openOnFocus);
  11498. }
  11499. self.refreshState();
  11500. },
  11501. /**
  11502. * Triggered on <input> blur.
  11503. *
  11504. * @param {object} e
  11505. * @param {Element} dest
  11506. */
  11507. onBlur: function onBlur(e, dest) {
  11508. var self = this;
  11509. if (!self.isFocused)
  11510. return;
  11511. self.isFocused = false;
  11512. if (self.ignoreFocus) {
  11513. return;
  11514. } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
  11515. // necessary to prevent IE closing the dropdown when the scrollbar is clicked
  11516. self.ignoreBlur = true;
  11517. self.onFocus(e);
  11518. return;
  11519. }
  11520. var deactivate = function deactivate() {
  11521. self.close();
  11522. self.setTextboxValue('');
  11523. self.setActiveItem(null);
  11524. self.setActiveOption(null);
  11525. self.setCaret(self.items.length);
  11526. self.refreshState();
  11527. // IE11 bug: element still marked as active
  11528. dest && dest.focus && dest.focus();
  11529. self.ignoreFocus = false;
  11530. self.trigger('blur');
  11531. };
  11532. self.ignoreFocus = true;
  11533. if (self.settings.create && self.settings.createOnBlur) {
  11534. self.createItem(null, false, deactivate);
  11535. } else {
  11536. deactivate();
  11537. }
  11538. },
  11539. /**
  11540. * Triggered when the user rolls over
  11541. * an option in the autocomplete dropdown menu.
  11542. *
  11543. * @param {object} e
  11544. * @returns {boolean}
  11545. */
  11546. onOptionHover: function onOptionHover(e) {
  11547. if (this.ignoreHover)
  11548. return;
  11549. this.setActiveOption(e.currentTarget, false);
  11550. },
  11551. /**
  11552. * Triggered when the user clicks on an option
  11553. * in the autocomplete dropdown menu.
  11554. *
  11555. * @param {object} e
  11556. * @returns {boolean}
  11557. */
  11558. onOptionSelect: function onOptionSelect(e) {
  11559. var value,
  11560. $target,
  11561. $option,
  11562. self = this;
  11563. if (e.preventDefault) {
  11564. e.preventDefault();
  11565. e.stopPropagation();
  11566. }
  11567. $target = $(e.currentTarget);
  11568. if ($target.hasClass('create')) {
  11569. self.createItem(null, function () {
  11570. if (self.settings.closeAfterSelect) {
  11571. self.close();
  11572. }
  11573. });
  11574. } else {
  11575. value = $target.attr('data-value');
  11576. if (typeof value !== 'undefined') {
  11577. self.lastQuery = null;
  11578. self.setTextboxValue('');
  11579. self.addItem(value);
  11580. if (self.settings.closeAfterSelect) {
  11581. self.close();
  11582. } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
  11583. self.setActiveOption(self.getOption(value));
  11584. }
  11585. }
  11586. }
  11587. },
  11588. /**
  11589. * Triggered when the user clicks on an item
  11590. * that has been selected.
  11591. *
  11592. * @param {object} e
  11593. * @returns {boolean}
  11594. */
  11595. onItemSelect: function onItemSelect(e) {
  11596. var self = this;
  11597. if (self.isLocked)
  11598. return;
  11599. if (self.settings.mode === 'multi') {
  11600. e.preventDefault();
  11601. self.setActiveItem(e.currentTarget, e);
  11602. }
  11603. },
  11604. /**
  11605. * Invokes the provided method that provides
  11606. * results to a callback---which are then added
  11607. * as options to the control.
  11608. *
  11609. * @param {function} fn
  11610. */
  11611. load: function load(fn) {
  11612. var self = this;
  11613. var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
  11614. self.loading++;
  11615. fn.apply(self, [function (results) {
  11616. self.loading = Math.max(self.loading - 1, 0);
  11617. if (results && results.length) {
  11618. self.addOption(results);
  11619. self.refreshOptions(self.isFocused && !self.isInputHidden);
  11620. }
  11621. if (!self.loading) {
  11622. $wrapper.removeClass(self.settings.loadingClass);
  11623. }
  11624. self.trigger('load', results);
  11625. }]);
  11626. },
  11627. /**
  11628. * Sets the input field of the control to the specified value.
  11629. *
  11630. * @param {string} value
  11631. */
  11632. setTextboxValue: function setTextboxValue(value) {
  11633. var $input = this.$control_input;
  11634. var changed = $input.val() !== value;
  11635. if (changed) {
  11636. $input.val(value).triggerHandler('update');
  11637. this.lastValue = value;
  11638. }
  11639. },
  11640. /**
  11641. * Returns the value of the control. If multiple items
  11642. * can be selected (e.g. <select multiple>), this returns
  11643. * an array. If only one item can be selected, this
  11644. * returns a string.
  11645. *
  11646. * @returns {mixed}
  11647. */
  11648. getValue: function getValue() {
  11649. if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
  11650. return this.items;
  11651. } else {
  11652. return this.items.join(this.settings.delimiter);
  11653. }
  11654. },
  11655. /**
  11656. * Resets the selected items to the given value.
  11657. *
  11658. * @param {mixed} value
  11659. */
  11660. setValue: function setValue(value, silent) {
  11661. var events = silent ? [] : ['change'];
  11662. debounce_events(this, events, function () {
  11663. this.clear(silent);
  11664. this.addItems(value, silent);
  11665. });
  11666. },
  11667. /**
  11668. * Sets the selected item.
  11669. *
  11670. * @param {object} $item
  11671. * @param {object} e (optional)
  11672. */
  11673. setActiveItem: function setActiveItem($item, e) {
  11674. var self = this;
  11675. var eventName;
  11676. var i, idx, begin, end, item, swap;
  11677. var $last;
  11678. if (self.settings.mode === 'single')
  11679. return;
  11680. $item = $($item);
  11681. // clear the active selection
  11682. if (!$item.length) {
  11683. $(self.$activeItems).removeClass('active');
  11684. self.$activeItems = [];
  11685. if (self.isFocused) {
  11686. self.showInput();
  11687. }
  11688. return;
  11689. }
  11690. // modify selection
  11691. eventName = e && e.type.toLowerCase();
  11692. if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
  11693. $last = self.$control.children('.active:last');
  11694. begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
  11695. end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
  11696. if (begin > end) {
  11697. swap = begin;
  11698. begin = end;
  11699. end = swap;
  11700. }
  11701. for (i = begin; i <= end; i++) {
  11702. item = self.$control[0].childNodes[i];
  11703. if (self.$activeItems.indexOf(item) === - 1) {
  11704. $(item).addClass('active');
  11705. self.$activeItems.push(item);
  11706. }
  11707. }
  11708. e.preventDefault();
  11709. } else if (eventName === 'mousedown' && self.isCtrlDown || eventName === 'keydown' && this.isShiftDown) {
  11710. if ($item.hasClass('active')) {
  11711. idx = self.$activeItems.indexOf($item[0]);
  11712. self.$activeItems.splice(idx, 1);
  11713. $item.removeClass('active');
  11714. } else {
  11715. self.$activeItems.push($item.addClass('active')[0]);
  11716. }
  11717. } else {
  11718. $(self.$activeItems).removeClass('active');
  11719. self.$activeItems = [$item.addClass('active')[0]];
  11720. }
  11721. // ensure control has focus
  11722. self.hideInput();
  11723. if (!this.isFocused) {
  11724. self.focus();
  11725. }
  11726. },
  11727. /**
  11728. * Sets the selected item in the dropdown menu
  11729. * of available options.
  11730. *
  11731. * @param {object} $object
  11732. * @param {boolean} scroll
  11733. * @param {boolean} animate
  11734. */
  11735. setActiveOption: function setActiveOption($option, scroll, animate) {
  11736. var height_menu, height_item, y;
  11737. var scroll_top, scroll_bottom;
  11738. var self = this;
  11739. if (self.$activeOption)
  11740. self.$activeOption.removeClass('active');
  11741. self.$activeOption = null;
  11742. $option = $($option);
  11743. if (!$option.length)
  11744. return;
  11745. self.$activeOption = $option.addClass('active');
  11746. if (scroll || !isset(scroll)) {
  11747. height_menu = self.$dropdown_content.height();
  11748. height_item = self.$activeOption.outerHeight(true);
  11749. scroll = self.$dropdown_content.scrollTop() || 0;
  11750. y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
  11751. scroll_top = y;
  11752. scroll_bottom = y - height_menu + height_item;
  11753. if (y + height_item > height_menu + scroll) {
  11754. self.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);
  11755. } else if (y < scroll) {
  11756. self.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);
  11757. }
  11758. }
  11759. },
  11760. /**
  11761. * Selects all items (CTRL + A).
  11762. */
  11763. selectAll: function selectAll() {
  11764. var self = this;
  11765. if (self.settings.mode === 'single')
  11766. return;
  11767. self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
  11768. if (self.$activeItems.length) {
  11769. self.hideInput();
  11770. self.close();
  11771. }
  11772. self.focus();
  11773. },
  11774. /**
  11775. * Hides the input element out of view, while
  11776. * retaining its focus.
  11777. */
  11778. hideInput: function hideInput() {
  11779. var self = this;
  11780. self.setTextboxValue('');
  11781. self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : - 10000});
  11782. self.isInputHidden = true;
  11783. },
  11784. /**
  11785. * Restores input visibility.
  11786. */
  11787. showInput: function showInput() {
  11788. this.$control_input.css({opacity: 1, position: 'relative', left: 0});
  11789. this.isInputHidden = false;
  11790. },
  11791. /**
  11792. * Gives the control focus.
  11793. */
  11794. focus: function focus() {
  11795. var self = this;
  11796. if (self.isDisabled)
  11797. return;
  11798. self.ignoreFocus = true;
  11799. self.$control_input[0].focus();
  11800. window.setTimeout(function () {
  11801. self.ignoreFocus = false;
  11802. self.onFocus();
  11803. }, 0);
  11804. },
  11805. /**
  11806. * Forces the control out of focus.
  11807. *
  11808. * @param {Element} dest
  11809. */
  11810. blur: function blur(dest) {
  11811. this.$control_input[0].blur();
  11812. this.onBlur(null, dest);
  11813. },
  11814. /**
  11815. * Returns a function that scores an object
  11816. * to show how good of a match it is to the
  11817. * provided query.
  11818. *
  11819. * @param {string} query
  11820. * @param {object} options
  11821. * @return {function}
  11822. */
  11823. getScoreFunction: function getScoreFunction(query) {
  11824. return this.sifter.getScoreFunction(query, this.getSearchOptions());
  11825. },
  11826. /**
  11827. * Returns search options for sifter (the system
  11828. * for scoring and sorting results).
  11829. *
  11830. * @see https://github.com/brianreavis/sifter.js
  11831. * @return {object}
  11832. */
  11833. getSearchOptions: function getSearchOptions() {
  11834. var settings = this.settings;
  11835. var sort = settings.sortField;
  11836. if (typeof sort === 'string') {
  11837. sort = [{field: sort}];
  11838. }
  11839. return {
  11840. fields: settings.searchField,
  11841. conjunction: settings.searchConjunction,
  11842. sort: sort
  11843. };
  11844. },
  11845. /**
  11846. * Searches through available options and returns
  11847. * a sorted array of matches.
  11848. *
  11849. * Returns an object containing:
  11850. *
  11851. * - query {string}
  11852. * - tokens {array}
  11853. * - total {int}
  11854. * - items {array}
  11855. *
  11856. * @param {string} query
  11857. * @returns {object}
  11858. */
  11859. search: function search(query) {
  11860. var i, value, score, result, calculateScore;
  11861. var self = this;
  11862. var settings = self.settings;
  11863. var options = this.getSearchOptions();
  11864. // validate user-provided result scoring function
  11865. if (settings.score) {
  11866. calculateScore = self.settings.score.apply(this, [query]);
  11867. if (typeof calculateScore !== 'function') {
  11868. throw new Error('Selectize "score" setting must be a function that returns a function');
  11869. }
  11870. }
  11871. // perform search
  11872. if (query !== self.lastQuery) {
  11873. self.lastQuery = query;
  11874. result = self.sifter.search(query, $.extend(options, {score: calculateScore}));
  11875. self.currentResults = result;
  11876. } else {
  11877. result = $.extend(true, {}, self.currentResults);
  11878. }
  11879. // filter out selected items
  11880. if (settings.hideSelected) {
  11881. for (i = result.items.length - 1; i >= 0; i--) {
  11882. if (self.items.indexOf(hash_key(result.items[i].id)) !== - 1) {
  11883. result.items.splice(i, 1);
  11884. }
  11885. }
  11886. }
  11887. return result;
  11888. },
  11889. /**
  11890. * Refreshes the list of available options shown
  11891. * in the autocomplete dropdown menu.
  11892. *
  11893. * @param {boolean} triggerDropdown
  11894. */
  11895. refreshOptions: function refreshOptions(triggerDropdown) {
  11896. var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
  11897. var $active, $active_before, $create;
  11898. if (typeof triggerDropdown === 'undefined') {
  11899. triggerDropdown = true;
  11900. }
  11901. var self = this;
  11902. var query = $.trim(self.$control_input.val());
  11903. var results = self.search(query);
  11904. var $dropdown_content = self.$dropdown_content;
  11905. var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
  11906. // build markup
  11907. n = results.items.length;
  11908. if (typeof self.settings.maxOptions === 'number') {
  11909. n = Math.min(n, self.settings.maxOptions);
  11910. }
  11911. // render and group available options individually
  11912. groups = {};
  11913. groups_order = [];
  11914. for (i = 0; i < n; i++) {
  11915. option = self.options[results.items[i].id];
  11916. option_html = self.render('option', option);
  11917. optgroup = option[self.settings.optgroupField] || '';
  11918. optgroups = $.isArray(optgroup) ? optgroup : [optgroup];
  11919. for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
  11920. optgroup = optgroups[j];
  11921. if (!self.optgroups.hasOwnProperty(optgroup)) {
  11922. optgroup = '';
  11923. }
  11924. if (!groups.hasOwnProperty(optgroup)) {
  11925. groups[optgroup] = document.createDocumentFragment();
  11926. groups_order.push(optgroup);
  11927. }
  11928. groups[optgroup].appendChild(option_html);
  11929. }
  11930. }
  11931. // sort optgroups
  11932. if (this.settings.lockOptgroupOrder) {
  11933. groups_order.sort(function (a, b) {
  11934. var a_order = self.optgroups[a].$order || 0;
  11935. var b_order = self.optgroups[b].$order || 0;
  11936. return a_order - b_order;
  11937. });
  11938. }
  11939. // render optgroup headers & join groups
  11940. html = document.createDocumentFragment();
  11941. for (i = 0, n = groups_order.length; i < n; i++) {
  11942. optgroup = groups_order[i];
  11943. if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
  11944. // render the optgroup header and options within it,
  11945. // then pass it to the wrapper template
  11946. html_children = document.createDocumentFragment();
  11947. html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
  11948. html_children.appendChild(groups[optgroup]);
  11949. html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
  11950. html: domToString(html_children),
  11951. dom: html_children
  11952. })));
  11953. } else {
  11954. html.appendChild(groups[optgroup]);
  11955. }
  11956. }
  11957. $dropdown_content.html(html);
  11958. // highlight matching terms inline
  11959. if (self.settings.highlight && results.query.length && results.tokens.length) {
  11960. $dropdown_content.removeHighlight();
  11961. for (i = 0, n = results.tokens.length; i < n; i++) {
  11962. highlight($dropdown_content, results.tokens[i].regex);
  11963. }
  11964. }
  11965. // add "selected" class to selected options
  11966. if (!self.settings.hideSelected) {
  11967. for (i = 0, n = self.items.length; i < n; i++) {
  11968. self.getOption(self.items[i]).addClass('selected');
  11969. }
  11970. }
  11971. // add create option
  11972. has_create_option = self.canCreate(query);
  11973. if (has_create_option) {
  11974. $dropdown_content.prepend(self.render('option_create', {input: query}));
  11975. $create = $($dropdown_content[0].childNodes[0]);
  11976. }
  11977. // activate
  11978. self.hasOptions = results.items.length > 0 || has_create_option;
  11979. if (self.hasOptions) {
  11980. if (results.items.length > 0) {
  11981. $active_before = active_before && self.getOption(active_before);
  11982. if ($active_before && $active_before.length) {
  11983. $active = $active_before;
  11984. } else if (self.settings.mode === 'single' && self.items.length) {
  11985. $active = self.getOption(self.items[0]);
  11986. }
  11987. if (!$active || !$active.length) {
  11988. if ($create && !self.settings.addPrecedence) {
  11989. $active = self.getAdjacentOption($create, 1);
  11990. } else {
  11991. $active = $dropdown_content.find('[data-selectable]:first');
  11992. }
  11993. }
  11994. } else {
  11995. $active = $create;
  11996. }
  11997. self.setActiveOption($active);
  11998. if (triggerDropdown && !self.isOpen) {
  11999. self.open();
  12000. }
  12001. } else {
  12002. self.setActiveOption(null);
  12003. if (triggerDropdown && self.isOpen) {
  12004. self.close();
  12005. }
  12006. }
  12007. },
  12008. /**
  12009. * Adds an available option. If it already exists,
  12010. * nothing will happen. Note: this does not refresh
  12011. * the options list dropdown (use `refreshOptions`
  12012. * for that).
  12013. *
  12014. * Usage:
  12015. *
  12016. * this.addOption(data)
  12017. *
  12018. * @param {object|array} data
  12019. */
  12020. addOption: function addOption(data) {
  12021. var i,
  12022. n,
  12023. value,
  12024. self = this;
  12025. if ($.isArray(data)) {
  12026. for (i = 0, n = data.length; i < n; i++) {
  12027. self.addOption(data[i]);
  12028. }
  12029. return;
  12030. }
  12031. if (value = self.registerOption(data)) {
  12032. self.userOptions[value] = true;
  12033. self.lastQuery = null;
  12034. self.trigger('option_add', value, data);
  12035. }
  12036. },
  12037. /**
  12038. * Registers an option to the pool of options.
  12039. *
  12040. * @param {object} data
  12041. * @return {boolean|string}
  12042. */
  12043. registerOption: function registerOption(data) {
  12044. var key = hash_key(data[this.settings.valueField]);
  12045. if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key))
  12046. return false;
  12047. data.$order = data.$order || ++this.order;
  12048. this.options[key] = data;
  12049. return key;
  12050. },
  12051. /**
  12052. * Registers an option group to the pool of option groups.
  12053. *
  12054. * @param {object} data
  12055. * @return {boolean|string}
  12056. */
  12057. registerOptionGroup: function registerOptionGroup(data) {
  12058. var key = hash_key(data[this.settings.optgroupValueField]);
  12059. if (!key)
  12060. return false;
  12061. data.$order = data.$order || ++this.order;
  12062. this.optgroups[key] = data;
  12063. return key;
  12064. },
  12065. /**
  12066. * Registers a new optgroup for options
  12067. * to be bucketed into.
  12068. *
  12069. * @param {string} id
  12070. * @param {object} data
  12071. */
  12072. addOptionGroup: function addOptionGroup(id, data) {
  12073. data[this.settings.optgroupValueField] = id;
  12074. if (id = this.registerOptionGroup(data)) {
  12075. this.trigger('optgroup_add', id, data);
  12076. }
  12077. },
  12078. /**
  12079. * Removes an existing option group.
  12080. *
  12081. * @param {string} id
  12082. */
  12083. removeOptionGroup: function removeOptionGroup(id) {
  12084. if (this.optgroups.hasOwnProperty(id)) {
  12085. delete this.optgroups[id];
  12086. this.renderCache = {};
  12087. this.trigger('optgroup_remove', id);
  12088. }
  12089. },
  12090. /**
  12091. * Clears all existing option groups.
  12092. */
  12093. clearOptionGroups: function clearOptionGroups() {
  12094. this.optgroups = {};
  12095. this.renderCache = {};
  12096. this.trigger('optgroup_clear');
  12097. },
  12098. /**
  12099. * Updates an option available for selection. If
  12100. * it is visible in the selected items or options
  12101. * dropdown, it will be re-rendered automatically.
  12102. *
  12103. * @param {string} value
  12104. * @param {object} data
  12105. */
  12106. updateOption: function updateOption(value, data) {
  12107. var self = this;
  12108. var $item, $item_new;
  12109. var value_new, index_item, cache_items, cache_options, order_old;
  12110. value = hash_key(value);
  12111. value_new = hash_key(data[self.settings.valueField]);
  12112. // sanity checks
  12113. if (value === null)
  12114. return;
  12115. if (!self.options.hasOwnProperty(value))
  12116. return;
  12117. if (typeof value_new !== 'string')
  12118. throw new Error('Value must be set in option data');
  12119. order_old = self.options[value].$order;
  12120. // update references
  12121. if (value_new !== value) {
  12122. delete self.options[value];
  12123. index_item = self.items.indexOf(value);
  12124. if (index_item !== - 1) {
  12125. self.items.splice(index_item, 1, value_new);
  12126. }
  12127. }
  12128. data.$order = data.$order || order_old;
  12129. self.options[value_new] = data;
  12130. // invalidate render cache
  12131. cache_items = self.renderCache['item'];
  12132. cache_options = self.renderCache['option'];
  12133. if (cache_items) {
  12134. delete cache_items[value];
  12135. delete cache_items[value_new];
  12136. }
  12137. if (cache_options) {
  12138. delete cache_options[value];
  12139. delete cache_options[value_new];
  12140. }
  12141. // update the item if it's selected
  12142. if (self.items.indexOf(value_new) !== - 1) {
  12143. $item = self.getItem(value);
  12144. $item_new = $(self.render('item', data));
  12145. if ($item.hasClass('active'))
  12146. $item_new.addClass('active');
  12147. $item.replaceWith($item_new);
  12148. }
  12149. // invalidate last query because we might have updated the sortField
  12150. self.lastQuery = null;
  12151. // update dropdown contents
  12152. if (self.isOpen) {
  12153. self.refreshOptions(false);
  12154. }
  12155. },
  12156. /**
  12157. * Removes a single option.
  12158. *
  12159. * @param {string} value
  12160. * @param {boolean} silent
  12161. */
  12162. removeOption: function removeOption(value, silent) {
  12163. var self = this;
  12164. value = hash_key(value);
  12165. var cache_items = self.renderCache['item'];
  12166. var cache_options = self.renderCache['option'];
  12167. if (cache_items)
  12168. delete cache_items[value];
  12169. if (cache_options)
  12170. delete cache_options[value];
  12171. delete self.userOptions[value];
  12172. delete self.options[value];
  12173. self.lastQuery = null;
  12174. self.trigger('option_remove', value);
  12175. self.removeItem(value, silent);
  12176. },
  12177. /**
  12178. * Clears all options.
  12179. */
  12180. clearOptions: function clearOptions() {
  12181. var self = this;
  12182. self.loadedSearches = {};
  12183. self.userOptions = {};
  12184. self.renderCache = {};
  12185. self.options = self.sifter.items = {};
  12186. self.lastQuery = null;
  12187. self.trigger('option_clear');
  12188. self.clear();
  12189. },
  12190. /**
  12191. * Returns the jQuery element of the option
  12192. * matching the given value.
  12193. *
  12194. * @param {string} value
  12195. * @returns {object}
  12196. */
  12197. getOption: function getOption(value) {
  12198. return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
  12199. },
  12200. /**
  12201. * Returns the jQuery element of the next or
  12202. * previous selectable option.
  12203. *
  12204. * @param {object} $option
  12205. * @param {int} direction can be 1 for next or -1 for previous
  12206. * @return {object}
  12207. */
  12208. getAdjacentOption: function getAdjacentOption($option, direction) {
  12209. var $options = this.$dropdown.find('[data-selectable]');
  12210. var index = $options.index($option) + direction;
  12211. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  12212. },
  12213. /**
  12214. * Finds the first element with a "data-value" attribute
  12215. * that matches the given value.
  12216. *
  12217. * @param {mixed} value
  12218. * @param {object} $els
  12219. * @return {object}
  12220. */
  12221. getElementWithValue: function getElementWithValue(value, $els) {
  12222. value = hash_key(value);
  12223. if (typeof value !== 'undefined' && value !== null) {
  12224. for (var i = 0, n = $els.length; i < n; i++) {
  12225. if ($els[i].getAttribute('data-value') === value) {
  12226. return $($els[i]);
  12227. }
  12228. }
  12229. }
  12230. return $();
  12231. },
  12232. /**
  12233. * Returns the jQuery element of the item
  12234. * matching the given value.
  12235. *
  12236. * @param {string} value
  12237. * @returns {object}
  12238. */
  12239. getItem: function getItem(value) {
  12240. return this.getElementWithValue(value, this.$control.children());
  12241. },
  12242. /**
  12243. * "Selects" multiple items at once. Adds them to the list
  12244. * at the current caret position.
  12245. *
  12246. * @param {string} value
  12247. * @param {boolean} silent
  12248. */
  12249. addItems: function addItems(values, silent) {
  12250. var items = $.isArray(values) ? values : [values];
  12251. for (var i = 0, n = items.length; i < n; i++) {
  12252. this.isPending = i < n - 1;
  12253. this.addItem(items[i], silent);
  12254. }
  12255. },
  12256. /**
  12257. * "Selects" an item. Adds it to the list
  12258. * at the current caret position.
  12259. *
  12260. * @param {string} value
  12261. * @param {boolean} silent
  12262. */
  12263. addItem: function addItem(value, silent) {
  12264. var events = silent ? [] : ['change'];
  12265. debounce_events(this, events, function () {
  12266. var $item, $option, $options;
  12267. var self = this;
  12268. var inputMode = self.settings.mode;
  12269. var i, active, value_next, wasFull;
  12270. value = hash_key(value);
  12271. if (self.items.indexOf(value) !== - 1) {
  12272. if (inputMode === 'single')
  12273. self.close();
  12274. return;
  12275. }
  12276. if (!self.options.hasOwnProperty(value))
  12277. return;
  12278. if (inputMode === 'single')
  12279. self.clear(silent);
  12280. if (inputMode === 'multi' && self.isFull())
  12281. return;
  12282. $item = $(self.render('item', self.options[value]));
  12283. wasFull = self.isFull();
  12284. self.items.splice(self.caretPos, 0, value);
  12285. self.insertAtCaret($item);
  12286. if (!self.isPending || !wasFull && self.isFull()) {
  12287. self.refreshState();
  12288. }
  12289. if (self.isSetup) {
  12290. $options = self.$dropdown_content.find('[data-selectable]');
  12291. // update menu / remove the option (if this is not one item being added as part of series)
  12292. if (!self.isPending) {
  12293. $option = self.getOption(value);
  12294. value_next = self.getAdjacentOption($option, 1).attr('data-value');
  12295. self.refreshOptions(self.isFocused && inputMode !== 'single');
  12296. if (value_next) {
  12297. self.setActiveOption(self.getOption(value_next));
  12298. }
  12299. }
  12300. // hide the menu if the maximum number of items have been selected or no options are left
  12301. if (!$options.length || self.isFull()) {
  12302. self.close();
  12303. } else {
  12304. self.positionDropdown();
  12305. }
  12306. self.updatePlaceholder();
  12307. self.trigger('item_add', value, $item);
  12308. self.updateOriginalInput({silent: silent});
  12309. }
  12310. });
  12311. },
  12312. /**
  12313. * Removes the selected item matching
  12314. * the provided value.
  12315. *
  12316. * @param {string} value
  12317. */
  12318. removeItem: function removeItem(value, silent) {
  12319. var self = this;
  12320. var $item, i, idx;
  12321. $item = value instanceof $ ? value : self.getItem(value);
  12322. value = hash_key($item.attr('data-value'));
  12323. i = self.items.indexOf(value);
  12324. if (i !== - 1) {
  12325. $item.remove();
  12326. if ($item.hasClass('active')) {
  12327. idx = self.$activeItems.indexOf($item[0]);
  12328. self.$activeItems.splice(idx, 1);
  12329. }
  12330. self.items.splice(i, 1);
  12331. self.lastQuery = null;
  12332. if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
  12333. self.removeOption(value, silent);
  12334. }
  12335. if (i < self.caretPos) {
  12336. self.setCaret(self.caretPos - 1);
  12337. }
  12338. self.refreshState();
  12339. self.updatePlaceholder();
  12340. self.updateOriginalInput({silent: silent});
  12341. self.positionDropdown();
  12342. self.trigger('item_remove', value, $item);
  12343. }
  12344. },
  12345. /**
  12346. * Invokes the `create` method provided in the
  12347. * selectize options that should provide the data
  12348. * for the new item, given the user input.
  12349. *
  12350. * Once this completes, it will be added
  12351. * to the item list.
  12352. *
  12353. * @param {string} value
  12354. * @param {boolean} [triggerDropdown]
  12355. * @param {function} [callback]
  12356. * @return {boolean}
  12357. */
  12358. createItem: function createItem(input, triggerDropdown) {
  12359. var self = this;
  12360. var caret = self.caretPos;
  12361. input = input || $.trim(self.$control_input.val() || '');
  12362. var callback = arguments[arguments.length - 1];
  12363. if (typeof callback !== 'function')
  12364. callback = function callback() {};
  12365. if (typeof triggerDropdown !== 'boolean') {
  12366. triggerDropdown = true;
  12367. }
  12368. if (!self.canCreate(input)) {
  12369. callback();
  12370. return false;
  12371. }
  12372. self.lock();
  12373. var setup = typeof self.settings.create === 'function' ? this.settings.create : function (input) {
  12374. var data = {};
  12375. data[self.settings.labelField] = input;
  12376. data[self.settings.valueField] = input;
  12377. return data;
  12378. };
  12379. var create = once(function (data) {
  12380. self.unlock();
  12381. if (!data || (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object')
  12382. return callback();
  12383. var value = hash_key(data[self.settings.valueField]);
  12384. if (typeof value !== 'string')
  12385. return callback();
  12386. self.setTextboxValue('');
  12387. self.addOption(data);
  12388. self.setCaret(caret);
  12389. self.addItem(value);
  12390. self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
  12391. callback(data);
  12392. });
  12393. var output = setup.apply(this, [input, create]);
  12394. if (typeof output !== 'undefined') {
  12395. create(output);
  12396. }
  12397. return true;
  12398. },
  12399. /**
  12400. * Re-renders the selected item lists.
  12401. */
  12402. refreshItems: function refreshItems() {
  12403. this.lastQuery = null;
  12404. if (this.isSetup) {
  12405. this.addItem(this.items);
  12406. }
  12407. this.refreshState();
  12408. this.updateOriginalInput();
  12409. },
  12410. /**
  12411. * Updates all state-dependent attributes
  12412. * and CSS classes.
  12413. */
  12414. refreshState: function refreshState() {
  12415. this.refreshValidityState();
  12416. this.refreshClasses();
  12417. },
  12418. /**
  12419. * Update the `required` attribute of both input and control input.
  12420. *
  12421. * The `required` property needs to be activated on the control input
  12422. * for the error to be displayed at the right place. `required` also
  12423. * needs to be temporarily deactivated on the input since the input is
  12424. * hidden and can't show errors.
  12425. */
  12426. refreshValidityState: function refreshValidityState() {
  12427. if (!this.isRequired)
  12428. return false;
  12429. var invalid = !this.items.length;
  12430. this.isInvalid = invalid;
  12431. this.$control_input.prop('required', invalid);
  12432. this.$input.prop('required', !invalid);
  12433. },
  12434. /**
  12435. * Updates all state-dependent CSS classes.
  12436. */
  12437. refreshClasses: function refreshClasses() {
  12438. var self = this;
  12439. var isFull = self.isFull();
  12440. var isLocked = self.isLocked;
  12441. self.$wrapper.toggleClass('rtl', self.rtl);
  12442. 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);
  12443. self.$control_input.data('grow', !isFull && !isLocked);
  12444. },
  12445. /**
  12446. * Determines whether or not more items can be added
  12447. * to the control without exceeding the user-defined maximum.
  12448. *
  12449. * @returns {boolean}
  12450. */
  12451. isFull: function isFull() {
  12452. return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
  12453. },
  12454. /**
  12455. * Refreshes the original <select> or <input>
  12456. * element to reflect the current state.
  12457. */
  12458. updateOriginalInput: function updateOriginalInput(opts) {
  12459. var i,
  12460. n,
  12461. options,
  12462. label,
  12463. self = this;
  12464. opts = opts || {};
  12465. if (self.tagType === TAG_SELECT) {
  12466. options = [];
  12467. for (i = 0, n = self.items.length; i < n; i++) {
  12468. label = self.options[self.items[i]][self.settings.labelField] || '';
  12469. options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
  12470. }
  12471. if (!options.length && !this.$input.attr('multiple')) {
  12472. options.push('<option value="" selected="selected"></option>');
  12473. }
  12474. self.$input.html(options.join(''));
  12475. } else {
  12476. self.$input.val(self.getValue());
  12477. self.$input.attr('value', self.$input.val());
  12478. }
  12479. if (self.isSetup) {
  12480. if (!opts.silent) {
  12481. self.trigger('change', self.$input.val());
  12482. }
  12483. }
  12484. },
  12485. /**
  12486. * Shows/hide the input placeholder depending
  12487. * on if there items in the list already.
  12488. */
  12489. updatePlaceholder: function updatePlaceholder() {
  12490. if (!this.settings.placeholder)
  12491. return;
  12492. var $input = this.$control_input;
  12493. if (this.items.length) {
  12494. $input.removeAttr('placeholder');
  12495. } else {
  12496. $input.attr('placeholder', this.settings.placeholder);
  12497. }
  12498. $input.triggerHandler('update', {force: true});
  12499. },
  12500. /**
  12501. * Shows the autocomplete dropdown containing
  12502. * the available options.
  12503. */
  12504. open: function open() {
  12505. var self = this;
  12506. if (self.isLocked || self.isOpen || self.settings.mode === 'multi' && self.isFull())
  12507. return;
  12508. self.focus();
  12509. self.isOpen = true;
  12510. self.refreshState();
  12511. self.$dropdown.css({visibility: 'hidden', display: 'block'});
  12512. self.positionDropdown();
  12513. self.$dropdown.css({visibility: 'visible'});
  12514. self.trigger('dropdown_open', self.$dropdown);
  12515. },
  12516. /**
  12517. * Closes the autocomplete dropdown menu.
  12518. */
  12519. close: function close() {
  12520. var self = this;
  12521. var trigger = self.isOpen;
  12522. if (self.settings.mode === 'single' && self.items.length) {
  12523. self.hideInput();
  12524. self.$control_input.blur(); // close keyboard on iOS
  12525. }
  12526. self.isOpen = false;
  12527. self.$dropdown.hide();
  12528. self.setActiveOption(null);
  12529. self.refreshState();
  12530. if (trigger)
  12531. self.trigger('dropdown_close', self.$dropdown);
  12532. },
  12533. /**
  12534. * Calculates and applies the appropriate
  12535. * position of the dropdown.
  12536. */
  12537. positionDropdown: function positionDropdown() {
  12538. var $control = this.$control;
  12539. var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
  12540. offset.top += $control.outerHeight(true);
  12541. this.$dropdown.css({
  12542. width: $control.outerWidth(),
  12543. top: offset.top,
  12544. left: offset.left
  12545. });
  12546. },
  12547. /**
  12548. * Resets / clears all selected items
  12549. * from the control.
  12550. *
  12551. * @param {boolean} silent
  12552. */
  12553. clear: function clear(silent) {
  12554. var self = this;
  12555. if (!self.items.length)
  12556. return;
  12557. self.$control.children(':not(input)').remove();
  12558. self.items = [];
  12559. self.lastQuery = null;
  12560. self.setCaret(0);
  12561. self.setActiveItem(null);
  12562. self.updatePlaceholder();
  12563. self.updateOriginalInput({silent: silent});
  12564. self.refreshState();
  12565. self.showInput();
  12566. self.trigger('clear');
  12567. },
  12568. /**
  12569. * A helper method for inserting an element
  12570. * at the current caret position.
  12571. *
  12572. * @param {object} $el
  12573. */
  12574. insertAtCaret: function insertAtCaret($el) {
  12575. var caret = Math.min(this.caretPos, this.items.length);
  12576. if (caret === 0) {
  12577. this.$control.prepend($el);
  12578. } else {
  12579. $(this.$control[0].childNodes[caret]).before($el);
  12580. }
  12581. this.setCaret(caret + 1);
  12582. },
  12583. /**
  12584. * Removes the current selected item(s).
  12585. *
  12586. * @param {object} e (optional)
  12587. * @returns {boolean}
  12588. */
  12589. deleteSelection: function deleteSelection(e) {
  12590. var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
  12591. var self = this;
  12592. direction = e && e.keyCode === KEY_BACKSPACE ? - 1 : 1;
  12593. selection = getSelection(self.$control_input[0]);
  12594. if (self.$activeOption && !self.settings.hideSelected) {
  12595. option_select = self.getAdjacentOption(self.$activeOption, - 1).attr('data-value');
  12596. }
  12597. // determine items that will be removed
  12598. values = [];
  12599. if (self.$activeItems.length) {
  12600. $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
  12601. caret = self.$control.children(':not(input)').index($tail);
  12602. if (direction > 0) {
  12603. caret++;
  12604. }
  12605. for (i = 0, n = self.$activeItems.length; i < n; i++) {
  12606. values.push($(self.$activeItems[i]).attr('data-value'));
  12607. }
  12608. if (e) {
  12609. e.preventDefault();
  12610. e.stopPropagation();
  12611. }
  12612. } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
  12613. if (direction < 0 && selection.start === 0 && selection.length === 0) {
  12614. values.push(self.items[self.caretPos - 1]);
  12615. } else if (direction > 0 && selection.start === self.$control_input.val().length) {
  12616. values.push(self.items[self.caretPos]);
  12617. }
  12618. }
  12619. // allow the callback to abort
  12620. if (!values.length || typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false) {
  12621. return false;
  12622. }
  12623. // perform removal
  12624. if (typeof caret !== 'undefined') {
  12625. self.setCaret(caret);
  12626. }
  12627. while (values.length) {
  12628. self.removeItem(values.pop());
  12629. }
  12630. self.showInput();
  12631. self.positionDropdown();
  12632. self.refreshOptions(true);
  12633. // select previous option
  12634. if (option_select) {
  12635. $option_select = self.getOption(option_select);
  12636. if ($option_select.length) {
  12637. self.setActiveOption($option_select);
  12638. }
  12639. }
  12640. return true;
  12641. },
  12642. /**
  12643. * Selects the previous / next item (depending
  12644. * on the `direction` argument).
  12645. *
  12646. * > 0 - right
  12647. * < 0 - left
  12648. *
  12649. * @param {int} direction
  12650. * @param {object} e (optional)
  12651. */
  12652. advanceSelection: function advanceSelection(direction, e) {
  12653. var tail, selection, idx, valueLength, cursorAtEdge, $tail;
  12654. var self = this;
  12655. if (direction === 0)
  12656. return;
  12657. if (self.rtl)
  12658. direction *= - 1;
  12659. tail = direction > 0 ? 'last' : 'first';
  12660. selection = getSelection(self.$control_input[0]);
  12661. if (self.isFocused && !self.isInputHidden) {
  12662. valueLength = self.$control_input.val().length;
  12663. cursorAtEdge = direction < 0 ? selection.start === 0 && selection.length === 0 : selection.start === valueLength;
  12664. if (cursorAtEdge && !valueLength) {
  12665. self.advanceCaret(direction, e);
  12666. }
  12667. } else {
  12668. $tail = self.$control.children('.active:' + tail);
  12669. if ($tail.length) {
  12670. idx = self.$control.children(':not(input)').index($tail);
  12671. self.setActiveItem(null);
  12672. self.setCaret(direction > 0 ? idx + 1 : idx);
  12673. }
  12674. }
  12675. },
  12676. /**
  12677. * Moves the caret left / right.
  12678. *
  12679. * @param {int} direction
  12680. * @param {object} e (optional)
  12681. */
  12682. advanceCaret: function advanceCaret(direction, e) {
  12683. var self = this,
  12684. fn,
  12685. $adj;
  12686. if (direction === 0)
  12687. return;
  12688. fn = direction > 0 ? 'next' : 'prev';
  12689. if (self.isShiftDown) {
  12690. $adj = self.$control_input[fn]();
  12691. if ($adj.length) {
  12692. self.hideInput();
  12693. self.setActiveItem($adj);
  12694. e && e.preventDefault();
  12695. }
  12696. } else {
  12697. self.setCaret(self.caretPos + direction);
  12698. }
  12699. },
  12700. /**
  12701. * Moves the caret to the specified index.
  12702. *
  12703. * @param {int} i
  12704. */
  12705. setCaret: function setCaret(i) {
  12706. var self = this;
  12707. if (self.settings.mode === 'single') {
  12708. i = self.items.length;
  12709. } else {
  12710. i = Math.max(0, Math.min(self.items.length, i));
  12711. }
  12712. if (!self.isPending) {
  12713. // the input must be moved by leaving it in place and moving the
  12714. // siblings, due to the fact that focus cannot be restored once lost
  12715. // on mobile webkit devices
  12716. var j, n, fn, $children, $child;
  12717. $children = self.$control.children(':not(input)');
  12718. for (j = 0, n = $children.length; j < n; j++) {
  12719. $child = $($children[j]).detach();
  12720. if (j < i) {
  12721. self.$control_input.before($child);
  12722. } else {
  12723. self.$control.append($child);
  12724. }
  12725. }
  12726. }
  12727. self.caretPos = i;
  12728. },
  12729. /**
  12730. * Disables user input on the control. Used while
  12731. * items are being asynchronously created.
  12732. */
  12733. lock: function lock() {
  12734. this.close();
  12735. this.isLocked = true;
  12736. this.refreshState();
  12737. },
  12738. /**
  12739. * Re-enables user input on the control.
  12740. */
  12741. unlock: function unlock() {
  12742. this.isLocked = false;
  12743. this.refreshState();
  12744. },
  12745. /**
  12746. * Disables user input on the control completely.
  12747. * While disabled, it cannot receive focus.
  12748. */
  12749. disable: function disable() {
  12750. var self = this;
  12751. self.$input.prop('disabled', true);
  12752. self.$control_input.prop('disabled', true).prop('tabindex', - 1);
  12753. self.isDisabled = true;
  12754. self.lock();
  12755. },
  12756. /**
  12757. * Enables the control so that it can respond
  12758. * to focus and user input.
  12759. */
  12760. enable: function enable() {
  12761. var self = this;
  12762. self.$input.prop('disabled', false);
  12763. self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
  12764. self.isDisabled = false;
  12765. self.unlock();
  12766. },
  12767. /**
  12768. * Completely destroys the control and
  12769. * unbinds all event listeners so that it can
  12770. * be garbage collected.
  12771. */
  12772. destroy: function destroy() {
  12773. var self = this;
  12774. var eventNS = self.eventNS;
  12775. var revertSettings = self.revertSettings;
  12776. self.trigger('destroy');
  12777. self.off();
  12778. self.$wrapper.remove();
  12779. self.$dropdown.remove();
  12780. self.$input.html('').append(revertSettings.$children).removeAttr('tabindex').removeClass('selectized').attr({tabindex: revertSettings.tabindex}).show();
  12781. self.$control_input.removeData('grow');
  12782. self.$input.removeData('selectize');
  12783. $(window).off(eventNS);
  12784. $(document).off(eventNS);
  12785. $(document.body).off(eventNS);
  12786. delete self.$input[0].selectize;
  12787. },
  12788. /**
  12789. * A helper method for rendering "item" and
  12790. * "option" templates, given the data.
  12791. *
  12792. * @param {string} templateName
  12793. * @param {object} data
  12794. * @returns {string}
  12795. */
  12796. render: function render(templateName, data) {
  12797. var value, id, label;
  12798. var html = '';
  12799. var cache = false;
  12800. var self = this;
  12801. var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
  12802. if (templateName === 'option' || templateName === 'item') {
  12803. value = hash_key(data[self.settings.valueField]);
  12804. cache = !!value;
  12805. }
  12806. // pull markup from cache if it exists
  12807. if (cache) {
  12808. if (!isset(self.renderCache[templateName])) {
  12809. self.renderCache[templateName] = {};
  12810. }
  12811. if (self.renderCache[templateName].hasOwnProperty(value)) {
  12812. return self.renderCache[templateName][value];
  12813. }
  12814. }
  12815. // render markup
  12816. html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
  12817. // add mandatory attributes
  12818. if (templateName === 'option' || templateName === 'option_create') {
  12819. html.attr('data-selectable', '');
  12820. } else if (templateName === 'optgroup') {
  12821. id = data[self.settings.optgroupValueField] || '';
  12822. html.attr('data-group', id);
  12823. }
  12824. if (templateName === 'option' || templateName === 'item') {
  12825. html.attr('data-value', value || '');
  12826. }
  12827. // update cache
  12828. if (cache) {
  12829. self.renderCache[templateName][value] = html[0];
  12830. }
  12831. return html[0];
  12832. },
  12833. /**
  12834. * Clears the render cache for a template. If
  12835. * no template is given, clears all render
  12836. * caches.
  12837. *
  12838. * @param {string} templateName
  12839. */
  12840. clearCache: function clearCache(templateName) {
  12841. var self = this;
  12842. if (typeof templateName === 'undefined') {
  12843. self.renderCache = {};
  12844. } else {
  12845. delete self.renderCache[templateName];
  12846. }
  12847. },
  12848. /**
  12849. * Determines whether or not to display the
  12850. * create item prompt, given a user input.
  12851. *
  12852. * @param {string} input
  12853. * @return {boolean}
  12854. */
  12855. canCreate: function canCreate(input) {
  12856. var self = this;
  12857. if (!self.settings.create)
  12858. return false;
  12859. var filter = self.settings.createFilter;
  12860. return input.length && (typeof filter !== 'function' || filter.apply(self, [input])) && (typeof filter !== 'string' || new RegExp(filter).test(input)) && (!(filter instanceof RegExp) || filter.test(input));
  12861. }
  12862. });
  12863. Selectize.count = 0;
  12864. Selectize.defaults = {
  12865. options: [],
  12866. optgroups: [],
  12867. plugins: [],
  12868. delimiter: ',',
  12869. splitOn: null, // regexp or string for splitting up values from a paste command
  12870. persist: true,
  12871. diacritics: true,
  12872. create: false,
  12873. createOnBlur: false,
  12874. createFilter: null,
  12875. highlight: true,
  12876. openOnFocus: true,
  12877. maxOptions: 1000,
  12878. maxItems: null,
  12879. hideSelected: null,
  12880. addPrecedence: false,
  12881. selectOnTab: false,
  12882. preload: false,
  12883. allowEmptyOption: false,
  12884. closeAfterSelect: false,
  12885. scrollDuration: 60,
  12886. loadThrottle: 300,
  12887. loadingClass: 'loading',
  12888. dataAttr: 'data-data',
  12889. optgroupField: 'optgroup',
  12890. valueField: 'value',
  12891. labelField: 'text',
  12892. optgroupLabelField: 'label',
  12893. optgroupValueField: 'value',
  12894. lockOptgroupOrder: false,
  12895. sortField: '$order',
  12896. searchField: ['text'],
  12897. searchConjunction: 'and',
  12898. mode: null,
  12899. wrapperClass: 'selectize-control',
  12900. inputClass: 'selectize-input',
  12901. dropdownClass: 'selectize-dropdown',
  12902. dropdownContentClass: 'selectize-dropdown-content',
  12903. dropdownParent: null,
  12904. copyClassesToDropdown: true,
  12905. /*
  12906. load : null, // function(query, callback) { ... }
  12907. score : null, // function(search) { ... }
  12908. onInitialize : null, // function() { ... }
  12909. onChange : null, // function(value) { ... }
  12910. onItemAdd : null, // function(value, $item) { ... }
  12911. onItemRemove : null, // function(value) { ... }
  12912. onClear : null, // function() { ... }
  12913. onOptionAdd : null, // function(value, data) { ... }
  12914. onOptionRemove : null, // function(value) { ... }
  12915. onOptionClear : null, // function() { ... }
  12916. onOptionGroupAdd : null, // function(id, data) { ... }
  12917. onOptionGroupRemove : null, // function(id) { ... }
  12918. onOptionGroupClear : null, // function() { ... }
  12919. onDropdownOpen : null, // function($dropdown) { ... }
  12920. onDropdownClose : null, // function($dropdown) { ... }
  12921. onType : null, // function(str) { ... }
  12922. onDelete : null, // function(values) { ... }
  12923. */
  12924. render: {
  12925. /*
  12926. item: null,
  12927. optgroup: null,
  12928. optgroup_header: null,
  12929. option: null,
  12930. option_create: null
  12931. */
  12932. }
  12933. };
  12934. $.fn.selectize = function (settings_user) {
  12935. var defaults = $.fn.selectize.defaults;
  12936. var settings = $.extend({}, defaults, settings_user);
  12937. var attr_data = settings.dataAttr;
  12938. var field_label = settings.labelField;
  12939. var field_value = settings.valueField;
  12940. var field_optgroup = settings.optgroupField;
  12941. var field_optgroup_label = settings.optgroupLabelField;
  12942. var field_optgroup_value = settings.optgroupValueField;
  12943. /**
  12944. * Initializes selectize from a <input type="text"> element.
  12945. *
  12946. * @param {object} $input
  12947. * @param {object} settings_element
  12948. */
  12949. var init_textbox = function init_textbox($input, settings_element) {
  12950. var i, n, values, option;
  12951. var data_raw = $input.attr(attr_data);
  12952. if (!data_raw) {
  12953. var value = $.trim($input.val() || '');
  12954. if (!settings.allowEmptyOption && !value.length)
  12955. return;
  12956. values = value.split(settings.delimiter);
  12957. for (i = 0, n = values.length; i < n; i++) {
  12958. option = {};
  12959. option[field_label] = values[i];
  12960. option[field_value] = values[i];
  12961. settings_element.options.push(option);
  12962. }
  12963. settings_element.items = values;
  12964. } else {
  12965. settings_element.options = JSON.parse(data_raw);
  12966. for (i = 0, n = settings_element.options.length; i < n; i++) {
  12967. settings_element.items.push(settings_element.options[i][field_value]);
  12968. }
  12969. }
  12970. };
  12971. /**
  12972. * Initializes selectize from a <select> element.
  12973. *
  12974. * @param {object} $input
  12975. * @param {object} settings_element
  12976. */
  12977. var init_select = function init_select($input, settings_element) {
  12978. var i,
  12979. n,
  12980. tagName,
  12981. $children,
  12982. order = 0;
  12983. var options = settings_element.options;
  12984. var optionsMap = {};
  12985. var readData = function readData($el) {
  12986. var data = attr_data && $el.attr(attr_data);
  12987. if (typeof data === 'string' && data.length) {
  12988. return JSON.parse(data);
  12989. }
  12990. return null;
  12991. };
  12992. var addOption = function addOption($option, group) {
  12993. $option = $($option);
  12994. var value = hash_key($option.val());
  12995. if (!value && !settings.allowEmptyOption)
  12996. return;
  12997. // if the option already exists, it's probably been
  12998. // duplicated in another optgroup. in this case, push
  12999. // the current group to the "optgroup" property on the
  13000. // existing option so that it's rendered in both places.
  13001. if (optionsMap.hasOwnProperty(value)) {
  13002. if (group) {
  13003. var arr = optionsMap[value][field_optgroup];
  13004. if (!arr) {
  13005. optionsMap[value][field_optgroup] = group;
  13006. } else if (!$.isArray(arr)) {
  13007. optionsMap[value][field_optgroup] = [arr, group];
  13008. } else {
  13009. arr.push(group);
  13010. }
  13011. }
  13012. return;
  13013. }
  13014. var option = readData($option) || {};
  13015. option[field_label] = option[field_label] || $option.text();
  13016. option[field_value] = option[field_value] || value;
  13017. option[field_optgroup] = option[field_optgroup] || group;
  13018. optionsMap[value] = option;
  13019. options.push(option);
  13020. if ($option.is(':selected')) {
  13021. settings_element.items.push(value);
  13022. }
  13023. };
  13024. var addGroup = function addGroup($optgroup) {
  13025. var i, n, id, optgroup, $options;
  13026. $optgroup = $($optgroup);
  13027. id = $optgroup.attr('label');
  13028. if (id) {
  13029. optgroup = readData($optgroup) || {};
  13030. optgroup[field_optgroup_label] = id;
  13031. optgroup[field_optgroup_value] = id;
  13032. settings_element.optgroups.push(optgroup);
  13033. }
  13034. $options = $('option', $optgroup);
  13035. for (i = 0, n = $options.length; i < n; i++) {
  13036. addOption($options[i], id);
  13037. }
  13038. };
  13039. settings_element.maxItems = $input.attr('multiple') ? null : 1;
  13040. $children = $input.children();
  13041. for (i = 0, n = $children.length; i < n; i++) {
  13042. tagName = $children[i].tagName.toLowerCase();
  13043. if (tagName === 'optgroup') {
  13044. addGroup($children[i]);
  13045. } else if (tagName === 'option') {
  13046. addOption($children[i]);
  13047. }
  13048. }
  13049. };
  13050. return this.each(function () {
  13051. if (this.selectize)
  13052. return;
  13053. var instance;
  13054. var $input = $(this);
  13055. var tag_name = this.tagName.toLowerCase();
  13056. var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
  13057. if (!placeholder && !settings.allowEmptyOption) {
  13058. placeholder = $input.children('option[value=""]').text();
  13059. }
  13060. var settings_element = {
  13061. 'placeholder': placeholder,
  13062. 'options': [],
  13063. 'optgroups': [],
  13064. 'items': []
  13065. };
  13066. if (tag_name === 'select') {
  13067. init_select($input, settings_element);
  13068. } else {
  13069. init_textbox($input, settings_element);
  13070. }
  13071. instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
  13072. });
  13073. };
  13074. $.fn.selectize.defaults = Selectize.defaults;
  13075. $.fn.selectize.support = {
  13076. validity: SUPPORTS_VALIDITY_API
  13077. };
  13078. Selectize.define('drag_drop', function (options) {
  13079. if (!$.fn.sortable)
  13080. throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
  13081. if (this.settings.mode !== 'multi')
  13082. return;
  13083. var self = this;
  13084. self.lock = function () {
  13085. var original = self.lock;
  13086. return function () {
  13087. var sortable = self.$control.data('sortable');
  13088. if (sortable)
  13089. sortable.disable();
  13090. return original.apply(self, arguments);
  13091. };
  13092. }();
  13093. self.unlock = function () {
  13094. var original = self.unlock;
  13095. return function () {
  13096. var sortable = self.$control.data('sortable');
  13097. if (sortable)
  13098. sortable.enable();
  13099. return original.apply(self, arguments);
  13100. };
  13101. }();
  13102. self.setup = function () {
  13103. var original = self.setup;
  13104. return function () {
  13105. original.apply(this, arguments);
  13106. var $control = self.$control.sortable({
  13107. items: '[data-value]',
  13108. forcePlaceholderSize: true,
  13109. disabled: self.isLocked,
  13110. start: function start(e, ui) {
  13111. ui.placeholder.css('width', ui.helper.css('width'));
  13112. $control.css({overflow: 'visible'});
  13113. },
  13114. stop: function stop() {
  13115. $control.css({overflow: 'hidden'});
  13116. var active = self.$activeItems ? self.$activeItems.slice() : null;
  13117. var values = [];
  13118. $control.children('[data-value]').each(function () {
  13119. values.push($(this).attr('data-value'));
  13120. });
  13121. self.setValue(values);
  13122. self.setActiveItem(active);
  13123. }
  13124. });
  13125. };
  13126. }();
  13127. });
  13128. Selectize.define('dropdown_header', function (options) {
  13129. var self = this;
  13130. options = $.extend({
  13131. title: 'Untitled',
  13132. headerClass: 'selectize-dropdown-header',
  13133. titleRowClass: 'selectize-dropdown-header-title',
  13134. labelClass: 'selectize-dropdown-header-label',
  13135. closeClass: 'selectize-dropdown-header-close',
  13136. html: function html(data) {
  13137. 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>';
  13138. }
  13139. }, options);
  13140. self.setup = function () {
  13141. var original = self.setup;
  13142. return function () {
  13143. original.apply(self, arguments);
  13144. self.$dropdown_header = $(options.html(options));
  13145. self.$dropdown.prepend(self.$dropdown_header);
  13146. };
  13147. }();
  13148. });
  13149. Selectize.define('optgroup_columns', function (options) {
  13150. var self = this;
  13151. options = $.extend({
  13152. equalizeWidth: true,
  13153. equalizeHeight: true
  13154. }, options);
  13155. this.getAdjacentOption = function ($option, direction) {
  13156. var $options = $option.closest('[data-group]').find('[data-selectable]');
  13157. var index = $options.index($option) + direction;
  13158. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  13159. };
  13160. this.onKeyDown = function () {
  13161. var original = self.onKeyDown;
  13162. return function (e) {
  13163. var index, $option, $options, $optgroup;
  13164. if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
  13165. self.ignoreHover = true;
  13166. $optgroup = this.$activeOption.closest('[data-group]');
  13167. index = $optgroup.find('[data-selectable]').index(this.$activeOption);
  13168. if (e.keyCode === KEY_LEFT) {
  13169. $optgroup = $optgroup.prev('[data-group]');
  13170. } else {
  13171. $optgroup = $optgroup.next('[data-group]');
  13172. }
  13173. $options = $optgroup.find('[data-selectable]');
  13174. $option = $options.eq(Math.min($options.length - 1, index));
  13175. if ($option.length) {
  13176. this.setActiveOption($option);
  13177. }
  13178. return;
  13179. }
  13180. return original.apply(this, arguments);
  13181. };
  13182. }();
  13183. var getScrollbarWidth = function getScrollbarWidth() {
  13184. var div;
  13185. var width = getScrollbarWidth.width;
  13186. var doc = document;
  13187. if (typeof width === 'undefined') {
  13188. div = doc.createElement('div');
  13189. div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
  13190. div = div.firstChild;
  13191. doc.body.appendChild(div);
  13192. width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
  13193. doc.body.removeChild(div);
  13194. }
  13195. return width;
  13196. };
  13197. var equalizeSizes = function equalizeSizes() {
  13198. var i, n, height_max, width, width_last, width_parent, $optgroups;
  13199. $optgroups = $('[data-group]', self.$dropdown_content);
  13200. n = $optgroups.length;
  13201. if (!n || !self.$dropdown_content.width())
  13202. return;
  13203. if (options.equalizeHeight) {
  13204. height_max = 0;
  13205. for (i = 0; i < n; i++) {
  13206. height_max = Math.max(height_max, $optgroups.eq(i).height());
  13207. }
  13208. $optgroups.css({height: height_max});
  13209. }
  13210. if (options.equalizeWidth) {
  13211. width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
  13212. width = Math.round(width_parent / n);
  13213. $optgroups.css({width: width});
  13214. if (n > 1) {
  13215. width_last = width_parent - width * (n - 1);
  13216. $optgroups.eq(n - 1).css({width: width_last});
  13217. }
  13218. }
  13219. };
  13220. if (options.equalizeHeight || options.equalizeWidth) {
  13221. hook.after(this, 'positionDropdown', equalizeSizes);
  13222. hook.after(this, 'refreshOptions', equalizeSizes);
  13223. }
  13224. });
  13225. Selectize.define('remove_button', function (options) {
  13226. options = $.extend({
  13227. label: '&times;',
  13228. title: 'Remove',
  13229. className: 'remove',
  13230. append: true
  13231. }, options);
  13232. var singleClose = function singleClose(thisRef, options) {
  13233. options.className = 'remove-single';
  13234. var self = thisRef;
  13235. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  13236. /**
  13237. * Appends an element as a child (with raw HTML).
  13238. *
  13239. * @param {string} html_container
  13240. * @param {string} html_element
  13241. * @return {string}
  13242. */
  13243. var append = function append(html_container, html_element) {
  13244. return html_container + html_element;
  13245. };
  13246. thisRef.setup = function () {
  13247. var original = self.setup;
  13248. return function () {
  13249. // override the item rendering method to add the button to each
  13250. if (options.append) {
  13251. var id = $(self.$input.context).attr('id');
  13252. var selectizer = $('#' + id);
  13253. var render_item = self.settings.render.item;
  13254. self.settings.render.item = function (data) {
  13255. return append(render_item.apply(thisRef, arguments), html);
  13256. };
  13257. }
  13258. original.apply(thisRef, arguments);
  13259. // add event listener
  13260. thisRef.$control.on('click', '.' + options.className, function (e) {
  13261. e.preventDefault();
  13262. if (self.isLocked)
  13263. return;
  13264. self.clear();
  13265. });
  13266. };
  13267. }();
  13268. };
  13269. var multiClose = function multiClose(thisRef, options) {
  13270. var self = thisRef;
  13271. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  13272. /**
  13273. * Appends an element as a child (with raw HTML).
  13274. *
  13275. * @param {string} html_container
  13276. * @param {string} html_element
  13277. * @return {string}
  13278. */
  13279. var append = function append(html_container, html_element) {
  13280. var pos = html_container.search(/(<\/[^>]+>\s*)$/);
  13281. return html_container.substring(0, pos) + html_element + html_container.substring(pos);
  13282. };
  13283. thisRef.setup = function () {
  13284. var original = self.setup;
  13285. return function () {
  13286. // override the item rendering method to add the button to each
  13287. if (options.append) {
  13288. var render_item = self.settings.render.item;
  13289. self.settings.render.item = function (data) {
  13290. return append(render_item.apply(thisRef, arguments), html);
  13291. };
  13292. }
  13293. original.apply(thisRef, arguments);
  13294. // add event listener
  13295. thisRef.$control.on('click', '.' + options.className, function (e) {
  13296. e.preventDefault();
  13297. if (self.isLocked)
  13298. return;
  13299. var $item = $(e.currentTarget).parent();
  13300. self.setActiveItem($item);
  13301. if (self.deleteSelection()) {
  13302. self.setCaret(self.items.length);
  13303. }
  13304. });
  13305. };
  13306. }();
  13307. };
  13308. if (this.settings.mode === 'single') {
  13309. singleClose(this, options);
  13310. return;
  13311. } else {
  13312. multiClose(this, options);
  13313. }
  13314. });
  13315. Selectize.define('restore_on_backspace', function (options) {
  13316. var self = this;
  13317. options.text = options.text || function (option) {
  13318. return option[this.settings.labelField];
  13319. };
  13320. this.onKeyDown = function () {
  13321. var original = self.onKeyDown;
  13322. return function (e) {
  13323. var index, option;
  13324. if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
  13325. index = this.caretPos - 1;
  13326. if (index >= 0 && index < this.items.length) {
  13327. option = this.options[this.items[index]];
  13328. if (this.deleteSelection(e)) {
  13329. this.setTextboxValue(options.text.apply(this, [option]));
  13330. this.refreshOptions(true);
  13331. }
  13332. e.preventDefault();
  13333. return;
  13334. }
  13335. }
  13336. return original.apply(this, arguments);
  13337. };
  13338. }();
  13339. });
  13340. return Selectize;
  13341. });
  13342. /***/ }),
  13343. /* 30 */
  13344. /***/ (function (module, exports, __webpack_require__) {
  13345. "use strict";
  13346. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  13347. /*!
  13348. Autosize 4.0.0
  13349. license: MIT
  13350. http://www.jacklmoore.com/autosize
  13351. */
  13352. (function (global, factory) {
  13353. if (true) {
  13354. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  13355. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  13356. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  13357. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13358. } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
  13359. factory(exports, module);
  13360. } else {
  13361. var mod = {
  13362. exports: {}
  13363. };
  13364. factory(mod.exports, mod);
  13365. global.autosize = mod.exports;
  13366. }
  13367. })(undefined, function (exports, module) {
  13368. 'use strict';
  13369. var map = typeof Map === "function" ? new Map() : function () {
  13370. var keys = [];
  13371. var values = [];
  13372. return {
  13373. has: function has(key) {
  13374. return keys.indexOf(key) > - 1;
  13375. },
  13376. get: function get(key) {
  13377. return values[keys.indexOf(key)];
  13378. },
  13379. set: function set(key, value) {
  13380. if (keys.indexOf(key) === - 1) {
  13381. keys.push(key);
  13382. values.push(value);
  13383. }
  13384. },
  13385. 'delete': function _delete(key) {
  13386. var index = keys.indexOf(key);
  13387. if (index > - 1) {
  13388. keys.splice(index, 1);
  13389. values.splice(index, 1);
  13390. }
  13391. }
  13392. };
  13393. }();
  13394. var createEvent = function createEvent(name) {
  13395. return new Event(name, {bubbles: true});
  13396. };
  13397. try {
  13398. new Event('test');
  13399. } catch (e) {
  13400. // IE does not support `new Event()`
  13401. createEvent = function createEvent(name) {
  13402. var evt = document.createEvent('Event');
  13403. evt.initEvent(name, true, false);
  13404. return evt;
  13405. };
  13406. }
  13407. function assign(ta) {
  13408. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta))
  13409. return;
  13410. var heightOffset = null;
  13411. var clientWidth = ta.clientWidth;
  13412. var cachedHeight = null;
  13413. function init() {
  13414. var style = window.getComputedStyle(ta, null);
  13415. if (style.resize === 'vertical') {
  13416. ta.style.resize = 'none';
  13417. } else if (style.resize === 'both') {
  13418. ta.style.resize = 'horizontal';
  13419. }
  13420. if (style.boxSizing === 'content-box') {
  13421. heightOffset = - (parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  13422. } else {
  13423. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  13424. }
  13425. // Fix when a textarea is not on document body and heightOffset is Not a Number
  13426. if (isNaN(heightOffset)) {
  13427. heightOffset = 0;
  13428. }
  13429. update();
  13430. }
  13431. function changeOverflow(value) {
  13432. {
  13433. // Chrome/Safari-specific fix:
  13434. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  13435. // made available by removing the scrollbar. The following forces the necessary text reflow.
  13436. var width = ta.style.width;
  13437. ta.style.width = '0px';
  13438. // Force reflow:
  13439. /* jshint ignore:start */
  13440. ta.offsetWidth;
  13441. /* jshint ignore:end */
  13442. ta.style.width = width;
  13443. }
  13444. ta.style.overflowY = value;
  13445. }
  13446. function getParentOverflows(el) {
  13447. var arr = [];
  13448. while (el && el.parentNode && el.parentNode instanceof Element) {
  13449. if (el.parentNode.scrollTop) {
  13450. arr.push({
  13451. node: el.parentNode,
  13452. scrollTop: el.parentNode.scrollTop
  13453. });
  13454. }
  13455. el = el.parentNode;
  13456. }
  13457. return arr;
  13458. }
  13459. function resize() {
  13460. var originalHeight = ta.style.height;
  13461. var overflows = getParentOverflows(ta);
  13462. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  13463. ta.style.height = '';
  13464. var endHeight = ta.scrollHeight + heightOffset;
  13465. if (ta.scrollHeight === 0) {
  13466. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  13467. ta.style.height = originalHeight;
  13468. return;
  13469. }
  13470. ta.style.height = endHeight + 'px';
  13471. // used to check if an update is actually necessary on window.resize
  13472. clientWidth = ta.clientWidth;
  13473. // prevents scroll-position jumping
  13474. overflows.forEach(function (el) {
  13475. el.node.scrollTop = el.scrollTop;
  13476. });
  13477. if (docTop) {
  13478. document.documentElement.scrollTop = docTop;
  13479. }
  13480. }
  13481. function update() {
  13482. resize();
  13483. var styleHeight = Math.round(parseFloat(ta.style.height));
  13484. var computed = window.getComputedStyle(ta, null);
  13485. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  13486. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  13487. // The actual height not matching the style height (set via the resize method) indicates that
  13488. // the max-height has been exceeded, in which case the overflow should be allowed.
  13489. if (actualHeight !== styleHeight) {
  13490. if (computed.overflowY === 'hidden') {
  13491. changeOverflow('scroll');
  13492. resize();
  13493. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  13494. }
  13495. } else {
  13496. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  13497. if (computed.overflowY !== 'hidden') {
  13498. changeOverflow('hidden');
  13499. resize();
  13500. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  13501. }
  13502. }
  13503. if (cachedHeight !== actualHeight) {
  13504. cachedHeight = actualHeight;
  13505. var evt = createEvent('autosize:resized');
  13506. try {
  13507. ta.dispatchEvent(evt);
  13508. } catch (err) {
  13509. // Firefox will throw an error on dispatchEvent for a detached element
  13510. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  13511. }
  13512. }
  13513. }
  13514. var pageResize = function pageResize() {
  13515. if (ta.clientWidth !== clientWidth) {
  13516. update();
  13517. }
  13518. };
  13519. var destroy = function (style) {
  13520. window.removeEventListener('resize', pageResize, false);
  13521. ta.removeEventListener('input', update, false);
  13522. ta.removeEventListener('keyup', update, false);
  13523. ta.removeEventListener('autosize:destroy', destroy, false);
  13524. ta.removeEventListener('autosize:update', update, false);
  13525. Object.keys(style).forEach(function (key) {
  13526. ta.style[key] = style[key];
  13527. });
  13528. map['delete'](ta);
  13529. }.bind(ta, {
  13530. height: ta.style.height,
  13531. resize: ta.style.resize,
  13532. overflowY: ta.style.overflowY,
  13533. overflowX: ta.style.overflowX,
  13534. wordWrap: ta.style.wordWrap
  13535. });
  13536. ta.addEventListener('autosize:destroy', destroy, false);
  13537. // IE9 does not fire onpropertychange or oninput for deletions,
  13538. // so binding to onkeyup to catch most of those events.
  13539. // There is no way that I know of to detect something like 'cut' in IE9.
  13540. if ('onpropertychange' in ta && 'oninput' in ta) {
  13541. ta.addEventListener('keyup', update, false);
  13542. }
  13543. window.addEventListener('resize', pageResize, false);
  13544. ta.addEventListener('input', update, false);
  13545. ta.addEventListener('autosize:update', update, false);
  13546. ta.style.overflowX = 'hidden';
  13547. ta.style.wordWrap = 'break-word';
  13548. map.set(ta, {
  13549. destroy: destroy,
  13550. update: update
  13551. });
  13552. init();
  13553. }
  13554. function destroy(ta) {
  13555. var methods = map.get(ta);
  13556. if (methods) {
  13557. methods.destroy();
  13558. }
  13559. }
  13560. function update(ta) {
  13561. var methods = map.get(ta);
  13562. if (methods) {
  13563. methods.update();
  13564. }
  13565. }
  13566. var autosize = null;
  13567. // Do nothing in Node.js environment and IE8 (or lower)
  13568. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  13569. autosize = function autosize(el) {
  13570. return el;
  13571. };
  13572. autosize.destroy = function (el) {
  13573. return el;
  13574. };
  13575. autosize.update = function (el) {
  13576. return el;
  13577. };
  13578. } else {
  13579. autosize = function autosize(el, options) {
  13580. if (el) {
  13581. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  13582. return assign(x, options);
  13583. });
  13584. }
  13585. return el;
  13586. };
  13587. autosize.destroy = function (el) {
  13588. if (el) {
  13589. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  13590. }
  13591. return el;
  13592. };
  13593. autosize.update = function (el) {
  13594. if (el) {
  13595. Array.prototype.forEach.call(el.length ? el : [el], update);
  13596. }
  13597. return el;
  13598. };
  13599. }
  13600. module.exports = autosize;
  13601. });
  13602. /***/ }),
  13603. /* 31 */
  13604. /***/ (function (module, exports, __webpack_require__) {
  13605. "use strict";
  13606. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  13607. var require;
  13608. var require;
  13609. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  13610. return typeof obj;
  13611. } : function (obj) {
  13612. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  13613. };
  13614. /*!
  13615. * enquire.js v2.1.6 - Awesome Media Queries in JavaScript
  13616. * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js
  13617. * License: MIT */
  13618. (function (f) {
  13619. if ((false ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  13620. module.exports = f();
  13621. } else if (true) {
  13622. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (f),
  13623. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  13624. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  13625. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13626. } else {
  13627. var g;
  13628. if (typeof window !== "undefined") {
  13629. g = window;
  13630. } else if (typeof global !== "undefined") {
  13631. g = global;
  13632. } else if (typeof self !== "undefined") {
  13633. g = self;
  13634. } else {
  13635. g = this;
  13636. }
  13637. g.enquire = f();
  13638. }
  13639. })(function () {
  13640. var define, module, exports;
  13641. return function e(t, n, r) {
  13642. function s(o, u) {
  13643. if (!n[o]) {
  13644. if (!t[o]) {
  13645. var a = typeof require == "function" && require;
  13646. if (!u && a)
  13647. return require(o, !0);
  13648. if (i)
  13649. return i(o, !0);
  13650. var f = new Error("Cannot find module '" + o + "'");
  13651. throw f.code = "MODULE_NOT_FOUND", f;
  13652. }
  13653. var l = n[o] = {exports: {}};
  13654. t[o][0].call(l.exports, function (e) {
  13655. var n = t[o][1][e];
  13656. return s(n ? n : e);
  13657. }, l, l.exports, e, t, n, r);
  13658. }
  13659. return n[o].exports;
  13660. }
  13661. var i = typeof require == "function" && require;
  13662. for (var o = 0; o < r.length; o++) {
  13663. s(r[o]);
  13664. }
  13665. return s;
  13666. }({1: [function (require, module, exports) {
  13667. var QueryHandler = require(3);
  13668. var each = require(4).each;
  13669. /**
  13670. * Represents a single media query, manages it's state and registered handlers for this query
  13671. *
  13672. * @constructor
  13673. * @param {string} query the media query string
  13674. * @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
  13675. */
  13676. function MediaQuery(query, isUnconditional) {
  13677. this.query = query;
  13678. this.isUnconditional = isUnconditional;
  13679. this.handlers = [];
  13680. this.mql = window.matchMedia(query);
  13681. var self = this;
  13682. this.listener = function (mql) {
  13683. // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
  13684. self.mql = mql.currentTarget || mql;
  13685. self.assess();
  13686. };
  13687. this.mql.addListener(this.listener);
  13688. }
  13689. MediaQuery.prototype = {
  13690. constuctor: MediaQuery,
  13691. /**
  13692. * add a handler for this query, triggering if already active
  13693. *
  13694. * @param {object} handler
  13695. * @param {function} handler.match callback for when query is activated
  13696. * @param {function} [handler.unmatch] callback for when query is deactivated
  13697. * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
  13698. * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
  13699. */
  13700. addHandler: function addHandler(handler) {
  13701. var qh = new QueryHandler(handler);
  13702. this.handlers.push(qh);
  13703. this.matches() && qh.on();
  13704. },
  13705. /**
  13706. * removes the given handler from the collection, and calls it's destroy methods
  13707. *
  13708. * @param {object || function} handler the handler to remove
  13709. */
  13710. removeHandler: function removeHandler(handler) {
  13711. var handlers = this.handlers;
  13712. each(handlers, function (h, i) {
  13713. if (h.equals(handler)) {
  13714. h.destroy();
  13715. return !handlers.splice(i, 1); //remove from array and exit each early
  13716. }
  13717. });
  13718. },
  13719. /**
  13720. * Determine whether the media query should be considered a match
  13721. *
  13722. * @return {Boolean} true if media query can be considered a match, false otherwise
  13723. */
  13724. matches: function matches() {
  13725. return this.mql.matches || this.isUnconditional;
  13726. },
  13727. /**
  13728. * Clears all handlers and unbinds events
  13729. */
  13730. clear: function clear() {
  13731. each(this.handlers, function (handler) {
  13732. handler.destroy();
  13733. });
  13734. this.mql.removeListener(this.listener);
  13735. this.handlers.length = 0; //clear array
  13736. },
  13737. /*
  13738. * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
  13739. */
  13740. assess: function assess() {
  13741. var action = this.matches() ? 'on' : 'off';
  13742. each(this.handlers, function (handler) {
  13743. handler[action]();
  13744. });
  13745. }
  13746. };
  13747. module.exports = MediaQuery;
  13748. }, {"3": 3, "4": 4}], 2: [function (require, module, exports) {
  13749. var MediaQuery = require(1);
  13750. var Util = require(4);
  13751. var each = Util.each;
  13752. var isFunction = Util.isFunction;
  13753. var isArray = Util.isArray;
  13754. /**
  13755. * Allows for registration of query handlers.
  13756. * Manages the query handler's state and is responsible for wiring up browser events
  13757. *
  13758. * @constructor
  13759. */
  13760. function MediaQueryDispatch() {
  13761. if (!window.matchMedia) {
  13762. throw new Error('matchMedia not present, legacy browsers require a polyfill');
  13763. }
  13764. this.queries = {};
  13765. this.browserIsIncapable = !window.matchMedia('only all').matches;
  13766. }
  13767. MediaQueryDispatch.prototype = {
  13768. constructor: MediaQueryDispatch,
  13769. /**
  13770. * Registers a handler for the given media query
  13771. *
  13772. * @param {string} q the media query
  13773. * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
  13774. * @param {function} options.match fired when query matched
  13775. * @param {function} [options.unmatch] fired when a query is no longer matched
  13776. * @param {function} [options.setup] fired when handler first triggered
  13777. * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
  13778. * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
  13779. */
  13780. register: function register(q, options, shouldDegrade) {
  13781. var queries = this.queries,
  13782. isUnconditional = shouldDegrade && this.browserIsIncapable;
  13783. if (!queries[q]) {
  13784. queries[q] = new MediaQuery(q, isUnconditional);
  13785. }
  13786. //normalise to object in an array
  13787. if (isFunction(options)) {
  13788. options = {match: options};
  13789. }
  13790. if (!isArray(options)) {
  13791. options = [options];
  13792. }
  13793. each(options, function (handler) {
  13794. if (isFunction(handler)) {
  13795. handler = {match: handler};
  13796. }
  13797. queries[q].addHandler(handler);
  13798. });
  13799. return this;
  13800. },
  13801. /**
  13802. * unregisters a query and all it's handlers, or a specific handler for a query
  13803. *
  13804. * @param {string} q the media query to target
  13805. * @param {object || function} [handler] specific handler to unregister
  13806. */
  13807. unregister: function unregister(q, handler) {
  13808. var query = this.queries[q];
  13809. if (query) {
  13810. if (handler) {
  13811. query.removeHandler(handler);
  13812. } else {
  13813. query.clear();
  13814. delete this.queries[q];
  13815. }
  13816. }
  13817. return this;
  13818. }
  13819. };
  13820. module.exports = MediaQueryDispatch;
  13821. }, {"1": 1, "4": 4}], 3: [function (require, module, exports) {
  13822. /**
  13823. * Delegate to handle a media query being matched and unmatched.
  13824. *
  13825. * @param {object} options
  13826. * @param {function} options.match callback for when the media query is matched
  13827. * @param {function} [options.unmatch] callback for when the media query is unmatched
  13828. * @param {function} [options.setup] one-time callback triggered the first time a query is matched
  13829. * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
  13830. * @constructor
  13831. */
  13832. function QueryHandler(options) {
  13833. this.options = options;
  13834. !options.deferSetup && this.setup();
  13835. }
  13836. QueryHandler.prototype = {
  13837. constructor: QueryHandler,
  13838. /**
  13839. * coordinates setup of the handler
  13840. *
  13841. * @function
  13842. */
  13843. setup: function setup() {
  13844. if (this.options.setup) {
  13845. this.options.setup();
  13846. }
  13847. this.initialised = true;
  13848. },
  13849. /**
  13850. * coordinates setup and triggering of the handler
  13851. *
  13852. * @function
  13853. */
  13854. on: function on() {
  13855. !this.initialised && this.setup();
  13856. this.options.match && this.options.match();
  13857. },
  13858. /**
  13859. * coordinates the unmatch event for the handler
  13860. *
  13861. * @function
  13862. */
  13863. off: function off() {
  13864. this.options.unmatch && this.options.unmatch();
  13865. },
  13866. /**
  13867. * called when a handler is to be destroyed.
  13868. * delegates to the destroy or unmatch callbacks, depending on availability.
  13869. *
  13870. * @function
  13871. */
  13872. destroy: function destroy() {
  13873. this.options.destroy ? this.options.destroy() : this.off();
  13874. },
  13875. /**
  13876. * determines equality by reference.
  13877. * if object is supplied compare options, if function, compare match callback
  13878. *
  13879. * @function
  13880. * @param {object || function} [target] the target for comparison
  13881. */
  13882. equals: function equals(target) {
  13883. return this.options === target || this.options.match === target;
  13884. }
  13885. };
  13886. module.exports = QueryHandler;
  13887. }, {}], 4: [function (require, module, exports) {
  13888. /**
  13889. * Helper function for iterating over a collection
  13890. *
  13891. * @param collection
  13892. * @param fn
  13893. */
  13894. function each(collection, fn) {
  13895. var i = 0,
  13896. length = collection.length,
  13897. cont;
  13898. for (i; i < length; i++) {
  13899. cont = fn(collection[i], i);
  13900. if (cont === false) {
  13901. break; //allow early exit
  13902. }
  13903. }
  13904. }
  13905. /**
  13906. * Helper function for determining whether target object is an array
  13907. *
  13908. * @param target the object under test
  13909. * @return {Boolean} true if array, false otherwise
  13910. */
  13911. function isArray(target) {
  13912. return Object.prototype.toString.apply(target) === '[object Array]';
  13913. }
  13914. /**
  13915. * Helper function for determining whether target object is a function
  13916. *
  13917. * @param target the object under test
  13918. * @return {Boolean} true if function, false otherwise
  13919. */
  13920. function isFunction(target) {
  13921. return typeof target === 'function';
  13922. }
  13923. module.exports = {
  13924. isFunction: isFunction,
  13925. isArray: isArray,
  13926. each: each
  13927. };
  13928. }, {}], 5: [function (require, module, exports) {
  13929. var MediaQueryDispatch = require(2);
  13930. module.exports = new MediaQueryDispatch();
  13931. }, {"2": 2}]}, {}, [5])(5);
  13932. });
  13933. /***/ }),
  13934. /* 32 */
  13935. /***/ (function (module, exports, __webpack_require__) {
  13936. "use strict";
  13937. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  13938. /*! jQuery UI - v1.12.1 - 2017-03-23
  13939. * http://jqueryui.com
  13940. * Includes: widget.js, keycode.js, widgets/mouse.js, widgets/slider.js
  13941. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  13942. (function (factory) {
  13943. if (true) {
  13944. // AMD. Register as an anonymous module.
  13945. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  13946. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  13947. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  13948. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13949. } else {
  13950. // Browser globals
  13951. factory(jQuery);
  13952. }
  13953. })(function ($) {
  13954. $.ui = $.ui || {};
  13955. var version = $.ui.version = "1.12.1";
  13956. /*!
  13957. * jQuery UI Widget 1.12.1
  13958. * http://jqueryui.com
  13959. *
  13960. * Copyright jQuery Foundation and other contributors
  13961. * Released under the MIT license.
  13962. * http://jquery.org/license
  13963. */
  13964. //>>label: Widget
  13965. //>>group: Core
  13966. //>>description: Provides a factory for creating stateful widgets with a common API.
  13967. //>>docs: http://api.jqueryui.com/jQuery.widget/
  13968. //>>demos: http://jqueryui.com/widget/
  13969. var widgetUuid = 0;
  13970. var widgetSlice = Array.prototype.slice;
  13971. $.cleanData = function (orig) {
  13972. return function (elems) {
  13973. var events, elem, i;
  13974. for (i = 0; (elem = elems[i]) != null; i++) {
  13975. try {
  13976. // Only trigger remove when necessary to save time
  13977. events = $._data(elem, "events");
  13978. if (events && events.remove) {
  13979. $(elem).triggerHandler("remove");
  13980. }
  13981. // Http://bugs.jquery.com/ticket/8235
  13982. } catch (e) {
  13983. }
  13984. }
  13985. orig(elems);
  13986. };
  13987. }($.cleanData);
  13988. $.widget = function (name, base, prototype) {
  13989. var existingConstructor, constructor, basePrototype;
  13990. // ProxiedPrototype allows the provided prototype to remain unmodified
  13991. // so that it can be used as a mixin for multiple widgets (#8876)
  13992. var proxiedPrototype = {};
  13993. var namespace = name.split(".")[0];
  13994. name = name.split(".")[1];
  13995. var fullName = namespace + "-" + name;
  13996. if (!prototype) {
  13997. prototype = base;
  13998. base = $.Widget;
  13999. }
  14000. if ($.isArray(prototype)) {
  14001. prototype = $.extend.apply(null, [{}].concat(prototype));
  14002. }
  14003. // Create selector for plugin
  14004. $.expr[":"][fullName.toLowerCase()] = function (elem) {
  14005. return !!$.data(elem, fullName);
  14006. };
  14007. $[namespace] = $[namespace] || {};
  14008. existingConstructor = $[namespace][name];
  14009. constructor = $[namespace][name] = function (options, element) {
  14010. // Allow instantiation without "new" keyword
  14011. if (!this._createWidget) {
  14012. return new constructor(options, element);
  14013. }
  14014. // Allow instantiation without initializing for simple inheritance
  14015. // must use "new" keyword (the code above always passes args)
  14016. if (arguments.length) {
  14017. this._createWidget(options, element);
  14018. }
  14019. };
  14020. // Extend with the existing constructor to carry over any static properties
  14021. $.extend(constructor, existingConstructor, {
  14022. version: prototype.version,
  14023. // Copy the object used to create the prototype in case we need to
  14024. // redefine the widget later
  14025. _proto: $.extend({}, prototype),
  14026. // Track widgets that inherit from this widget in case this widget is
  14027. // redefined after a widget inherits from it
  14028. _childConstructors: []
  14029. });
  14030. basePrototype = new base();
  14031. // We need to make the options hash a property directly on the new instance
  14032. // otherwise we'll modify the options hash on the prototype that we're
  14033. // inheriting from
  14034. basePrototype.options = $.widget.extend({}, basePrototype.options);
  14035. $.each(prototype, function (prop, value) {
  14036. if (!$.isFunction(value)) {
  14037. proxiedPrototype[prop] = value;
  14038. return;
  14039. }
  14040. proxiedPrototype[prop] = function () {
  14041. function _super() {
  14042. return base.prototype[prop].apply(this, arguments);
  14043. }
  14044. function _superApply(args) {
  14045. return base.prototype[prop].apply(this, args);
  14046. }
  14047. return function () {
  14048. var __super = this._super;
  14049. var __superApply = this._superApply;
  14050. var returnValue;
  14051. this._super = _super;
  14052. this._superApply = _superApply;
  14053. returnValue = value.apply(this, arguments);
  14054. this._super = __super;
  14055. this._superApply = __superApply;
  14056. return returnValue;
  14057. };
  14058. }();
  14059. });
  14060. constructor.prototype = $.widget.extend(basePrototype, {
  14061. // TODO: remove support for widgetEventPrefix
  14062. // always use the name + a colon as the prefix, e.g., draggable:start
  14063. // don't prefix for widgets that aren't DOM-based
  14064. widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name
  14065. }, proxiedPrototype, {
  14066. constructor: constructor,
  14067. namespace: namespace,
  14068. widgetName: name,
  14069. widgetFullName: fullName
  14070. });
  14071. // If this widget is being redefined then we need to find all widgets that
  14072. // are inheriting from it and redefine all of them so that they inherit from
  14073. // the new version of this widget. We're essentially trying to replace one
  14074. // level in the prototype chain.
  14075. if (existingConstructor) {
  14076. $.each(existingConstructor._childConstructors, function (i, child) {
  14077. var childPrototype = child.prototype;
  14078. // Redefine the child widget using the same prototype that was
  14079. // originally used, but inherit from the new version of the base
  14080. $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
  14081. });
  14082. // Remove the list of existing child constructors from the old constructor
  14083. // so the old child constructors can be garbage collected
  14084. delete existingConstructor._childConstructors;
  14085. } else {
  14086. base._childConstructors.push(constructor);
  14087. }
  14088. $.widget.bridge(name, constructor);
  14089. return constructor;
  14090. };
  14091. $.widget.extend = function (target) {
  14092. var input = widgetSlice.call(arguments, 1);
  14093. var inputIndex = 0;
  14094. var inputLength = input.length;
  14095. var key;
  14096. var value;
  14097. for (; inputIndex < inputLength; inputIndex++) {
  14098. for (key in input[inputIndex]) {
  14099. value = input[inputIndex][key];
  14100. if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
  14101. // Clone objects
  14102. if ($.isPlainObject(value)) {
  14103. target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) :
  14104. // Don't extend strings, arrays, etc. with objects
  14105. $.widget.extend({}, value);
  14106. // Copy everything else by reference
  14107. } else {
  14108. target[key] = value;
  14109. }
  14110. }
  14111. }
  14112. }
  14113. return target;
  14114. };
  14115. $.widget.bridge = function (name, object) {
  14116. var fullName = object.prototype.widgetFullName || name;
  14117. $.fn[name] = function (options) {
  14118. var isMethodCall = typeof options === "string";
  14119. var args = widgetSlice.call(arguments, 1);
  14120. var returnValue = this;
  14121. if (isMethodCall) {
  14122. // If this is an empty collection, we need to have the instance method
  14123. // return undefined instead of the jQuery instance
  14124. if (!this.length && options === "instance") {
  14125. returnValue = undefined;
  14126. } else {
  14127. this.each(function () {
  14128. var methodValue;
  14129. var instance = $.data(this, fullName);
  14130. if (options === "instance") {
  14131. returnValue = instance;
  14132. return false;
  14133. }
  14134. if (!instance) {
  14135. return $.error("cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'");
  14136. }
  14137. if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
  14138. return $.error("no such method '" + options + "' for " + name + " widget instance");
  14139. }
  14140. methodValue = instance[options].apply(instance, args);
  14141. if (methodValue !== instance && methodValue !== undefined) {
  14142. returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue;
  14143. return false;
  14144. }
  14145. });
  14146. }
  14147. } else {
  14148. // Allow multiple hashes to be passed on init
  14149. if (args.length) {
  14150. options = $.widget.extend.apply(null, [options].concat(args));
  14151. }
  14152. this.each(function () {
  14153. var instance = $.data(this, fullName);
  14154. if (instance) {
  14155. instance.option(options || {});
  14156. if (instance._init) {
  14157. instance._init();
  14158. }
  14159. } else {
  14160. $.data(this, fullName, new object(options, this));
  14161. }
  14162. });
  14163. }
  14164. return returnValue;
  14165. };
  14166. };
  14167. $.Widget = function () /* options, element */ {};
  14168. $.Widget._childConstructors = [];
  14169. $.Widget.prototype = {
  14170. widgetName: "widget",
  14171. widgetEventPrefix: "",
  14172. defaultElement: "<div>",
  14173. options: {
  14174. classes: {},
  14175. disabled: false,
  14176. // Callbacks
  14177. create: null
  14178. },
  14179. _createWidget: function _createWidget(options, element) {
  14180. element = $(element || this.defaultElement || this)[0];
  14181. this.element = $(element);
  14182. this.uuid = widgetUuid++;
  14183. this.eventNamespace = "." + this.widgetName + this.uuid;
  14184. this.bindings = $();
  14185. this.hoverable = $();
  14186. this.focusable = $();
  14187. this.classesElementLookup = {};
  14188. if (element !== this) {
  14189. $.data(element, this.widgetFullName, this);
  14190. this._on(true, this.element, {
  14191. remove: function remove(event) {
  14192. if (event.target === element) {
  14193. this.destroy();
  14194. }
  14195. }
  14196. });
  14197. this.document = $(element.style ?
  14198. // Element within the document
  14199. element.ownerDocument :
  14200. // Element is window or document
  14201. element.document || element);
  14202. this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
  14203. }
  14204. this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options);
  14205. this._create();
  14206. if (this.options.disabled) {
  14207. this._setOptionDisabled(this.options.disabled);
  14208. }
  14209. this._trigger("create", null, this._getCreateEventData());
  14210. this._init();
  14211. },
  14212. _getCreateOptions: function _getCreateOptions() {
  14213. return {};
  14214. },
  14215. _getCreateEventData: $.noop,
  14216. _create: $.noop,
  14217. _init: $.noop,
  14218. destroy: function destroy() {
  14219. var that = this;
  14220. this._destroy();
  14221. $.each(this.classesElementLookup, function (key, value) {
  14222. that._removeClass(value, key);
  14223. });
  14224. // We can probably remove the unbind calls in 2.0
  14225. // all event bindings should go through this._on()
  14226. this.element.off(this.eventNamespace).removeData(this.widgetFullName);
  14227. this.widget().off(this.eventNamespace).removeAttr("aria-disabled");
  14228. // Clean up events and states
  14229. this.bindings.off(this.eventNamespace);
  14230. },
  14231. _destroy: $.noop,
  14232. widget: function widget() {
  14233. return this.element;
  14234. },
  14235. option: function option(key, value) {
  14236. var options = key;
  14237. var parts;
  14238. var curOption;
  14239. var i;
  14240. if (arguments.length === 0) {
  14241. // Don't return a reference to the internal hash
  14242. return $.widget.extend({}, this.options);
  14243. }
  14244. if (typeof key === "string") {
  14245. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  14246. options = {};
  14247. parts = key.split(".");
  14248. key = parts.shift();
  14249. if (parts.length) {
  14250. curOption = options[key] = $.widget.extend({}, this.options[key]);
  14251. for (i = 0; i < parts.length - 1; i++) {
  14252. curOption[parts[i]] = curOption[parts[i]] || {};
  14253. curOption = curOption[parts[i]];
  14254. }
  14255. key = parts.pop();
  14256. if (arguments.length === 1) {
  14257. return curOption[key] === undefined ? null : curOption[key];
  14258. }
  14259. curOption[key] = value;
  14260. } else {
  14261. if (arguments.length === 1) {
  14262. return this.options[key] === undefined ? null : this.options[key];
  14263. }
  14264. options[key] = value;
  14265. }
  14266. }
  14267. this._setOptions(options);
  14268. return this;
  14269. },
  14270. _setOptions: function _setOptions(options) {
  14271. var key;
  14272. for (key in options) {
  14273. this._setOption(key, options[key]);
  14274. }
  14275. return this;
  14276. },
  14277. _setOption: function _setOption(key, value) {
  14278. if (key === "classes") {
  14279. this._setOptionClasses(value);
  14280. }
  14281. this.options[key] = value;
  14282. if (key === "disabled") {
  14283. this._setOptionDisabled(value);
  14284. }
  14285. return this;
  14286. },
  14287. _setOptionClasses: function _setOptionClasses(value) {
  14288. var classKey, elements, currentElements;
  14289. for (classKey in value) {
  14290. currentElements = this.classesElementLookup[classKey];
  14291. if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) {
  14292. continue;
  14293. }
  14294. // We are doing this to create a new jQuery object because the _removeClass() call
  14295. // on the next line is going to destroy the reference to the current elements being
  14296. // tracked. We need to save a copy of this collection so that we can add the new classes
  14297. // below.
  14298. elements = $(currentElements.get());
  14299. this._removeClass(currentElements, classKey);
  14300. // We don't use _addClass() here, because that uses this.options.classes
  14301. // for generating the string of classes. We want to use the value passed in from
  14302. // _setOption(), this is the new value of the classes option which was passed to
  14303. // _setOption(). We pass this value directly to _classes().
  14304. elements.addClass(this._classes({
  14305. element: elements,
  14306. keys: classKey,
  14307. classes: value,
  14308. add: true
  14309. }));
  14310. }
  14311. },
  14312. _setOptionDisabled: function _setOptionDisabled(value) {
  14313. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
  14314. // If the widget is becoming disabled, then nothing is interactive
  14315. if (value) {
  14316. this._removeClass(this.hoverable, null, "ui-state-hover");
  14317. this._removeClass(this.focusable, null, "ui-state-focus");
  14318. }
  14319. },
  14320. enable: function enable() {
  14321. return this._setOptions({disabled: false});
  14322. },
  14323. disable: function disable() {
  14324. return this._setOptions({disabled: true});
  14325. },
  14326. _classes: function _classes(options) {
  14327. var full = [];
  14328. var that = this;
  14329. options = $.extend({
  14330. element: this.element,
  14331. classes: this.options.classes || {}
  14332. }, options);
  14333. function processClassString(classes, checkOption) {
  14334. var current, i;
  14335. for (i = 0; i < classes.length; i++) {
  14336. current = that.classesElementLookup[classes[i]] || $();
  14337. if (options.add) {
  14338. current = $($.unique(current.get().concat(options.element.get())));
  14339. } else {
  14340. current = $(current.not(options.element).get());
  14341. }
  14342. that.classesElementLookup[classes[i]] = current;
  14343. full.push(classes[i]);
  14344. if (checkOption && options.classes[classes[i]]) {
  14345. full.push(options.classes[classes[i]]);
  14346. }
  14347. }
  14348. }
  14349. this._on(options.element, {
  14350. "remove": "_untrackClassesElement"
  14351. });
  14352. if (options.keys) {
  14353. processClassString(options.keys.match(/\S+/g) || [], true);
  14354. }
  14355. if (options.extra) {
  14356. processClassString(options.extra.match(/\S+/g) || []);
  14357. }
  14358. return full.join(" ");
  14359. },
  14360. _untrackClassesElement: function _untrackClassesElement(event) {
  14361. var that = this;
  14362. $.each(that.classesElementLookup, function (key, value) {
  14363. if ($.inArray(event.target, value) !== - 1) {
  14364. that.classesElementLookup[key] = $(value.not(event.target).get());
  14365. }
  14366. });
  14367. },
  14368. _removeClass: function _removeClass(element, keys, extra) {
  14369. return this._toggleClass(element, keys, extra, false);
  14370. },
  14371. _addClass: function _addClass(element, keys, extra) {
  14372. return this._toggleClass(element, keys, extra, true);
  14373. },
  14374. _toggleClass: function _toggleClass(element, keys, extra, add) {
  14375. add = typeof add === "boolean" ? add : extra;
  14376. var shift = typeof element === "string" || element === null,
  14377. options = {
  14378. extra: shift ? keys : extra,
  14379. keys: shift ? element : keys,
  14380. element: shift ? this.element : element,
  14381. add: add
  14382. };
  14383. options.element.toggleClass(this._classes(options), add);
  14384. return this;
  14385. },
  14386. _on: function _on(suppressDisabledCheck, element, handlers) {
  14387. var delegateElement;
  14388. var instance = this;
  14389. // No suppressDisabledCheck flag, shuffle arguments
  14390. if (typeof suppressDisabledCheck !== "boolean") {
  14391. handlers = element;
  14392. element = suppressDisabledCheck;
  14393. suppressDisabledCheck = false;
  14394. }
  14395. // No element argument, shuffle and use this.element
  14396. if (!handlers) {
  14397. handlers = element;
  14398. element = this.element;
  14399. delegateElement = this.widget();
  14400. } else {
  14401. element = delegateElement = $(element);
  14402. this.bindings = this.bindings.add(element);
  14403. }
  14404. $.each(handlers, function (event, handler) {
  14405. function handlerProxy() {
  14406. // Allow widgets to customize the disabled handling
  14407. // - disabled as an array instead of boolean
  14408. // - disabled class as method for disabling individual parts
  14409. if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass("ui-state-disabled"))) {
  14410. return;
  14411. }
  14412. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  14413. }
  14414. // Copy the guid so direct unbinding works
  14415. if (typeof handler !== "string") {
  14416. handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++;
  14417. }
  14418. var match = event.match(/^([\w:-]*)\s*(.*)$/);
  14419. var eventName = match[1] + instance.eventNamespace;
  14420. var selector = match[2];
  14421. if (selector) {
  14422. delegateElement.on(eventName, selector, handlerProxy);
  14423. } else {
  14424. element.on(eventName, handlerProxy);
  14425. }
  14426. });
  14427. },
  14428. _off: function _off(element, eventName) {
  14429. eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
  14430. element.off(eventName).off(eventName);
  14431. // Clear the stack to avoid memory leaks (#10056)
  14432. this.bindings = $(this.bindings.not(element).get());
  14433. this.focusable = $(this.focusable.not(element).get());
  14434. this.hoverable = $(this.hoverable.not(element).get());
  14435. },
  14436. _delay: function _delay(handler, delay) {
  14437. function handlerProxy() {
  14438. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  14439. }
  14440. var instance = this;
  14441. return setTimeout(handlerProxy, delay || 0);
  14442. },
  14443. _hoverable: function _hoverable(element) {
  14444. this.hoverable = this.hoverable.add(element);
  14445. this._on(element, {
  14446. mouseenter: function mouseenter(event) {
  14447. this._addClass($(event.currentTarget), null, "ui-state-hover");
  14448. },
  14449. mouseleave: function mouseleave(event) {
  14450. this._removeClass($(event.currentTarget), null, "ui-state-hover");
  14451. }
  14452. });
  14453. },
  14454. _focusable: function _focusable(element) {
  14455. this.focusable = this.focusable.add(element);
  14456. this._on(element, {
  14457. focusin: function focusin(event) {
  14458. this._addClass($(event.currentTarget), null, "ui-state-focus");
  14459. },
  14460. focusout: function focusout(event) {
  14461. this._removeClass($(event.currentTarget), null, "ui-state-focus");
  14462. }
  14463. });
  14464. },
  14465. _trigger: function _trigger(type, event, data) {
  14466. var prop, orig;
  14467. var callback = this.options[type];
  14468. data = data || {};
  14469. event = $.Event(event);
  14470. event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase();
  14471. // The original event may come from any element
  14472. // so we need to reset the target on the new event
  14473. event.target = this.element[0];
  14474. // Copy original event properties over to the new event
  14475. orig = event.originalEvent;
  14476. if (orig) {
  14477. for (prop in orig) {
  14478. if (!(prop in event)) {
  14479. event[prop] = orig[prop];
  14480. }
  14481. }
  14482. }
  14483. this.element.trigger(event, data);
  14484. return !($.isFunction(callback) && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented());
  14485. }
  14486. };
  14487. $.each({show: "fadeIn", hide: "fadeOut"}, function (method, defaultEffect) {
  14488. $.Widget.prototype["_" + method] = function (element, options, callback) {
  14489. if (typeof options === "string") {
  14490. options = {effect: options};
  14491. }
  14492. var hasOptions;
  14493. var effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect;
  14494. options = options || {};
  14495. if (typeof options === "number") {
  14496. options = {duration: options};
  14497. }
  14498. hasOptions = !$.isEmptyObject(options);
  14499. options.complete = callback;
  14500. if (options.delay) {
  14501. element.delay(options.delay);
  14502. }
  14503. if (hasOptions && $.effects && $.effects.effect[effectName]) {
  14504. element[method](options);
  14505. } else if (effectName !== method && element[effectName]) {
  14506. element[effectName](options.duration, options.easing, callback);
  14507. } else {
  14508. element.queue(function (next) {
  14509. $(this)[method]();
  14510. if (callback) {
  14511. callback.call(element[0]);
  14512. }
  14513. next();
  14514. });
  14515. }
  14516. };
  14517. });
  14518. var widget = $.widget;
  14519. /*!
  14520. * jQuery UI Keycode 1.12.1
  14521. * http://jqueryui.com
  14522. *
  14523. * Copyright jQuery Foundation and other contributors
  14524. * Released under the MIT license.
  14525. * http://jquery.org/license
  14526. */
  14527. //>>label: Keycode
  14528. //>>group: Core
  14529. //>>description: Provide keycodes as keynames
  14530. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  14531. var keycode = $.ui.keyCode = {
  14532. BACKSPACE: 8,
  14533. COMMA: 188,
  14534. DELETE: 46,
  14535. DOWN: 40,
  14536. END: 35,
  14537. ENTER: 13,
  14538. ESCAPE: 27,
  14539. HOME: 36,
  14540. LEFT: 37,
  14541. PAGE_DOWN: 34,
  14542. PAGE_UP: 33,
  14543. PERIOD: 190,
  14544. RIGHT: 39,
  14545. SPACE: 32,
  14546. TAB: 9,
  14547. UP: 38
  14548. };
  14549. // This file is deprecated
  14550. var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
  14551. /*!
  14552. * jQuery UI Mouse 1.12.1
  14553. * http://jqueryui.com
  14554. *
  14555. * Copyright jQuery Foundation and other contributors
  14556. * Released under the MIT license.
  14557. * http://jquery.org/license
  14558. */
  14559. //>>label: Mouse
  14560. //>>group: Widgets
  14561. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  14562. //>>docs: http://api.jqueryui.com/mouse/
  14563. var mouseHandled = false;
  14564. $(document).on("mouseup", function () {
  14565. mouseHandled = false;
  14566. });
  14567. var widgetsMouse = $.widget("ui.mouse", {
  14568. version: "1.12.1",
  14569. options: {
  14570. cancel: "input, textarea, button, select, option",
  14571. distance: 1,
  14572. delay: 0
  14573. },
  14574. _mouseInit: function _mouseInit() {
  14575. var that = this;
  14576. this.element.on("mousedown." + this.widgetName, function (event) {
  14577. return that._mouseDown(event);
  14578. }).on("click." + this.widgetName, function (event) {
  14579. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  14580. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  14581. event.stopImmediatePropagation();
  14582. return false;
  14583. }
  14584. });
  14585. this.started = false;
  14586. },
  14587. // TODO: make sure destroying one instance of mouse doesn't mess with
  14588. // other instances of mouse
  14589. _mouseDestroy: function _mouseDestroy() {
  14590. this.element.off("." + this.widgetName);
  14591. if (this._mouseMoveDelegate) {
  14592. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  14593. }
  14594. },
  14595. _mouseDown: function _mouseDown(event) {
  14596. // don't let more than one widget handle mouseStart
  14597. if (mouseHandled) {
  14598. return;
  14599. }
  14600. this._mouseMoved = false;
  14601. // We may have missed mouseup (out of window)
  14602. this._mouseStarted && this._mouseUp(event);
  14603. this._mouseDownEvent = event;
  14604. var that = this,
  14605. btnIsLeft = event.which === 1,
  14606. // event.target.nodeName works around a bug in IE 8 with
  14607. // disabled inputs (#7620)
  14608. elIsCancel = typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false;
  14609. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  14610. return true;
  14611. }
  14612. this.mouseDelayMet = !this.options.delay;
  14613. if (!this.mouseDelayMet) {
  14614. this._mouseDelayTimer = setTimeout(function () {
  14615. that.mouseDelayMet = true;
  14616. }, this.options.delay);
  14617. }
  14618. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  14619. this._mouseStarted = this._mouseStart(event) !== false;
  14620. if (!this._mouseStarted) {
  14621. event.preventDefault();
  14622. return true;
  14623. }
  14624. }
  14625. // Click event may never have fired (Gecko & Opera)
  14626. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  14627. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  14628. }
  14629. // These delegates are required to keep context
  14630. this._mouseMoveDelegate = function (event) {
  14631. return that._mouseMove(event);
  14632. };
  14633. this._mouseUpDelegate = function (event) {
  14634. return that._mouseUp(event);
  14635. };
  14636. this.document.on("mousemove." + this.widgetName, this._mouseMoveDelegate).on("mouseup." + this.widgetName, this._mouseUpDelegate);
  14637. event.preventDefault();
  14638. mouseHandled = true;
  14639. return true;
  14640. },
  14641. _mouseMove: function _mouseMove(event) {
  14642. // Only check for mouseups outside the document if you've moved inside the document
  14643. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  14644. // fire a mousemove event if content is placed under the cursor. See #7778
  14645. // Support: IE <9
  14646. if (this._mouseMoved) {
  14647. // IE mouseup check - mouseup happened when mouse was out of window
  14648. if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) {
  14649. return this._mouseUp(event);
  14650. // Iframe mouseup check - mouseup occurred in another document
  14651. } else if (!event.which) {
  14652. // Support: Safari <=8 - 9
  14653. // Safari sets which to 0 if you press any of the following keys
  14654. // during a drag (#14461)
  14655. if (event.originalEvent.altKey || event.originalEvent.ctrlKey || event.originalEvent.metaKey || event.originalEvent.shiftKey) {
  14656. this.ignoreMissingWhich = true;
  14657. } else if (!this.ignoreMissingWhich) {
  14658. return this._mouseUp(event);
  14659. }
  14660. }
  14661. }
  14662. if (event.which || event.button) {
  14663. this._mouseMoved = true;
  14664. }
  14665. if (this._mouseStarted) {
  14666. this._mouseDrag(event);
  14667. return event.preventDefault();
  14668. }
  14669. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  14670. this._mouseStarted = this._mouseStart(this._mouseDownEvent, event) !== false;
  14671. this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event);
  14672. }
  14673. return !this._mouseStarted;
  14674. },
  14675. _mouseUp: function _mouseUp(event) {
  14676. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  14677. if (this._mouseStarted) {
  14678. this._mouseStarted = false;
  14679. if (event.target === this._mouseDownEvent.target) {
  14680. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  14681. }
  14682. this._mouseStop(event);
  14683. }
  14684. if (this._mouseDelayTimer) {
  14685. clearTimeout(this._mouseDelayTimer);
  14686. delete this._mouseDelayTimer;
  14687. }
  14688. this.ignoreMissingWhich = false;
  14689. mouseHandled = false;
  14690. event.preventDefault();
  14691. },
  14692. _mouseDistanceMet: function _mouseDistanceMet(event) {
  14693. return Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance;
  14694. },
  14695. _mouseDelayMet: function _mouseDelayMet() /* event */ {
  14696. return this.mouseDelayMet;
  14697. },
  14698. // These are placeholder methods, to be overriden by extending plugin
  14699. _mouseStart: function _mouseStart() /* event */ {},
  14700. _mouseDrag: function _mouseDrag() /* event */ {},
  14701. _mouseStop: function _mouseStop() /* event */ {},
  14702. _mouseCapture: function _mouseCapture() /* event */ {
  14703. return true;
  14704. }
  14705. });
  14706. /*!
  14707. * jQuery UI Slider 1.12.1
  14708. * http://jqueryui.com
  14709. *
  14710. * Copyright jQuery Foundation and other contributors
  14711. * Released under the MIT license.
  14712. * http://jquery.org/license
  14713. */
  14714. //>>label: Slider
  14715. //>>group: Widgets
  14716. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  14717. //>>docs: http://api.jqueryui.com/slider/
  14718. //>>demos: http://jqueryui.com/slider/
  14719. //>>css.structure: ../../themes/base/core.css
  14720. //>>css.structure: ../../themes/base/slider.css
  14721. //>>css.theme: ../../themes/base/theme.css
  14722. var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
  14723. version: "1.12.1",
  14724. widgetEventPrefix: "slide",
  14725. options: {
  14726. animate: false,
  14727. classes: {
  14728. "ui-slider": "ui-corner-all",
  14729. "ui-slider-handle": "ui-corner-all",
  14730. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  14731. // element, but worked best visually with a variety of themes
  14732. "ui-slider-range": "ui-corner-all ui-widget-header"
  14733. },
  14734. distance: 0,
  14735. max: 100,
  14736. min: 0,
  14737. orientation: "horizontal",
  14738. range: false,
  14739. step: 1,
  14740. value: 0,
  14741. values: null,
  14742. // Callbacks
  14743. change: null,
  14744. slide: null,
  14745. start: null,
  14746. stop: null
  14747. },
  14748. // Number of pages in a slider
  14749. // (how many times can you page up/down to go through the whole range)
  14750. numPages: 5,
  14751. _create: function _create() {
  14752. this._keySliding = false;
  14753. this._mouseSliding = false;
  14754. this._animateOff = true;
  14755. this._handleIndex = null;
  14756. this._detectOrientation();
  14757. this._mouseInit();
  14758. this._calculateNewMax();
  14759. this._addClass("ui-slider ui-slider-" + this.orientation, "ui-widget ui-widget-content");
  14760. this._refresh();
  14761. this._animateOff = false;
  14762. },
  14763. _refresh: function _refresh() {
  14764. this._createRange();
  14765. this._createHandles();
  14766. this._setupEvents();
  14767. this._refreshValue();
  14768. },
  14769. _createHandles: function _createHandles() {
  14770. var i,
  14771. handleCount,
  14772. options = this.options,
  14773. existingHandles = this.element.find(".ui-slider-handle"),
  14774. handle = "<span tabindex='0'></span>",
  14775. handles = [];
  14776. handleCount = options.values && options.values.length || 1;
  14777. if (existingHandles.length > handleCount) {
  14778. existingHandles.slice(handleCount).remove();
  14779. existingHandles = existingHandles.slice(0, handleCount);
  14780. }
  14781. for (i = existingHandles.length; i < handleCount; i++) {
  14782. handles.push(handle);
  14783. }
  14784. this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));
  14785. this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
  14786. this.handle = this.handles.eq(0);
  14787. this.handles.each(function (i) {
  14788. $(this).data("ui-slider-handle-index", i).attr("tabIndex", 0);
  14789. });
  14790. },
  14791. _createRange: function _createRange() {
  14792. var options = this.options;
  14793. if (options.range) {
  14794. if (options.range === true) {
  14795. if (!options.values) {
  14796. options.values = [this._valueMin(), this._valueMin()];
  14797. } else if (options.values.length && options.values.length !== 2) {
  14798. options.values = [options.values[0], options.values[0]];
  14799. } else if ($.isArray(options.values)) {
  14800. options.values = options.values.slice(0);
  14801. }
  14802. }
  14803. if (!this.range || !this.range.length) {
  14804. this.range = $("<div>").appendTo(this.element);
  14805. this._addClass(this.range, "ui-slider-range");
  14806. } else {
  14807. this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
  14808. // Handle range switching from true to min/max
  14809. this.range.css({
  14810. "left": "",
  14811. "bottom": ""
  14812. });
  14813. }
  14814. if (options.range === "min" || options.range === "max") {
  14815. this._addClass(this.range, "ui-slider-range-" + options.range);
  14816. }
  14817. } else {
  14818. if (this.range) {
  14819. this.range.remove();
  14820. }
  14821. this.range = null;
  14822. }
  14823. },
  14824. _setupEvents: function _setupEvents() {
  14825. this._off(this.handles);
  14826. this._on(this.handles, this._handleEvents);
  14827. this._hoverable(this.handles);
  14828. this._focusable(this.handles);
  14829. },
  14830. _destroy: function _destroy() {
  14831. this.handles.remove();
  14832. if (this.range) {
  14833. this.range.remove();
  14834. }
  14835. this._mouseDestroy();
  14836. },
  14837. _mouseCapture: function _mouseCapture(event) {
  14838. var position,
  14839. normValue,
  14840. distance,
  14841. closestHandle,
  14842. index,
  14843. allowed,
  14844. offset,
  14845. mouseOverHandle,
  14846. that = this,
  14847. o = this.options;
  14848. if (o.disabled) {
  14849. return false;
  14850. }
  14851. this.elementSize = {
  14852. width: this.element.outerWidth(),
  14853. height: this.element.outerHeight()
  14854. };
  14855. this.elementOffset = this.element.offset();
  14856. position = {x: event.pageX, y: event.pageY};
  14857. normValue = this._normValueFromMouse(position);
  14858. distance = this._valueMax() - this._valueMin() + 1;
  14859. this.handles.each(function (i) {
  14860. var thisDistance = Math.abs(normValue - that.values(i));
  14861. if (distance > thisDistance || distance === thisDistance && (i === that._lastChangedValue || that.values(i) === o.min)) {
  14862. distance = thisDistance;
  14863. closestHandle = $(this);
  14864. index = i;
  14865. }
  14866. });
  14867. allowed = this._start(event, index);
  14868. if (allowed === false) {
  14869. return false;
  14870. }
  14871. this._mouseSliding = true;
  14872. this._handleIndex = index;
  14873. this._addClass(closestHandle, null, "ui-state-active");
  14874. closestHandle.trigger("focus");
  14875. offset = closestHandle.offset();
  14876. mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
  14877. this._clickOffset = mouseOverHandle ? {left: 0, top: 0} : {
  14878. left: event.pageX - offset.left - closestHandle.width() / 2,
  14879. 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)
  14880. };
  14881. if (!this.handles.hasClass("ui-state-hover")) {
  14882. this._slide(event, index, normValue);
  14883. }
  14884. this._animateOff = true;
  14885. return true;
  14886. },
  14887. _mouseStart: function _mouseStart() {
  14888. return true;
  14889. },
  14890. _mouseDrag: function _mouseDrag(event) {
  14891. var position = {x: event.pageX, y: event.pageY},
  14892. normValue = this._normValueFromMouse(position);
  14893. this._slide(event, this._handleIndex, normValue);
  14894. return false;
  14895. },
  14896. _mouseStop: function _mouseStop(event) {
  14897. this._removeClass(this.handles, null, "ui-state-active");
  14898. this._mouseSliding = false;
  14899. this._stop(event, this._handleIndex);
  14900. this._change(event, this._handleIndex);
  14901. this._handleIndex = null;
  14902. this._clickOffset = null;
  14903. this._animateOff = false;
  14904. return false;
  14905. },
  14906. _detectOrientation: function _detectOrientation() {
  14907. this.orientation = this.options.orientation === "vertical" ? "vertical" : "horizontal";
  14908. },
  14909. _normValueFromMouse: function _normValueFromMouse(position) {
  14910. var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse;
  14911. if (this.orientation === "horizontal") {
  14912. pixelTotal = this.elementSize.width;
  14913. pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
  14914. } else {
  14915. pixelTotal = this.elementSize.height;
  14916. pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
  14917. }
  14918. percentMouse = pixelMouse / pixelTotal;
  14919. if (percentMouse > 1) {
  14920. percentMouse = 1;
  14921. }
  14922. if (percentMouse < 0) {
  14923. percentMouse = 0;
  14924. }
  14925. if (this.orientation === "vertical") {
  14926. percentMouse = 1 - percentMouse;
  14927. }
  14928. valueTotal = this._valueMax() - this._valueMin();
  14929. valueMouse = this._valueMin() + percentMouse * valueTotal;
  14930. return this._trimAlignValue(valueMouse);
  14931. },
  14932. _uiHash: function _uiHash(index, value, values) {
  14933. var uiHash = {
  14934. handle: this.handles[index],
  14935. handleIndex: index,
  14936. value: value !== undefined ? value : this.value()
  14937. };
  14938. if (this._hasMultipleValues()) {
  14939. uiHash.value = value !== undefined ? value : this.values(index);
  14940. uiHash.values = values || this.values();
  14941. }
  14942. return uiHash;
  14943. },
  14944. _hasMultipleValues: function _hasMultipleValues() {
  14945. return this.options.values && this.options.values.length;
  14946. },
  14947. _start: function _start(event, index) {
  14948. return this._trigger("start", event, this._uiHash(index));
  14949. },
  14950. _slide: function _slide(event, index, newVal) {
  14951. var allowed,
  14952. otherVal,
  14953. currentValue = this.value(),
  14954. newValues = this.values();
  14955. if (this._hasMultipleValues()) {
  14956. otherVal = this.values(index ? 0 : 1);
  14957. currentValue = this.values(index);
  14958. if (this.options.values.length === 2 && this.options.range === true) {
  14959. newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
  14960. }
  14961. newValues[index] = newVal;
  14962. }
  14963. if (newVal === currentValue) {
  14964. return;
  14965. }
  14966. allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
  14967. // A slide can be canceled by returning false from the slide callback
  14968. if (allowed === false) {
  14969. return;
  14970. }
  14971. if (this._hasMultipleValues()) {
  14972. this.values(index, newVal);
  14973. } else {
  14974. this.value(newVal);
  14975. }
  14976. },
  14977. _stop: function _stop(event, index) {
  14978. this._trigger("stop", event, this._uiHash(index));
  14979. },
  14980. _change: function _change(event, index) {
  14981. if (!this._keySliding && !this._mouseSliding) {
  14982. //store the last changed value index for reference when handles overlap
  14983. this._lastChangedValue = index;
  14984. this._trigger("change", event, this._uiHash(index));
  14985. }
  14986. },
  14987. value: function value(newValue) {
  14988. if (arguments.length) {
  14989. this.options.value = this._trimAlignValue(newValue);
  14990. this._refreshValue();
  14991. this._change(null, 0);
  14992. return;
  14993. }
  14994. return this._value();
  14995. },
  14996. values: function values(index, newValue) {
  14997. var vals, newValues, i;
  14998. if (arguments.length > 1) {
  14999. this.options.values[index] = this._trimAlignValue(newValue);
  15000. this._refreshValue();
  15001. this._change(null, index);
  15002. return;
  15003. }
  15004. if (arguments.length) {
  15005. if ($.isArray(arguments[0])) {
  15006. vals = this.options.values;
  15007. newValues = arguments[0];
  15008. for (i = 0; i < vals.length; i += 1) {
  15009. vals[i] = this._trimAlignValue(newValues[i]);
  15010. this._change(null, i);
  15011. }
  15012. this._refreshValue();
  15013. } else {
  15014. if (this._hasMultipleValues()) {
  15015. return this._values(index);
  15016. } else {
  15017. return this.value();
  15018. }
  15019. }
  15020. } else {
  15021. return this._values();
  15022. }
  15023. },
  15024. _setOption: function _setOption(key, value) {
  15025. var i,
  15026. valsLength = 0;
  15027. if (key === "range" && this.options.range === true) {
  15028. if (value === "min") {
  15029. this.options.value = this._values(0);
  15030. this.options.values = null;
  15031. } else if (value === "max") {
  15032. this.options.value = this._values(this.options.values.length - 1);
  15033. this.options.values = null;
  15034. }
  15035. }
  15036. if ($.isArray(this.options.values)) {
  15037. valsLength = this.options.values.length;
  15038. }
  15039. this._super(key, value);
  15040. switch (key) {
  15041. case "orientation":
  15042. this._detectOrientation();
  15043. this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-" + this.orientation);
  15044. this._refreshValue();
  15045. if (this.options.range) {
  15046. this._refreshRange(value);
  15047. }
  15048. // Reset positioning from previous orientation
  15049. this.handles.css(value === "horizontal" ? "bottom" : "left", "");
  15050. break;
  15051. case "value":
  15052. this._animateOff = true;
  15053. this._refreshValue();
  15054. this._change(null, 0);
  15055. this._animateOff = false;
  15056. break;
  15057. case "values":
  15058. this._animateOff = true;
  15059. this._refreshValue();
  15060. // Start from the last handle to prevent unreachable handles (#9046)
  15061. for (i = valsLength - 1; i >= 0; i--) {
  15062. this._change(null, i);
  15063. }
  15064. this._animateOff = false;
  15065. break;
  15066. case "step":
  15067. case "min":
  15068. case "max":
  15069. this._animateOff = true;
  15070. this._calculateNewMax();
  15071. this._refreshValue();
  15072. this._animateOff = false;
  15073. break;
  15074. case "range":
  15075. this._animateOff = true;
  15076. this._refresh();
  15077. this._animateOff = false;
  15078. break;
  15079. }
  15080. },
  15081. _setOptionDisabled: function _setOptionDisabled(value) {
  15082. this._super(value);
  15083. this._toggleClass(null, "ui-state-disabled", !!value);
  15084. },
  15085. //internal value getter
  15086. // _value() returns value trimmed by min and max, aligned by step
  15087. _value: function _value() {
  15088. var val = this.options.value;
  15089. val = this._trimAlignValue(val);
  15090. return val;
  15091. },
  15092. //internal values getter
  15093. // _values() returns array of values trimmed by min and max, aligned by step
  15094. // _values( index ) returns single value trimmed by min and max, aligned by step
  15095. _values: function _values(index) {
  15096. var val, vals, i;
  15097. if (arguments.length) {
  15098. val = this.options.values[index];
  15099. val = this._trimAlignValue(val);
  15100. return val;
  15101. } else if (this._hasMultipleValues()) {
  15102. // .slice() creates a copy of the array
  15103. // this copy gets trimmed by min and max and then returned
  15104. vals = this.options.values.slice();
  15105. for (i = 0; i < vals.length; i += 1) {
  15106. vals[i] = this._trimAlignValue(vals[i]);
  15107. }
  15108. return vals;
  15109. } else {
  15110. return [];
  15111. }
  15112. },
  15113. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  15114. _trimAlignValue: function _trimAlignValue(val) {
  15115. if (val <= this._valueMin()) {
  15116. return this._valueMin();
  15117. }
  15118. if (val >= this._valueMax()) {
  15119. return this._valueMax();
  15120. }
  15121. var step = this.options.step > 0 ? this.options.step : 1,
  15122. valModStep = (val - this._valueMin()) % step,
  15123. alignValue = val - valModStep;
  15124. if (Math.abs(valModStep) * 2 >= step) {
  15125. alignValue += valModStep > 0 ? step : - step;
  15126. }
  15127. // Since JavaScript has problems with large floats, round
  15128. // the final value to 5 digits after the decimal point (see #4124)
  15129. return parseFloat(alignValue.toFixed(5));
  15130. },
  15131. _calculateNewMax: function _calculateNewMax() {
  15132. var max = this.options.max,
  15133. min = this._valueMin(),
  15134. step = this.options.step,
  15135. aboveMin = Math.round((max - min) / step) * step;
  15136. max = aboveMin + min;
  15137. if (max > this.options.max) {
  15138. //If max is not divisible by step, rounding off may increase its value
  15139. max -= step;
  15140. }
  15141. this.max = parseFloat(max.toFixed(this._precision()));
  15142. },
  15143. _precision: function _precision() {
  15144. var precision = this._precisionOf(this.options.step);
  15145. if (this.options.min !== null) {
  15146. precision = Math.max(precision, this._precisionOf(this.options.min));
  15147. }
  15148. return precision;
  15149. },
  15150. _precisionOf: function _precisionOf(num) {
  15151. var str = num.toString(),
  15152. decimal = str.indexOf(".");
  15153. return decimal === - 1 ? 0 : str.length - decimal - 1;
  15154. },
  15155. _valueMin: function _valueMin() {
  15156. return this.options.min;
  15157. },
  15158. _valueMax: function _valueMax() {
  15159. return this.max;
  15160. },
  15161. _refreshRange: function _refreshRange(orientation) {
  15162. if (orientation === "vertical") {
  15163. this.range.css({"width": "", "left": ""});
  15164. }
  15165. if (orientation === "horizontal") {
  15166. this.range.css({"height": "", "bottom": ""});
  15167. }
  15168. },
  15169. _refreshValue: function _refreshValue() {
  15170. var lastValPercent,
  15171. valPercent,
  15172. value,
  15173. valueMin,
  15174. valueMax,
  15175. oRange = this.options.range,
  15176. o = this.options,
  15177. that = this,
  15178. animate = !this._animateOff ? o.animate : false,
  15179. _set = {};
  15180. if (this._hasMultipleValues()) {
  15181. this.handles.each(function (i) {
  15182. valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - that._valueMin()) * 100;
  15183. _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  15184. $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  15185. if (that.options.range === true) {
  15186. if (that.orientation === "horizontal") {
  15187. if (i === 0) {
  15188. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  15189. left: valPercent + "%"
  15190. }, o.animate);
  15191. }
  15192. if (i === 1) {
  15193. that.range[animate ? "animate" : "css"]({
  15194. width: valPercent - lastValPercent + "%"
  15195. }, {
  15196. queue: false,
  15197. duration: o.animate
  15198. });
  15199. }
  15200. } else {
  15201. if (i === 0) {
  15202. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  15203. bottom: valPercent + "%"
  15204. }, o.animate);
  15205. }
  15206. if (i === 1) {
  15207. that.range[animate ? "animate" : "css"]({
  15208. height: valPercent - lastValPercent + "%"
  15209. }, {
  15210. queue: false,
  15211. duration: o.animate
  15212. });
  15213. }
  15214. }
  15215. }
  15216. lastValPercent = valPercent;
  15217. });
  15218. } else {
  15219. value = this.value();
  15220. valueMin = this._valueMin();
  15221. valueMax = this._valueMax();
  15222. valPercent = valueMax !== valueMin ? (value - valueMin) / (valueMax - valueMin) * 100 : 0;
  15223. _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  15224. this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  15225. if (oRange === "min" && this.orientation === "horizontal") {
  15226. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  15227. width: valPercent + "%"
  15228. }, o.animate);
  15229. }
  15230. if (oRange === "max" && this.orientation === "horizontal") {
  15231. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  15232. width: 100 - valPercent + "%"
  15233. }, o.animate);
  15234. }
  15235. if (oRange === "min" && this.orientation === "vertical") {
  15236. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  15237. height: valPercent + "%"
  15238. }, o.animate);
  15239. }
  15240. if (oRange === "max" && this.orientation === "vertical") {
  15241. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  15242. height: 100 - valPercent + "%"
  15243. }, o.animate);
  15244. }
  15245. }
  15246. },
  15247. _handleEvents: {
  15248. keydown: function keydown(event) {
  15249. var allowed,
  15250. curVal,
  15251. newVal,
  15252. step,
  15253. index = $(event.target).data("ui-slider-handle-index");
  15254. switch (event.keyCode) {
  15255. case $.ui.keyCode.HOME:
  15256. case $.ui.keyCode.END:
  15257. case $.ui.keyCode.PAGE_UP:
  15258. case $.ui.keyCode.PAGE_DOWN:
  15259. case $.ui.keyCode.UP:
  15260. case $.ui.keyCode.RIGHT:
  15261. case $.ui.keyCode.DOWN:
  15262. case $.ui.keyCode.LEFT:
  15263. event.preventDefault();
  15264. if (!this._keySliding) {
  15265. this._keySliding = true;
  15266. this._addClass($(event.target), null, "ui-state-active");
  15267. allowed = this._start(event, index);
  15268. if (allowed === false) {
  15269. return;
  15270. }
  15271. }
  15272. break;
  15273. }
  15274. step = this.options.step;
  15275. if (this._hasMultipleValues()) {
  15276. curVal = newVal = this.values(index);
  15277. } else {
  15278. curVal = newVal = this.value();
  15279. }
  15280. switch (event.keyCode) {
  15281. case $.ui.keyCode.HOME:
  15282. newVal = this._valueMin();
  15283. break;
  15284. case $.ui.keyCode.END:
  15285. newVal = this._valueMax();
  15286. break;
  15287. case $.ui.keyCode.PAGE_UP:
  15288. newVal = this._trimAlignValue(curVal + (this._valueMax() - this._valueMin()) / this.numPages);
  15289. break;
  15290. case $.ui.keyCode.PAGE_DOWN:
  15291. newVal = this._trimAlignValue(curVal - (this._valueMax() - this._valueMin()) / this.numPages);
  15292. break;
  15293. case $.ui.keyCode.UP:
  15294. case $.ui.keyCode.RIGHT:
  15295. if (curVal === this._valueMax()) {
  15296. return;
  15297. }
  15298. newVal = this._trimAlignValue(curVal + step);
  15299. break;
  15300. case $.ui.keyCode.DOWN:
  15301. case $.ui.keyCode.LEFT:
  15302. if (curVal === this._valueMin()) {
  15303. return;
  15304. }
  15305. newVal = this._trimAlignValue(curVal - step);
  15306. break;
  15307. }
  15308. this._slide(event, index, newVal);
  15309. },
  15310. keyup: function keyup(event) {
  15311. var index = $(event.target).data("ui-slider-handle-index");
  15312. if (this._keySliding) {
  15313. this._keySliding = false;
  15314. this._stop(event, index);
  15315. this._change(event, index);
  15316. this._removeClass($(event.target), null, "ui-state-active");
  15317. }
  15318. }
  15319. }
  15320. });
  15321. });
  15322. /***/ }),
  15323. /* 33 */
  15324. /***/ (function (module, exports, __webpack_require__) {
  15325. "use strict";
  15326. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  15327. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  15328. return typeof obj;
  15329. } : function (obj) {
  15330. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  15331. };
  15332. (function (global, factory) {
  15333. (false ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  15334. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  15335. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  15336. __WEBPACK_AMD_DEFINE_FACTORY__),
  15337. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : global.StickySidebar = factory();
  15338. })(undefined, function () {
  15339. 'use strict';
  15340. var _createClass = function () {
  15341. function defineProperties(target, props) {
  15342. for (var i = 0; i < props.length; i++) {
  15343. var descriptor = props[i];
  15344. descriptor.enumerable = descriptor.enumerable || false;
  15345. descriptor.configurable = true;
  15346. if ("value" in descriptor)
  15347. descriptor.writable = true;
  15348. Object.defineProperty(target, descriptor.key, descriptor);
  15349. }
  15350. }
  15351. return function (Constructor, protoProps, staticProps) {
  15352. if (protoProps)
  15353. defineProperties(Constructor.prototype, protoProps);
  15354. if (staticProps)
  15355. defineProperties(Constructor, staticProps);
  15356. return Constructor;
  15357. };
  15358. }();
  15359. function _classCallCheck(instance, Constructor) {
  15360. if (!(instance instanceof Constructor)) {
  15361. throw new TypeError("Cannot call a class as a function");
  15362. }
  15363. }
  15364. /**
  15365. * Sticky Sidebar JavaScript Plugin.
  15366. * @version 3.2.0
  15367. * @author Ahmed Bouhuolia <a.bouhuolia@gmail.com>
  15368. * @license The MIT License (MIT)
  15369. */
  15370. var StickySidebar = function () {
  15371. // ---------------------------------
  15372. // # Define Constants
  15373. // ---------------------------------
  15374. //
  15375. var EVENT_KEY = '.stickySidebar';
  15376. var DEFAULTS = {
  15377. /**
  15378. * Additional top spacing of the element when it becomes sticky.
  15379. * @type {Numeric|Function}
  15380. */
  15381. topSpacing: 0,
  15382. /**
  15383. * Additional bottom spacing of the element when it becomes sticky.
  15384. * @type {Numeric|Function}
  15385. */
  15386. bottomSpacing: 0,
  15387. /**
  15388. * Container sidebar selector to know what the beginning and end of sticky element.
  15389. * @type {String|False}
  15390. */
  15391. containerSelector: false,
  15392. /**
  15393. * Inner wrapper selector.
  15394. * @type {String}
  15395. */
  15396. innerWrapperSelector: '.inner-wrapper-sticky',
  15397. /**
  15398. * The name of CSS class to apply to elements when they have become stuck.
  15399. * @type {String|False}
  15400. */
  15401. stickyClass: 'is-affixed',
  15402. /**
  15403. * Detect when sidebar and its container change height so re-calculate their dimensions.
  15404. * @type {Boolean}
  15405. */
  15406. resizeSensor: true,
  15407. /**
  15408. * The sidebar returns to its normal position if its width below this value.
  15409. * @type {Numeric}
  15410. */
  15411. minWidth: false
  15412. };
  15413. // ---------------------------------
  15414. // # Class Definition
  15415. // ---------------------------------
  15416. //
  15417. /**
  15418. * Sticky Sidebar Class.
  15419. * @public
  15420. */
  15421. var StickySidebar = function () {
  15422. /**
  15423. * Sticky Sidebar Constructor.
  15424. * @constructor
  15425. * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
  15426. * @param {Object} options - The options of sticky sidebar.
  15427. */
  15428. function StickySidebar(sidebar) {
  15429. var _this = this;
  15430. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  15431. _classCallCheck(this, StickySidebar);
  15432. this.options = StickySidebar.extend(DEFAULTS, options);
  15433. // Sidebar element query if there's no one, throw error.
  15434. this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
  15435. if ('undefined' === typeof this.sidebar)
  15436. throw new Error("There is no specific sidebar element.");
  15437. this.sidebarInner = false;
  15438. this.container = this.sidebar.parentElement;
  15439. // Current Affix Type of sidebar element.
  15440. this.affixedType = 'STATIC';
  15441. this.direction = 'down';
  15442. this.support = {
  15443. transform: false,
  15444. transform3d: false
  15445. };
  15446. this._initialized = false;
  15447. this._breakpoint = false;
  15448. this._resizeListeners = [];
  15449. // Dimenstions of sidebar, container and screen viewport.
  15450. this.dimensions = {
  15451. translateY: 0,
  15452. topSpacing: 0,
  15453. bottomSpacing: 0,
  15454. sidebarHeight: 0,
  15455. sidebarWidth: 0,
  15456. containerTop: 0,
  15457. containerHeight: 0,
  15458. viewportHeight: 0,
  15459. viewportTop: 0,
  15460. lastViewportTop: 0
  15461. };
  15462. // Bind event handlers for referencability.
  15463. ['handleEvent'].forEach(function (method) {
  15464. _this[method] = _this[method].bind(_this);
  15465. });
  15466. // Initialize sticky sidebar for first time.
  15467. this.initialize();
  15468. }
  15469. /**
  15470. * Initializes the sticky sidebar by adding inner wrapper, define its container,
  15471. * min-width breakpoint, calculating dimenstions, adding helper classes and inline style.
  15472. * @private
  15473. */
  15474. _createClass(StickySidebar, [{
  15475. key: 'initialize',
  15476. value: function initialize() {
  15477. var _this2 = this;
  15478. this._setSupportFeatures();
  15479. // Get sticky sidebar inner wrapper, if not found, will create one.
  15480. if (this.options.innerWrapperSelector) {
  15481. this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
  15482. if (null === this.sidebarInner)
  15483. this.sidebarInner = false;
  15484. }
  15485. if (!this.sidebarInner) {
  15486. var wrapper = document.createElement('div');
  15487. wrapper.setAttribute('class', 'inner-wrapper-sticky');
  15488. this.sidebar.appendChild(wrapper);
  15489. while (this.sidebar.firstChild != wrapper) {
  15490. wrapper.appendChild(this.sidebar.firstChild);
  15491. }
  15492. this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
  15493. }
  15494. // Container wrapper of the sidebar.
  15495. if (this.options.containerSelector) {
  15496. var containers = document.querySelectorAll(this.options.containerSelector);
  15497. containers = Array.prototype.slice.call(containers);
  15498. containers.forEach(function (container, item) {
  15499. if (!container.contains(_this2.sidebar))
  15500. return;
  15501. _this2.container = container;
  15502. });
  15503. if (!containers.length)
  15504. throw new Error("The container does not contains on the sidebar.");
  15505. }
  15506. // If top/bottom spacing is not function parse value to integer.
  15507. if ('function' !== typeof this.options.topSpacing)
  15508. this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
  15509. if ('function' !== typeof this.options.bottomSpacing)
  15510. this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
  15511. // Breakdown sticky sidebar if screen width below `options.minWidth`.
  15512. this._widthBreakpoint();
  15513. // Calculate dimensions of sidebar, container and viewport.
  15514. this.calcDimensions();
  15515. // Affix sidebar in proper position.
  15516. this.stickyPosition();
  15517. // Bind all events.
  15518. this.bindEvents();
  15519. // Inform other properties the sticky sidebar is initialized.
  15520. this._initialized = true;
  15521. }
  15522. /**
  15523. * Bind all events of sticky sidebar plugin.
  15524. * @protected
  15525. */
  15526. }, {
  15527. key: 'bindEvents',
  15528. value: function bindEvents() {
  15529. window.addEventListener('resize', this, {passive: true});
  15530. window.addEventListener('scroll', this, {passive: true});
  15531. this.sidebar.addEventListener('update' + EVENT_KEY, this);
  15532. if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  15533. new ResizeSensor(this.sidebarInner, this.handleEvent);
  15534. new ResizeSensor(this.container, this.handleEvent);
  15535. }
  15536. }
  15537. /**
  15538. * Handles all events of the plugin.
  15539. * @param {Object} event - Event object passed from listener.
  15540. */
  15541. }, {
  15542. key: 'handleEvent',
  15543. value: function handleEvent(event) {
  15544. this.updateSticky(event);
  15545. }
  15546. /**
  15547. * Calculates dimesntions of sidebar, container and screen viewpoint
  15548. * @public
  15549. */
  15550. }, {
  15551. key: 'calcDimensions',
  15552. value: function calcDimensions() {
  15553. if (this._breakpoint)
  15554. return;
  15555. var dims = this.dimensions;
  15556. // Container of sticky sidebar dimensions.
  15557. dims.containerTop = StickySidebar.offsetRelative(this.container).top;
  15558. dims.containerHeight = this.container.clientHeight;
  15559. dims.containerBottom = dims.containerTop + dims.containerHeight;
  15560. // Sidebar dimensions.
  15561. dims.sidebarHeight = this.sidebarInner.offsetHeight;
  15562. dims.sidebarWidth = this.sidebar.offsetWidth;
  15563. // Screen viewport dimensions.
  15564. dims.viewportHeight = window.innerHeight;
  15565. this._calcDimensionsWithScroll();
  15566. }
  15567. /**
  15568. * Some dimensions values need to be up-to-date when scrolling the page.
  15569. * @private
  15570. */
  15571. }, {
  15572. key: '_calcDimensionsWithScroll',
  15573. value: function _calcDimensionsWithScroll() {
  15574. var dims = this.dimensions;
  15575. dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
  15576. dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
  15577. dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
  15578. dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  15579. dims.topSpacing = this.options.topSpacing;
  15580. dims.bottomSpacing = this.options.bottomSpacing;
  15581. if ('function' === typeof dims.topSpacing)
  15582. dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
  15583. if ('function' === typeof dims.bottomSpacing)
  15584. dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
  15585. }
  15586. /**
  15587. * Detarmine wheather the sidebar is bigger than viewport.
  15588. * @public
  15589. * @return {Boolean}
  15590. */
  15591. }, {
  15592. key: 'isSidebarFitsViewport',
  15593. value: function isSidebarFitsViewport() {
  15594. return this.dimensions.sidebarHeight < this.dimensions.viewportHeight;
  15595. }
  15596. /**
  15597. * Observe browser scrolling direction top and down.
  15598. */
  15599. }, {
  15600. key: 'observeScrollDir',
  15601. value: function observeScrollDir() {
  15602. var dims = this.dimensions;
  15603. if (dims.lastViewportTop === dims.viewportTop)
  15604. return;
  15605. var furthest = 'down' === this.direction ? Math.min : Math.max;
  15606. // If the browser is scrolling not in the same direction.
  15607. if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop))
  15608. this.direction = 'down' === this.direction ? 'up' : 'down';
  15609. }
  15610. /**
  15611. * Gets affix type of sidebar according to current scrollTop and scrollLeft.
  15612. * Holds all logical affix of the sidebar when scrolling up and down and when sidebar
  15613. * is bigger than viewport and vice versa.
  15614. * @public
  15615. * @return {String|False} - Proper affix type.
  15616. */
  15617. }, {
  15618. key: 'getAffixType',
  15619. value: function getAffixType() {
  15620. var dims = this.dimensions,
  15621. affixType = false;
  15622. this._calcDimensionsWithScroll();
  15623. var sidebarBottom = dims.sidebarHeight + dims.containerTop;
  15624. var colliderTop = dims.viewportTop + dims.topSpacing;
  15625. var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
  15626. // When browser is scrolling top.
  15627. if ('up' === this.direction) {
  15628. if (colliderTop <= dims.containerTop) {
  15629. dims.translateY = 0;
  15630. affixType = 'STATIC';
  15631. } else if (colliderTop <= dims.translateY + dims.containerTop) {
  15632. dims.translateY = colliderTop - dims.containerTop;
  15633. affixType = 'VIEWPORT-TOP';
  15634. } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) {
  15635. affixType = 'VIEWPORT-UNBOTTOM';
  15636. }
  15637. // When browser is scrolling up.
  15638. } else {
  15639. // When sidebar element is not bigger than screen viewport.
  15640. if (this.isSidebarFitsViewport()) {
  15641. if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
  15642. dims.translateY = dims.containerBottom - sidebarBottom;
  15643. affixType = 'CONTAINER-BOTTOM';
  15644. } else if (colliderTop >= dims.containerTop) {
  15645. dims.translateY = colliderTop - dims.containerTop;
  15646. affixType = 'VIEWPORT-TOP';
  15647. }
  15648. // When sidebar element is bigger than screen viewport.
  15649. } else {
  15650. if (dims.containerBottom <= colliderBottom) {
  15651. dims.translateY = dims.containerBottom - sidebarBottom;
  15652. affixType = 'CONTAINER-BOTTOM';
  15653. } else if (sidebarBottom + dims.translateY <= colliderBottom) {
  15654. dims.translateY = colliderBottom - sidebarBottom;
  15655. affixType = 'VIEWPORT-BOTTOM';
  15656. } else if (dims.containerTop + dims.translateY <= colliderTop) {
  15657. affixType = 'VIEWPORT-UNBOTTOM';
  15658. }
  15659. }
  15660. }
  15661. // Make sure the translate Y is not bigger than container height.
  15662. dims.translateY = Math.max(0, dims.translateY);
  15663. dims.translateY = Math.min(dims.containerHeight, dims.translateY);
  15664. dims.lastViewportTop = dims.viewportTop;
  15665. return affixType;
  15666. }
  15667. /**
  15668. * Gets inline style of sticky sidebar wrapper and inner wrapper according
  15669. * to its affix type.
  15670. * @private
  15671. * @param {String} affixType - Affix type of sticky sidebar.
  15672. * @return {Object}
  15673. */
  15674. }, {
  15675. key: '_getStyle',
  15676. value: function _getStyle(affixType) {
  15677. if ('undefined' === typeof affixType)
  15678. return;
  15679. var style = {inner: {}, outer: {}};
  15680. var dims = this.dimensions;
  15681. switch (affixType) {
  15682. case 'VIEWPORT-TOP':
  15683. style.inner = {position: 'fixed', top: this.options.topSpacing,
  15684. left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth};
  15685. break;
  15686. case 'VIEWPORT-BOTTOM':
  15687. style.inner = {position: 'fixed', top: 'auto', left: dims.sidebarLeft,
  15688. bottom: this.options.bottomSpacing, width: dims.sidebarWidth};
  15689. break;
  15690. case 'CONTAINER-BOTTOM':
  15691. case 'VIEWPORT-UNBOTTOM':
  15692. var translate = this._getTranslate(0, dims.translateY + 'px');
  15693. if (translate)
  15694. style.inner = {transform: translate};
  15695. else
  15696. style.inner = {position: 'absolute', top: dims.translateY, width: dims.sidebarWidth};
  15697. break;
  15698. }
  15699. switch (affixType) {
  15700. case 'VIEWPORT-TOP':
  15701. case 'VIEWPORT-BOTTOM':
  15702. case 'VIEWPORT-UNBOTTOM':
  15703. case 'CONTAINER-BOTTOM':
  15704. style.outer = {height: dims.sidebarHeight, position: 'relative'};
  15705. break;
  15706. }
  15707. style.outer = StickySidebar.extend({height: '', position: ''}, style.outer);
  15708. style.inner = StickySidebar.extend({position: 'relative', top: '', left: '',
  15709. bottom: '', width: '', transform: this._getTranslate()}, style.inner);
  15710. return style;
  15711. }
  15712. /**
  15713. * Cause the sidebar to be sticky according to affix type by adding inline
  15714. * style, adding helper class and trigger events.
  15715. * @function
  15716. * @protected
  15717. * @param {string} force - Update sticky sidebar position by force.
  15718. */
  15719. }, {
  15720. key: 'stickyPosition',
  15721. value: function stickyPosition(force) {
  15722. if (this._breakpoint)
  15723. return;
  15724. force = force || false;
  15725. var affixType = this.getAffixType();
  15726. var style = this._getStyle(affixType);
  15727. if ((this.affixedType != affixType || force) && affixType) {
  15728. var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
  15729. StickySidebar.eventTrigger(this.sidebar, affixEvent);
  15730. if ('STATIC' === affixType)
  15731. StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
  15732. else
  15733. StickySidebar.addClass(this.sidebar, this.options.stickyClass);
  15734. for (var key in style.outer) {
  15735. this.sidebar.style[key] = style.outer[key];
  15736. }
  15737. for (var _key in style.inner) {
  15738. var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : '';
  15739. this.sidebarInner.style[_key] = style.inner[_key] + _unit2;
  15740. }
  15741. var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport', '') + EVENT_KEY;
  15742. StickySidebar.eventTrigger(this.sidebar, affixedEvent);
  15743. } else {
  15744. if (this._initialized)
  15745. this.sidebarInner.style.left = style.inner.left;
  15746. }
  15747. this.affixedType = affixType;
  15748. }
  15749. /**
  15750. * Breakdown sticky sidebar when window width is below `options.minWidth` value.
  15751. * @protected
  15752. */
  15753. }, {
  15754. key: '_widthBreakpoint',
  15755. value: function _widthBreakpoint() {
  15756. if (window.innerWidth <= this.options.minWidth) {
  15757. this._breakpoint = true;
  15758. this.affixedType = 'STATIC';
  15759. this.sidebar.removeAttribute('style');
  15760. StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
  15761. this.sidebarInner.removeAttribute('style');
  15762. } else {
  15763. this._breakpoint = false;
  15764. }
  15765. }
  15766. /**
  15767. * Switchs between functions stack for each event type, if there's no
  15768. * event, it will re-initialize sticky sidebar.
  15769. * @public
  15770. */
  15771. }, {
  15772. key: 'updateSticky',
  15773. value: function updateSticky() {
  15774. var _this3 = this;
  15775. var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  15776. if (this._running)
  15777. return;
  15778. this._running = true;
  15779. (function (eventType) {
  15780. requestAnimationFrame(function () {
  15781. switch (eventType) {
  15782. // When browser is scrolling and re-calculate just dimensions
  15783. // within scroll.
  15784. case 'scroll':
  15785. _this3._calcDimensionsWithScroll();
  15786. _this3.observeScrollDir();
  15787. _this3.stickyPosition();
  15788. break;
  15789. // When browser is resizing or there's no event, observe width
  15790. // breakpoint and re-calculate dimensions.
  15791. case 'resize':
  15792. default:
  15793. _this3._widthBreakpoint();
  15794. _this3.calcDimensions();
  15795. _this3.stickyPosition(true);
  15796. break;
  15797. }
  15798. _this3._running = false;
  15799. });
  15800. })(event.type);
  15801. }
  15802. /**
  15803. * Set browser support features to the public property.
  15804. * @private
  15805. */
  15806. }, {
  15807. key: '_setSupportFeatures',
  15808. value: function _setSupportFeatures() {
  15809. var support = this.support;
  15810. support.transform = StickySidebar.supportTransform();
  15811. support.transform3d = StickySidebar.supportTransform(true);
  15812. }
  15813. /**
  15814. * Get translate value, if the browser supports transfrom3d, it will adopt it.
  15815. * and the same with translate. if browser doesn't support both return false.
  15816. * @param {Number} y - Value of Y-axis.
  15817. * @param {Number} x - Value of X-axis.
  15818. * @param {Number} z - Value of Z-axis.
  15819. * @return {String|False}
  15820. */
  15821. }, {
  15822. key: '_getTranslate',
  15823. value: function _getTranslate() {
  15824. var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  15825. var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  15826. var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  15827. if (this.support.transform3d)
  15828. return 'translate3d(' + y + ', ' + x + ', ' + z + ')';
  15829. else if (this.support.translate)
  15830. return 'translate(' + y + ', ' + x + ')';
  15831. else
  15832. return false;
  15833. }
  15834. /**
  15835. * Destroy sticky sidebar plugin.
  15836. * @public
  15837. */
  15838. }, {
  15839. key: 'destroy',
  15840. value: function destroy() {
  15841. window.removeEventListener('resize', this);
  15842. window.removeEventListener('scroll', this);
  15843. this.sidebar.classList.remove(this.options.stickyClass);
  15844. this.sidebar.style.minHeight = '';
  15845. this.sidebar.removeEventListener('update' + EVENT_KEY, this);
  15846. var styleReset = {inner: {}, outer: {}};
  15847. styleReset.inner = {position: '', top: '', left: '', bottom: '', width: '', transform: ''};
  15848. styleReset.outer = {height: '', position: ''};
  15849. for (var key in styleReset.outer) {
  15850. this.sidebar.style[key] = styleReset.outer[key];
  15851. }
  15852. for (var _key2 in styleReset.inner) {
  15853. this.sidebarInner.style[_key2] = styleReset.inner[_key2];
  15854. }
  15855. if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  15856. ResizeSensor.detach(this.sidebarInner, this.handleEvent);
  15857. ResizeSensor.detach(this.container, this.handleEvent);
  15858. }
  15859. }
  15860. /**
  15861. * Detarmine if the browser supports CSS transfrom feature.
  15862. * @function
  15863. * @static
  15864. * @param {Boolean} transform3d - Detect transform with translate3d.
  15865. * @return {String}
  15866. */
  15867. }], [{
  15868. key: 'supportTransform',
  15869. value: function supportTransform(transform3d) {
  15870. var result = false,
  15871. property = transform3d ? 'perspective' : 'transform',
  15872. upper = property.charAt(0).toUpperCase() + property.slice(1),
  15873. prefixes = ['Webkit', 'Moz', 'O', 'ms'],
  15874. support = document.createElement('support'),
  15875. style = support.style;
  15876. (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
  15877. if (style[property] !== undefined) {
  15878. result = property;
  15879. return false;
  15880. }
  15881. });
  15882. return result;
  15883. }
  15884. /**
  15885. * Trigger custom event.
  15886. * @static
  15887. * @param {DOMObject} element - Target element on the DOM.
  15888. * @param {String} eventName - Event name.
  15889. * @param {Object} data -
  15890. */
  15891. }, {
  15892. key: 'eventTrigger',
  15893. value: function eventTrigger(element, eventName, data) {
  15894. try {
  15895. var event = new CustomEvent(eventName, {detail: data});
  15896. } catch (e) {
  15897. var event = document.createEvent('CustomEvent');
  15898. event.initCustomEvent(eventName, true, true, data);
  15899. }
  15900. element.dispatchEvent(event);
  15901. }
  15902. /**
  15903. * Extend options object with defaults.
  15904. * @function
  15905. * @static
  15906. */
  15907. }, {
  15908. key: 'extend',
  15909. value: function extend(defaults, options) {
  15910. var results = {};
  15911. for (var key in defaults) {
  15912. if ('undefined' !== typeof options[key])
  15913. results[key] = options[key];
  15914. else
  15915. results[key] = defaults[key];
  15916. }
  15917. return results;
  15918. }
  15919. /**
  15920. * Get current coordinates left and top of specific element.
  15921. * @static
  15922. */
  15923. }, {
  15924. key: 'offsetRelative',
  15925. value: function offsetRelative(element) {
  15926. var result = {left: 0, top: 0};
  15927. do {
  15928. var offsetTop = element.offsetTop;
  15929. var offsetLeft = element.offsetLeft;
  15930. if (!isNaN(offsetTop))
  15931. result.top += offsetTop;
  15932. if (!isNaN(offsetLeft))
  15933. result.left += offsetLeft;
  15934. } while (element = element.offsetParent);
  15935. return result;
  15936. }
  15937. /**
  15938. * Add specific class name to specific element.
  15939. * @static
  15940. * @param {ObjectDOM} element
  15941. * @param {String} className
  15942. */
  15943. }, {
  15944. key: 'addClass',
  15945. value: function addClass(element, className) {
  15946. if (!StickySidebar.hasClass(element, className)) {
  15947. if (element.classList)
  15948. element.classList.add(className);
  15949. else
  15950. element.className += ' ' + className;
  15951. }
  15952. }
  15953. /**
  15954. * Remove specific class name to specific element
  15955. * @static
  15956. * @param {ObjectDOM} element
  15957. * @param {String} className
  15958. */
  15959. }, {
  15960. key: 'removeClass',
  15961. value: function removeClass(element, className) {
  15962. if (StickySidebar.hasClass(element, className)) {
  15963. if (element.classList)
  15964. element.classList.remove(className);
  15965. else
  15966. element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  15967. }
  15968. }
  15969. /**
  15970. * Detarmine weather the element has specific class name.
  15971. * @static
  15972. * @param {ObjectDOM} element
  15973. * @param {String} className
  15974. */
  15975. }, {
  15976. key: 'hasClass',
  15977. value: function hasClass(element, className) {
  15978. if (element.classList)
  15979. return element.classList.contains(className);
  15980. else
  15981. return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
  15982. }
  15983. }]);
  15984. return StickySidebar;
  15985. }();
  15986. return StickySidebar;
  15987. }();
  15988. // Global
  15989. // -------------------------
  15990. window.StickySidebar = StickySidebar;
  15991. return StickySidebar;
  15992. });
  15993. //# sourceMappingURL=sticky-sidebar.js.map
  15994. /***/ }),
  15995. /* 34 */
  15996. /***/ (function (module, exports, __webpack_require__) {
  15997. "use strict";
  15998. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  15999. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  16000. return typeof obj;
  16001. } : function (obj) {
  16002. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  16003. };
  16004. /*! tether 1.4.0 */
  16005. (function (root, factory) {
  16006. if (true) {
  16007. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  16008. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  16009. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  16010. __WEBPACK_AMD_DEFINE_FACTORY__),
  16011. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16012. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  16013. module.exports = factory(require, exports, module);
  16014. } else {
  16015. root.Tether = factory();
  16016. }
  16017. })(undefined, function (require, exports, module) {
  16018. 'use strict';
  16019. var _createClass = function () {
  16020. function defineProperties(target, props) {
  16021. for (var i = 0; i < props.length; i++) {
  16022. var descriptor = props[i];
  16023. descriptor.enumerable = descriptor.enumerable || false;
  16024. descriptor.configurable = true;
  16025. if ('value' in descriptor)
  16026. descriptor.writable = true;
  16027. Object.defineProperty(target, descriptor.key, descriptor);
  16028. }
  16029. }
  16030. return function (Constructor, protoProps, staticProps) {
  16031. if (protoProps)
  16032. defineProperties(Constructor.prototype, protoProps);
  16033. if (staticProps)
  16034. defineProperties(Constructor, staticProps);
  16035. return Constructor;
  16036. };
  16037. }();
  16038. function _classCallCheck(instance, Constructor) {
  16039. if (!(instance instanceof Constructor)) {
  16040. throw new TypeError('Cannot call a class as a function');
  16041. }
  16042. }
  16043. var TetherBase = undefined;
  16044. if (typeof TetherBase === 'undefined') {
  16045. TetherBase = {modules: []};
  16046. }
  16047. var zeroElement = null;
  16048. // Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
  16049. // if the element lies within a nested document (<frame> or <iframe>-like).
  16050. function getActualBoundingClientRect(node) {
  16051. var boundingRect = node.getBoundingClientRect();
  16052. // The original object returned by getBoundingClientRect is immutable, so we clone it
  16053. // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
  16054. var rect = {};
  16055. for (var k in boundingRect) {
  16056. rect[k] = boundingRect[k];
  16057. }
  16058. if (node.ownerDocument !== document) {
  16059. var _frameElement = node.ownerDocument.defaultView.frameElement;
  16060. if (_frameElement) {
  16061. var frameRect = getActualBoundingClientRect(_frameElement);
  16062. rect.top += frameRect.top;
  16063. rect.bottom += frameRect.top;
  16064. rect.left += frameRect.left;
  16065. rect.right += frameRect.left;
  16066. }
  16067. }
  16068. return rect;
  16069. }
  16070. function getScrollParents(el) {
  16071. // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
  16072. // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  16073. var computedStyle = getComputedStyle(el) || {};
  16074. var position = computedStyle.position;
  16075. var parents = [];
  16076. if (position === 'fixed') {
  16077. return [el];
  16078. }
  16079. var parent = el;
  16080. while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
  16081. var style = undefined;
  16082. try {
  16083. style = getComputedStyle(parent);
  16084. } catch (err) {
  16085. }
  16086. if (typeof style === 'undefined' || style === null) {
  16087. parents.push(parent);
  16088. return parents;
  16089. }
  16090. var _style = style;
  16091. var overflow = _style.overflow;
  16092. var overflowX = _style.overflowX;
  16093. var overflowY = _style.overflowY;
  16094. if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
  16095. if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
  16096. parents.push(parent);
  16097. }
  16098. }
  16099. }
  16100. parents.push(el.ownerDocument.body);
  16101. // If the node is within a frame, account for the parent window scroll
  16102. if (el.ownerDocument !== document) {
  16103. parents.push(el.ownerDocument.defaultView);
  16104. }
  16105. return parents;
  16106. }
  16107. var uniqueId = function () {
  16108. var id = 0;
  16109. return function () {
  16110. return ++id;
  16111. };
  16112. }();
  16113. var zeroPosCache = {};
  16114. var getOrigin = function getOrigin() {
  16115. // getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
  16116. // jitter as the user scrolls that messes with our ability to detect if two positions
  16117. // are equivilant or not. We place an element at the top left of the page that will
  16118. // get the same jitter, so we can cancel the two out.
  16119. var node = zeroElement;
  16120. if (!node || !document.body.contains(node)) {
  16121. node = document.createElement('div');
  16122. node.setAttribute('data-tether-id', uniqueId());
  16123. extend(node.style, {
  16124. top: 0,
  16125. left: 0,
  16126. position: 'absolute'
  16127. });
  16128. document.body.appendChild(node);
  16129. zeroElement = node;
  16130. }
  16131. var id = node.getAttribute('data-tether-id');
  16132. if (typeof zeroPosCache[id] === 'undefined') {
  16133. zeroPosCache[id] = getActualBoundingClientRect(node);
  16134. // Clear the cache when this position call is done
  16135. defer(function () {
  16136. delete zeroPosCache[id];
  16137. });
  16138. }
  16139. return zeroPosCache[id];
  16140. };
  16141. function removeUtilElements() {
  16142. if (zeroElement) {
  16143. document.body.removeChild(zeroElement);
  16144. }
  16145. zeroElement = null;
  16146. }
  16147. ;
  16148. function getBounds(el) {
  16149. var doc = undefined;
  16150. if (el === document) {
  16151. doc = document;
  16152. el = document.documentElement;
  16153. } else {
  16154. doc = el.ownerDocument;
  16155. }
  16156. var docEl = doc.documentElement;
  16157. var box = getActualBoundingClientRect(el);
  16158. var origin = getOrigin();
  16159. box.top -= origin.top;
  16160. box.left -= origin.left;
  16161. if (typeof box.width === 'undefined') {
  16162. box.width = document.body.scrollWidth - box.left - box.right;
  16163. }
  16164. if (typeof box.height === 'undefined') {
  16165. box.height = document.body.scrollHeight - box.top - box.bottom;
  16166. }
  16167. box.top = box.top - docEl.clientTop;
  16168. box.left = box.left - docEl.clientLeft;
  16169. box.right = doc.body.clientWidth - box.width - box.left;
  16170. box.bottom = doc.body.clientHeight - box.height - box.top;
  16171. return box;
  16172. }
  16173. function getOffsetParent(el) {
  16174. return el.offsetParent || document.documentElement;
  16175. }
  16176. var _scrollBarSize = null;
  16177. function getScrollBarSize() {
  16178. if (_scrollBarSize) {
  16179. return _scrollBarSize;
  16180. }
  16181. var inner = document.createElement('div');
  16182. inner.style.width = '100%';
  16183. inner.style.height = '200px';
  16184. var outer = document.createElement('div');
  16185. extend(outer.style, {
  16186. position: 'absolute',
  16187. top: 0,
  16188. left: 0,
  16189. pointerEvents: 'none',
  16190. visibility: 'hidden',
  16191. width: '200px',
  16192. height: '150px',
  16193. overflow: 'hidden'
  16194. });
  16195. outer.appendChild(inner);
  16196. document.body.appendChild(outer);
  16197. var widthContained = inner.offsetWidth;
  16198. outer.style.overflow = 'scroll';
  16199. var widthScroll = inner.offsetWidth;
  16200. if (widthContained === widthScroll) {
  16201. widthScroll = outer.clientWidth;
  16202. }
  16203. document.body.removeChild(outer);
  16204. var width = widthContained - widthScroll;
  16205. _scrollBarSize = {width: width, height: width};
  16206. return _scrollBarSize;
  16207. }
  16208. function extend() {
  16209. var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  16210. var args = [];
  16211. Array.prototype.push.apply(args, arguments);
  16212. args.slice(1).forEach(function (obj) {
  16213. if (obj) {
  16214. for (var key in obj) {
  16215. if ({}.hasOwnProperty.call(obj, key)) {
  16216. out[key] = obj[key];
  16217. }
  16218. }
  16219. }
  16220. });
  16221. return out;
  16222. }
  16223. function removeClass(el, name) {
  16224. if (typeof el.classList !== 'undefined') {
  16225. name.split(' ').forEach(function (cls) {
  16226. if (cls.trim()) {
  16227. el.classList.remove(cls);
  16228. }
  16229. });
  16230. } else {
  16231. var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
  16232. var className = getClassName(el).replace(regex, ' ');
  16233. setClassName(el, className);
  16234. }
  16235. }
  16236. function addClass(el, name) {
  16237. if (typeof el.classList !== 'undefined') {
  16238. name.split(' ').forEach(function (cls) {
  16239. if (cls.trim()) {
  16240. el.classList.add(cls);
  16241. }
  16242. });
  16243. } else {
  16244. removeClass(el, name);
  16245. var cls = getClassName(el) + (' ' + name);
  16246. setClassName(el, cls);
  16247. }
  16248. }
  16249. function hasClass(el, name) {
  16250. if (typeof el.classList !== 'undefined') {
  16251. return el.classList.contains(name);
  16252. }
  16253. var className = getClassName(el);
  16254. return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
  16255. }
  16256. function getClassName(el) {
  16257. // Can't use just SVGAnimatedString here since nodes within a Frame in IE have
  16258. // completely separately SVGAnimatedString base classes
  16259. if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
  16260. return el.className.baseVal;
  16261. }
  16262. return el.className;
  16263. }
  16264. function setClassName(el, className) {
  16265. el.setAttribute('class', className);
  16266. }
  16267. function updateClasses(el, add, all) {
  16268. // Of the set of 'all' classes, we need the 'add' classes, and only the
  16269. // 'add' classes to be set.
  16270. all.forEach(function (cls) {
  16271. if (add.indexOf(cls) === - 1 && hasClass(el, cls)) {
  16272. removeClass(el, cls);
  16273. }
  16274. });
  16275. add.forEach(function (cls) {
  16276. if (!hasClass(el, cls)) {
  16277. addClass(el, cls);
  16278. }
  16279. });
  16280. }
  16281. var deferred = [];
  16282. var defer = function defer(fn) {
  16283. deferred.push(fn);
  16284. };
  16285. var flush = function flush() {
  16286. var fn = undefined;
  16287. while (fn = deferred.pop()) {
  16288. fn();
  16289. }
  16290. };
  16291. var Evented = function () {
  16292. function Evented() {
  16293. _classCallCheck(this, Evented);
  16294. }
  16295. _createClass(Evented, [{
  16296. key: 'on',
  16297. value: function on(event, handler, ctx) {
  16298. var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
  16299. if (typeof this.bindings === 'undefined') {
  16300. this.bindings = {};
  16301. }
  16302. if (typeof this.bindings[event] === 'undefined') {
  16303. this.bindings[event] = [];
  16304. }
  16305. this.bindings[event].push({handler: handler, ctx: ctx, once: once});
  16306. }
  16307. }, {
  16308. key: 'once',
  16309. value: function once(event, handler, ctx) {
  16310. this.on(event, handler, ctx, true);
  16311. }
  16312. }, {
  16313. key: 'off',
  16314. value: function off(event, handler) {
  16315. if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
  16316. return;
  16317. }
  16318. if (typeof handler === 'undefined') {
  16319. delete this.bindings[event];
  16320. } else {
  16321. var i = 0;
  16322. while (i < this.bindings[event].length) {
  16323. if (this.bindings[event][i].handler === handler) {
  16324. this.bindings[event].splice(i, 1);
  16325. } else {
  16326. ++i;
  16327. }
  16328. }
  16329. }
  16330. }
  16331. }, {
  16332. key: 'trigger',
  16333. value: function trigger(event) {
  16334. if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
  16335. var i = 0;
  16336. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  16337. args[_key - 1] = arguments[_key];
  16338. }
  16339. while (i < this.bindings[event].length) {
  16340. var _bindings$event$i = this.bindings[event][i];
  16341. var handler = _bindings$event$i.handler;
  16342. var ctx = _bindings$event$i.ctx;
  16343. var once = _bindings$event$i.once;
  16344. var context = ctx;
  16345. if (typeof context === 'undefined') {
  16346. context = this;
  16347. }
  16348. handler.apply(context, args);
  16349. if (once) {
  16350. this.bindings[event].splice(i, 1);
  16351. } else {
  16352. ++i;
  16353. }
  16354. }
  16355. }
  16356. }
  16357. }]);
  16358. return Evented;
  16359. }();
  16360. TetherBase.Utils = {
  16361. getActualBoundingClientRect: getActualBoundingClientRect,
  16362. getScrollParents: getScrollParents,
  16363. getBounds: getBounds,
  16364. getOffsetParent: getOffsetParent,
  16365. extend: extend,
  16366. addClass: addClass,
  16367. removeClass: removeClass,
  16368. hasClass: hasClass,
  16369. updateClasses: updateClasses,
  16370. defer: defer,
  16371. flush: flush,
  16372. uniqueId: uniqueId,
  16373. Evented: Evented,
  16374. getScrollBarSize: getScrollBarSize,
  16375. removeUtilElements: removeUtilElements
  16376. };
  16377. /* globals TetherBase, performance */
  16378. 'use strict';
  16379. var _slicedToArray = function () {
  16380. function sliceIterator(arr, i) {
  16381. var _arr = [];
  16382. var _n = true;
  16383. var _d = false;
  16384. var _e = undefined;
  16385. try {
  16386. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16387. _arr.push(_s.value);
  16388. if (i && _arr.length === i)
  16389. break;
  16390. }
  16391. } catch (err) {
  16392. _d = true;
  16393. _e = err;
  16394. } finally {
  16395. try {
  16396. if (!_n && _i['return'])
  16397. _i['return']();
  16398. } finally {
  16399. if (_d)
  16400. throw _e;
  16401. }
  16402. }
  16403. return _arr;
  16404. }
  16405. return function (arr, i) {
  16406. if (Array.isArray(arr)) {
  16407. return arr;
  16408. } else if (Symbol.iterator in Object(arr)) {
  16409. return sliceIterator(arr, i);
  16410. } else {
  16411. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16412. }
  16413. };
  16414. }();
  16415. var _createClass = function () {
  16416. function defineProperties(target, props) {
  16417. for (var i = 0; i < props.length; i++) {
  16418. var descriptor = props[i];
  16419. descriptor.enumerable = descriptor.enumerable || false;
  16420. descriptor.configurable = true;
  16421. if ('value' in descriptor)
  16422. descriptor.writable = true;
  16423. Object.defineProperty(target, descriptor.key, descriptor);
  16424. }
  16425. }
  16426. return function (Constructor, protoProps, staticProps) {
  16427. if (protoProps)
  16428. defineProperties(Constructor.prototype, protoProps);
  16429. if (staticProps)
  16430. defineProperties(Constructor, staticProps);
  16431. return Constructor;
  16432. };
  16433. }();
  16434. var _get = function get(_x6, _x7, _x8) {
  16435. var _again = true;
  16436. _function: while (_again) {
  16437. var object = _x6,
  16438. property = _x7,
  16439. receiver = _x8;
  16440. _again = false;
  16441. if (object === null)
  16442. object = Function.prototype;
  16443. var desc = Object.getOwnPropertyDescriptor(object, property);
  16444. if (desc === undefined) {
  16445. var parent = Object.getPrototypeOf(object);
  16446. if (parent === null) {
  16447. return undefined;
  16448. } else {
  16449. _x6 = parent;
  16450. _x7 = property;
  16451. _x8 = receiver;
  16452. _again = true;
  16453. desc = parent = undefined;
  16454. continue _function;
  16455. }
  16456. } else if ('value' in desc) {
  16457. return desc.value;
  16458. } else {
  16459. var getter = desc.get;
  16460. if (getter === undefined) {
  16461. return undefined;
  16462. }
  16463. return getter.call(receiver);
  16464. }
  16465. }
  16466. };
  16467. function _classCallCheck(instance, Constructor) {
  16468. if (!(instance instanceof Constructor)) {
  16469. throw new TypeError('Cannot call a class as a function');
  16470. }
  16471. }
  16472. function _inherits(subClass, superClass) {
  16473. if (typeof superClass !== 'function' && superClass !== null) {
  16474. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  16475. }
  16476. subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {value: subClass, enumerable: false, writable: true, configurable: true}});
  16477. if (superClass)
  16478. Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16479. }
  16480. if (typeof TetherBase === 'undefined') {
  16481. throw new Error('You must include the utils.js file before tether.js');
  16482. }
  16483. var _TetherBase$Utils = TetherBase.Utils;
  16484. var getScrollParents = _TetherBase$Utils.getScrollParents;
  16485. var getBounds = _TetherBase$Utils.getBounds;
  16486. var getOffsetParent = _TetherBase$Utils.getOffsetParent;
  16487. var extend = _TetherBase$Utils.extend;
  16488. var addClass = _TetherBase$Utils.addClass;
  16489. var removeClass = _TetherBase$Utils.removeClass;
  16490. var updateClasses = _TetherBase$Utils.updateClasses;
  16491. var defer = _TetherBase$Utils.defer;
  16492. var flush = _TetherBase$Utils.flush;
  16493. var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
  16494. var removeUtilElements = _TetherBase$Utils.removeUtilElements;
  16495. function within(a, b) {
  16496. var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
  16497. return a + diff >= b && b >= a - diff;
  16498. }
  16499. var transformKey = function () {
  16500. if (typeof document === 'undefined') {
  16501. return '';
  16502. }
  16503. var el = document.createElement('div');
  16504. var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
  16505. for (var i = 0; i < transforms.length; ++i) {
  16506. var key = transforms[i];
  16507. if (el.style[key] !== undefined) {
  16508. return key;
  16509. }
  16510. }
  16511. }();
  16512. var tethers = [];
  16513. var position = function position() {
  16514. tethers.forEach(function (tether) {
  16515. tether.position(false);
  16516. });
  16517. flush();
  16518. };
  16519. function now() {
  16520. if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
  16521. return performance.now();
  16522. }
  16523. return + new Date();
  16524. }
  16525. (function () {
  16526. var lastCall = null;
  16527. var lastDuration = null;
  16528. var pendingTimeout = null;
  16529. var tick = function tick() {
  16530. if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
  16531. // We voluntarily throttle ourselves if we can't manage 60fps
  16532. lastDuration = Math.min(lastDuration - 16, 250);
  16533. // Just in case this is the last event, remember to position just once more
  16534. pendingTimeout = setTimeout(tick, 250);
  16535. return;
  16536. }
  16537. if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
  16538. // Some browsers call events a little too frequently, refuse to run more than is reasonable
  16539. return;
  16540. }
  16541. if (pendingTimeout != null) {
  16542. clearTimeout(pendingTimeout);
  16543. pendingTimeout = null;
  16544. }
  16545. lastCall = now();
  16546. position();
  16547. lastDuration = now() - lastCall;
  16548. };
  16549. if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
  16550. ['resize', 'scroll', 'touchmove'].forEach(function (event) {
  16551. window.addEventListener(event, tick);
  16552. });
  16553. }
  16554. })();
  16555. var MIRROR_LR = {
  16556. center: 'center',
  16557. left: 'right',
  16558. right: 'left'
  16559. };
  16560. var MIRROR_TB = {
  16561. middle: 'middle',
  16562. top: 'bottom',
  16563. bottom: 'top'
  16564. };
  16565. var OFFSET_MAP = {
  16566. top: 0,
  16567. left: 0,
  16568. middle: '50%',
  16569. center: '50%',
  16570. bottom: '100%',
  16571. right: '100%'
  16572. };
  16573. var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
  16574. var left = attachment.left;
  16575. var top = attachment.top;
  16576. if (left === 'auto') {
  16577. left = MIRROR_LR[relativeToAttachment.left];
  16578. }
  16579. if (top === 'auto') {
  16580. top = MIRROR_TB[relativeToAttachment.top];
  16581. }
  16582. return {left: left, top: top};
  16583. };
  16584. var attachmentToOffset = function attachmentToOffset(attachment) {
  16585. var left = attachment.left;
  16586. var top = attachment.top;
  16587. if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
  16588. left = OFFSET_MAP[attachment.left];
  16589. }
  16590. if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
  16591. top = OFFSET_MAP[attachment.top];
  16592. }
  16593. return {left: left, top: top};
  16594. };
  16595. function addOffset() {
  16596. var out = {top: 0, left: 0};
  16597. for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
  16598. offsets[_key] = arguments[_key];
  16599. }
  16600. offsets.forEach(function (_ref) {
  16601. var top = _ref.top;
  16602. var left = _ref.left;
  16603. if (typeof top === 'string') {
  16604. top = parseFloat(top, 10);
  16605. }
  16606. if (typeof left === 'string') {
  16607. left = parseFloat(left, 10);
  16608. }
  16609. out.top += top;
  16610. out.left += left;
  16611. });
  16612. return out;
  16613. }
  16614. function offsetToPx(offset, size) {
  16615. if (typeof offset.left === 'string' && offset.left.indexOf('%') !== - 1) {
  16616. offset.left = parseFloat(offset.left, 10) / 100 * size.width;
  16617. }
  16618. if (typeof offset.top === 'string' && offset.top.indexOf('%') !== - 1) {
  16619. offset.top = parseFloat(offset.top, 10) / 100 * size.height;
  16620. }
  16621. return offset;
  16622. }
  16623. var parseOffset = function parseOffset(value) {
  16624. var _value$split = value.split(' ');
  16625. var _value$split2 = _slicedToArray(_value$split, 2);
  16626. var top = _value$split2[0];
  16627. var left = _value$split2[1];
  16628. return {top: top, left: left};
  16629. };
  16630. var parseAttachment = parseOffset;
  16631. var TetherClass = function (_Evented) {
  16632. _inherits(TetherClass, _Evented);
  16633. function TetherClass(options) {
  16634. var _this = this;
  16635. _classCallCheck(this, TetherClass);
  16636. _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
  16637. this.position = this.position.bind(this);
  16638. tethers.push(this);
  16639. this.history = [];
  16640. this.setOptions(options, false);
  16641. TetherBase.modules.forEach(function (module) {
  16642. if (typeof module.initialize !== 'undefined') {
  16643. module.initialize.call(_this);
  16644. }
  16645. });
  16646. this.position();
  16647. }
  16648. _createClass(TetherClass, [{
  16649. key: 'getClass',
  16650. value: function getClass() {
  16651. var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  16652. var classes = this.options.classes;
  16653. if (typeof classes !== 'undefined' && classes[key]) {
  16654. return this.options.classes[key];
  16655. } else if (this.options.classPrefix) {
  16656. return this.options.classPrefix + '-' + key;
  16657. } else {
  16658. return key;
  16659. }
  16660. }
  16661. }, {
  16662. key: 'setOptions',
  16663. value: function setOptions(options) {
  16664. var _this2 = this;
  16665. var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
  16666. var defaults = {
  16667. offset: '0 0',
  16668. targetOffset: '0 0',
  16669. targetAttachment: 'auto auto',
  16670. classPrefix: 'tether'
  16671. };
  16672. this.options = extend(defaults, options);
  16673. var _options = this.options;
  16674. var element = _options.element;
  16675. var target = _options.target;
  16676. var targetModifier = _options.targetModifier;
  16677. this.element = element;
  16678. this.target = target;
  16679. this.targetModifier = targetModifier;
  16680. if (this.target === 'viewport') {
  16681. this.target = document.body;
  16682. this.targetModifier = 'visible';
  16683. } else if (this.target === 'scroll-handle') {
  16684. this.target = document.body;
  16685. this.targetModifier = 'scroll-handle';
  16686. }
  16687. ['element', 'target'].forEach(function (key) {
  16688. if (typeof _this2[key] === 'undefined') {
  16689. throw new Error('Tether Error: Both element and target must be defined');
  16690. }
  16691. if (typeof _this2[key].jquery !== 'undefined') {
  16692. _this2[key] = _this2[key][0];
  16693. } else if (typeof _this2[key] === 'string') {
  16694. _this2[key] = document.querySelector(_this2[key]);
  16695. }
  16696. });
  16697. addClass(this.element, this.getClass('element'));
  16698. if (!(this.options.addTargetClasses === false)) {
  16699. addClass(this.target, this.getClass('target'));
  16700. }
  16701. if (!this.options.attachment) {
  16702. throw new Error('Tether Error: You must provide an attachment');
  16703. }
  16704. this.targetAttachment = parseAttachment(this.options.targetAttachment);
  16705. this.attachment = parseAttachment(this.options.attachment);
  16706. this.offset = parseOffset(this.options.offset);
  16707. this.targetOffset = parseOffset(this.options.targetOffset);
  16708. if (typeof this.scrollParents !== 'undefined') {
  16709. this.disable();
  16710. }
  16711. if (this.targetModifier === 'scroll-handle') {
  16712. this.scrollParents = [this.target];
  16713. } else {
  16714. this.scrollParents = getScrollParents(this.target);
  16715. }
  16716. if (!(this.options.enabled === false)) {
  16717. this.enable(pos);
  16718. }
  16719. }
  16720. }, {
  16721. key: 'getTargetBounds',
  16722. value: function getTargetBounds() {
  16723. if (typeof this.targetModifier !== 'undefined') {
  16724. if (this.targetModifier === 'visible') {
  16725. if (this.target === document.body) {
  16726. return {top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth};
  16727. } else {
  16728. var bounds = getBounds(this.target);
  16729. var out = {
  16730. height: bounds.height,
  16731. width: bounds.width,
  16732. top: bounds.top,
  16733. left: bounds.left
  16734. };
  16735. out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
  16736. out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
  16737. out.height = Math.min(innerHeight, out.height);
  16738. out.height -= 2;
  16739. out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
  16740. out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
  16741. out.width = Math.min(innerWidth, out.width);
  16742. out.width -= 2;
  16743. if (out.top < pageYOffset) {
  16744. out.top = pageYOffset;
  16745. }
  16746. if (out.left < pageXOffset) {
  16747. out.left = pageXOffset;
  16748. }
  16749. return out;
  16750. }
  16751. } else if (this.targetModifier === 'scroll-handle') {
  16752. var bounds = undefined;
  16753. var target = this.target;
  16754. if (target === document.body) {
  16755. target = document.documentElement;
  16756. bounds = {
  16757. left: pageXOffset,
  16758. top: pageYOffset,
  16759. height: innerHeight,
  16760. width: innerWidth
  16761. };
  16762. } else {
  16763. bounds = getBounds(target);
  16764. }
  16765. var style = getComputedStyle(target);
  16766. var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
  16767. var scrollBottom = 0;
  16768. if (hasBottomScroll) {
  16769. scrollBottom = 15;
  16770. }
  16771. var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
  16772. var out = {
  16773. width: 15,
  16774. height: height * 0.975 * (height / target.scrollHeight),
  16775. left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
  16776. };
  16777. var fitAdj = 0;
  16778. if (height < 408 && this.target === document.body) {
  16779. fitAdj = - 0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
  16780. }
  16781. if (this.target !== document.body) {
  16782. out.height = Math.max(out.height, 24);
  16783. }
  16784. var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
  16785. out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
  16786. if (this.target === document.body) {
  16787. out.height = Math.max(out.height, 24);
  16788. }
  16789. return out;
  16790. }
  16791. } else {
  16792. return getBounds(this.target);
  16793. }
  16794. }
  16795. }, {
  16796. key: 'clearCache',
  16797. value: function clearCache() {
  16798. this._cache = {};
  16799. }
  16800. }, {
  16801. key: 'cache',
  16802. value: function cache(k, getter) {
  16803. // More than one module will often need the same DOM info, so
  16804. // we keep a cache which is cleared on each position call
  16805. if (typeof this._cache === 'undefined') {
  16806. this._cache = {};
  16807. }
  16808. if (typeof this._cache[k] === 'undefined') {
  16809. this._cache[k] = getter.call(this);
  16810. }
  16811. return this._cache[k];
  16812. }
  16813. }, {
  16814. key: 'enable',
  16815. value: function enable() {
  16816. var _this3 = this;
  16817. var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  16818. if (!(this.options.addTargetClasses === false)) {
  16819. addClass(this.target, this.getClass('enabled'));
  16820. }
  16821. addClass(this.element, this.getClass('enabled'));
  16822. this.enabled = true;
  16823. this.scrollParents.forEach(function (parent) {
  16824. if (parent !== _this3.target.ownerDocument) {
  16825. parent.addEventListener('scroll', _this3.position);
  16826. }
  16827. });
  16828. if (pos) {
  16829. this.position();
  16830. }
  16831. }
  16832. }, {
  16833. key: 'disable',
  16834. value: function disable() {
  16835. var _this4 = this;
  16836. removeClass(this.target, this.getClass('enabled'));
  16837. removeClass(this.element, this.getClass('enabled'));
  16838. this.enabled = false;
  16839. if (typeof this.scrollParents !== 'undefined') {
  16840. this.scrollParents.forEach(function (parent) {
  16841. parent.removeEventListener('scroll', _this4.position);
  16842. });
  16843. }
  16844. }
  16845. }, {
  16846. key: 'destroy',
  16847. value: function destroy() {
  16848. var _this5 = this;
  16849. this.disable();
  16850. tethers.forEach(function (tether, i) {
  16851. if (tether === _this5) {
  16852. tethers.splice(i, 1);
  16853. }
  16854. });
  16855. // Remove any elements we were using for convenience from the DOM
  16856. if (tethers.length === 0) {
  16857. removeUtilElements();
  16858. }
  16859. }
  16860. }, {
  16861. key: 'updateAttachClasses',
  16862. value: function updateAttachClasses(elementAttach, targetAttach) {
  16863. var _this6 = this;
  16864. elementAttach = elementAttach || this.attachment;
  16865. targetAttach = targetAttach || this.targetAttachment;
  16866. var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
  16867. if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
  16868. // updateAttachClasses can be called more than once in a position call, so
  16869. // we need to clean up after ourselves such that when the last defer gets
  16870. // ran it doesn't add any extra classes from previous calls.
  16871. this._addAttachClasses.splice(0, this._addAttachClasses.length);
  16872. }
  16873. if (typeof this._addAttachClasses === 'undefined') {
  16874. this._addAttachClasses = [];
  16875. }
  16876. var add = this._addAttachClasses;
  16877. if (elementAttach.top) {
  16878. add.push(this.getClass('element-attached') + '-' + elementAttach.top);
  16879. }
  16880. if (elementAttach.left) {
  16881. add.push(this.getClass('element-attached') + '-' + elementAttach.left);
  16882. }
  16883. if (targetAttach.top) {
  16884. add.push(this.getClass('target-attached') + '-' + targetAttach.top);
  16885. }
  16886. if (targetAttach.left) {
  16887. add.push(this.getClass('target-attached') + '-' + targetAttach.left);
  16888. }
  16889. var all = [];
  16890. sides.forEach(function (side) {
  16891. all.push(_this6.getClass('element-attached') + '-' + side);
  16892. all.push(_this6.getClass('target-attached') + '-' + side);
  16893. });
  16894. defer(function () {
  16895. if (!(typeof _this6._addAttachClasses !== 'undefined')) {
  16896. return;
  16897. }
  16898. updateClasses(_this6.element, _this6._addAttachClasses, all);
  16899. if (!(_this6.options.addTargetClasses === false)) {
  16900. updateClasses(_this6.target, _this6._addAttachClasses, all);
  16901. }
  16902. delete _this6._addAttachClasses;
  16903. });
  16904. }
  16905. }, {
  16906. key: 'position',
  16907. value: function position() {
  16908. var _this7 = this;
  16909. var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  16910. // flushChanges commits the changes immediately, leave true unless you are positioning multiple
  16911. // tethers (in which case call Tether.Utils.flush yourself when you're done)
  16912. if (!this.enabled) {
  16913. return;
  16914. }
  16915. this.clearCache();
  16916. // Turn 'auto' attachments into the appropriate corner or edge
  16917. var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
  16918. this.updateAttachClasses(this.attachment, targetAttachment);
  16919. var elementPos = this.cache('element-bounds', function () {
  16920. return getBounds(_this7.element);
  16921. });
  16922. var width = elementPos.width;
  16923. var height = elementPos.height;
  16924. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  16925. var _lastSize = this.lastSize;
  16926. // We cache the height and width to make it possible to position elements that are
  16927. // getting hidden.
  16928. width = _lastSize.width;
  16929. height = _lastSize.height;
  16930. } else {
  16931. this.lastSize = {width: width, height: height};
  16932. }
  16933. var targetPos = this.cache('target-bounds', function () {
  16934. return _this7.getTargetBounds();
  16935. });
  16936. var targetSize = targetPos;
  16937. // Get an actual px offset from the attachment
  16938. var offset = offsetToPx(attachmentToOffset(this.attachment), {width: width, height: height});
  16939. var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
  16940. var manualOffset = offsetToPx(this.offset, {width: width, height: height});
  16941. var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
  16942. // Add the manually provided offset
  16943. offset = addOffset(offset, manualOffset);
  16944. targetOffset = addOffset(targetOffset, manualTargetOffset);
  16945. // It's now our goal to make (element position + offset) == (target position + target offset)
  16946. var left = targetPos.left + targetOffset.left - offset.left;
  16947. var top = targetPos.top + targetOffset.top - offset.top;
  16948. for (var i = 0; i < TetherBase.modules.length; ++i) {
  16949. var _module2 = TetherBase.modules[i];
  16950. var ret = _module2.position.call(this, {
  16951. left: left,
  16952. top: top,
  16953. targetAttachment: targetAttachment,
  16954. targetPos: targetPos,
  16955. elementPos: elementPos,
  16956. offset: offset,
  16957. targetOffset: targetOffset,
  16958. manualOffset: manualOffset,
  16959. manualTargetOffset: manualTargetOffset,
  16960. scrollbarSize: scrollbarSize,
  16961. attachment: this.attachment
  16962. });
  16963. if (ret === false) {
  16964. return false;
  16965. } else if (typeof ret === 'undefined' || (typeof ret === 'undefined' ? 'undefined' : _typeof(ret)) !== 'object') {
  16966. continue;
  16967. } else {
  16968. top = ret.top;
  16969. left = ret.left;
  16970. }
  16971. }
  16972. // We describe the position three different ways to give the optimizer
  16973. // a chance to decide the best possible way to position the element
  16974. // with the fewest repaints.
  16975. var next = {
  16976. // It's position relative to the page (absolute positioning when
  16977. // the element is a child of the body)
  16978. page: {
  16979. top: top,
  16980. left: left
  16981. },
  16982. // It's position relative to the viewport (fixed positioning)
  16983. viewport: {
  16984. top: top - pageYOffset,
  16985. bottom: pageYOffset - top - height + innerHeight,
  16986. left: left - pageXOffset,
  16987. right: pageXOffset - left - width + innerWidth
  16988. }
  16989. };
  16990. var doc = this.target.ownerDocument;
  16991. var win = doc.defaultView;
  16992. var scrollbarSize = undefined;
  16993. if (win.innerHeight > doc.documentElement.clientHeight) {
  16994. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  16995. next.viewport.bottom -= scrollbarSize.height;
  16996. }
  16997. if (win.innerWidth > doc.documentElement.clientWidth) {
  16998. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  16999. next.viewport.right -= scrollbarSize.width;
  17000. }
  17001. if (['', 'static'].indexOf(doc.body.style.position) === - 1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === - 1) {
  17002. // Absolute positioning in the body will be relative to the page, not the 'initial containing block'
  17003. next.page.bottom = doc.body.scrollHeight - top - height;
  17004. next.page.right = doc.body.scrollWidth - left - width;
  17005. }
  17006. if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
  17007. (function () {
  17008. var offsetParent = _this7.cache('target-offsetparent', function () {
  17009. return getOffsetParent(_this7.target);
  17010. });
  17011. var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
  17012. return getBounds(offsetParent);
  17013. });
  17014. var offsetParentStyle = getComputedStyle(offsetParent);
  17015. var offsetParentSize = offsetPosition;
  17016. var offsetBorder = {};
  17017. ['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
  17018. offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
  17019. });
  17020. offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
  17021. offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
  17022. if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
  17023. if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
  17024. // We're within the visible part of the target's scroll parent
  17025. var scrollTop = offsetParent.scrollTop;
  17026. var scrollLeft = offsetParent.scrollLeft;
  17027. // It's position relative to the target's offset parent (absolute positioning when
  17028. // the element is moved to be a child of the target's offset parent).
  17029. next.offset = {
  17030. top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
  17031. left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
  17032. };
  17033. }
  17034. }
  17035. })();
  17036. }
  17037. // We could also travel up the DOM and try each containing context, rather than only
  17038. // looking at the body, but we're gonna get diminishing returns.
  17039. this.move(next);
  17040. this.history.unshift(next);
  17041. if (this.history.length > 3) {
  17042. this.history.pop();
  17043. }
  17044. if (flushChanges) {
  17045. flush();
  17046. }
  17047. return true;
  17048. }
  17049. // THE ISSUE
  17050. }, {
  17051. key: 'move',
  17052. value: function move(pos) {
  17053. var _this8 = this;
  17054. if (!(typeof this.element.parentNode !== 'undefined')) {
  17055. return;
  17056. }
  17057. var same = {};
  17058. for (var type in pos) {
  17059. same[type] = {};
  17060. for (var key in pos[type]) {
  17061. var found = false;
  17062. for (var i = 0; i < this.history.length; ++i) {
  17063. var point = this.history[i];
  17064. if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
  17065. found = true;
  17066. break;
  17067. }
  17068. }
  17069. if (!found) {
  17070. same[type][key] = true;
  17071. }
  17072. }
  17073. }
  17074. var css = {top: '', left: '', right: '', bottom: ''};
  17075. var transcribe = function transcribe(_same, _pos) {
  17076. var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
  17077. var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
  17078. if (gpu !== false) {
  17079. var yPos = undefined,
  17080. xPos = undefined;
  17081. if (_same.top) {
  17082. css.top = 0;
  17083. yPos = _pos.top;
  17084. } else {
  17085. css.bottom = 0;
  17086. yPos = - _pos.bottom;
  17087. }
  17088. if (_same.left) {
  17089. css.left = 0;
  17090. xPos = _pos.left;
  17091. } else {
  17092. css.right = 0;
  17093. xPos = - _pos.right;
  17094. }
  17095. if (window.matchMedia) {
  17096. // HubSpot/tether#207
  17097. 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;
  17098. if (!retina) {
  17099. xPos = Math.round(xPos);
  17100. yPos = Math.round(yPos);
  17101. }
  17102. }
  17103. css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
  17104. if (transformKey !== 'msTransform') {
  17105. // The Z transform will keep this in the GPU (faster, and prevents artifacts),
  17106. // but IE9 doesn't support 3d transforms and will choke.
  17107. css[transformKey] += " translateZ(0)";
  17108. }
  17109. } else {
  17110. if (_same.top) {
  17111. css.top = _pos.top + 'px';
  17112. } else {
  17113. css.bottom = _pos.bottom + 'px';
  17114. }
  17115. if (_same.left) {
  17116. css.left = _pos.left + 'px';
  17117. } else {
  17118. css.right = _pos.right + 'px';
  17119. }
  17120. }
  17121. };
  17122. var moved = false;
  17123. if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
  17124. css.position = 'absolute';
  17125. transcribe(same.page, pos.page);
  17126. } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
  17127. css.position = 'fixed';
  17128. transcribe(same.viewport, pos.viewport);
  17129. } else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
  17130. (function () {
  17131. css.position = 'absolute';
  17132. var offsetParent = _this8.cache('target-offsetparent', function () {
  17133. return getOffsetParent(_this8.target);
  17134. });
  17135. if (getOffsetParent(_this8.element) !== offsetParent) {
  17136. defer(function () {
  17137. _this8.element.parentNode.removeChild(_this8.element);
  17138. offsetParent.appendChild(_this8.element);
  17139. });
  17140. }
  17141. transcribe(same.offset, pos.offset);
  17142. moved = true;
  17143. })();
  17144. } else {
  17145. css.position = 'absolute';
  17146. transcribe({top: true, left: true}, pos.page);
  17147. }
  17148. if (!moved) {
  17149. if (this.options.bodyElement) {
  17150. this.options.bodyElement.appendChild(this.element);
  17151. } else {
  17152. var offsetParentIsBody = true;
  17153. var currentNode = this.element.parentNode;
  17154. while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
  17155. if (getComputedStyle(currentNode).position !== 'static') {
  17156. offsetParentIsBody = false;
  17157. break;
  17158. }
  17159. currentNode = currentNode.parentNode;
  17160. }
  17161. if (!offsetParentIsBody) {
  17162. this.element.parentNode.removeChild(this.element);
  17163. this.element.ownerDocument.body.appendChild(this.element);
  17164. }
  17165. }
  17166. }
  17167. // Any css change will trigger a repaint, so let's avoid one if nothing changed
  17168. var writeCSS = {};
  17169. var write = false;
  17170. for (var key in css) {
  17171. var val = css[key];
  17172. var elVal = this.element.style[key];
  17173. if (elVal !== val) {
  17174. write = true;
  17175. writeCSS[key] = val;
  17176. }
  17177. }
  17178. if (write) {
  17179. defer(function () {
  17180. extend(_this8.element.style, writeCSS);
  17181. _this8.trigger('repositioned');
  17182. });
  17183. }
  17184. }
  17185. }]);
  17186. return TetherClass;
  17187. }(Evented);
  17188. TetherClass.modules = [];
  17189. TetherBase.position = position;
  17190. var Tether = extend(TetherClass, TetherBase);
  17191. /* globals TetherBase */
  17192. 'use strict';
  17193. var _slicedToArray = function () {
  17194. function sliceIterator(arr, i) {
  17195. var _arr = [];
  17196. var _n = true;
  17197. var _d = false;
  17198. var _e = undefined;
  17199. try {
  17200. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  17201. _arr.push(_s.value);
  17202. if (i && _arr.length === i)
  17203. break;
  17204. }
  17205. } catch (err) {
  17206. _d = true;
  17207. _e = err;
  17208. } finally {
  17209. try {
  17210. if (!_n && _i['return'])
  17211. _i['return']();
  17212. } finally {
  17213. if (_d)
  17214. throw _e;
  17215. }
  17216. }
  17217. return _arr;
  17218. }
  17219. return function (arr, i) {
  17220. if (Array.isArray(arr)) {
  17221. return arr;
  17222. } else if (Symbol.iterator in Object(arr)) {
  17223. return sliceIterator(arr, i);
  17224. } else {
  17225. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  17226. }
  17227. };
  17228. }();
  17229. var _TetherBase$Utils = TetherBase.Utils;
  17230. var getBounds = _TetherBase$Utils.getBounds;
  17231. var extend = _TetherBase$Utils.extend;
  17232. var updateClasses = _TetherBase$Utils.updateClasses;
  17233. var defer = _TetherBase$Utils.defer;
  17234. var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
  17235. function getBoundingRect(tether, to) {
  17236. if (to === 'scrollParent') {
  17237. to = tether.scrollParents[0];
  17238. } else if (to === 'window') {
  17239. to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
  17240. }
  17241. if (to === document) {
  17242. to = to.documentElement;
  17243. }
  17244. if (typeof to.nodeType !== 'undefined') {
  17245. (function () {
  17246. var node = to;
  17247. var size = getBounds(to);
  17248. var pos = size;
  17249. var style = getComputedStyle(to);
  17250. to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
  17251. // Account any parent Frames scroll offset
  17252. if (node.ownerDocument !== document) {
  17253. var win = node.ownerDocument.defaultView;
  17254. to[0] += win.pageXOffset;
  17255. to[1] += win.pageYOffset;
  17256. to[2] += win.pageXOffset;
  17257. to[3] += win.pageYOffset;
  17258. }
  17259. BOUNDS_FORMAT.forEach(function (side, i) {
  17260. side = side[0].toUpperCase() + side.substr(1);
  17261. if (side === 'Top' || side === 'Left') {
  17262. to[i] += parseFloat(style['border' + side + 'Width']);
  17263. } else {
  17264. to[i] -= parseFloat(style['border' + side + 'Width']);
  17265. }
  17266. });
  17267. })();
  17268. }
  17269. return to;
  17270. }
  17271. TetherBase.modules.push({
  17272. position: function position(_ref) {
  17273. var _this = this;
  17274. var top = _ref.top;
  17275. var left = _ref.left;
  17276. var targetAttachment = _ref.targetAttachment;
  17277. if (!this.options.constraints) {
  17278. return true;
  17279. }
  17280. var _cache = this.cache('element-bounds', function () {
  17281. return getBounds(_this.element);
  17282. });
  17283. var height = _cache.height;
  17284. var width = _cache.width;
  17285. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  17286. var _lastSize = this.lastSize;
  17287. // Handle the item getting hidden as a result of our positioning without glitching
  17288. // the classes in and out
  17289. width = _lastSize.width;
  17290. height = _lastSize.height;
  17291. }
  17292. var targetSize = this.cache('target-bounds', function () {
  17293. return _this.getTargetBounds();
  17294. });
  17295. var targetHeight = targetSize.height;
  17296. var targetWidth = targetSize.width;
  17297. var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
  17298. this.options.constraints.forEach(function (constraint) {
  17299. var outOfBoundsClass = constraint.outOfBoundsClass;
  17300. var pinnedClass = constraint.pinnedClass;
  17301. if (outOfBoundsClass) {
  17302. allClasses.push(outOfBoundsClass);
  17303. }
  17304. if (pinnedClass) {
  17305. allClasses.push(pinnedClass);
  17306. }
  17307. });
  17308. allClasses.forEach(function (cls) {
  17309. ['left', 'top', 'right', 'bottom'].forEach(function (side) {
  17310. allClasses.push(cls + '-' + side);
  17311. });
  17312. });
  17313. var addClasses = [];
  17314. var tAttachment = extend({}, targetAttachment);
  17315. var eAttachment = extend({}, this.attachment);
  17316. this.options.constraints.forEach(function (constraint) {
  17317. var to = constraint.to;
  17318. var attachment = constraint.attachment;
  17319. var pin = constraint.pin;
  17320. if (typeof attachment === 'undefined') {
  17321. attachment = '';
  17322. }
  17323. var changeAttachX = undefined,
  17324. changeAttachY = undefined;
  17325. if (attachment.indexOf(' ') >= 0) {
  17326. var _attachment$split = attachment.split(' ');
  17327. var _attachment$split2 = _slicedToArray(_attachment$split, 2);
  17328. changeAttachY = _attachment$split2[0];
  17329. changeAttachX = _attachment$split2[1];
  17330. } else {
  17331. changeAttachX = changeAttachY = attachment;
  17332. }
  17333. var bounds = getBoundingRect(_this, to);
  17334. if (changeAttachY === 'target' || changeAttachY === 'both') {
  17335. if (top < bounds[1] && tAttachment.top === 'top') {
  17336. top += targetHeight;
  17337. tAttachment.top = 'bottom';
  17338. }
  17339. if (top + height > bounds[3] && tAttachment.top === 'bottom') {
  17340. top -= targetHeight;
  17341. tAttachment.top = 'top';
  17342. }
  17343. }
  17344. if (changeAttachY === 'together') {
  17345. if (tAttachment.top === 'top') {
  17346. if (eAttachment.top === 'bottom' && top < bounds[1]) {
  17347. top += targetHeight;
  17348. tAttachment.top = 'bottom';
  17349. top += height;
  17350. eAttachment.top = 'top';
  17351. } else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
  17352. top -= height - targetHeight;
  17353. tAttachment.top = 'bottom';
  17354. eAttachment.top = 'bottom';
  17355. }
  17356. }
  17357. if (tAttachment.top === 'bottom') {
  17358. if (eAttachment.top === 'top' && top + height > bounds[3]) {
  17359. top -= targetHeight;
  17360. tAttachment.top = 'top';
  17361. top -= height;
  17362. eAttachment.top = 'bottom';
  17363. } else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
  17364. top += height - targetHeight;
  17365. tAttachment.top = 'top';
  17366. eAttachment.top = 'top';
  17367. }
  17368. }
  17369. if (tAttachment.top === 'middle') {
  17370. if (top + height > bounds[3] && eAttachment.top === 'top') {
  17371. top -= height;
  17372. eAttachment.top = 'bottom';
  17373. } else if (top < bounds[1] && eAttachment.top === 'bottom') {
  17374. top += height;
  17375. eAttachment.top = 'top';
  17376. }
  17377. }
  17378. }
  17379. if (changeAttachX === 'target' || changeAttachX === 'both') {
  17380. if (left < bounds[0] && tAttachment.left === 'left') {
  17381. left += targetWidth;
  17382. tAttachment.left = 'right';
  17383. }
  17384. if (left + width > bounds[2] && tAttachment.left === 'right') {
  17385. left -= targetWidth;
  17386. tAttachment.left = 'left';
  17387. }
  17388. }
  17389. if (changeAttachX === 'together') {
  17390. if (left < bounds[0] && tAttachment.left === 'left') {
  17391. if (eAttachment.left === 'right') {
  17392. left += targetWidth;
  17393. tAttachment.left = 'right';
  17394. left += width;
  17395. eAttachment.left = 'left';
  17396. } else if (eAttachment.left === 'left') {
  17397. left += targetWidth;
  17398. tAttachment.left = 'right';
  17399. left -= width;
  17400. eAttachment.left = 'right';
  17401. }
  17402. } else if (left + width > bounds[2] && tAttachment.left === 'right') {
  17403. if (eAttachment.left === 'left') {
  17404. left -= targetWidth;
  17405. tAttachment.left = 'left';
  17406. left -= width;
  17407. eAttachment.left = 'right';
  17408. } else if (eAttachment.left === 'right') {
  17409. left -= targetWidth;
  17410. tAttachment.left = 'left';
  17411. left += width;
  17412. eAttachment.left = 'left';
  17413. }
  17414. } else if (tAttachment.left === 'center') {
  17415. if (left + width > bounds[2] && eAttachment.left === 'left') {
  17416. left -= width;
  17417. eAttachment.left = 'right';
  17418. } else if (left < bounds[0] && eAttachment.left === 'right') {
  17419. left += width;
  17420. eAttachment.left = 'left';
  17421. }
  17422. }
  17423. }
  17424. if (changeAttachY === 'element' || changeAttachY === 'both') {
  17425. if (top < bounds[1] && eAttachment.top === 'bottom') {
  17426. top += height;
  17427. eAttachment.top = 'top';
  17428. }
  17429. if (top + height > bounds[3] && eAttachment.top === 'top') {
  17430. top -= height;
  17431. eAttachment.top = 'bottom';
  17432. }
  17433. }
  17434. if (changeAttachX === 'element' || changeAttachX === 'both') {
  17435. if (left < bounds[0]) {
  17436. if (eAttachment.left === 'right') {
  17437. left += width;
  17438. eAttachment.left = 'left';
  17439. } else if (eAttachment.left === 'center') {
  17440. left += width / 2;
  17441. eAttachment.left = 'left';
  17442. }
  17443. }
  17444. if (left + width > bounds[2]) {
  17445. if (eAttachment.left === 'left') {
  17446. left -= width;
  17447. eAttachment.left = 'right';
  17448. } else if (eAttachment.left === 'center') {
  17449. left -= width / 2;
  17450. eAttachment.left = 'right';
  17451. }
  17452. }
  17453. }
  17454. if (typeof pin === 'string') {
  17455. pin = pin.split(',').map(function (p) {
  17456. return p.trim();
  17457. });
  17458. } else if (pin === true) {
  17459. pin = ['top', 'left', 'right', 'bottom'];
  17460. }
  17461. pin = pin || [];
  17462. var pinned = [];
  17463. var oob = [];
  17464. if (top < bounds[1]) {
  17465. if (pin.indexOf('top') >= 0) {
  17466. top = bounds[1];
  17467. pinned.push('top');
  17468. } else {
  17469. oob.push('top');
  17470. }
  17471. }
  17472. if (top + height > bounds[3]) {
  17473. if (pin.indexOf('bottom') >= 0) {
  17474. top = bounds[3] - height;
  17475. pinned.push('bottom');
  17476. } else {
  17477. oob.push('bottom');
  17478. }
  17479. }
  17480. if (left < bounds[0]) {
  17481. if (pin.indexOf('left') >= 0) {
  17482. left = bounds[0];
  17483. pinned.push('left');
  17484. } else {
  17485. oob.push('left');
  17486. }
  17487. }
  17488. if (left + width > bounds[2]) {
  17489. if (pin.indexOf('right') >= 0) {
  17490. left = bounds[2] - width;
  17491. pinned.push('right');
  17492. } else {
  17493. oob.push('right');
  17494. }
  17495. }
  17496. if (pinned.length) {
  17497. (function () {
  17498. var pinnedClass = undefined;
  17499. if (typeof _this.options.pinnedClass !== 'undefined') {
  17500. pinnedClass = _this.options.pinnedClass;
  17501. } else {
  17502. pinnedClass = _this.getClass('pinned');
  17503. }
  17504. addClasses.push(pinnedClass);
  17505. pinned.forEach(function (side) {
  17506. addClasses.push(pinnedClass + '-' + side);
  17507. });
  17508. })();
  17509. }
  17510. if (oob.length) {
  17511. (function () {
  17512. var oobClass = undefined;
  17513. if (typeof _this.options.outOfBoundsClass !== 'undefined') {
  17514. oobClass = _this.options.outOfBoundsClass;
  17515. } else {
  17516. oobClass = _this.getClass('out-of-bounds');
  17517. }
  17518. addClasses.push(oobClass);
  17519. oob.forEach(function (side) {
  17520. addClasses.push(oobClass + '-' + side);
  17521. });
  17522. })();
  17523. }
  17524. if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
  17525. eAttachment.left = tAttachment.left = false;
  17526. }
  17527. if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
  17528. eAttachment.top = tAttachment.top = false;
  17529. }
  17530. if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
  17531. _this.updateAttachClasses(eAttachment, tAttachment);
  17532. _this.trigger('update', {
  17533. attachment: eAttachment,
  17534. targetAttachment: tAttachment
  17535. });
  17536. }
  17537. });
  17538. defer(function () {
  17539. if (!(_this.options.addTargetClasses === false)) {
  17540. updateClasses(_this.target, addClasses, allClasses);
  17541. }
  17542. updateClasses(_this.element, addClasses, allClasses);
  17543. });
  17544. return {top: top, left: left};
  17545. }
  17546. });
  17547. /* globals TetherBase */
  17548. 'use strict';
  17549. var _TetherBase$Utils = TetherBase.Utils;
  17550. var getBounds = _TetherBase$Utils.getBounds;
  17551. var updateClasses = _TetherBase$Utils.updateClasses;
  17552. var defer = _TetherBase$Utils.defer;
  17553. TetherBase.modules.push({
  17554. position: function position(_ref) {
  17555. var _this = this;
  17556. var top = _ref.top;
  17557. var left = _ref.left;
  17558. var _cache = this.cache('element-bounds', function () {
  17559. return getBounds(_this.element);
  17560. });
  17561. var height = _cache.height;
  17562. var width = _cache.width;
  17563. var targetPos = this.getTargetBounds();
  17564. var bottom = top + height;
  17565. var right = left + width;
  17566. var abutted = [];
  17567. if (top <= targetPos.bottom && bottom >= targetPos.top) {
  17568. ['left', 'right'].forEach(function (side) {
  17569. var targetPosSide = targetPos[side];
  17570. if (targetPosSide === left || targetPosSide === right) {
  17571. abutted.push(side);
  17572. }
  17573. });
  17574. }
  17575. if (left <= targetPos.right && right >= targetPos.left) {
  17576. ['top', 'bottom'].forEach(function (side) {
  17577. var targetPosSide = targetPos[side];
  17578. if (targetPosSide === top || targetPosSide === bottom) {
  17579. abutted.push(side);
  17580. }
  17581. });
  17582. }
  17583. var allClasses = [];
  17584. var addClasses = [];
  17585. var sides = ['left', 'top', 'right', 'bottom'];
  17586. allClasses.push(this.getClass('abutted'));
  17587. sides.forEach(function (side) {
  17588. allClasses.push(_this.getClass('abutted') + '-' + side);
  17589. });
  17590. if (abutted.length) {
  17591. addClasses.push(this.getClass('abutted'));
  17592. }
  17593. abutted.forEach(function (side) {
  17594. addClasses.push(_this.getClass('abutted') + '-' + side);
  17595. });
  17596. defer(function () {
  17597. if (!(_this.options.addTargetClasses === false)) {
  17598. updateClasses(_this.target, addClasses, allClasses);
  17599. }
  17600. updateClasses(_this.element, addClasses, allClasses);
  17601. });
  17602. return true;
  17603. }
  17604. });
  17605. /* globals TetherBase */
  17606. 'use strict';
  17607. var _slicedToArray = function () {
  17608. function sliceIterator(arr, i) {
  17609. var _arr = [];
  17610. var _n = true;
  17611. var _d = false;
  17612. var _e = undefined;
  17613. try {
  17614. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  17615. _arr.push(_s.value);
  17616. if (i && _arr.length === i)
  17617. break;
  17618. }
  17619. } catch (err) {
  17620. _d = true;
  17621. _e = err;
  17622. } finally {
  17623. try {
  17624. if (!_n && _i['return'])
  17625. _i['return']();
  17626. } finally {
  17627. if (_d)
  17628. throw _e;
  17629. }
  17630. }
  17631. return _arr;
  17632. }
  17633. return function (arr, i) {
  17634. if (Array.isArray(arr)) {
  17635. return arr;
  17636. } else if (Symbol.iterator in Object(arr)) {
  17637. return sliceIterator(arr, i);
  17638. } else {
  17639. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  17640. }
  17641. };
  17642. }();
  17643. TetherBase.modules.push({
  17644. position: function position(_ref) {
  17645. var top = _ref.top;
  17646. var left = _ref.left;
  17647. if (!this.options.shift) {
  17648. return;
  17649. }
  17650. var shift = this.options.shift;
  17651. if (typeof this.options.shift === 'function') {
  17652. shift = this.options.shift.call(this, {top: top, left: left});
  17653. }
  17654. var shiftTop = undefined,
  17655. shiftLeft = undefined;
  17656. if (typeof shift === 'string') {
  17657. shift = shift.split(' ');
  17658. shift[1] = shift[1] || shift[0];
  17659. var _shift = shift;
  17660. var _shift2 = _slicedToArray(_shift, 2);
  17661. shiftTop = _shift2[0];
  17662. shiftLeft = _shift2[1];
  17663. shiftTop = parseFloat(shiftTop, 10);
  17664. shiftLeft = parseFloat(shiftLeft, 10);
  17665. } else {
  17666. shiftTop = shift.top;
  17667. shiftLeft = shift.left;
  17668. }
  17669. top += shiftTop;
  17670. left += shiftLeft;
  17671. return {top: top, left: left};
  17672. }
  17673. });
  17674. return Tether;
  17675. });
  17676. /***/ }),
  17677. /* 35 */
  17678. /***/ (function (module, exports, __webpack_require__) {
  17679. "use strict";
  17680. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  17681. /*
  17682. * Toastr
  17683. * Copyright 2012-2015
  17684. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  17685. * All Rights Reserved.
  17686. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  17687. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  17688. *
  17689. * ARIA Support: Greta Krafsig
  17690. *
  17691. * Project: https://github.com/CodeSeven/toastr
  17692. */
  17693. /* global define */
  17694. (function (define) {
  17695. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_RESULT__ = function ($) {
  17696. return function () {
  17697. var $container;
  17698. var listener;
  17699. var toastId = 0;
  17700. var toastType = {
  17701. error: 'error',
  17702. info: 'info',
  17703. success: 'success',
  17704. warning: 'warning'
  17705. };
  17706. var toastr = {
  17707. clear: clear,
  17708. remove: remove,
  17709. error: error,
  17710. getContainer: getContainer,
  17711. info: info,
  17712. options: {},
  17713. subscribe: subscribe,
  17714. success: success,
  17715. version: '2.1.3',
  17716. warning: warning
  17717. };
  17718. var previousToast;
  17719. return toastr;
  17720. ////////////////
  17721. function error(message, title, optionsOverride) {
  17722. return notify({
  17723. type: toastType.error,
  17724. iconClass: getOptions().iconClasses.error,
  17725. message: message,
  17726. optionsOverride: optionsOverride,
  17727. title: title
  17728. });
  17729. }
  17730. function getContainer(options, create) {
  17731. if (!options) {
  17732. options = getOptions();
  17733. }
  17734. $container = $('#' + options.containerId);
  17735. if ($container.length) {
  17736. return $container;
  17737. }
  17738. if (create) {
  17739. $container = createContainer(options);
  17740. }
  17741. return $container;
  17742. }
  17743. function info(message, title, optionsOverride) {
  17744. return notify({
  17745. type: toastType.info,
  17746. iconClass: getOptions().iconClasses.info,
  17747. message: message,
  17748. optionsOverride: optionsOverride,
  17749. title: title
  17750. });
  17751. }
  17752. function subscribe(callback) {
  17753. listener = callback;
  17754. }
  17755. function success(message, title, optionsOverride) {
  17756. return notify({
  17757. type: toastType.success,
  17758. iconClass: getOptions().iconClasses.success,
  17759. message: message,
  17760. optionsOverride: optionsOverride,
  17761. title: title
  17762. });
  17763. }
  17764. function warning(message, title, optionsOverride) {
  17765. return notify({
  17766. type: toastType.warning,
  17767. iconClass: getOptions().iconClasses.warning,
  17768. message: message,
  17769. optionsOverride: optionsOverride,
  17770. title: title
  17771. });
  17772. }
  17773. function clear($toastElement, clearOptions) {
  17774. var options = getOptions();
  17775. if (!$container) {
  17776. getContainer(options);
  17777. }
  17778. if (!clearToast($toastElement, options, clearOptions)) {
  17779. clearContainer(options);
  17780. }
  17781. }
  17782. function remove($toastElement) {
  17783. var options = getOptions();
  17784. if (!$container) {
  17785. getContainer(options);
  17786. }
  17787. if ($toastElement && $(':focus', $toastElement).length === 0) {
  17788. removeToast($toastElement);
  17789. return;
  17790. }
  17791. if ($container.children().length) {
  17792. $container.remove();
  17793. }
  17794. }
  17795. // internal functions
  17796. function clearContainer(options) {
  17797. var toastsToClear = $container.children();
  17798. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  17799. clearToast($(toastsToClear[i]), options);
  17800. }
  17801. }
  17802. function clearToast($toastElement, options, clearOptions) {
  17803. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  17804. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  17805. $toastElement[options.hideMethod]({
  17806. duration: options.hideDuration,
  17807. easing: options.hideEasing,
  17808. complete: function complete() {
  17809. removeToast($toastElement);
  17810. }
  17811. });
  17812. return true;
  17813. }
  17814. return false;
  17815. }
  17816. function createContainer(options) {
  17817. $container = $('<div/>').attr('id', options.containerId).addClass(options.positionClass);
  17818. $container.appendTo($(options.target));
  17819. return $container;
  17820. }
  17821. function getDefaults() {
  17822. return {
  17823. tapToDismiss: true,
  17824. toastClass: 'toast',
  17825. containerId: 'toast-container',
  17826. debug: false,
  17827. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  17828. showDuration: 300,
  17829. showEasing: 'swing', //swing and linear are built into jQuery
  17830. onShown: undefined,
  17831. hideMethod: 'fadeOut',
  17832. hideDuration: 1000,
  17833. hideEasing: 'swing',
  17834. onHidden: undefined,
  17835. closeMethod: false,
  17836. closeDuration: false,
  17837. closeEasing: false,
  17838. closeOnHover: true,
  17839. extendedTimeOut: 1000,
  17840. iconClasses: {
  17841. error: 'toast-error',
  17842. info: 'toast-info',
  17843. success: 'toast-success',
  17844. warning: 'toast-warning'
  17845. },
  17846. iconClass: 'toast-info',
  17847. positionClass: 'toast-top-right',
  17848. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  17849. titleClass: 'toast-title',
  17850. messageClass: 'toast-message',
  17851. escapeHtml: false,
  17852. target: 'body',
  17853. closeHtml: '<button type="button">&times;</button>',
  17854. closeClass: 'toast-close-button',
  17855. newestOnTop: true,
  17856. preventDuplicates: false,
  17857. progressBar: false,
  17858. progressClass: 'toast-progress',
  17859. rtl: false
  17860. };
  17861. }
  17862. function publish(args) {
  17863. if (!listener) {
  17864. return;
  17865. }
  17866. listener(args);
  17867. }
  17868. function notify(map) {
  17869. var options = getOptions();
  17870. var iconClass = map.iconClass || options.iconClass;
  17871. if (typeof map.optionsOverride !== 'undefined') {
  17872. options = $.extend(options, map.optionsOverride);
  17873. iconClass = map.optionsOverride.iconClass || iconClass;
  17874. }
  17875. if (shouldExit(options, map)) {
  17876. return;
  17877. }
  17878. toastId++;
  17879. $container = getContainer(options, true);
  17880. var intervalId = null;
  17881. var $toastElement = $('<div/>');
  17882. var $titleElement = $('<div/>');
  17883. var $messageElement = $('<div/>');
  17884. var $progressElement = $('<div/>');
  17885. var $closeElement = $(options.closeHtml);
  17886. var progressBar = {
  17887. intervalId: null,
  17888. hideEta: null,
  17889. maxHideTime: null
  17890. };
  17891. var response = {
  17892. toastId: toastId,
  17893. state: 'visible',
  17894. startTime: new Date(),
  17895. options: options,
  17896. map: map
  17897. };
  17898. personalizeToast();
  17899. displayToast();
  17900. handleEvents();
  17901. publish(response);
  17902. if (options.debug && console) {
  17903. console.log(response);
  17904. }
  17905. return $toastElement;
  17906. function escapeHtml(source) {
  17907. if (source == null) {
  17908. source = '';
  17909. }
  17910. return source.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  17911. }
  17912. function personalizeToast() {
  17913. setIcon();
  17914. setTitle();
  17915. setMessage();
  17916. setCloseButton();
  17917. setProgressBar();
  17918. setRTL();
  17919. setSequence();
  17920. setAria();
  17921. }
  17922. function setAria() {
  17923. var ariaValue = '';
  17924. switch (map.iconClass) {
  17925. case 'toast-success':
  17926. case 'toast-info':
  17927. ariaValue = 'polite';
  17928. break;
  17929. default:
  17930. ariaValue = 'assertive';
  17931. }
  17932. $toastElement.attr('aria-live', ariaValue);
  17933. }
  17934. function handleEvents() {
  17935. if (options.closeOnHover) {
  17936. $toastElement.hover(stickAround, delayedHideToast);
  17937. }
  17938. if (!options.onclick && options.tapToDismiss) {
  17939. $toastElement.click(hideToast);
  17940. }
  17941. if (options.closeButton && $closeElement) {
  17942. $closeElement.click(function (event) {
  17943. if (event.stopPropagation) {
  17944. event.stopPropagation();
  17945. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  17946. event.cancelBubble = true;
  17947. }
  17948. if (options.onCloseClick) {
  17949. options.onCloseClick(event);
  17950. }
  17951. hideToast(true);
  17952. });
  17953. }
  17954. if (options.onclick) {
  17955. $toastElement.click(function (event) {
  17956. options.onclick(event);
  17957. hideToast();
  17958. });
  17959. }
  17960. }
  17961. function displayToast() {
  17962. $toastElement.hide();
  17963. $toastElement[options.showMethod]({duration: options.showDuration, easing: options.showEasing, complete: options.onShown});
  17964. if (options.timeOut > 0) {
  17965. intervalId = setTimeout(hideToast, options.timeOut);
  17966. progressBar.maxHideTime = parseFloat(options.timeOut);
  17967. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  17968. if (options.progressBar) {
  17969. progressBar.intervalId = setInterval(updateProgress, 10);
  17970. }
  17971. }
  17972. }
  17973. function setIcon() {
  17974. if (map.iconClass) {
  17975. $toastElement.addClass(options.toastClass).addClass(iconClass);
  17976. }
  17977. }
  17978. function setSequence() {
  17979. if (options.newestOnTop) {
  17980. $container.prepend($toastElement);
  17981. } else {
  17982. $container.append($toastElement);
  17983. }
  17984. }
  17985. function setTitle() {
  17986. if (map.title) {
  17987. var suffix = map.title;
  17988. if (options.escapeHtml) {
  17989. suffix = escapeHtml(map.title);
  17990. }
  17991. $titleElement.append(suffix).addClass(options.titleClass);
  17992. $toastElement.append($titleElement);
  17993. }
  17994. }
  17995. function setMessage() {
  17996. if (map.message) {
  17997. var suffix = map.message;
  17998. if (options.escapeHtml) {
  17999. suffix = escapeHtml(map.message);
  18000. }
  18001. $messageElement.append(suffix).addClass(options.messageClass);
  18002. $toastElement.append($messageElement);
  18003. }
  18004. }
  18005. function setCloseButton() {
  18006. if (options.closeButton) {
  18007. $closeElement.addClass(options.closeClass).attr('role', 'button');
  18008. $toastElement.prepend($closeElement);
  18009. }
  18010. }
  18011. function setProgressBar() {
  18012. if (options.progressBar) {
  18013. $progressElement.addClass(options.progressClass);
  18014. $toastElement.prepend($progressElement);
  18015. }
  18016. }
  18017. function setRTL() {
  18018. if (options.rtl) {
  18019. $toastElement.addClass('rtl');
  18020. }
  18021. }
  18022. function shouldExit(options, map) {
  18023. if (options.preventDuplicates) {
  18024. if (map.message === previousToast) {
  18025. return true;
  18026. } else {
  18027. previousToast = map.message;
  18028. }
  18029. }
  18030. return false;
  18031. }
  18032. function hideToast(override) {
  18033. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  18034. var duration = override && options.closeDuration !== false ? options.closeDuration : options.hideDuration;
  18035. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  18036. if ($(':focus', $toastElement).length && !override) {
  18037. return;
  18038. }
  18039. clearTimeout(progressBar.intervalId);
  18040. return $toastElement[method]({
  18041. duration: duration,
  18042. easing: easing,
  18043. complete: function complete() {
  18044. removeToast($toastElement);
  18045. clearTimeout(intervalId);
  18046. if (options.onHidden && response.state !== 'hidden') {
  18047. options.onHidden();
  18048. }
  18049. response.state = 'hidden';
  18050. response.endTime = new Date();
  18051. publish(response);
  18052. }
  18053. });
  18054. }
  18055. function delayedHideToast() {
  18056. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  18057. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  18058. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  18059. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  18060. }
  18061. }
  18062. function stickAround() {
  18063. clearTimeout(intervalId);
  18064. progressBar.hideEta = 0;
  18065. $toastElement.stop(true, true)[options.showMethod]({duration: options.showDuration, easing: options.showEasing});
  18066. }
  18067. function updateProgress() {
  18068. var percentage = (progressBar.hideEta - new Date().getTime()) / progressBar.maxHideTime * 100;
  18069. $progressElement.width(percentage + '%');
  18070. }
  18071. }
  18072. function getOptions() {
  18073. return $.extend({}, getDefaults(), toastr.options);
  18074. }
  18075. function removeToast($toastElement) {
  18076. if (!$container) {
  18077. $container = getContainer();
  18078. }
  18079. if ($toastElement.is(':visible')) {
  18080. return;
  18081. }
  18082. $toastElement.remove();
  18083. $toastElement = null;
  18084. if ($container.children().length === 0) {
  18085. $container.remove();
  18086. previousToast = undefined;
  18087. }
  18088. }
  18089. }();
  18090. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  18091. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18092. })(__webpack_require__(36));
  18093. /***/ }),
  18094. /* 36 */
  18095. /***/ (function (module, exports) {
  18096. module.exports = function () {
  18097. throw new Error("define cannot be used indirect");
  18098. };
  18099. /***/ })
  18100. /******/]);