layers-ui.js 664 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // identity function for calling harmony imports with the correct context
  37. /******/ __webpack_require__.i = function(value) { return value; };
  38. /******/
  39. /******/ // define getter function for harmony exports
  40. /******/ __webpack_require__.d = function(exports, name, getter) {
  41. /******/ if(!__webpack_require__.o(exports, name)) {
  42. /******/ Object.defineProperty(exports, name, {
  43. /******/ configurable: false,
  44. /******/ enumerable: true,
  45. /******/ get: getter
  46. /******/ });
  47. /******/ }
  48. /******/ };
  49. /******/
  50. /******/ // getDefaultExport function for compatibility with non-harmony modules
  51. /******/ __webpack_require__.n = function(module) {
  52. /******/ var getter = module && module.__esModule ?
  53. /******/ function getDefault() { return module['default']; } :
  54. /******/ function getModuleExports() { return module; };
  55. /******/ __webpack_require__.d(getter, 'a', getter);
  56. /******/ return getter;
  57. /******/ };
  58. /******/
  59. /******/ // Object.prototype.hasOwnProperty.call
  60. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  61. /******/
  62. /******/ // __webpack_public_path__
  63. /******/ __webpack_require__.p = "";
  64. /******/
  65. /******/ // Load entry module and return exports
  66. /******/ return __webpack_require__(__webpack_require__.s = 28);
  67. /******/ })
  68. /************************************************************************/
  69. /******/ ([
  70. /* 0 */
  71. /***/ (function(module, exports, __webpack_require__) {
  72. "use strict";
  73. Object.defineProperty(exports, "__esModule", {
  74. value: true
  75. });
  76. var _jquery = __webpack_require__(1);
  77. var _jquery2 = _interopRequireDefault(_jquery);
  78. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  79. /**
  80. * --------------------------------------------------------------------------
  81. * Bootstrap (v4.0.0-beta): util.js
  82. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  83. * --------------------------------------------------------------------------
  84. */
  85. var Util = function () {
  86. /**
  87. * ------------------------------------------------------------------------
  88. * Private TransitionEnd Helpers
  89. * ------------------------------------------------------------------------
  90. */
  91. var transition = false;
  92. var MAX_UID = 1000000;
  93. var TransitionEndEvent = {
  94. WebkitTransition: 'webkitTransitionEnd',
  95. MozTransition: 'transitionend',
  96. OTransition: 'oTransitionEnd otransitionend',
  97. transition: 'transitionend'
  98. // shoutout AngusCroll (https://goo.gl/pxwQGp)
  99. };function toType(obj) {
  100. return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
  101. }
  102. function getSpecialTransitionEndEvent() {
  103. return {
  104. bindType: transition.end,
  105. delegateType: transition.end,
  106. handle: function handle(event) {
  107. if ((0, _jquery2.default)(event.target).is(this)) {
  108. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  109. }
  110. return undefined; // eslint-disable-line no-undefined
  111. }
  112. };
  113. }
  114. function transitionEndTest() {
  115. if (window.QUnit) {
  116. return false;
  117. }
  118. var el = document.createElement('bootstrap');
  119. for (var name in TransitionEndEvent) {
  120. if (typeof el.style[name] !== 'undefined') {
  121. return {
  122. end: TransitionEndEvent[name]
  123. };
  124. }
  125. }
  126. return false;
  127. }
  128. function transitionEndEmulator(duration) {
  129. var _this = this;
  130. var called = false;
  131. (0, _jquery2.default)(this).one(Util.TRANSITION_END, function () {
  132. called = true;
  133. });
  134. setTimeout(function () {
  135. if (!called) {
  136. Util.triggerTransitionEnd(_this);
  137. }
  138. }, duration);
  139. return this;
  140. }
  141. function setTransitionEndSupport() {
  142. transition = transitionEndTest();
  143. _jquery2.default.fn.emulateTransitionEnd = transitionEndEmulator;
  144. if (Util.supportsTransitionEnd()) {
  145. _jquery2.default.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  146. }
  147. }
  148. function parseOption(item) {
  149. if ('true' === item) {
  150. return true;
  151. } else if ('false' === item) {
  152. return false;
  153. } else if (!isNaN(item * 1)) {
  154. return parseFloat(item);
  155. } else {
  156. return item;
  157. }
  158. }
  159. /**
  160. * --------------------------------------------------------------------------
  161. * Public Util Api
  162. * --------------------------------------------------------------------------
  163. */
  164. var Util = {
  165. TRANSITION_END: 'bsTransitionEnd',
  166. getUID: function getUID(prefix) {
  167. do {
  168. // eslint-disable-next-line no-bitwise
  169. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  170. } while (document.getElementById(prefix));
  171. return prefix;
  172. },
  173. getSelectorFromElement: function getSelectorFromElement(element) {
  174. var selector = element.getAttribute('data-target');
  175. if (!selector || selector === '#') {
  176. selector = element.getAttribute('href') || '';
  177. }
  178. try {
  179. var $selector = (0, _jquery2.default)(document).find(selector);
  180. return $selector.length > 0 ? selector : null;
  181. } catch (error) {
  182. return null;
  183. }
  184. },
  185. reflow: function reflow(element) {
  186. return element.offsetHeight;
  187. },
  188. triggerTransitionEnd: function triggerTransitionEnd(element) {
  189. (0, _jquery2.default)(element).trigger(transition.end);
  190. },
  191. supportsTransitionEnd: function supportsTransitionEnd() {
  192. return Boolean(transition);
  193. },
  194. isElement: function isElement(obj) {
  195. return (obj[0] || obj).nodeType;
  196. },
  197. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  198. for (var property in configTypes) {
  199. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  200. var expectedTypes = configTypes[property];
  201. var value = config[property];
  202. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  203. if (!new RegExp(expectedTypes).test(valueType)) {
  204. throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
  205. }
  206. }
  207. }
  208. },
  209. parseDataOptions: function parseDataOptions(dataOptions) {
  210. var options = [];
  211. var string = dataOptions.split(';');
  212. string.forEach(function (item, index) {
  213. var option = item.split(':');
  214. option = option.map(function (item) {
  215. return item.trim();
  216. });
  217. if (option[0]) {
  218. options[option[0]] = parseOption(option[1]);
  219. }
  220. });
  221. return options;
  222. }
  223. };
  224. setTransitionEndSupport();
  225. return Util;
  226. }(_jquery2.default);
  227. exports.default = Util;
  228. /***/ }),
  229. /* 1 */
  230. /***/ (function(module, exports) {
  231. module.exports = jQuery;
  232. /***/ }),
  233. /* 2 */,
  234. /* 3 */
  235. /***/ (function(module, exports, __webpack_require__) {
  236. "use strict";
  237. Object.defineProperty(exports, "__esModule", {
  238. value: true
  239. });
  240. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  241. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  242. var SELECTORS = {
  243. inputsContainer: '[data-inputs-container]',
  244. virtualInput: '[data-virtual-input]',
  245. isChecked: 'is-selected',
  246. inputTarget: '[data-input-target]',
  247. dataTargetId: '[data-target-id]',
  248. content: '[data-content]',
  249. contentTarget: '[data-content-target]'
  250. };
  251. var selectInput = function () {
  252. function selectInput(inputGroup, drop) {
  253. _classCallCheck(this, selectInput);
  254. this.inputGroup = inputGroup;
  255. this.type = this.inputGroup.data('inputs-container');
  256. this.drop = drop;
  257. this.virtualInputs = this.inputGroup.find(SELECTORS.virtualInput);
  258. this.bindEvents();
  259. }
  260. _createClass(selectInput, [{
  261. key: 'bindEvents',
  262. value: function bindEvents() {
  263. var _this = this;
  264. this.virtualInputs.on('click', function (event) {
  265. return _this.selectItem(event);
  266. });
  267. }
  268. }, {
  269. key: 'selectItem',
  270. value: function selectItem(event) {
  271. if (this.type == 'checkboxes') {
  272. if ($(event.currentTarget).hasClass('is-selected')) {
  273. $(event.currentTarget).removeClass(SELECTORS.isChecked);
  274. $(event.currentTarget).find('input').prop("checked", false);
  275. } else {
  276. $(event.currentTarget).addClass(SELECTORS.isChecked);
  277. $(event.currentTarget).find('input').prop("checked", true);
  278. }
  279. } else {
  280. this.virtualInputs.removeClass(SELECTORS.isChecked);
  281. this.virtualInputs.find('input').prop("checked", false);
  282. $(event.currentTarget).addClass(SELECTORS.isChecked);
  283. $(event.currentTarget).find('input').prop("checked", true);
  284. }
  285. if (this.drop) {
  286. this.getDropdownContent(event);
  287. this.setDropdownContent();
  288. this.drop.close();
  289. }
  290. }
  291. }, {
  292. key: 'setDropdownContent',
  293. value: function setDropdownContent() {
  294. for (var property in this.data) {
  295. $(this.drop.target).find('[data-view-' + property + ']').text(this.data[property]);
  296. }
  297. }
  298. }, {
  299. key: 'getDropdownContent',
  300. value: function getDropdownContent(event) {
  301. this.data = $(event.currentTarget).data('config');
  302. }
  303. }], [{
  304. key: 'init',
  305. value: function init(container, drop) {
  306. if (container) {
  307. new selectInput($(container).find(SELECTORS.inputsContainer), drop);
  308. } else {
  309. $(SELECTORS.inputsContainer).each(function () {
  310. new selectInput($(this), drop);
  311. });
  312. }
  313. }
  314. }]);
  315. return selectInput;
  316. }();
  317. exports.default = selectInput;
  318. /***/ }),
  319. /* 4 */
  320. /***/ (function(module, exports, __webpack_require__) {
  321. "use strict";
  322. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  323. /**
  324. * Swiper 3.4.2
  325. * Most modern mobile touch slider and framework with hardware accelerated transitions
  326. *
  327. * http://www.idangero.us/swiper/
  328. *
  329. * Copyright 2017, Vladimir Kharlampidi
  330. * The iDangero.us
  331. * http://www.idangero.us/
  332. *
  333. * Licensed under MIT
  334. *
  335. * Released on: March 10, 2017
  336. */
  337. (function () {
  338. 'use strict';
  339. var $;
  340. /*===========================
  341. Swiper
  342. ===========================*/
  343. var Swiper = function Swiper(container, params) {
  344. if (!(this instanceof Swiper)) return new Swiper(container, params);
  345. var defaults = {
  346. direction: 'horizontal',
  347. touchEventsTarget: 'lu-container',
  348. initialSlide: 0,
  349. speed: 300,
  350. // autoplay
  351. autoplay: false,
  352. autoplayDisableOnInteraction: true,
  353. autoplayStopOnLast: false,
  354. // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
  355. iOSEdgeSwipeDetection: false,
  356. iOSEdgeSwipeThreshold: 20,
  357. // Free mode
  358. freeMode: false,
  359. freeModeMomentum: true,
  360. freeModeMomentumRatio: 1,
  361. freeModeMomentumBounce: true,
  362. freeModeMomentumBounceRatio: 1,
  363. freeModeMomentumVelocityRatio: 1,
  364. freeModeSticky: false,
  365. freeModeMinimumVelocity: 0.02,
  366. // Autoheight
  367. autoHeight: false,
  368. // Set wrapper width
  369. setWrapperSize: false,
  370. // Virtual Translate
  371. virtualTranslate: false,
  372. // Effects
  373. effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
  374. coverflow: {
  375. rotate: 50,
  376. stretch: 0,
  377. depth: 100,
  378. modifier: 1,
  379. slideShadows: true
  380. },
  381. flip: {
  382. slideShadows: true,
  383. limitRotation: true
  384. },
  385. cube: {
  386. slideShadows: true,
  387. shadow: true,
  388. shadowOffset: 20,
  389. shadowScale: 0.94
  390. },
  391. fade: {
  392. crossFade: false
  393. },
  394. // Parallax
  395. parallax: false,
  396. // Zoom
  397. zoom: false,
  398. zoomMax: 3,
  399. zoomMin: 1,
  400. zoomToggle: true,
  401. // Scrollbar
  402. scrollbar: null,
  403. scrollbarHide: true,
  404. scrollbarDraggable: false,
  405. scrollbarSnapOnRelease: false,
  406. // Keyboard Mousewheel
  407. keyboardControl: false,
  408. mousewheelControl: false,
  409. mousewheelReleaseOnEdges: false,
  410. mousewheelInvert: false,
  411. mousewheelForceToAxis: false,
  412. mousewheelSensitivity: 1,
  413. mousewheelEventsTarged: 'lu-container',
  414. // Hash Navigation
  415. hashnav: false,
  416. hashnavWatchState: false,
  417. // History
  418. history: false,
  419. // Commong Nav State
  420. replaceState: false,
  421. // Breakpoints
  422. breakpoints: undefined,
  423. // Slides grid
  424. spaceBetween: 0,
  425. slidesPerView: 1,
  426. slidesPerColumn: 1,
  427. slidesPerColumnFill: 'column',
  428. slidesPerGroup: 1,
  429. centeredSlides: false,
  430. slidesOffsetBefore: 0, // in px
  431. slidesOffsetAfter: 0, // in px
  432. // Round length
  433. roundLengths: false,
  434. // Touches
  435. touchRatio: 1,
  436. touchAngle: 45,
  437. simulateTouch: true,
  438. shortSwipes: true,
  439. longSwipes: true,
  440. longSwipesRatio: 0.5,
  441. longSwipesMs: 300,
  442. followFinger: true,
  443. onlyExternal: false,
  444. threshold: 0,
  445. touchMoveStopPropagation: true,
  446. touchReleaseOnEdges: false,
  447. // Unique Navigation Elements
  448. uniqueNavElements: true,
  449. // Pagination
  450. pagination: null,
  451. paginationElement: 'span',
  452. paginationClickable: false,
  453. paginationHide: false,
  454. paginationBulletRender: null,
  455. paginationProgressRender: null,
  456. paginationFractionRender: null,
  457. paginationCustomRender: null,
  458. paginationType: 'bullets', // 'bullets' or 'progress' or 'fraction' or 'custom'
  459. // Resistance
  460. resistance: true,
  461. resistanceRatio: 0.85,
  462. // Next/prev buttons
  463. nextButton: null,
  464. prevButton: null,
  465. // Progress
  466. watchSlidesProgress: false,
  467. watchSlidesVisibility: false,
  468. // Cursor
  469. grabCursor: false,
  470. // Clicks
  471. preventClicks: true,
  472. preventClicksPropagation: true,
  473. slideToClickedSlide: false,
  474. // Lazy Loading
  475. lazyLoading: false,
  476. lazyLoadingInPrevNext: false,
  477. lazyLoadingInPrevNextAmount: 1,
  478. lazyLoadingOnTransitionStart: false,
  479. // Images
  480. preloadImages: true,
  481. updateOnImagesReady: true,
  482. // loop
  483. loop: false,
  484. loopAdditionalSlides: 0,
  485. loopedSlides: null,
  486. // Control
  487. control: undefined,
  488. controlInverse: false,
  489. controlBy: 'slide', //or 'container'
  490. normalizeSlideIndex: true,
  491. // Swiping/no swiping
  492. allowSwipeToPrev: true,
  493. allowSwipeToNext: true,
  494. swipeHandler: null, //'.swipe-handler',
  495. noSwiping: true,
  496. noSwipingClass: 'swiper-no-swiping',
  497. // Passive Listeners
  498. passiveListeners: true,
  499. // NS
  500. containerModifierClass: 'swiper-container-', // NEW
  501. slideClass: 'swiper-slide',
  502. slideActiveClass: 'swiper-slide-active',
  503. slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
  504. slideVisibleClass: 'swiper-slide-visible',
  505. slideDuplicateClass: 'swiper-slide-duplicate',
  506. slideNextClass: 'swiper-slide-next',
  507. slideDuplicateNextClass: 'swiper-slide-duplicate-next',
  508. slidePrevClass: 'swiper-slide-prev',
  509. slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
  510. wrapperClass: 'swiper-wrapper',
  511. bulletClass: 'swiper-pagination-bullet',
  512. bulletActiveClass: 'swiper-pagination-bullet-active',
  513. buttonDisabledClass: 'swiper-button-disabled',
  514. paginationCurrentClass: 'swiper-pagination-current',
  515. paginationTotalClass: 'swiper-pagination-total',
  516. paginationHiddenClass: 'swiper-pagination-hidden',
  517. paginationProgressbarClass: 'swiper-pagination-progressbar',
  518. paginationClickableClass: 'swiper-pagination-clickable', // NEW
  519. paginationModifierClass: 'swiper-pagination-', // NEW
  520. lazyLoadingClass: 'swiper-lazy',
  521. lazyStatusLoadingClass: 'swiper-lazy-loading',
  522. lazyStatusLoadedClass: 'swiper-lazy-loaded',
  523. lazyPreloaderClass: 'swiper-lazy-preloader',
  524. notificationClass: 'swiper-notification',
  525. preloaderClass: 'preloader',
  526. zoomContainerClass: 'swiper-zoom-container',
  527. // Observer
  528. observer: false,
  529. observeParents: false,
  530. // Accessibility
  531. a11y: false,
  532. prevSlideMessage: 'Previous slide',
  533. nextSlideMessage: 'Next slide',
  534. firstSlideMessage: 'This is the first slide',
  535. lastSlideMessage: 'This is the last slide',
  536. paginationBulletMessage: 'Go to slide {{index}}',
  537. // Callbacks
  538. runCallbacksOnInit: true
  539. /*
  540. Callbacks:
  541. onInit: function (swiper)
  542. onDestroy: function (swiper)
  543. onBeforeResize: function (swiper)
  544. onAfterResize: function (swiper)
  545. onClick: function (swiper, e)
  546. onTap: function (swiper, e)
  547. onDoubleTap: function (swiper, e)
  548. onSliderMove: function (swiper, e)
  549. onSlideChangeStart: function (swiper)
  550. onSlideChangeEnd: function (swiper)
  551. onTransitionStart: function (swiper)
  552. onTransitionEnd: function (swiper)
  553. onImagesReady: function (swiper)
  554. onProgress: function (swiper, progress)
  555. onTouchStart: function (swiper, e)
  556. onTouchMove: function (swiper, e)
  557. onTouchMoveOpposite: function (swiper, e)
  558. onTouchEnd: function (swiper, e)
  559. onReachBeginning: function (swiper)
  560. onReachEnd: function (swiper)
  561. onSetTransition: function (swiper, duration)
  562. onSetTranslate: function (swiper, translate)
  563. onAutoplayStart: function (swiper)
  564. onAutoplayStop: function (swiper),
  565. onLazyImageLoad: function (swiper, slide, image)
  566. onLazyImageReady: function (swiper, slide, image)
  567. onKeyPress: function (swiper, keyCode)
  568. */
  569. };
  570. var initialVirtualTranslate = params && params.virtualTranslate;
  571. params = params || {};
  572. var originalParams = {};
  573. for (var param in params) {
  574. if (_typeof(params[param]) === 'object' && params[param] !== null && !(params[param].nodeType || params[param] === window || params[param] === document || typeof Dom7 !== 'undefined' && params[param] instanceof Dom7 || typeof jQuery !== 'undefined' && params[param] instanceof jQuery)) {
  575. originalParams[param] = {};
  576. for (var deepParam in params[param]) {
  577. originalParams[param][deepParam] = params[param][deepParam];
  578. }
  579. } else {
  580. originalParams[param] = params[param];
  581. }
  582. }
  583. for (var def in defaults) {
  584. if (typeof params[def] === 'undefined') {
  585. params[def] = defaults[def];
  586. } else if (_typeof(params[def]) === 'object') {
  587. for (var deepDef in defaults[def]) {
  588. if (typeof params[def][deepDef] === 'undefined') {
  589. params[def][deepDef] = defaults[def][deepDef];
  590. }
  591. }
  592. }
  593. }
  594. // Swiper
  595. var s = this;
  596. // Params
  597. s.params = params;
  598. s.originalParams = originalParams;
  599. // Classname
  600. s.classNames = [];
  601. /*=========================
  602. Dom Library and plugins
  603. ===========================*/
  604. if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined') {
  605. $ = Dom7;
  606. }
  607. if (typeof $ === 'undefined') {
  608. if (typeof Dom7 === 'undefined') {
  609. $ = window.Dom7 || window.Zepto || window.jQuery;
  610. } else {
  611. $ = Dom7;
  612. }
  613. if (!$) return;
  614. }
  615. // Export it to Swiper instance
  616. s.$ = $;
  617. /*=========================
  618. Breakpoints
  619. ===========================*/
  620. s.currentBreakpoint = undefined;
  621. s.getActiveBreakpoint = function () {
  622. //Get breakpoint for window width
  623. if (!s.params.breakpoints) return false;
  624. var breakpoint = false;
  625. var points = [],
  626. point;
  627. for (point in s.params.breakpoints) {
  628. if (s.params.breakpoints.hasOwnProperty(point)) {
  629. points.push(point);
  630. }
  631. }
  632. points.sort(function (a, b) {
  633. return parseInt(a, 10) > parseInt(b, 10);
  634. });
  635. for (var i = 0; i < points.length; i++) {
  636. point = points[i];
  637. if (point >= window.innerWidth && !breakpoint) {
  638. breakpoint = point;
  639. }
  640. }
  641. return breakpoint || 'max';
  642. };
  643. s.setBreakpoint = function () {
  644. //Set breakpoint for window width and update parameters
  645. var breakpoint = s.getActiveBreakpoint();
  646. if (breakpoint && s.currentBreakpoint !== breakpoint) {
  647. var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
  648. var needsReLoop = s.params.loop && breakPointsParams.slidesPerView !== s.params.slidesPerView;
  649. for (var param in breakPointsParams) {
  650. s.params[param] = breakPointsParams[param];
  651. }
  652. s.currentBreakpoint = breakpoint;
  653. if (needsReLoop && s.destroyLoop) {
  654. s.reLoop(true);
  655. }
  656. }
  657. };
  658. // Set breakpoint on load
  659. if (s.params.breakpoints) {
  660. s.setBreakpoint();
  661. }
  662. /*=========================
  663. Preparation - Define Container, Wrapper and Pagination
  664. ===========================*/
  665. s.container = $(container);
  666. if (s.container.length === 0) return;
  667. if (s.container.length > 1) {
  668. var swipers = [];
  669. s.container.each(function () {
  670. var container = this;
  671. swipers.push(new Swiper(this, params));
  672. });
  673. return swipers;
  674. }
  675. // Save instance in container HTML Element and in data
  676. s.container[0].swiper = s;
  677. s.container.data('swiper', s);
  678. s.classNames.push(s.params.containerModifierClass + s.params.direction);
  679. if (s.params.freeMode) {
  680. s.classNames.push(s.params.containerModifierClass + 'free-mode');
  681. }
  682. if (!s.support.flexbox) {
  683. s.classNames.push(s.params.containerModifierClass + 'no-flexbox');
  684. s.params.slidesPerColumn = 1;
  685. }
  686. if (s.params.autoHeight) {
  687. s.classNames.push(s.params.containerModifierClass + 'autoheight');
  688. }
  689. // Enable slides progress when required
  690. if (s.params.parallax || s.params.watchSlidesVisibility) {
  691. s.params.watchSlidesProgress = true;
  692. }
  693. // Max resistance when touchReleaseOnEdges
  694. if (s.params.touchReleaseOnEdges) {
  695. s.params.resistanceRatio = 0;
  696. }
  697. // Coverflow / 3D
  698. if (['cube', 'coverflow', 'flip'].indexOf(s.params.effect) >= 0) {
  699. if (s.support.transforms3d) {
  700. s.params.watchSlidesProgress = true;
  701. s.classNames.push(s.params.containerModifierClass + '3d');
  702. } else {
  703. s.params.effect = 'slide';
  704. }
  705. }
  706. if (s.params.effect !== 'slide') {
  707. s.classNames.push(s.params.containerModifierClass + s.params.effect);
  708. }
  709. if (s.params.effect === 'cube') {
  710. s.params.resistanceRatio = 0;
  711. s.params.slidesPerView = 1;
  712. s.params.slidesPerColumn = 1;
  713. s.params.slidesPerGroup = 1;
  714. s.params.centeredSlides = false;
  715. s.params.spaceBetween = 0;
  716. s.params.virtualTranslate = true;
  717. }
  718. if (s.params.effect === 'fade' || s.params.effect === 'flip') {
  719. s.params.slidesPerView = 1;
  720. s.params.slidesPerColumn = 1;
  721. s.params.slidesPerGroup = 1;
  722. s.params.watchSlidesProgress = true;
  723. s.params.spaceBetween = 0;
  724. if (typeof initialVirtualTranslate === 'undefined') {
  725. s.params.virtualTranslate = true;
  726. }
  727. }
  728. // Grab Cursor
  729. if (s.params.grabCursor && s.support.touch) {
  730. s.params.grabCursor = false;
  731. }
  732. // Wrapper
  733. s.wrapper = s.container.children('.' + s.params.wrapperClass);
  734. // Pagination
  735. if (s.params.pagination) {
  736. s.paginationContainer = $(s.params.pagination);
  737. if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
  738. s.paginationContainer = s.container.find(s.params.pagination);
  739. }
  740. if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
  741. s.paginationContainer.addClass(s.params.paginationModifierClass + 'clickable');
  742. } else {
  743. s.params.paginationClickable = false;
  744. }
  745. s.paginationContainer.addClass(s.params.paginationModifierClass + s.params.paginationType);
  746. }
  747. // Next/Prev Buttons
  748. if (s.params.nextButton || s.params.prevButton) {
  749. if (s.params.nextButton) {
  750. s.nextButton = $(s.params.nextButton);
  751. if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
  752. s.nextButton = s.container.find(s.params.nextButton);
  753. }
  754. }
  755. if (s.params.prevButton) {
  756. s.prevButton = $(s.params.prevButton);
  757. if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
  758. s.prevButton = s.container.find(s.params.prevButton);
  759. }
  760. }
  761. }
  762. // Is Horizontal
  763. s.isHorizontal = function () {
  764. return s.params.direction === 'horizontal';
  765. };
  766. // s.isH = isH;
  767. // RTL
  768. s.rtl = s.isHorizontal() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');
  769. if (s.rtl) {
  770. s.classNames.push(s.params.containerModifierClass + 'rtl');
  771. }
  772. // Wrong RTL support
  773. if (s.rtl) {
  774. s.wrongRTL = s.wrapper.css('display') === '-webkit-box';
  775. }
  776. // Columns
  777. if (s.params.slidesPerColumn > 1) {
  778. s.classNames.push(s.params.containerModifierClass + 'multirow');
  779. }
  780. // Check for Android
  781. if (s.device.android) {
  782. s.classNames.push(s.params.containerModifierClass + 'android');
  783. }
  784. // Add classes
  785. s.container.addClass(s.classNames.join(' '));
  786. // Translate
  787. s.translate = 0;
  788. // Progress
  789. s.progress = 0;
  790. // Velocity
  791. s.velocity = 0;
  792. /*=========================
  793. Locks, unlocks
  794. ===========================*/
  795. s.lockSwipeToNext = function () {
  796. s.params.allowSwipeToNext = false;
  797. if (s.params.allowSwipeToPrev === false && s.params.grabCursor) {
  798. s.unsetGrabCursor();
  799. }
  800. };
  801. s.lockSwipeToPrev = function () {
  802. s.params.allowSwipeToPrev = false;
  803. if (s.params.allowSwipeToNext === false && s.params.grabCursor) {
  804. s.unsetGrabCursor();
  805. }
  806. };
  807. s.lockSwipes = function () {
  808. s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;
  809. if (s.params.grabCursor) s.unsetGrabCursor();
  810. };
  811. s.unlockSwipeToNext = function () {
  812. s.params.allowSwipeToNext = true;
  813. if (s.params.allowSwipeToPrev === true && s.params.grabCursor) {
  814. s.setGrabCursor();
  815. }
  816. };
  817. s.unlockSwipeToPrev = function () {
  818. s.params.allowSwipeToPrev = true;
  819. if (s.params.allowSwipeToNext === true && s.params.grabCursor) {
  820. s.setGrabCursor();
  821. }
  822. };
  823. s.unlockSwipes = function () {
  824. s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;
  825. if (s.params.grabCursor) s.setGrabCursor();
  826. };
  827. /*=========================
  828. Round helper
  829. ===========================*/
  830. function round(a) {
  831. return Math.floor(a);
  832. }
  833. /*=========================
  834. Set grab cursor
  835. ===========================*/
  836. s.setGrabCursor = function (moving) {
  837. s.container[0].style.cursor = 'move';
  838. s.container[0].style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
  839. s.container[0].style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
  840. s.container[0].style.cursor = moving ? 'grabbing' : 'grab';
  841. };
  842. s.unsetGrabCursor = function () {
  843. s.container[0].style.cursor = '';
  844. };
  845. if (s.params.grabCursor) {
  846. s.setGrabCursor();
  847. }
  848. /*=========================
  849. Update on Images Ready
  850. ===========================*/
  851. s.imagesToLoad = [];
  852. s.imagesLoaded = 0;
  853. s.loadImage = function (imgElement, src, srcset, sizes, checkForComplete, callback) {
  854. var image;
  855. function onReady() {
  856. if (callback) callback();
  857. }
  858. if (!imgElement.complete || !checkForComplete) {
  859. if (src) {
  860. image = new window.Image();
  861. image.onload = onReady;
  862. image.onerror = onReady;
  863. if (sizes) {
  864. image.sizes = sizes;
  865. }
  866. if (srcset) {
  867. image.srcset = srcset;
  868. }
  869. if (src) {
  870. image.src = src;
  871. }
  872. } else {
  873. onReady();
  874. }
  875. } else {
  876. //image already loaded...
  877. onReady();
  878. }
  879. };
  880. s.preloadImages = function () {
  881. s.imagesToLoad = s.container.find('img');
  882. function _onReady() {
  883. if (typeof s === 'undefined' || s === null || !s) return;
  884. if (s.imagesLoaded !== undefined) s.imagesLoaded++;
  885. if (s.imagesLoaded === s.imagesToLoad.length) {
  886. if (s.params.updateOnImagesReady) s.update();
  887. s.emit('onImagesReady', s);
  888. }
  889. }
  890. for (var i = 0; i < s.imagesToLoad.length; i++) {
  891. s.loadImage(s.imagesToLoad[i], s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src'), s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset'), s.imagesToLoad[i].sizes || s.imagesToLoad[i].getAttribute('sizes'), true, _onReady);
  892. }
  893. };
  894. /*=========================
  895. Autoplay
  896. ===========================*/
  897. s.autoplayTimeoutId = undefined;
  898. s.autoplaying = false;
  899. s.autoplayPaused = false;
  900. function autoplay() {
  901. var autoplayDelay = s.params.autoplay;
  902. var activeSlide = s.slides.eq(s.activeIndex);
  903. if (activeSlide.attr('data-swiper-autoplay')) {
  904. autoplayDelay = activeSlide.attr('data-swiper-autoplay') || s.params.autoplay;
  905. }
  906. s.autoplayTimeoutId = setTimeout(function () {
  907. if (s.params.loop) {
  908. s.fixLoop();
  909. s._slideNext();
  910. s.emit('onAutoplay', s);
  911. } else {
  912. if (!s.isEnd) {
  913. s._slideNext();
  914. s.emit('onAutoplay', s);
  915. } else {
  916. if (!params.autoplayStopOnLast) {
  917. s._slideTo(0);
  918. s.emit('onAutoplay', s);
  919. } else {
  920. s.stopAutoplay();
  921. }
  922. }
  923. }
  924. }, autoplayDelay);
  925. }
  926. s.startAutoplay = function () {
  927. if (typeof s.autoplayTimeoutId !== 'undefined') return false;
  928. if (!s.params.autoplay) return false;
  929. if (s.autoplaying) return false;
  930. s.autoplaying = true;
  931. s.emit('onAutoplayStart', s);
  932. autoplay();
  933. };
  934. s.stopAutoplay = function (internal) {
  935. if (!s.autoplayTimeoutId) return;
  936. if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
  937. s.autoplaying = false;
  938. s.autoplayTimeoutId = undefined;
  939. s.emit('onAutoplayStop', s);
  940. };
  941. s.pauseAutoplay = function (speed) {
  942. if (s.autoplayPaused) return;
  943. if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
  944. s.autoplayPaused = true;
  945. if (speed === 0) {
  946. s.autoplayPaused = false;
  947. autoplay();
  948. } else {
  949. s.wrapper.transitionEnd(function () {
  950. if (!s) return;
  951. s.autoplayPaused = false;
  952. if (!s.autoplaying) {
  953. s.stopAutoplay();
  954. } else {
  955. autoplay();
  956. }
  957. });
  958. }
  959. };
  960. /*=========================
  961. Min/Max Translate
  962. ===========================*/
  963. s.minTranslate = function () {
  964. return -s.snapGrid[0];
  965. };
  966. s.maxTranslate = function () {
  967. return -s.snapGrid[s.snapGrid.length - 1];
  968. };
  969. /*=========================
  970. Slider/slides sizes
  971. ===========================*/
  972. s.updateAutoHeight = function () {
  973. var activeSlides = [];
  974. var newHeight = 0;
  975. var i;
  976. // Find slides currently in view
  977. if (s.params.slidesPerView !== 'auto' && s.params.slidesPerView > 1) {
  978. for (i = 0; i < Math.ceil(s.params.slidesPerView); i++) {
  979. var index = s.activeIndex + i;
  980. if (index > s.slides.length) break;
  981. activeSlides.push(s.slides.eq(index)[0]);
  982. }
  983. } else {
  984. activeSlides.push(s.slides.eq(s.activeIndex)[0]);
  985. }
  986. // Find new height from heighest slide in view
  987. for (i = 0; i < activeSlides.length; i++) {
  988. if (typeof activeSlides[i] !== 'undefined') {
  989. var height = activeSlides[i].offsetHeight;
  990. newHeight = height > newHeight ? height : newHeight;
  991. }
  992. }
  993. // Update Height
  994. if (newHeight) s.wrapper.css('height', newHeight + 'px');
  995. };
  996. s.updateContainerSize = function () {
  997. var width, height;
  998. if (typeof s.params.width !== 'undefined') {
  999. width = s.params.width;
  1000. } else {
  1001. width = s.container[0].clientWidth;
  1002. }
  1003. if (typeof s.params.height !== 'undefined') {
  1004. height = s.params.height;
  1005. } else {
  1006. height = s.container[0].clientHeight;
  1007. }
  1008. if (width === 0 && s.isHorizontal() || height === 0 && !s.isHorizontal()) {
  1009. return;
  1010. }
  1011. //Subtract paddings
  1012. width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);
  1013. height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);
  1014. // Store values
  1015. s.width = width;
  1016. s.height = height;
  1017. s.size = s.isHorizontal() ? s.width : s.height;
  1018. };
  1019. s.updateSlidesSize = function () {
  1020. s.slides = s.wrapper.children('.' + s.params.slideClass);
  1021. s.snapGrid = [];
  1022. s.slidesGrid = [];
  1023. s.slidesSizesGrid = [];
  1024. var spaceBetween = s.params.spaceBetween,
  1025. slidePosition = -s.params.slidesOffsetBefore,
  1026. i,
  1027. prevSlideSize = 0,
  1028. index = 0;
  1029. if (typeof s.size === 'undefined') return;
  1030. if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
  1031. spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
  1032. }
  1033. s.virtualSize = -spaceBetween;
  1034. // reset margins
  1035. if (s.rtl) s.slides.css({ marginLeft: '', marginTop: '' });else s.slides.css({ marginRight: '', marginBottom: '' });
  1036. var slidesNumberEvenToRows;
  1037. if (s.params.slidesPerColumn > 1) {
  1038. if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {
  1039. slidesNumberEvenToRows = s.slides.length;
  1040. } else {
  1041. slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;
  1042. }
  1043. if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {
  1044. slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);
  1045. }
  1046. }
  1047. // Calc slides
  1048. var slideSize;
  1049. var slidesPerColumn = s.params.slidesPerColumn;
  1050. var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
  1051. var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);
  1052. for (i = 0; i < s.slides.length; i++) {
  1053. slideSize = 0;
  1054. var slide = s.slides.eq(i);
  1055. if (s.params.slidesPerColumn > 1) {
  1056. // Set slides order
  1057. var newSlideOrderIndex;
  1058. var column, row;
  1059. if (s.params.slidesPerColumnFill === 'column') {
  1060. column = Math.floor(i / slidesPerColumn);
  1061. row = i - column * slidesPerColumn;
  1062. if (column > numFullColumns || column === numFullColumns && row === slidesPerColumn - 1) {
  1063. if (++row >= slidesPerColumn) {
  1064. row = 0;
  1065. column++;
  1066. }
  1067. }
  1068. newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
  1069. slide.css({
  1070. '-webkit-box-ordinal-group': newSlideOrderIndex,
  1071. '-moz-box-ordinal-group': newSlideOrderIndex,
  1072. '-ms-flex-order': newSlideOrderIndex,
  1073. '-webkit-order': newSlideOrderIndex,
  1074. 'order': newSlideOrderIndex
  1075. });
  1076. } else {
  1077. row = Math.floor(i / slidesPerRow);
  1078. column = i - row * slidesPerRow;
  1079. }
  1080. slide.css('margin-' + (s.isHorizontal() ? 'top' : 'left'), row !== 0 && s.params.spaceBetween && s.params.spaceBetween + 'px').attr('data-swiper-column', column).attr('data-swiper-row', row);
  1081. }
  1082. if (slide.css('display') === 'none') continue;
  1083. if (s.params.slidesPerView === 'auto') {
  1084. slideSize = s.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
  1085. if (s.params.roundLengths) slideSize = round(slideSize);
  1086. } else {
  1087. slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;
  1088. if (s.params.roundLengths) slideSize = round(slideSize);
  1089. if (s.isHorizontal()) {
  1090. s.slides[i].style.width = slideSize + 'px';
  1091. } else {
  1092. s.slides[i].style.height = slideSize + 'px';
  1093. }
  1094. }
  1095. s.slides[i].swiperSlideSize = slideSize;
  1096. s.slidesSizesGrid.push(slideSize);
  1097. if (s.params.centeredSlides) {
  1098. slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
  1099. if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
  1100. if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
  1101. if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
  1102. if (index % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
  1103. s.slidesGrid.push(slidePosition);
  1104. } else {
  1105. if (index % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
  1106. s.slidesGrid.push(slidePosition);
  1107. slidePosition = slidePosition + slideSize + spaceBetween;
  1108. }
  1109. s.virtualSize += slideSize + spaceBetween;
  1110. prevSlideSize = slideSize;
  1111. index++;
  1112. }
  1113. s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;
  1114. var newSlidesGrid;
  1115. if (s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {
  1116. s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });
  1117. }
  1118. if (!s.support.flexbox || s.params.setWrapperSize) {
  1119. if (s.isHorizontal()) s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });else s.wrapper.css({ height: s.virtualSize + s.params.spaceBetween + 'px' });
  1120. }
  1121. if (s.params.slidesPerColumn > 1) {
  1122. s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;
  1123. s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;
  1124. if (s.isHorizontal()) s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });else s.wrapper.css({ height: s.virtualSize + s.params.spaceBetween + 'px' });
  1125. if (s.params.centeredSlides) {
  1126. newSlidesGrid = [];
  1127. for (i = 0; i < s.snapGrid.length; i++) {
  1128. if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);
  1129. }
  1130. s.snapGrid = newSlidesGrid;
  1131. }
  1132. }
  1133. // Remove last grid elements depending on width
  1134. if (!s.params.centeredSlides) {
  1135. newSlidesGrid = [];
  1136. for (i = 0; i < s.snapGrid.length; i++) {
  1137. if (s.snapGrid[i] <= s.virtualSize - s.size) {
  1138. newSlidesGrid.push(s.snapGrid[i]);
  1139. }
  1140. }
  1141. s.snapGrid = newSlidesGrid;
  1142. if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
  1143. s.snapGrid.push(s.virtualSize - s.size);
  1144. }
  1145. }
  1146. if (s.snapGrid.length === 0) s.snapGrid = [0];
  1147. if (s.params.spaceBetween !== 0) {
  1148. if (s.isHorizontal()) {
  1149. if (s.rtl) s.slides.css({ marginLeft: spaceBetween + 'px' });else s.slides.css({ marginRight: spaceBetween + 'px' });
  1150. } else s.slides.css({ marginBottom: spaceBetween + 'px' });
  1151. }
  1152. if (s.params.watchSlidesProgress) {
  1153. s.updateSlidesOffset();
  1154. }
  1155. };
  1156. s.updateSlidesOffset = function () {
  1157. for (var i = 0; i < s.slides.length; i++) {
  1158. s.slides[i].swiperSlideOffset = s.isHorizontal() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;
  1159. }
  1160. };
  1161. /*=========================
  1162. Dynamic Slides Per View
  1163. ===========================*/
  1164. s.currentSlidesPerView = function () {
  1165. var spv = 1,
  1166. i,
  1167. j;
  1168. if (s.params.centeredSlides) {
  1169. var size = s.slides[s.activeIndex].swiperSlideSize;
  1170. var breakLoop;
  1171. for (i = s.activeIndex + 1; i < s.slides.length; i++) {
  1172. if (s.slides[i] && !breakLoop) {
  1173. size += s.slides[i].swiperSlideSize;
  1174. spv++;
  1175. if (size > s.size) breakLoop = true;
  1176. }
  1177. }
  1178. for (j = s.activeIndex - 1; j >= 0; j--) {
  1179. if (s.slides[j] && !breakLoop) {
  1180. size += s.slides[j].swiperSlideSize;
  1181. spv++;
  1182. if (size > s.size) breakLoop = true;
  1183. }
  1184. }
  1185. } else {
  1186. for (i = s.activeIndex + 1; i < s.slides.length; i++) {
  1187. if (s.slidesGrid[i] - s.slidesGrid[s.activeIndex] < s.size) {
  1188. spv++;
  1189. }
  1190. }
  1191. }
  1192. return spv;
  1193. };
  1194. /*=========================
  1195. Slider/slides progress
  1196. ===========================*/
  1197. s.updateSlidesProgress = function (translate) {
  1198. if (typeof translate === 'undefined') {
  1199. translate = s.translate || 0;
  1200. }
  1201. if (s.slides.length === 0) return;
  1202. if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();
  1203. var offsetCenter = -translate;
  1204. if (s.rtl) offsetCenter = translate;
  1205. // Visible Slides
  1206. s.slides.removeClass(s.params.slideVisibleClass);
  1207. for (var i = 0; i < s.slides.length; i++) {
  1208. var slide = s.slides[i];
  1209. var slideProgress = (offsetCenter + (s.params.centeredSlides ? s.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);
  1210. if (s.params.watchSlidesVisibility) {
  1211. var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
  1212. var slideAfter = slideBefore + s.slidesSizesGrid[i];
  1213. var isVisible = slideBefore >= 0 && slideBefore < s.size || slideAfter > 0 && slideAfter <= s.size || slideBefore <= 0 && slideAfter >= s.size;
  1214. if (isVisible) {
  1215. s.slides.eq(i).addClass(s.params.slideVisibleClass);
  1216. }
  1217. }
  1218. slide.progress = s.rtl ? -slideProgress : slideProgress;
  1219. }
  1220. };
  1221. s.updateProgress = function (translate) {
  1222. if (typeof translate === 'undefined') {
  1223. translate = s.translate || 0;
  1224. }
  1225. var translatesDiff = s.maxTranslate() - s.minTranslate();
  1226. var wasBeginning = s.isBeginning;
  1227. var wasEnd = s.isEnd;
  1228. if (translatesDiff === 0) {
  1229. s.progress = 0;
  1230. s.isBeginning = s.isEnd = true;
  1231. } else {
  1232. s.progress = (translate - s.minTranslate()) / translatesDiff;
  1233. s.isBeginning = s.progress <= 0;
  1234. s.isEnd = s.progress >= 1;
  1235. }
  1236. if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);
  1237. if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);
  1238. if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);
  1239. s.emit('onProgress', s, s.progress);
  1240. };
  1241. s.updateActiveIndex = function () {
  1242. var translate = s.rtl ? s.translate : -s.translate;
  1243. var newActiveIndex, i, snapIndex;
  1244. for (i = 0; i < s.slidesGrid.length; i++) {
  1245. if (typeof s.slidesGrid[i + 1] !== 'undefined') {
  1246. if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {
  1247. newActiveIndex = i;
  1248. } else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {
  1249. newActiveIndex = i + 1;
  1250. }
  1251. } else {
  1252. if (translate >= s.slidesGrid[i]) {
  1253. newActiveIndex = i;
  1254. }
  1255. }
  1256. }
  1257. // Normalize slideIndex
  1258. if (s.params.normalizeSlideIndex) {
  1259. if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;
  1260. }
  1261. // for (i = 0; i < s.slidesGrid.length; i++) {
  1262. // if (- translate >= s.slidesGrid[i]) {
  1263. // newActiveIndex = i;
  1264. // }
  1265. // }
  1266. snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);
  1267. if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;
  1268. if (newActiveIndex === s.activeIndex) {
  1269. return;
  1270. }
  1271. s.snapIndex = snapIndex;
  1272. s.previousIndex = s.activeIndex;
  1273. s.activeIndex = newActiveIndex;
  1274. s.updateClasses();
  1275. s.updateRealIndex();
  1276. };
  1277. s.updateRealIndex = function () {
  1278. s.realIndex = parseInt(s.slides.eq(s.activeIndex).attr('data-swiper-slide-index') || s.activeIndex, 10);
  1279. };
  1280. /*=========================
  1281. Classes
  1282. ===========================*/
  1283. s.updateClasses = function () {
  1284. s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass + ' ' + s.params.slideDuplicateActiveClass + ' ' + s.params.slideDuplicateNextClass + ' ' + s.params.slideDuplicatePrevClass);
  1285. var activeSlide = s.slides.eq(s.activeIndex);
  1286. // Active classes
  1287. activeSlide.addClass(s.params.slideActiveClass);
  1288. if (params.loop) {
  1289. // Duplicate to all looped slides
  1290. if (activeSlide.hasClass(s.params.slideDuplicateClass)) {
  1291. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass);
  1292. } else {
  1293. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass);
  1294. }
  1295. }
  1296. // Next Slide
  1297. var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
  1298. if (s.params.loop && nextSlide.length === 0) {
  1299. nextSlide = s.slides.eq(0);
  1300. nextSlide.addClass(s.params.slideNextClass);
  1301. }
  1302. // Prev Slide
  1303. var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
  1304. if (s.params.loop && prevSlide.length === 0) {
  1305. prevSlide = s.slides.eq(-1);
  1306. prevSlide.addClass(s.params.slidePrevClass);
  1307. }
  1308. if (params.loop) {
  1309. // Duplicate to all looped slides
  1310. if (nextSlide.hasClass(s.params.slideDuplicateClass)) {
  1311. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass);
  1312. } else {
  1313. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass);
  1314. }
  1315. if (prevSlide.hasClass(s.params.slideDuplicateClass)) {
  1316. s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass);
  1317. } else {
  1318. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass);
  1319. }
  1320. }
  1321. // Pagination
  1322. if (s.paginationContainer && s.paginationContainer.length > 0) {
  1323. // Current/Total
  1324. var current,
  1325. total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
  1326. if (s.params.loop) {
  1327. current = Math.ceil((s.activeIndex - s.loopedSlides) / s.params.slidesPerGroup);
  1328. if (current > s.slides.length - 1 - s.loopedSlides * 2) {
  1329. current = current - (s.slides.length - s.loopedSlides * 2);
  1330. }
  1331. if (current > total - 1) current = current - total;
  1332. if (current < 0 && s.params.paginationType !== 'bullets') current = total + current;
  1333. } else {
  1334. if (typeof s.snapIndex !== 'undefined') {
  1335. current = s.snapIndex;
  1336. } else {
  1337. current = s.activeIndex || 0;
  1338. }
  1339. }
  1340. // Types
  1341. if (s.params.paginationType === 'bullets' && s.bullets && s.bullets.length > 0) {
  1342. s.bullets.removeClass(s.params.bulletActiveClass);
  1343. if (s.paginationContainer.length > 1) {
  1344. s.bullets.each(function () {
  1345. if ($(this).index() === current) $(this).addClass(s.params.bulletActiveClass);
  1346. });
  1347. } else {
  1348. s.bullets.eq(current).addClass(s.params.bulletActiveClass);
  1349. }
  1350. }
  1351. if (s.params.paginationType === 'fraction') {
  1352. s.paginationContainer.find('.' + s.params.paginationCurrentClass).text(current + 1);
  1353. s.paginationContainer.find('.' + s.params.paginationTotalClass).text(total);
  1354. }
  1355. if (s.params.paginationType === 'progress') {
  1356. var scale = (current + 1) / total,
  1357. scaleX = scale,
  1358. scaleY = 1;
  1359. if (!s.isHorizontal()) {
  1360. scaleY = scale;
  1361. scaleX = 1;
  1362. }
  1363. s.paginationContainer.find('.' + s.params.paginationProgressbarClass).transform('translate3d(0,0,0) scaleX(' + scaleX + ') scaleY(' + scaleY + ')').transition(s.params.speed);
  1364. }
  1365. if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
  1366. s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
  1367. s.emit('onPaginationRendered', s, s.paginationContainer[0]);
  1368. }
  1369. }
  1370. // Next/active buttons
  1371. if (!s.params.loop) {
  1372. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  1373. if (s.isBeginning) {
  1374. s.prevButton.addClass(s.params.buttonDisabledClass);
  1375. if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
  1376. } else {
  1377. s.prevButton.removeClass(s.params.buttonDisabledClass);
  1378. if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
  1379. }
  1380. }
  1381. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  1382. if (s.isEnd) {
  1383. s.nextButton.addClass(s.params.buttonDisabledClass);
  1384. if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
  1385. } else {
  1386. s.nextButton.removeClass(s.params.buttonDisabledClass);
  1387. if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
  1388. }
  1389. }
  1390. }
  1391. };
  1392. /*=========================
  1393. Pagination
  1394. ===========================*/
  1395. s.updatePagination = function () {
  1396. if (!s.params.pagination) return;
  1397. if (s.paginationContainer && s.paginationContainer.length > 0) {
  1398. var paginationHTML = '';
  1399. if (s.params.paginationType === 'bullets') {
  1400. var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
  1401. for (var i = 0; i < numberOfBullets; i++) {
  1402. if (s.params.paginationBulletRender) {
  1403. paginationHTML += s.params.paginationBulletRender(s, i, s.params.bulletClass);
  1404. } else {
  1405. paginationHTML += '<' + s.params.paginationElement + ' class="' + s.params.bulletClass + '"></' + s.params.paginationElement + '>';
  1406. }
  1407. }
  1408. s.paginationContainer.html(paginationHTML);
  1409. s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);
  1410. if (s.params.paginationClickable && s.params.a11y && s.a11y) {
  1411. s.a11y.initPagination();
  1412. }
  1413. }
  1414. if (s.params.paginationType === 'fraction') {
  1415. if (s.params.paginationFractionRender) {
  1416. paginationHTML = s.params.paginationFractionRender(s, s.params.paginationCurrentClass, s.params.paginationTotalClass);
  1417. } else {
  1418. paginationHTML = '<span class="' + s.params.paginationCurrentClass + '"></span>' + ' / ' + '<span class="' + s.params.paginationTotalClass + '"></span>';
  1419. }
  1420. s.paginationContainer.html(paginationHTML);
  1421. }
  1422. if (s.params.paginationType === 'progress') {
  1423. if (s.params.paginationProgressRender) {
  1424. paginationHTML = s.params.paginationProgressRender(s, s.params.paginationProgressbarClass);
  1425. } else {
  1426. paginationHTML = '<span class="' + s.params.paginationProgressbarClass + '"></span>';
  1427. }
  1428. s.paginationContainer.html(paginationHTML);
  1429. }
  1430. if (s.params.paginationType !== 'custom') {
  1431. s.emit('onPaginationRendered', s, s.paginationContainer[0]);
  1432. }
  1433. }
  1434. };
  1435. /*=========================
  1436. Common update method
  1437. ===========================*/
  1438. s.update = function (updateTranslate) {
  1439. if (!s) return;
  1440. s.updateContainerSize();
  1441. s.updateSlidesSize();
  1442. s.updateProgress();
  1443. s.updatePagination();
  1444. s.updateClasses();
  1445. if (s.params.scrollbar && s.scrollbar) {
  1446. s.scrollbar.set();
  1447. }
  1448. var newTranslate;
  1449. function forceSetTranslate() {
  1450. var translate = s.rtl ? -s.translate : s.translate;
  1451. newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
  1452. s.setWrapperTranslate(newTranslate);
  1453. s.updateActiveIndex();
  1454. s.updateClasses();
  1455. }
  1456. if (updateTranslate) {
  1457. var translated;
  1458. if (s.controller && s.controller.spline) {
  1459. s.controller.spline = undefined;
  1460. }
  1461. if (s.params.freeMode) {
  1462. forceSetTranslate();
  1463. if (s.params.autoHeight) {
  1464. s.updateAutoHeight();
  1465. }
  1466. } else {
  1467. if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
  1468. translated = s.slideTo(s.slides.length - 1, 0, false, true);
  1469. } else {
  1470. translated = s.slideTo(s.activeIndex, 0, false, true);
  1471. }
  1472. if (!translated) {
  1473. forceSetTranslate();
  1474. }
  1475. }
  1476. } else if (s.params.autoHeight) {
  1477. s.updateAutoHeight();
  1478. }
  1479. };
  1480. /*=========================
  1481. Resize Handler
  1482. ===========================*/
  1483. s.onResize = function (forceUpdatePagination) {
  1484. if (s.params.onBeforeResize) s.params.onBeforeResize(s);
  1485. //Breakpoints
  1486. if (s.params.breakpoints) {
  1487. s.setBreakpoint();
  1488. }
  1489. // Disable locks on resize
  1490. var allowSwipeToPrev = s.params.allowSwipeToPrev;
  1491. var allowSwipeToNext = s.params.allowSwipeToNext;
  1492. s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;
  1493. s.updateContainerSize();
  1494. s.updateSlidesSize();
  1495. if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination) s.updatePagination();
  1496. if (s.params.scrollbar && s.scrollbar) {
  1497. s.scrollbar.set();
  1498. }
  1499. if (s.controller && s.controller.spline) {
  1500. s.controller.spline = undefined;
  1501. }
  1502. var slideChangedBySlideTo = false;
  1503. if (s.params.freeMode) {
  1504. var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
  1505. s.setWrapperTranslate(newTranslate);
  1506. s.updateActiveIndex();
  1507. s.updateClasses();
  1508. if (s.params.autoHeight) {
  1509. s.updateAutoHeight();
  1510. }
  1511. } else {
  1512. s.updateClasses();
  1513. if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
  1514. slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
  1515. } else {
  1516. slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
  1517. }
  1518. }
  1519. if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
  1520. s.lazy.load();
  1521. }
  1522. // Return locks after resize
  1523. s.params.allowSwipeToPrev = allowSwipeToPrev;
  1524. s.params.allowSwipeToNext = allowSwipeToNext;
  1525. if (s.params.onAfterResize) s.params.onAfterResize(s);
  1526. };
  1527. /*=========================
  1528. Events
  1529. ===========================*/
  1530. //Define Touch Events
  1531. s.touchEventsDesktop = { start: 'mousedown', move: 'mousemove', end: 'mouseup' };
  1532. if (window.navigator.pointerEnabled) s.touchEventsDesktop = { start: 'pointerdown', move: 'pointermove', end: 'pointerup' };else if (window.navigator.msPointerEnabled) s.touchEventsDesktop = { start: 'MSPointerDown', move: 'MSPointerMove', end: 'MSPointerUp' };
  1533. s.touchEvents = {
  1534. start: s.support.touch || !s.params.simulateTouch ? 'touchstart' : s.touchEventsDesktop.start,
  1535. move: s.support.touch || !s.params.simulateTouch ? 'touchmove' : s.touchEventsDesktop.move,
  1536. end: s.support.touch || !s.params.simulateTouch ? 'touchend' : s.touchEventsDesktop.end
  1537. };
  1538. // WP8 Touch Events Fix
  1539. if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {
  1540. //console.log('1669', s.params.touchEventsTarget);
  1541. (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);
  1542. }
  1543. // Attach/detach events
  1544. s.initEvents = function (detach) {
  1545. var actionDom = detach ? 'off' : 'on';
  1546. var action = detach ? 'removeEventListener' : 'addEventListener';
  1547. var touchEventsTarget = s.params.touchEventsTarget === 'lu-container' ? s.container[0] : s.wrapper[0];
  1548. var target = s.support.touch ? touchEventsTarget : document;
  1549. var moveCapture = s.params.nested ? true : false;
  1550. //Touch Events
  1551. if (s.browser.ie) {
  1552. touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
  1553. target[action](s.touchEvents.move, s.onTouchMove, moveCapture);
  1554. target[action](s.touchEvents.end, s.onTouchEnd, false);
  1555. } else {
  1556. if (s.support.touch) {
  1557. var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? { passive: true, capture: false } : false;
  1558. touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, passiveListener);
  1559. touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);
  1560. touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, passiveListener);
  1561. }
  1562. if (params.simulateTouch && !s.device.ios && !s.device.android || params.simulateTouch && !s.support.touch && s.device.ios) {
  1563. touchEventsTarget[action]('mousedown', s.onTouchStart, false);
  1564. document[action]('mousemove', s.onTouchMove, moveCapture);
  1565. document[action]('mouseup', s.onTouchEnd, false);
  1566. }
  1567. }
  1568. window[action]('resize', s.onResize);
  1569. // Next, Prev, Index
  1570. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  1571. s.nextButton[actionDom]('click', s.onClickNext);
  1572. if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
  1573. }
  1574. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  1575. s.prevButton[actionDom]('click', s.onClickPrev);
  1576. if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
  1577. }
  1578. if (s.params.pagination && s.params.paginationClickable) {
  1579. s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
  1580. if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
  1581. }
  1582. // Prevent Links Clicks
  1583. if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
  1584. };
  1585. s.attachEvents = function () {
  1586. s.initEvents();
  1587. };
  1588. s.detachEvents = function () {
  1589. s.initEvents(true);
  1590. };
  1591. /*=========================
  1592. Handle Clicks
  1593. ===========================*/
  1594. // Prevent Clicks
  1595. s.allowClick = true;
  1596. s.preventClicks = function (e) {
  1597. if (!s.allowClick) {
  1598. if (s.params.preventClicks) e.preventDefault();
  1599. if (s.params.preventClicksPropagation && s.animating) {
  1600. e.stopPropagation();
  1601. e.stopImmediatePropagation();
  1602. }
  1603. }
  1604. };
  1605. // Clicks
  1606. s.onClickNext = function (e) {
  1607. e.preventDefault();
  1608. if (s.isEnd && !s.params.loop) return;
  1609. s.slideNext();
  1610. };
  1611. s.onClickPrev = function (e) {
  1612. e.preventDefault();
  1613. if (s.isBeginning && !s.params.loop) return;
  1614. s.slidePrev();
  1615. };
  1616. s.onClickIndex = function (e) {
  1617. e.preventDefault();
  1618. var index = $(this).index() * s.params.slidesPerGroup;
  1619. if (s.params.loop) index = index + s.loopedSlides;
  1620. s.slideTo(index);
  1621. };
  1622. /*=========================
  1623. Handle Touches
  1624. ===========================*/
  1625. function findElementInEvent(e, selector) {
  1626. var el = $(e.target);
  1627. if (!el.is(selector)) {
  1628. if (typeof selector === 'string') {
  1629. el = el.parents(selector);
  1630. } else if (selector.nodeType) {
  1631. var found;
  1632. el.parents().each(function (index, _el) {
  1633. if (_el === selector) found = selector;
  1634. });
  1635. if (!found) return undefined;else return selector;
  1636. }
  1637. }
  1638. if (el.length === 0) {
  1639. return undefined;
  1640. }
  1641. return el[0];
  1642. }
  1643. s.updateClickedSlide = function (e) {
  1644. var slide = findElementInEvent(e, '.' + s.params.slideClass);
  1645. var slideFound = false;
  1646. if (slide) {
  1647. for (var i = 0; i < s.slides.length; i++) {
  1648. if (s.slides[i] === slide) slideFound = true;
  1649. }
  1650. }
  1651. if (slide && slideFound) {
  1652. s.clickedSlide = slide;
  1653. s.clickedIndex = $(slide).index();
  1654. } else {
  1655. s.clickedSlide = undefined;
  1656. s.clickedIndex = undefined;
  1657. return;
  1658. }
  1659. if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {
  1660. var slideToIndex = s.clickedIndex,
  1661. realIndex,
  1662. duplicatedSlides,
  1663. slidesPerView = s.params.slidesPerView === 'auto' ? s.currentSlidesPerView() : s.params.slidesPerView;
  1664. if (s.params.loop) {
  1665. if (s.animating) return;
  1666. realIndex = parseInt($(s.clickedSlide).attr('data-swiper-slide-index'), 10);
  1667. if (s.params.centeredSlides) {
  1668. if (slideToIndex < s.loopedSlides - slidesPerView / 2 || slideToIndex > s.slides.length - s.loopedSlides + slidesPerView / 2) {
  1669. s.fixLoop();
  1670. slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();
  1671. setTimeout(function () {
  1672. s.slideTo(slideToIndex);
  1673. }, 0);
  1674. } else {
  1675. s.slideTo(slideToIndex);
  1676. }
  1677. } else {
  1678. if (slideToIndex > s.slides.length - slidesPerView) {
  1679. s.fixLoop();
  1680. slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();
  1681. setTimeout(function () {
  1682. s.slideTo(slideToIndex);
  1683. }, 0);
  1684. } else {
  1685. s.slideTo(slideToIndex);
  1686. }
  1687. }
  1688. } else {
  1689. s.slideTo(slideToIndex);
  1690. }
  1691. }
  1692. };
  1693. var isTouched,
  1694. isMoved,
  1695. allowTouchCallbacks,
  1696. touchStartTime,
  1697. isScrolling,
  1698. currentTranslate,
  1699. startTranslate,
  1700. allowThresholdMove,
  1701. // Form elements to match
  1702. formElements = 'input, select, textarea, button, video',
  1703. // Last click time
  1704. lastClickTime = Date.now(),
  1705. clickTimeout,
  1706. //Velocities
  1707. velocities = [],
  1708. allowMomentumBounce;
  1709. // Animating Flag
  1710. s.animating = false;
  1711. // Touches information
  1712. s.touches = {
  1713. startX: 0,
  1714. startY: 0,
  1715. currentX: 0,
  1716. currentY: 0,
  1717. diff: 0
  1718. };
  1719. // Touch handlers
  1720. var isTouchEvent, startMoving;
  1721. s.onTouchStart = function (e) {
  1722. if (e.originalEvent) e = e.originalEvent;
  1723. isTouchEvent = e.type === 'touchstart';
  1724. if (!isTouchEvent && 'which' in e && e.which === 3) return;
  1725. if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {
  1726. s.allowClick = true;
  1727. return;
  1728. }
  1729. if (s.params.swipeHandler) {
  1730. if (!findElementInEvent(e, s.params.swipeHandler)) return;
  1731. }
  1732. var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  1733. var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  1734. // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
  1735. if (s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {
  1736. return;
  1737. }
  1738. isTouched = true;
  1739. isMoved = false;
  1740. allowTouchCallbacks = true;
  1741. isScrolling = undefined;
  1742. startMoving = undefined;
  1743. s.touches.startX = startX;
  1744. s.touches.startY = startY;
  1745. touchStartTime = Date.now();
  1746. s.allowClick = true;
  1747. s.updateContainerSize();
  1748. s.swipeDirection = undefined;
  1749. if (s.params.threshold > 0) allowThresholdMove = false;
  1750. if (e.type !== 'touchstart') {
  1751. var preventDefault = true;
  1752. if ($(e.target).is(formElements)) preventDefault = false;
  1753. if (document.activeElement && $(document.activeElement).is(formElements)) {
  1754. document.activeElement.blur();
  1755. }
  1756. if (preventDefault) {
  1757. e.preventDefault();
  1758. }
  1759. }
  1760. s.emit('onTouchStart', s, e);
  1761. };
  1762. s.onTouchMove = function (e) {
  1763. if (e.originalEvent) e = e.originalEvent;
  1764. if (isTouchEvent && e.type === 'mousemove') return;
  1765. if (e.preventedByNestedSwiper) {
  1766. s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1767. s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1768. return;
  1769. }
  1770. if (s.params.onlyExternal) {
  1771. // isMoved = true;
  1772. s.allowClick = false;
  1773. if (isTouched) {
  1774. s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1775. s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1776. touchStartTime = Date.now();
  1777. }
  1778. return;
  1779. }
  1780. if (isTouchEvent && s.params.touchReleaseOnEdges && !s.params.loop) {
  1781. if (!s.isHorizontal()) {
  1782. // Vertical
  1783. if (s.touches.currentY < s.touches.startY && s.translate <= s.maxTranslate() || s.touches.currentY > s.touches.startY && s.translate >= s.minTranslate()) {
  1784. return;
  1785. }
  1786. } else {
  1787. if (s.touches.currentX < s.touches.startX && s.translate <= s.maxTranslate() || s.touches.currentX > s.touches.startX && s.translate >= s.minTranslate()) {
  1788. return;
  1789. }
  1790. }
  1791. }
  1792. if (isTouchEvent && document.activeElement) {
  1793. if (e.target === document.activeElement && $(e.target).is(formElements)) {
  1794. isMoved = true;
  1795. s.allowClick = false;
  1796. return;
  1797. }
  1798. }
  1799. if (allowTouchCallbacks) {
  1800. s.emit('onTouchMove', s, e);
  1801. }
  1802. if (e.targetTouches && e.targetTouches.length > 1) return;
  1803. s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  1804. s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  1805. if (typeof isScrolling === 'undefined') {
  1806. var touchAngle;
  1807. if (s.isHorizontal() && s.touches.currentY === s.touches.startY || !s.isHorizontal() && s.touches.currentX === s.touches.startX) {
  1808. isScrolling = false;
  1809. } else {
  1810. touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;
  1811. isScrolling = s.isHorizontal() ? touchAngle > s.params.touchAngle : 90 - touchAngle > s.params.touchAngle;
  1812. }
  1813. }
  1814. if (isScrolling) {
  1815. s.emit('onTouchMoveOpposite', s, e);
  1816. }
  1817. if (typeof startMoving === 'undefined') {
  1818. if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {
  1819. startMoving = true;
  1820. }
  1821. }
  1822. if (!isTouched) return;
  1823. if (isScrolling) {
  1824. isTouched = false;
  1825. return;
  1826. }
  1827. if (!startMoving) {
  1828. return;
  1829. }
  1830. s.allowClick = false;
  1831. s.emit('onSliderMove', s, e);
  1832. e.preventDefault();
  1833. if (s.params.touchMoveStopPropagation && !s.params.nested) {
  1834. e.stopPropagation();
  1835. }
  1836. if (!isMoved) {
  1837. if (params.loop) {
  1838. s.fixLoop();
  1839. }
  1840. startTranslate = s.getWrapperTranslate();
  1841. s.setWrapperTransition(0);
  1842. if (s.animating) {
  1843. s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');
  1844. }
  1845. if (s.params.autoplay && s.autoplaying) {
  1846. if (s.params.autoplayDisableOnInteraction) {
  1847. s.stopAutoplay();
  1848. } else {
  1849. s.pauseAutoplay();
  1850. }
  1851. }
  1852. allowMomentumBounce = false;
  1853. //Grab Cursor
  1854. if (s.params.grabCursor && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {
  1855. s.setGrabCursor(true);
  1856. }
  1857. }
  1858. isMoved = true;
  1859. var diff = s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
  1860. diff = diff * s.params.touchRatio;
  1861. if (s.rtl) diff = -diff;
  1862. s.swipeDirection = diff > 0 ? 'prev' : 'next';
  1863. currentTranslate = diff + startTranslate;
  1864. var disableParentSwiper = true;
  1865. if (diff > 0 && currentTranslate > s.minTranslate()) {
  1866. disableParentSwiper = false;
  1867. if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);
  1868. } else if (diff < 0 && currentTranslate < s.maxTranslate()) {
  1869. disableParentSwiper = false;
  1870. if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);
  1871. }
  1872. if (disableParentSwiper) {
  1873. e.preventedByNestedSwiper = true;
  1874. }
  1875. // Directions locks
  1876. if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {
  1877. currentTranslate = startTranslate;
  1878. }
  1879. if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {
  1880. currentTranslate = startTranslate;
  1881. }
  1882. // Threshold
  1883. if (s.params.threshold > 0) {
  1884. if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {
  1885. if (!allowThresholdMove) {
  1886. allowThresholdMove = true;
  1887. s.touches.startX = s.touches.currentX;
  1888. s.touches.startY = s.touches.currentY;
  1889. currentTranslate = startTranslate;
  1890. s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
  1891. return;
  1892. }
  1893. } else {
  1894. currentTranslate = startTranslate;
  1895. return;
  1896. }
  1897. }
  1898. if (!s.params.followFinger) return;
  1899. // Update active index in free mode
  1900. if (s.params.freeMode || s.params.watchSlidesProgress) {
  1901. s.updateActiveIndex();
  1902. }
  1903. if (s.params.freeMode) {
  1904. //Velocity
  1905. if (velocities.length === 0) {
  1906. velocities.push({
  1907. position: s.touches[s.isHorizontal() ? 'startX' : 'startY'],
  1908. time: touchStartTime
  1909. });
  1910. }
  1911. velocities.push({
  1912. position: s.touches[s.isHorizontal() ? 'currentX' : 'currentY'],
  1913. time: new window.Date().getTime()
  1914. });
  1915. }
  1916. // Update progress
  1917. s.updateProgress(currentTranslate);
  1918. // Update translate
  1919. s.setWrapperTranslate(currentTranslate);
  1920. };
  1921. s.onTouchEnd = function (e) {
  1922. if (e.originalEvent) e = e.originalEvent;
  1923. if (allowTouchCallbacks) {
  1924. s.emit('onTouchEnd', s, e);
  1925. }
  1926. allowTouchCallbacks = false;
  1927. if (!isTouched) return;
  1928. //Return Grab Cursor
  1929. if (s.params.grabCursor && isMoved && isTouched && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {
  1930. s.setGrabCursor(false);
  1931. }
  1932. // Time diff
  1933. var touchEndTime = Date.now();
  1934. var timeDiff = touchEndTime - touchStartTime;
  1935. // Tap, doubleTap, Click
  1936. if (s.allowClick) {
  1937. s.updateClickedSlide(e);
  1938. s.emit('onTap', s, e);
  1939. if (timeDiff < 300 && touchEndTime - lastClickTime > 300) {
  1940. if (clickTimeout) clearTimeout(clickTimeout);
  1941. clickTimeout = setTimeout(function () {
  1942. if (!s) return;
  1943. if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {
  1944. s.paginationContainer.toggleClass(s.params.paginationHiddenClass);
  1945. }
  1946. s.emit('onClick', s, e);
  1947. }, 300);
  1948. }
  1949. if (timeDiff < 300 && touchEndTime - lastClickTime < 300) {
  1950. if (clickTimeout) clearTimeout(clickTimeout);
  1951. s.emit('onDoubleTap', s, e);
  1952. }
  1953. }
  1954. lastClickTime = Date.now();
  1955. setTimeout(function () {
  1956. if (s) s.allowClick = true;
  1957. }, 0);
  1958. if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {
  1959. isTouched = isMoved = false;
  1960. return;
  1961. }
  1962. isTouched = isMoved = false;
  1963. var currentPos;
  1964. if (s.params.followFinger) {
  1965. currentPos = s.rtl ? s.translate : -s.translate;
  1966. } else {
  1967. currentPos = -currentTranslate;
  1968. }
  1969. if (s.params.freeMode) {
  1970. if (currentPos < -s.minTranslate()) {
  1971. s.slideTo(s.activeIndex);
  1972. return;
  1973. } else if (currentPos > -s.maxTranslate()) {
  1974. if (s.slides.length < s.snapGrid.length) {
  1975. s.slideTo(s.snapGrid.length - 1);
  1976. } else {
  1977. s.slideTo(s.slides.length - 1);
  1978. }
  1979. return;
  1980. }
  1981. if (s.params.freeModeMomentum) {
  1982. if (velocities.length > 1) {
  1983. var lastMoveEvent = velocities.pop(),
  1984. velocityEvent = velocities.pop();
  1985. var distance = lastMoveEvent.position - velocityEvent.position;
  1986. var time = lastMoveEvent.time - velocityEvent.time;
  1987. s.velocity = distance / time;
  1988. s.velocity = s.velocity / 2;
  1989. if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {
  1990. s.velocity = 0;
  1991. }
  1992. // this implies that the user stopped moving a finger then released.
  1993. // There would be no events with distance zero, so the last event is stale.
  1994. if (time > 150 || new window.Date().getTime() - lastMoveEvent.time > 300) {
  1995. s.velocity = 0;
  1996. }
  1997. } else {
  1998. s.velocity = 0;
  1999. }
  2000. s.velocity = s.velocity * s.params.freeModeMomentumVelocityRatio;
  2001. velocities.length = 0;
  2002. var momentumDuration = 1000 * s.params.freeModeMomentumRatio;
  2003. var momentumDistance = s.velocity * momentumDuration;
  2004. var newPosition = s.translate + momentumDistance;
  2005. if (s.rtl) newPosition = -newPosition;
  2006. var doBounce = false;
  2007. var afterBouncePosition;
  2008. var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;
  2009. if (newPosition < s.maxTranslate()) {
  2010. if (s.params.freeModeMomentumBounce) {
  2011. if (newPosition + s.maxTranslate() < -bounceAmount) {
  2012. newPosition = s.maxTranslate() - bounceAmount;
  2013. }
  2014. afterBouncePosition = s.maxTranslate();
  2015. doBounce = true;
  2016. allowMomentumBounce = true;
  2017. } else {
  2018. newPosition = s.maxTranslate();
  2019. }
  2020. } else if (newPosition > s.minTranslate()) {
  2021. if (s.params.freeModeMomentumBounce) {
  2022. if (newPosition - s.minTranslate() > bounceAmount) {
  2023. newPosition = s.minTranslate() + bounceAmount;
  2024. }
  2025. afterBouncePosition = s.minTranslate();
  2026. doBounce = true;
  2027. allowMomentumBounce = true;
  2028. } else {
  2029. newPosition = s.minTranslate();
  2030. }
  2031. } else if (s.params.freeModeSticky) {
  2032. var j = 0,
  2033. nextSlide;
  2034. for (j = 0; j < s.snapGrid.length; j += 1) {
  2035. if (s.snapGrid[j] > -newPosition) {
  2036. nextSlide = j;
  2037. break;
  2038. }
  2039. }
  2040. if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {
  2041. newPosition = s.snapGrid[nextSlide];
  2042. } else {
  2043. newPosition = s.snapGrid[nextSlide - 1];
  2044. }
  2045. if (!s.rtl) newPosition = -newPosition;
  2046. }
  2047. //Fix duration
  2048. if (s.velocity !== 0) {
  2049. if (s.rtl) {
  2050. momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);
  2051. } else {
  2052. momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
  2053. }
  2054. } else if (s.params.freeModeSticky) {
  2055. s.slideReset();
  2056. return;
  2057. }
  2058. if (s.params.freeModeMomentumBounce && doBounce) {
  2059. s.updateProgress(afterBouncePosition);
  2060. s.setWrapperTransition(momentumDuration);
  2061. s.setWrapperTranslate(newPosition);
  2062. s.onTransitionStart();
  2063. s.animating = true;
  2064. s.wrapper.transitionEnd(function () {
  2065. if (!s || !allowMomentumBounce) return;
  2066. s.emit('onMomentumBounce', s);
  2067. s.setWrapperTransition(s.params.speed);
  2068. s.setWrapperTranslate(afterBouncePosition);
  2069. s.wrapper.transitionEnd(function () {
  2070. if (!s) return;
  2071. s.onTransitionEnd();
  2072. });
  2073. });
  2074. } else if (s.velocity) {
  2075. s.updateProgress(newPosition);
  2076. s.setWrapperTransition(momentumDuration);
  2077. s.setWrapperTranslate(newPosition);
  2078. s.onTransitionStart();
  2079. if (!s.animating) {
  2080. s.animating = true;
  2081. s.wrapper.transitionEnd(function () {
  2082. if (!s) return;
  2083. s.onTransitionEnd();
  2084. });
  2085. }
  2086. } else {
  2087. s.updateProgress(newPosition);
  2088. }
  2089. s.updateActiveIndex();
  2090. }
  2091. if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {
  2092. s.updateProgress();
  2093. s.updateActiveIndex();
  2094. }
  2095. return;
  2096. }
  2097. // Find current slide
  2098. var i,
  2099. stopIndex = 0,
  2100. groupSize = s.slidesSizesGrid[0];
  2101. for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {
  2102. if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {
  2103. if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {
  2104. stopIndex = i;
  2105. groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];
  2106. }
  2107. } else {
  2108. if (currentPos >= s.slidesGrid[i]) {
  2109. stopIndex = i;
  2110. groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];
  2111. }
  2112. }
  2113. }
  2114. // Find current slide size
  2115. var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;
  2116. if (timeDiff > s.params.longSwipesMs) {
  2117. // Long touches
  2118. if (!s.params.longSwipes) {
  2119. s.slideTo(s.activeIndex);
  2120. return;
  2121. }
  2122. if (s.swipeDirection === 'next') {
  2123. if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);else s.slideTo(stopIndex);
  2124. }
  2125. if (s.swipeDirection === 'prev') {
  2126. if (ratio > 1 - s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);else s.slideTo(stopIndex);
  2127. }
  2128. } else {
  2129. // Short swipes
  2130. if (!s.params.shortSwipes) {
  2131. s.slideTo(s.activeIndex);
  2132. return;
  2133. }
  2134. if (s.swipeDirection === 'next') {
  2135. s.slideTo(stopIndex + s.params.slidesPerGroup);
  2136. }
  2137. if (s.swipeDirection === 'prev') {
  2138. s.slideTo(stopIndex);
  2139. }
  2140. }
  2141. };
  2142. /*=========================
  2143. Transitions
  2144. ===========================*/
  2145. s._slideTo = function (slideIndex, speed) {
  2146. return s.slideTo(slideIndex, speed, true, true);
  2147. };
  2148. s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
  2149. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2150. if (typeof slideIndex === 'undefined') slideIndex = 0;
  2151. if (slideIndex < 0) slideIndex = 0;
  2152. s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);
  2153. if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;
  2154. var translate = -s.snapGrid[s.snapIndex];
  2155. // Stop autoplay
  2156. if (s.params.autoplay && s.autoplaying) {
  2157. if (internal || !s.params.autoplayDisableOnInteraction) {
  2158. s.pauseAutoplay(speed);
  2159. } else {
  2160. s.stopAutoplay();
  2161. }
  2162. }
  2163. // Update progress
  2164. s.updateProgress(translate);
  2165. // Normalize slideIndex
  2166. if (s.params.normalizeSlideIndex) {
  2167. for (var i = 0; i < s.slidesGrid.length; i++) {
  2168. if (-Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {
  2169. slideIndex = i;
  2170. }
  2171. }
  2172. }
  2173. // Directions locks
  2174. if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {
  2175. return false;
  2176. }
  2177. if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {
  2178. if ((s.activeIndex || 0) !== slideIndex) return false;
  2179. }
  2180. // Update Index
  2181. if (typeof speed === 'undefined') speed = s.params.speed;
  2182. s.previousIndex = s.activeIndex || 0;
  2183. s.activeIndex = slideIndex;
  2184. s.updateRealIndex();
  2185. if (s.rtl && -translate === s.translate || !s.rtl && translate === s.translate) {
  2186. // Update Height
  2187. if (s.params.autoHeight) {
  2188. s.updateAutoHeight();
  2189. }
  2190. s.updateClasses();
  2191. if (s.params.effect !== 'slide') {
  2192. s.setWrapperTranslate(translate);
  2193. }
  2194. return false;
  2195. }
  2196. s.updateClasses();
  2197. s.onTransitionStart(runCallbacks);
  2198. if (speed === 0 || s.browser.lteIE9) {
  2199. s.setWrapperTranslate(translate);
  2200. s.setWrapperTransition(0);
  2201. s.onTransitionEnd(runCallbacks);
  2202. } else {
  2203. s.setWrapperTranslate(translate);
  2204. s.setWrapperTransition(speed);
  2205. if (!s.animating) {
  2206. s.animating = true;
  2207. s.wrapper.transitionEnd(function () {
  2208. if (!s) return;
  2209. s.onTransitionEnd(runCallbacks);
  2210. });
  2211. }
  2212. }
  2213. return true;
  2214. };
  2215. s.onTransitionStart = function (runCallbacks) {
  2216. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2217. if (s.params.autoHeight) {
  2218. s.updateAutoHeight();
  2219. }
  2220. if (s.lazy) s.lazy.onTransitionStart();
  2221. if (runCallbacks) {
  2222. s.emit('onTransitionStart', s);
  2223. if (s.activeIndex !== s.previousIndex) {
  2224. s.emit('onSlideChangeStart', s);
  2225. if (s.activeIndex > s.previousIndex) {
  2226. s.emit('onSlideNextStart', s);
  2227. } else {
  2228. s.emit('onSlidePrevStart', s);
  2229. }
  2230. }
  2231. }
  2232. };
  2233. s.onTransitionEnd = function (runCallbacks) {
  2234. s.animating = false;
  2235. s.setWrapperTransition(0);
  2236. if (typeof runCallbacks === 'undefined') runCallbacks = true;
  2237. if (s.lazy) s.lazy.onTransitionEnd();
  2238. if (runCallbacks) {
  2239. s.emit('onTransitionEnd', s);
  2240. if (s.activeIndex !== s.previousIndex) {
  2241. s.emit('onSlideChangeEnd', s);
  2242. if (s.activeIndex > s.previousIndex) {
  2243. s.emit('onSlideNextEnd', s);
  2244. } else {
  2245. s.emit('onSlidePrevEnd', s);
  2246. }
  2247. }
  2248. }
  2249. if (s.params.history && s.history) {
  2250. s.history.setHistory(s.params.history, s.activeIndex);
  2251. }
  2252. if (s.params.hashnav && s.hashnav) {
  2253. s.hashnav.setHash();
  2254. }
  2255. };
  2256. s.slideNext = function (runCallbacks, speed, internal) {
  2257. if (s.params.loop) {
  2258. if (s.animating) return false;
  2259. s.fixLoop();
  2260. var clientLeft = s.container[0].clientLeft;
  2261. return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
  2262. } else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
  2263. };
  2264. s._slideNext = function (speed) {
  2265. return s.slideNext(true, speed, true);
  2266. };
  2267. s.slidePrev = function (runCallbacks, speed, internal) {
  2268. if (s.params.loop) {
  2269. if (s.animating) return false;
  2270. s.fixLoop();
  2271. var clientLeft = s.container[0].clientLeft;
  2272. return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
  2273. } else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
  2274. };
  2275. s._slidePrev = function (speed) {
  2276. return s.slidePrev(true, speed, true);
  2277. };
  2278. s.slideReset = function (runCallbacks, speed, internal) {
  2279. return s.slideTo(s.activeIndex, speed, runCallbacks);
  2280. };
  2281. s.disableTouchControl = function () {
  2282. s.params.onlyExternal = true;
  2283. return true;
  2284. };
  2285. s.enableTouchControl = function () {
  2286. s.params.onlyExternal = false;
  2287. return true;
  2288. };
  2289. /*=========================
  2290. Translate/transition helpers
  2291. ===========================*/
  2292. s.setWrapperTransition = function (duration, byController) {
  2293. s.wrapper.transition(duration);
  2294. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  2295. s.effects[s.params.effect].setTransition(duration);
  2296. }
  2297. if (s.params.parallax && s.parallax) {
  2298. s.parallax.setTransition(duration);
  2299. }
  2300. if (s.params.scrollbar && s.scrollbar) {
  2301. s.scrollbar.setTransition(duration);
  2302. }
  2303. if (s.params.control && s.controller) {
  2304. s.controller.setTransition(duration, byController);
  2305. }
  2306. s.emit('onSetTransition', s, duration);
  2307. };
  2308. s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {
  2309. var x = 0,
  2310. y = 0,
  2311. z = 0;
  2312. if (s.isHorizontal()) {
  2313. x = s.rtl ? -translate : translate;
  2314. } else {
  2315. y = translate;
  2316. }
  2317. if (s.params.roundLengths) {
  2318. x = round(x);
  2319. y = round(y);
  2320. }
  2321. if (!s.params.virtualTranslate) {
  2322. if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');
  2323. }
  2324. s.translate = s.isHorizontal() ? x : y;
  2325. // Check if we need to update progress
  2326. var progress;
  2327. var translatesDiff = s.maxTranslate() - s.minTranslate();
  2328. if (translatesDiff === 0) {
  2329. progress = 0;
  2330. } else {
  2331. progress = (translate - s.minTranslate()) / translatesDiff;
  2332. }
  2333. if (progress !== s.progress) {
  2334. s.updateProgress(translate);
  2335. }
  2336. if (updateActiveIndex) s.updateActiveIndex();
  2337. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  2338. s.effects[s.params.effect].setTranslate(s.translate);
  2339. }
  2340. if (s.params.parallax && s.parallax) {
  2341. s.parallax.setTranslate(s.translate);
  2342. }
  2343. if (s.params.scrollbar && s.scrollbar) {
  2344. s.scrollbar.setTranslate(s.translate);
  2345. }
  2346. if (s.params.control && s.controller) {
  2347. s.controller.setTranslate(s.translate, byController);
  2348. }
  2349. s.emit('onSetTranslate', s, s.translate);
  2350. };
  2351. s.getTranslate = function (el, axis) {
  2352. var matrix, curTransform, curStyle, transformMatrix;
  2353. // automatic axis detection
  2354. if (typeof axis === 'undefined') {
  2355. axis = 'x';
  2356. }
  2357. if (s.params.virtualTranslate) {
  2358. return s.rtl ? -s.translate : s.translate;
  2359. }
  2360. //console.log(el)
  2361. curStyle = window.getComputedStyle(el, null);
  2362. if (window.WebKitCSSMatrix) {
  2363. curTransform = curStyle.transform || curStyle.webkitTransform;
  2364. if (curTransform.split(',').length > 6) {
  2365. curTransform = curTransform.split(', ').map(function (a) {
  2366. return a.replace(',', '.');
  2367. }).join(', ');
  2368. }
  2369. // Some old versions of Webkit choke when 'none' is passed; pass
  2370. // empty string instead in this case
  2371. transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
  2372. } else {
  2373. transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
  2374. matrix = transformMatrix.toString().split(',');
  2375. }
  2376. if (axis === 'x') {
  2377. //Latest Chrome and webkits Fix
  2378. if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
  2379. //Crazy IE10 Matrix
  2380. else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
  2381. //Normal Browsers
  2382. else curTransform = parseFloat(matrix[4]);
  2383. }
  2384. if (axis === 'y') {
  2385. //Latest Chrome and webkits Fix
  2386. if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
  2387. //Crazy IE10 Matrix
  2388. else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
  2389. //Normal Browsers
  2390. else curTransform = parseFloat(matrix[5]);
  2391. }
  2392. if (s.rtl && curTransform) curTransform = -curTransform;
  2393. return curTransform || 0;
  2394. };
  2395. s.getWrapperTranslate = function (axis) {
  2396. if (typeof axis === 'undefined') {
  2397. axis = s.isHorizontal() ? 'x' : 'y';
  2398. }
  2399. return s.getTranslate(s.wrapper[0], axis);
  2400. };
  2401. /*=========================
  2402. Observer
  2403. ===========================*/
  2404. s.observers = [];
  2405. function initObserver(target, options) {
  2406. options = options || {};
  2407. // create an observer instance
  2408. var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
  2409. var observer = new ObserverFunc(function (mutations) {
  2410. mutations.forEach(function (mutation) {
  2411. s.onResize(true);
  2412. s.emit('onObserverUpdate', s, mutation);
  2413. });
  2414. });
  2415. observer.observe(target, {
  2416. attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
  2417. childList: typeof options.childList === 'undefined' ? true : options.childList,
  2418. characterData: typeof options.characterData === 'undefined' ? true : options.characterData
  2419. });
  2420. s.observers.push(observer);
  2421. }
  2422. s.initObservers = function () {
  2423. if (s.params.observeParents) {
  2424. var containerParents = s.container.parents();
  2425. for (var i = 0; i < containerParents.length; i++) {
  2426. initObserver(containerParents[i]);
  2427. }
  2428. }
  2429. // Observe container
  2430. initObserver(s.container[0], { childList: false });
  2431. // Observe wrapper
  2432. initObserver(s.wrapper[0], { attributes: false });
  2433. };
  2434. s.disconnectObservers = function () {
  2435. for (var i = 0; i < s.observers.length; i++) {
  2436. s.observers[i].disconnect();
  2437. }
  2438. s.observers = [];
  2439. };
  2440. /*=========================
  2441. Loop
  2442. ===========================*/
  2443. // Create looped slides
  2444. s.createLoop = function () {
  2445. // Remove duplicated slides
  2446. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
  2447. var slides = s.wrapper.children('.' + s.params.slideClass);
  2448. if (s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length;
  2449. s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);
  2450. s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;
  2451. if (s.loopedSlides > slides.length) {
  2452. s.loopedSlides = slides.length;
  2453. }
  2454. var prependSlides = [],
  2455. appendSlides = [],
  2456. i;
  2457. slides.each(function (index, el) {
  2458. var slide = $(this);
  2459. if (index < s.loopedSlides) appendSlides.push(el);
  2460. if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);
  2461. slide.attr('data-swiper-slide-index', index);
  2462. });
  2463. for (i = 0; i < appendSlides.length; i++) {
  2464. s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
  2465. }
  2466. for (i = prependSlides.length - 1; i >= 0; i--) {
  2467. s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
  2468. }
  2469. };
  2470. s.destroyLoop = function () {
  2471. s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
  2472. s.slides.removeAttr('data-swiper-slide-index');
  2473. };
  2474. s.reLoop = function (updatePosition) {
  2475. var oldIndex = s.activeIndex - s.loopedSlides;
  2476. s.destroyLoop();
  2477. s.createLoop();
  2478. s.updateSlidesSize();
  2479. if (updatePosition) {
  2480. s.slideTo(oldIndex + s.loopedSlides, 0, false);
  2481. }
  2482. };
  2483. s.fixLoop = function () {
  2484. var newIndex;
  2485. //Fix For Negative Oversliding
  2486. if (s.activeIndex < s.loopedSlides) {
  2487. newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;
  2488. newIndex = newIndex + s.loopedSlides;
  2489. s.slideTo(newIndex, 0, false, true);
  2490. }
  2491. //Fix For Positive Oversliding
  2492. else if (s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2 || s.activeIndex > s.slides.length - s.params.slidesPerView * 2) {
  2493. newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;
  2494. newIndex = newIndex + s.loopedSlides;
  2495. s.slideTo(newIndex, 0, false, true);
  2496. }
  2497. };
  2498. /*=========================
  2499. Append/Prepend/Remove Slides
  2500. ===========================*/
  2501. s.appendSlide = function (slides) {
  2502. if (s.params.loop) {
  2503. s.destroyLoop();
  2504. }
  2505. if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
  2506. for (var i = 0; i < slides.length; i++) {
  2507. if (slides[i]) s.wrapper.append(slides[i]);
  2508. }
  2509. } else {
  2510. s.wrapper.append(slides);
  2511. }
  2512. if (s.params.loop) {
  2513. s.createLoop();
  2514. }
  2515. if (!(s.params.observer && s.support.observer)) {
  2516. s.update(true);
  2517. }
  2518. };
  2519. s.prependSlide = function (slides) {
  2520. if (s.params.loop) {
  2521. s.destroyLoop();
  2522. }
  2523. var newActiveIndex = s.activeIndex + 1;
  2524. if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
  2525. for (var i = 0; i < slides.length; i++) {
  2526. if (slides[i]) s.wrapper.prepend(slides[i]);
  2527. }
  2528. newActiveIndex = s.activeIndex + slides.length;
  2529. } else {
  2530. s.wrapper.prepend(slides);
  2531. }
  2532. if (s.params.loop) {
  2533. s.createLoop();
  2534. }
  2535. if (!(s.params.observer && s.support.observer)) {
  2536. s.update(true);
  2537. }
  2538. s.slideTo(newActiveIndex, 0, false);
  2539. };
  2540. s.removeSlide = function (slidesIndexes) {
  2541. if (s.params.loop) {
  2542. s.destroyLoop();
  2543. s.slides = s.wrapper.children('.' + s.params.slideClass);
  2544. }
  2545. var newActiveIndex = s.activeIndex,
  2546. indexToRemove;
  2547. if ((typeof slidesIndexes === 'undefined' ? 'undefined' : _typeof(slidesIndexes)) === 'object' && slidesIndexes.length) {
  2548. for (var i = 0; i < slidesIndexes.length; i++) {
  2549. indexToRemove = slidesIndexes[i];
  2550. if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
  2551. if (indexToRemove < newActiveIndex) newActiveIndex--;
  2552. }
  2553. newActiveIndex = Math.max(newActiveIndex, 0);
  2554. } else {
  2555. indexToRemove = slidesIndexes;
  2556. if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
  2557. if (indexToRemove < newActiveIndex) newActiveIndex--;
  2558. newActiveIndex = Math.max(newActiveIndex, 0);
  2559. }
  2560. if (s.params.loop) {
  2561. s.createLoop();
  2562. }
  2563. if (!(s.params.observer && s.support.observer)) {
  2564. s.update(true);
  2565. }
  2566. if (s.params.loop) {
  2567. s.slideTo(newActiveIndex + s.loopedSlides, 0, false);
  2568. } else {
  2569. s.slideTo(newActiveIndex, 0, false);
  2570. }
  2571. };
  2572. s.removeAllSlides = function () {
  2573. var slidesIndexes = [];
  2574. for (var i = 0; i < s.slides.length; i++) {
  2575. slidesIndexes.push(i);
  2576. }
  2577. s.removeSlide(slidesIndexes);
  2578. };
  2579. /*=========================
  2580. Effects
  2581. ===========================*/
  2582. s.effects = {
  2583. fade: {
  2584. setTranslate: function setTranslate() {
  2585. for (var i = 0; i < s.slides.length; i++) {
  2586. var slide = s.slides.eq(i);
  2587. var offset = slide[0].swiperSlideOffset;
  2588. var tx = -offset;
  2589. if (!s.params.virtualTranslate) tx = tx - s.translate;
  2590. var ty = 0;
  2591. if (!s.isHorizontal()) {
  2592. ty = tx;
  2593. tx = 0;
  2594. }
  2595. var slideOpacity = s.params.fade.crossFade ? Math.max(1 - Math.abs(slide[0].progress), 0) : 1 + Math.min(Math.max(slide[0].progress, -1), 0);
  2596. slide.css({
  2597. opacity: slideOpacity
  2598. }).transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');
  2599. }
  2600. },
  2601. setTransition: function setTransition(duration) {
  2602. s.slides.transition(duration);
  2603. if (s.params.virtualTranslate && duration !== 0) {
  2604. var eventTriggered = false;
  2605. s.slides.transitionEnd(function () {
  2606. if (eventTriggered) return;
  2607. if (!s) return;
  2608. eventTriggered = true;
  2609. s.animating = false;
  2610. var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
  2611. for (var i = 0; i < triggerEvents.length; i++) {
  2612. s.wrapper.trigger(triggerEvents[i]);
  2613. }
  2614. });
  2615. }
  2616. }
  2617. },
  2618. flip: {
  2619. setTranslate: function setTranslate() {
  2620. for (var i = 0; i < s.slides.length; i++) {
  2621. var slide = s.slides.eq(i);
  2622. var progress = slide[0].progress;
  2623. if (s.params.flip.limitRotation) {
  2624. progress = Math.max(Math.min(slide[0].progress, 1), -1);
  2625. }
  2626. var offset = slide[0].swiperSlideOffset;
  2627. var rotate = -180 * progress,
  2628. rotateY = rotate,
  2629. rotateX = 0,
  2630. tx = -offset,
  2631. ty = 0;
  2632. if (!s.isHorizontal()) {
  2633. ty = tx;
  2634. tx = 0;
  2635. rotateX = -rotateY;
  2636. rotateY = 0;
  2637. } else if (s.rtl) {
  2638. rotateY = -rotateY;
  2639. }
  2640. slide[0].style.zIndex = -Math.abs(Math.round(progress)) + s.slides.length;
  2641. if (s.params.flip.slideShadows) {
  2642. //Set shadows
  2643. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2644. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2645. if (shadowBefore.length === 0) {
  2646. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2647. slide.append(shadowBefore);
  2648. }
  2649. if (shadowAfter.length === 0) {
  2650. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2651. slide.append(shadowAfter);
  2652. }
  2653. if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
  2654. if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
  2655. }
  2656. slide.transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');
  2657. }
  2658. },
  2659. setTransition: function setTransition(duration) {
  2660. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2661. if (s.params.virtualTranslate && duration !== 0) {
  2662. var eventTriggered = false;
  2663. s.slides.eq(s.activeIndex).transitionEnd(function () {
  2664. if (eventTriggered) return;
  2665. if (!s) return;
  2666. if (!$(this).hasClass(s.params.slideActiveClass)) return;
  2667. eventTriggered = true;
  2668. s.animating = false;
  2669. var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
  2670. for (var i = 0; i < triggerEvents.length; i++) {
  2671. s.wrapper.trigger(triggerEvents[i]);
  2672. }
  2673. });
  2674. }
  2675. }
  2676. },
  2677. cube: {
  2678. setTranslate: function setTranslate() {
  2679. var wrapperRotate = 0,
  2680. cubeShadow;
  2681. if (s.params.cube.shadow) {
  2682. if (s.isHorizontal()) {
  2683. cubeShadow = s.wrapper.find('.swiper-cube-shadow');
  2684. if (cubeShadow.length === 0) {
  2685. cubeShadow = $('<div class="swiper-cube-shadow"></div>');
  2686. s.wrapper.append(cubeShadow);
  2687. }
  2688. cubeShadow.css({ height: s.width + 'px' });
  2689. } else {
  2690. cubeShadow = s.container.find('.swiper-cube-shadow');
  2691. if (cubeShadow.length === 0) {
  2692. cubeShadow = $('<div class="swiper-cube-shadow"></div>');
  2693. s.container.append(cubeShadow);
  2694. }
  2695. }
  2696. }
  2697. for (var i = 0; i < s.slides.length; i++) {
  2698. var slide = s.slides.eq(i);
  2699. var slideAngle = i * 90;
  2700. var round = Math.floor(slideAngle / 360);
  2701. if (s.rtl) {
  2702. slideAngle = -slideAngle;
  2703. round = Math.floor(-slideAngle / 360);
  2704. }
  2705. var progress = Math.max(Math.min(slide[0].progress, 1), -1);
  2706. var tx = 0,
  2707. ty = 0,
  2708. tz = 0;
  2709. if (i % 4 === 0) {
  2710. tx = -round * 4 * s.size;
  2711. tz = 0;
  2712. } else if ((i - 1) % 4 === 0) {
  2713. tx = 0;
  2714. tz = -round * 4 * s.size;
  2715. } else if ((i - 2) % 4 === 0) {
  2716. tx = s.size + round * 4 * s.size;
  2717. tz = s.size;
  2718. } else if ((i - 3) % 4 === 0) {
  2719. tx = -s.size;
  2720. tz = 3 * s.size + s.size * 4 * round;
  2721. }
  2722. if (s.rtl) {
  2723. tx = -tx;
  2724. }
  2725. if (!s.isHorizontal()) {
  2726. ty = tx;
  2727. tx = 0;
  2728. }
  2729. var transform = 'rotateX(' + (s.isHorizontal() ? 0 : -slideAngle) + 'deg) rotateY(' + (s.isHorizontal() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
  2730. if (progress <= 1 && progress > -1) {
  2731. wrapperRotate = i * 90 + progress * 90;
  2732. if (s.rtl) wrapperRotate = -i * 90 - progress * 90;
  2733. }
  2734. slide.transform(transform);
  2735. if (s.params.cube.slideShadows) {
  2736. //Set shadows
  2737. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2738. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2739. if (shadowBefore.length === 0) {
  2740. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2741. slide.append(shadowBefore);
  2742. }
  2743. if (shadowAfter.length === 0) {
  2744. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2745. slide.append(shadowAfter);
  2746. }
  2747. if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
  2748. if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
  2749. }
  2750. }
  2751. s.wrapper.css({
  2752. '-webkit-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2753. '-moz-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2754. '-ms-transform-origin': '50% 50% -' + s.size / 2 + 'px',
  2755. 'transform-origin': '50% 50% -' + s.size / 2 + 'px'
  2756. });
  2757. if (s.params.cube.shadow) {
  2758. if (s.isHorizontal()) {
  2759. cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + -s.width / 2 + 'px) rotateX(90deg) rotateZ(0deg) scale(' + s.params.cube.shadowScale + ')');
  2760. } else {
  2761. var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
  2762. var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
  2763. var scale1 = s.params.cube.shadowScale,
  2764. scale2 = s.params.cube.shadowScale / multiplier,
  2765. offset = s.params.cube.shadowOffset;
  2766. cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + -s.height / 2 / scale2 + 'px) rotateX(-90deg)');
  2767. }
  2768. }
  2769. var zFactor = s.isSafari || s.isUiWebView ? -s.size / 2 : 0;
  2770. s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (s.isHorizontal() ? 0 : wrapperRotate) + 'deg) rotateY(' + (s.isHorizontal() ? -wrapperRotate : 0) + 'deg)');
  2771. },
  2772. setTransition: function setTransition(duration) {
  2773. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2774. if (s.params.cube.shadow && !s.isHorizontal()) {
  2775. s.container.find('.swiper-cube-shadow').transition(duration);
  2776. }
  2777. }
  2778. },
  2779. coverflow: {
  2780. setTranslate: function setTranslate() {
  2781. var transform = s.translate;
  2782. var center = s.isHorizontal() ? -transform + s.width / 2 : -transform + s.height / 2;
  2783. var rotate = s.isHorizontal() ? s.params.coverflow.rotate : -s.params.coverflow.rotate;
  2784. var translate = s.params.coverflow.depth;
  2785. //Each slide offset from center
  2786. for (var i = 0, length = s.slides.length; i < length; i++) {
  2787. var slide = s.slides.eq(i);
  2788. var slideSize = s.slidesSizesGrid[i];
  2789. var slideOffset = slide[0].swiperSlideOffset;
  2790. var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;
  2791. var rotateY = s.isHorizontal() ? rotate * offsetMultiplier : 0;
  2792. var rotateX = s.isHorizontal() ? 0 : rotate * offsetMultiplier;
  2793. // var rotateZ = 0
  2794. var translateZ = -translate * Math.abs(offsetMultiplier);
  2795. var translateY = s.isHorizontal() ? 0 : s.params.coverflow.stretch * offsetMultiplier;
  2796. var translateX = s.isHorizontal() ? s.params.coverflow.stretch * offsetMultiplier : 0;
  2797. //Fix for ultra small values
  2798. if (Math.abs(translateX) < 0.001) translateX = 0;
  2799. if (Math.abs(translateY) < 0.001) translateY = 0;
  2800. if (Math.abs(translateZ) < 0.001) translateZ = 0;
  2801. if (Math.abs(rotateY) < 0.001) rotateY = 0;
  2802. if (Math.abs(rotateX) < 0.001) rotateX = 0;
  2803. var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';
  2804. slide.transform(slideTransform);
  2805. slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
  2806. if (s.params.coverflow.slideShadows) {
  2807. //Set shadows
  2808. var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
  2809. var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
  2810. if (shadowBefore.length === 0) {
  2811. shadowBefore = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'left' : 'top') + '"></div>');
  2812. slide.append(shadowBefore);
  2813. }
  2814. if (shadowAfter.length === 0) {
  2815. shadowAfter = $('<div class="swiper-slide-shadow-' + (s.isHorizontal() ? 'right' : 'bottom') + '"></div>');
  2816. slide.append(shadowAfter);
  2817. }
  2818. if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
  2819. if (shadowAfter.length) shadowAfter[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
  2820. }
  2821. }
  2822. //Set correct perspective for IE10
  2823. if (s.browser.ie) {
  2824. var ws = s.wrapper[0].style;
  2825. ws.perspectiveOrigin = center + 'px 50%';
  2826. }
  2827. },
  2828. setTransition: function setTransition(duration) {
  2829. s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  2830. }
  2831. }
  2832. };
  2833. /*=========================
  2834. Images Lazy Loading
  2835. ===========================*/
  2836. s.lazy = {
  2837. initialImageLoaded: false,
  2838. loadImageInSlide: function loadImageInSlide(index, loadInDuplicate) {
  2839. if (typeof index === 'undefined') return;
  2840. if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true;
  2841. if (s.slides.length === 0) return;
  2842. var slide = s.slides.eq(index);
  2843. var img = slide.find('.' + s.params.lazyLoadingClass + ':not(.' + s.params.lazyStatusLoadedClass + '):not(.' + s.params.lazyStatusLoadingClass + ')');
  2844. if (slide.hasClass(s.params.lazyLoadingClass) && !slide.hasClass(s.params.lazyStatusLoadedClass) && !slide.hasClass(s.params.lazyStatusLoadingClass)) {
  2845. img = img.add(slide[0]);
  2846. }
  2847. if (img.length === 0) return;
  2848. img.each(function () {
  2849. var _img = $(this);
  2850. _img.addClass(s.params.lazyStatusLoadingClass);
  2851. var background = _img.attr('data-background');
  2852. var src = _img.attr('data-src'),
  2853. srcset = _img.attr('data-srcset'),
  2854. sizes = _img.attr('data-sizes');
  2855. s.loadImage(_img[0], src || background, srcset, sizes, false, function () {
  2856. if (typeof s === 'undefined' || s === null || !s) return;
  2857. if (background) {
  2858. _img.css('background-image', 'url("' + background + '")');
  2859. _img.removeAttr('data-background');
  2860. } else {
  2861. if (srcset) {
  2862. _img.attr('srcset', srcset);
  2863. _img.removeAttr('data-srcset');
  2864. }
  2865. if (sizes) {
  2866. _img.attr('sizes', sizes);
  2867. _img.removeAttr('data-sizes');
  2868. }
  2869. if (src) {
  2870. _img.attr('src', src);
  2871. _img.removeAttr('data-src');
  2872. }
  2873. }
  2874. _img.addClass(s.params.lazyStatusLoadedClass).removeClass(s.params.lazyStatusLoadingClass);
  2875. slide.find('.' + s.params.lazyPreloaderClass + ', .' + s.params.preloaderClass).remove();
  2876. if (s.params.loop && loadInDuplicate) {
  2877. var slideOriginalIndex = slide.attr('data-swiper-slide-index');
  2878. if (slide.hasClass(s.params.slideDuplicateClass)) {
  2879. var originalSlide = s.wrapper.children('[data-swiper-slide-index="' + slideOriginalIndex + '"]:not(.' + s.params.slideDuplicateClass + ')');
  2880. s.lazy.loadImageInSlide(originalSlide.index(), false);
  2881. } else {
  2882. var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + slideOriginalIndex + '"]');
  2883. s.lazy.loadImageInSlide(duplicatedSlide.index(), false);
  2884. }
  2885. }
  2886. s.emit('onLazyImageReady', s, slide[0], _img[0]);
  2887. });
  2888. s.emit('onLazyImageLoad', s, slide[0], _img[0]);
  2889. });
  2890. },
  2891. load: function load() {
  2892. var i;
  2893. var slidesPerView = s.params.slidesPerView;
  2894. if (slidesPerView === 'auto') {
  2895. slidesPerView = 0;
  2896. }
  2897. if (!s.lazy.initialImageLoaded) s.lazy.initialImageLoaded = true;
  2898. if (s.params.watchSlidesVisibility) {
  2899. s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {
  2900. s.lazy.loadImageInSlide($(this).index());
  2901. });
  2902. } else {
  2903. if (slidesPerView > 1) {
  2904. for (i = s.activeIndex; i < s.activeIndex + slidesPerView; i++) {
  2905. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2906. }
  2907. } else {
  2908. s.lazy.loadImageInSlide(s.activeIndex);
  2909. }
  2910. }
  2911. if (s.params.lazyLoadingInPrevNext) {
  2912. if (slidesPerView > 1 || s.params.lazyLoadingInPrevNextAmount && s.params.lazyLoadingInPrevNextAmount > 1) {
  2913. var amount = s.params.lazyLoadingInPrevNextAmount;
  2914. var spv = slidesPerView;
  2915. var maxIndex = Math.min(s.activeIndex + spv + Math.max(amount, spv), s.slides.length);
  2916. var minIndex = Math.max(s.activeIndex - Math.max(spv, amount), 0);
  2917. // Next Slides
  2918. for (i = s.activeIndex + slidesPerView; i < maxIndex; i++) {
  2919. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2920. }
  2921. // Prev Slides
  2922. for (i = minIndex; i < s.activeIndex; i++) {
  2923. if (s.slides[i]) s.lazy.loadImageInSlide(i);
  2924. }
  2925. } else {
  2926. var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);
  2927. if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());
  2928. var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);
  2929. if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());
  2930. }
  2931. }
  2932. },
  2933. onTransitionStart: function onTransitionStart() {
  2934. if (s.params.lazyLoading) {
  2935. if (s.params.lazyLoadingOnTransitionStart || !s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded) {
  2936. s.lazy.load();
  2937. }
  2938. }
  2939. },
  2940. onTransitionEnd: function onTransitionEnd() {
  2941. if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {
  2942. s.lazy.load();
  2943. }
  2944. }
  2945. };
  2946. /*=========================
  2947. Scrollbar
  2948. ===========================*/
  2949. s.scrollbar = {
  2950. isTouched: false,
  2951. setDragPosition: function setDragPosition(e) {
  2952. var sb = s.scrollbar;
  2953. var x = 0,
  2954. y = 0;
  2955. var translate;
  2956. var pointerPosition = s.isHorizontal() ? e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX || e.clientX : e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY || e.clientY;
  2957. var position = pointerPosition - sb.track.offset()[s.isHorizontal() ? 'left' : 'top'] - sb.dragSize / 2;
  2958. var positionMin = -s.minTranslate() * sb.moveDivider;
  2959. var positionMax = -s.maxTranslate() * sb.moveDivider;
  2960. if (position < positionMin) {
  2961. position = positionMin;
  2962. } else if (position > positionMax) {
  2963. position = positionMax;
  2964. }
  2965. position = -position / sb.moveDivider;
  2966. s.updateProgress(position);
  2967. s.setWrapperTranslate(position, true);
  2968. },
  2969. dragStart: function dragStart(e) {
  2970. var sb = s.scrollbar;
  2971. sb.isTouched = true;
  2972. e.preventDefault();
  2973. e.stopPropagation();
  2974. sb.setDragPosition(e);
  2975. clearTimeout(sb.dragTimeout);
  2976. sb.track.transition(0);
  2977. if (s.params.scrollbarHide) {
  2978. sb.track.css('opacity', 1);
  2979. }
  2980. s.wrapper.transition(100);
  2981. sb.drag.transition(100);
  2982. s.emit('onScrollbarDragStart', s);
  2983. },
  2984. dragMove: function dragMove(e) {
  2985. var sb = s.scrollbar;
  2986. if (!sb.isTouched) return;
  2987. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  2988. sb.setDragPosition(e);
  2989. s.wrapper.transition(0);
  2990. sb.track.transition(0);
  2991. sb.drag.transition(0);
  2992. s.emit('onScrollbarDragMove', s);
  2993. },
  2994. dragEnd: function dragEnd(e) {
  2995. var sb = s.scrollbar;
  2996. if (!sb.isTouched) return;
  2997. sb.isTouched = false;
  2998. if (s.params.scrollbarHide) {
  2999. clearTimeout(sb.dragTimeout);
  3000. sb.dragTimeout = setTimeout(function () {
  3001. sb.track.css('opacity', 0);
  3002. sb.track.transition(400);
  3003. }, 1000);
  3004. }
  3005. s.emit('onScrollbarDragEnd', s);
  3006. if (s.params.scrollbarSnapOnRelease) {
  3007. s.slideReset();
  3008. }
  3009. },
  3010. draggableEvents: function () {
  3011. if (s.params.simulateTouch === false && !s.support.touch) return s.touchEventsDesktop;else return s.touchEvents;
  3012. }(),
  3013. enableDraggable: function enableDraggable() {
  3014. var sb = s.scrollbar;
  3015. var target = s.support.touch ? sb.track : document;
  3016. $(sb.track).on(sb.draggableEvents.start, sb.dragStart);
  3017. $(target).on(sb.draggableEvents.move, sb.dragMove);
  3018. $(target).on(sb.draggableEvents.end, sb.dragEnd);
  3019. },
  3020. disableDraggable: function disableDraggable() {
  3021. var sb = s.scrollbar;
  3022. var target = s.support.touch ? sb.track : document;
  3023. $(sb.track).off(sb.draggableEvents.start, sb.dragStart);
  3024. $(target).off(sb.draggableEvents.move, sb.dragMove);
  3025. $(target).off(sb.draggableEvents.end, sb.dragEnd);
  3026. },
  3027. set: function set() {
  3028. if (!s.params.scrollbar) return;
  3029. var sb = s.scrollbar;
  3030. sb.track = $(s.params.scrollbar);
  3031. if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
  3032. sb.track = s.container.find(s.params.scrollbar);
  3033. }
  3034. sb.drag = sb.track.find('.swiper-scrollbar-drag');
  3035. if (sb.drag.length === 0) {
  3036. sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
  3037. sb.track.append(sb.drag);
  3038. }
  3039. sb.drag[0].style.width = '';
  3040. sb.drag[0].style.height = '';
  3041. sb.trackSize = s.isHorizontal() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;
  3042. sb.divider = s.size / s.virtualSize;
  3043. sb.moveDivider = sb.divider * (sb.trackSize / s.size);
  3044. sb.dragSize = sb.trackSize * sb.divider;
  3045. if (s.isHorizontal()) {
  3046. sb.drag[0].style.width = sb.dragSize + 'px';
  3047. } else {
  3048. sb.drag[0].style.height = sb.dragSize + 'px';
  3049. }
  3050. if (sb.divider >= 1) {
  3051. sb.track[0].style.display = 'none';
  3052. } else {
  3053. sb.track[0].style.display = '';
  3054. }
  3055. if (s.params.scrollbarHide) {
  3056. sb.track[0].style.opacity = 0;
  3057. }
  3058. },
  3059. setTranslate: function setTranslate() {
  3060. if (!s.params.scrollbar) return;
  3061. var diff;
  3062. var sb = s.scrollbar;
  3063. var translate = s.translate || 0;
  3064. var newPos;
  3065. var newSize = sb.dragSize;
  3066. newPos = (sb.trackSize - sb.dragSize) * s.progress;
  3067. if (s.rtl && s.isHorizontal()) {
  3068. newPos = -newPos;
  3069. if (newPos > 0) {
  3070. newSize = sb.dragSize - newPos;
  3071. newPos = 0;
  3072. } else if (-newPos + sb.dragSize > sb.trackSize) {
  3073. newSize = sb.trackSize + newPos;
  3074. }
  3075. } else {
  3076. if (newPos < 0) {
  3077. newSize = sb.dragSize + newPos;
  3078. newPos = 0;
  3079. } else if (newPos + sb.dragSize > sb.trackSize) {
  3080. newSize = sb.trackSize - newPos;
  3081. }
  3082. }
  3083. if (s.isHorizontal()) {
  3084. if (s.support.transforms3d) {
  3085. sb.drag.transform('translate3d(' + newPos + 'px, 0, 0)');
  3086. } else {
  3087. sb.drag.transform('translateX(' + newPos + 'px)');
  3088. }
  3089. sb.drag[0].style.width = newSize + 'px';
  3090. } else {
  3091. if (s.support.transforms3d) {
  3092. sb.drag.transform('translate3d(0px, ' + newPos + 'px, 0)');
  3093. } else {
  3094. sb.drag.transform('translateY(' + newPos + 'px)');
  3095. }
  3096. sb.drag[0].style.height = newSize + 'px';
  3097. }
  3098. if (s.params.scrollbarHide) {
  3099. clearTimeout(sb.timeout);
  3100. sb.track[0].style.opacity = 1;
  3101. sb.timeout = setTimeout(function () {
  3102. sb.track[0].style.opacity = 0;
  3103. sb.track.transition(400);
  3104. }, 1000);
  3105. }
  3106. },
  3107. setTransition: function setTransition(duration) {
  3108. if (!s.params.scrollbar) return;
  3109. s.scrollbar.drag.transition(duration);
  3110. }
  3111. };
  3112. /*=========================
  3113. Controller
  3114. ===========================*/
  3115. s.controller = {
  3116. LinearSpline: function LinearSpline(x, y) {
  3117. var binarySearch = function () {
  3118. var maxIndex, minIndex, guess;
  3119. return function (array, val) {
  3120. minIndex = -1;
  3121. maxIndex = array.length;
  3122. while (maxIndex - minIndex > 1) {
  3123. if (array[guess = maxIndex + minIndex >> 1] <= val) {
  3124. minIndex = guess;
  3125. } else {
  3126. maxIndex = guess;
  3127. }
  3128. }return maxIndex;
  3129. };
  3130. }();
  3131. this.x = x;
  3132. this.y = y;
  3133. this.lastIndex = x.length - 1;
  3134. // Given an x value (x2), return the expected y2 value:
  3135. // (x1,y1) is the known point before given value,
  3136. // (x3,y3) is the known point after given value.
  3137. var i1, i3;
  3138. var l = this.x.length;
  3139. this.interpolate = function (x2) {
  3140. if (!x2) return 0;
  3141. // Get the indexes of x1 and x3 (the array indexes before and after given x2):
  3142. i3 = binarySearch(this.x, x2);
  3143. i1 = i3 - 1;
  3144. // We have our indexes i1 & i3, so we can calculate already:
  3145. // y2 := ((x2�x1) × (y3�y1)) ÷ (x3�x1) + y1
  3146. return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
  3147. };
  3148. },
  3149. //xxx: for now i will just save one spline function to to
  3150. getInterpolateFunction: function getInterpolateFunction(c) {
  3151. if (!s.controller.spline) s.controller.spline = s.params.loop ? new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) : new s.controller.LinearSpline(s.snapGrid, c.snapGrid);
  3152. },
  3153. setTranslate: function setTranslate(translate, byController) {
  3154. var controlled = s.params.control;
  3155. var multiplier, controlledTranslate;
  3156. function setControlledTranslate(c) {
  3157. // this will create an Interpolate function based on the snapGrids
  3158. // x is the Grid of the scrolled scroller and y will be the controlled scroller
  3159. // it makes sense to create this only once and recall it for the interpolation
  3160. // the function does a lot of value caching for performance
  3161. translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate;
  3162. if (s.params.controlBy === 'slide') {
  3163. s.controller.getInterpolateFunction(c);
  3164. // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
  3165. // but it did not work out
  3166. controlledTranslate = -s.controller.spline.interpolate(-translate);
  3167. }
  3168. console.log('3402', s.params.controlBy);
  3169. if (!controlledTranslate || s.params.controlBy === 'container') {
  3170. multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());
  3171. controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();
  3172. }
  3173. if (s.params.controlInverse) {
  3174. controlledTranslate = c.maxTranslate() - controlledTranslate;
  3175. }
  3176. c.updateProgress(controlledTranslate);
  3177. c.setWrapperTranslate(controlledTranslate, false, s);
  3178. c.updateActiveIndex();
  3179. }
  3180. if (Array.isArray(controlled)) {
  3181. for (var i = 0; i < controlled.length; i++) {
  3182. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  3183. setControlledTranslate(controlled[i]);
  3184. }
  3185. }
  3186. } else if (controlled instanceof Swiper && byController !== controlled) {
  3187. setControlledTranslate(controlled);
  3188. }
  3189. },
  3190. setTransition: function setTransition(duration, byController) {
  3191. var controlled = s.params.control;
  3192. var i;
  3193. function setControlledTransition(c) {
  3194. c.setWrapperTransition(duration, s);
  3195. if (duration !== 0) {
  3196. c.onTransitionStart();
  3197. c.wrapper.transitionEnd(function () {
  3198. if (!controlled) return;
  3199. if (c.params.loop && s.params.controlBy === 'slide') {
  3200. c.fixLoop();
  3201. }
  3202. c.onTransitionEnd();
  3203. });
  3204. }
  3205. }
  3206. if (Array.isArray(controlled)) {
  3207. for (i = 0; i < controlled.length; i++) {
  3208. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  3209. setControlledTransition(controlled[i]);
  3210. }
  3211. }
  3212. } else if (controlled instanceof Swiper && byController !== controlled) {
  3213. setControlledTransition(controlled);
  3214. }
  3215. }
  3216. };
  3217. /*=========================
  3218. Hash Navigation
  3219. ===========================*/
  3220. s.hashnav = {
  3221. onHashCange: function onHashCange(e, a) {
  3222. var newHash = document.location.hash.replace('#', '');
  3223. var activeSlideHash = s.slides.eq(s.activeIndex).attr('data-hash');
  3224. if (newHash !== activeSlideHash) {
  3225. s.slideTo(s.wrapper.children('.' + s.params.slideClass + '[data-hash="' + newHash + '"]').index());
  3226. }
  3227. },
  3228. attachEvents: function attachEvents(detach) {
  3229. var action = detach ? 'off' : 'on';
  3230. $(window)[action]('hashchange', s.hashnav.onHashCange);
  3231. },
  3232. setHash: function setHash() {
  3233. if (!s.hashnav.initialized || !s.params.hashnav) return;
  3234. if (s.params.replaceState && window.history && window.history.replaceState) {
  3235. window.history.replaceState(null, null, '#' + s.slides.eq(s.activeIndex).attr('data-hash') || '');
  3236. } else {
  3237. var slide = s.slides.eq(s.activeIndex);
  3238. var hash = slide.attr('data-hash') || slide.attr('data-history');
  3239. document.location.hash = hash || '';
  3240. }
  3241. },
  3242. init: function init() {
  3243. if (!s.params.hashnav || s.params.history) return;
  3244. s.hashnav.initialized = true;
  3245. var hash = document.location.hash.replace('#', '');
  3246. if (hash) {
  3247. var speed = 0;
  3248. for (var i = 0, length = s.slides.length; i < length; i++) {
  3249. var slide = s.slides.eq(i);
  3250. var slideHash = slide.attr('data-hash') || slide.attr('data-history');
  3251. if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) {
  3252. var index = slide.index();
  3253. s.slideTo(index, speed, s.params.runCallbacksOnInit, true);
  3254. }
  3255. }
  3256. }
  3257. if (s.params.hashnavWatchState) s.hashnav.attachEvents();
  3258. },
  3259. destroy: function destroy() {
  3260. if (s.params.hashnavWatchState) s.hashnav.attachEvents(true);
  3261. }
  3262. };
  3263. /*=========================
  3264. History Api with fallback to Hashnav
  3265. ===========================*/
  3266. s.history = {
  3267. init: function init() {
  3268. if (!s.params.history) return;
  3269. if (!window.history || !window.history.pushState) {
  3270. s.params.history = false;
  3271. s.params.hashnav = true;
  3272. return;
  3273. }
  3274. s.history.initialized = true;
  3275. this.paths = this.getPathValues();
  3276. if (!this.paths.key && !this.paths.value) return;
  3277. this.scrollToSlide(0, this.paths.value, s.params.runCallbacksOnInit);
  3278. if (!s.params.replaceState) {
  3279. window.addEventListener('popstate', this.setHistoryPopState);
  3280. }
  3281. },
  3282. setHistoryPopState: function setHistoryPopState() {
  3283. s.history.paths = s.history.getPathValues();
  3284. s.history.scrollToSlide(s.params.speed, s.history.paths.value, false);
  3285. },
  3286. getPathValues: function getPathValues() {
  3287. var pathArray = window.location.pathname.slice(1).split('/');
  3288. var total = pathArray.length;
  3289. var key = pathArray[total - 2];
  3290. var value = pathArray[total - 1];
  3291. return { key: key, value: value };
  3292. },
  3293. setHistory: function setHistory(key, index) {
  3294. if (!s.history.initialized || !s.params.history) return;
  3295. var slide = s.slides.eq(index);
  3296. var value = this.slugify(slide.attr('data-history'));
  3297. if (!window.location.pathname.includes(key)) {
  3298. value = key + '/' + value;
  3299. }
  3300. if (s.params.replaceState) {
  3301. window.history.replaceState(null, null, value);
  3302. } else {
  3303. window.history.pushState(null, null, value);
  3304. }
  3305. },
  3306. slugify: function slugify(text) {
  3307. return text.toString().toLowerCase().replace(/\s+/g, '-').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
  3308. },
  3309. scrollToSlide: function scrollToSlide(speed, value, runCallbacks) {
  3310. if (value) {
  3311. for (var i = 0, length = s.slides.length; i < length; i++) {
  3312. var slide = s.slides.eq(i);
  3313. var slideHistory = this.slugify(slide.attr('data-history'));
  3314. if (slideHistory === value && !slide.hasClass(s.params.slideDuplicateClass)) {
  3315. var index = slide.index();
  3316. s.slideTo(index, speed, runCallbacks);
  3317. }
  3318. }
  3319. } else {
  3320. s.slideTo(0, speed, runCallbacks);
  3321. }
  3322. }
  3323. };
  3324. /*=========================
  3325. Keyboard Control
  3326. ===========================*/
  3327. function handleKeyboard(e) {
  3328. if (e.originalEvent) e = e.originalEvent; //jquery fix
  3329. var kc = e.keyCode || e.charCode;
  3330. // Directions locks
  3331. if (!s.params.allowSwipeToNext && (s.isHorizontal() && kc === 39 || !s.isHorizontal() && kc === 40)) {
  3332. return false;
  3333. }
  3334. if (!s.params.allowSwipeToPrev && (s.isHorizontal() && kc === 37 || !s.isHorizontal() && kc === 38)) {
  3335. return false;
  3336. }
  3337. if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
  3338. return;
  3339. }
  3340. if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
  3341. return;
  3342. }
  3343. if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
  3344. var inView = false;
  3345. //Check that swiper should be inside of visible area of window
  3346. if (s.container.parents('.' + s.params.slideClass).length > 0 && s.container.parents('.' + s.params.slideActiveClass).length === 0) {
  3347. return;
  3348. }
  3349. var windowScroll = {
  3350. left: window.pageXOffset,
  3351. top: window.pageYOffset
  3352. };
  3353. var windowWidth = window.innerWidth;
  3354. var windowHeight = window.innerHeight;
  3355. var swiperOffset = s.container.offset();
  3356. if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;
  3357. var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + s.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + s.height], [swiperOffset.left + s.width, swiperOffset.top + s.height]];
  3358. for (var i = 0; i < swiperCoord.length; i++) {
  3359. var point = swiperCoord[i];
  3360. if (point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth && point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight) {
  3361. inView = true;
  3362. }
  3363. }
  3364. if (!inView) return;
  3365. }
  3366. if (s.isHorizontal()) {
  3367. if (kc === 37 || kc === 39) {
  3368. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3369. }
  3370. if (kc === 39 && !s.rtl || kc === 37 && s.rtl) s.slideNext();
  3371. if (kc === 37 && !s.rtl || kc === 39 && s.rtl) s.slidePrev();
  3372. } else {
  3373. if (kc === 38 || kc === 40) {
  3374. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3375. }
  3376. if (kc === 40) s.slideNext();
  3377. if (kc === 38) s.slidePrev();
  3378. }
  3379. s.emit('onKeyPress', s, kc);
  3380. }
  3381. s.disableKeyboardControl = function () {
  3382. s.params.keyboardControl = false;
  3383. $(document).off('keydown', handleKeyboard);
  3384. };
  3385. s.enableKeyboardControl = function () {
  3386. s.params.keyboardControl = true;
  3387. $(document).on('keydown', handleKeyboard);
  3388. };
  3389. /*=========================
  3390. Mousewheel Control
  3391. ===========================*/
  3392. s.mousewheel = {
  3393. event: false,
  3394. lastScrollTime: new window.Date().getTime()
  3395. };
  3396. function isEventSupported() {
  3397. var eventName = 'onwheel';
  3398. var isSupported = eventName in document;
  3399. if (!isSupported) {
  3400. var element = document.createElement('div');
  3401. element.setAttribute(eventName, 'return;');
  3402. isSupported = typeof element[eventName] === 'function';
  3403. }
  3404. if (!isSupported && document.implementation && document.implementation.hasFeature &&
  3405. // always returns true in newer browsers as per the standard.
  3406. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  3407. document.implementation.hasFeature('', '') !== true) {
  3408. // This is the only way to test support for the `wheel` event in IE9+.
  3409. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  3410. }
  3411. return isSupported;
  3412. }
  3413. /**
  3414. * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is
  3415. * complicated, thus this doc is long and (hopefully) detailed enough to answer
  3416. * your questions.
  3417. *
  3418. * If you need to react to the mouse wheel in a predictable way, this code is
  3419. * like your bestest friend. * hugs *
  3420. *
  3421. * As of today, there are 4 DOM event types you can listen to:
  3422. *
  3423. * 'wheel' -- Chrome(31+), FF(17+), IE(9+)
  3424. * 'mousewheel' -- Chrome, IE(6+), Opera, Safari
  3425. * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother!
  3426. * 'DOMMouseScroll' -- FF(0.9.7+) since 2003
  3427. *
  3428. * So what to do? The is the best:
  3429. *
  3430. * normalizeWheel.getEventType();
  3431. *
  3432. * In your event callback, use this code to get sane interpretation of the
  3433. * deltas. This code will return an object with properties:
  3434. *
  3435. * spinX -- normalized spin speed (use for zoom) - x plane
  3436. * spinY -- " - y plane
  3437. * pixelX -- normalized distance (to pixels) - x plane
  3438. * pixelY -- " - y plane
  3439. *
  3440. * Wheel values are provided by the browser assuming you are using the wheel to
  3441. * scroll a web page by a number of lines or pixels (or pages). Values can vary
  3442. * significantly on different platforms and browsers, forgetting that you can
  3443. * scroll at different speeds. Some devices (like trackpads) emit more events
  3444. * at smaller increments with fine granularity, and some emit massive jumps with
  3445. * linear speed or acceleration.
  3446. *
  3447. * This code does its best to normalize the deltas for you:
  3448. *
  3449. * - spin is trying to normalize how far the wheel was spun (or trackpad
  3450. * dragged). This is super useful for zoom support where you want to
  3451. * throw away the chunky scroll steps on the PC and make those equal to
  3452. * the slow and smooth tiny steps on the Mac. Key data: This code tries to
  3453. * resolve a single slow step on a wheel to 1.
  3454. *
  3455. * - pixel is normalizing the desired scroll delta in pixel units. You'll
  3456. * get the crazy differences between browsers, but at least it'll be in
  3457. * pixels!
  3458. *
  3459. * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This
  3460. * should translate to positive value zooming IN, negative zooming OUT.
  3461. * This matches the newer 'wheel' event.
  3462. *
  3463. * Why are there spinX, spinY (or pixels)?
  3464. *
  3465. * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
  3466. * with a mouse. It results in side-scrolling in the browser by default.
  3467. *
  3468. * - spinY is what you expect -- it's the classic axis of a mouse wheel.
  3469. *
  3470. * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and
  3471. * probably is by browsers in conjunction with fancy 3D controllers .. but
  3472. * you know.
  3473. *
  3474. * Implementation info:
  3475. *
  3476. * Examples of 'wheel' event if you scroll slowly (down) by one step with an
  3477. * average mouse:
  3478. *
  3479. * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120)
  3480. * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12)
  3481. * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A)
  3482. * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120)
  3483. * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120)
  3484. *
  3485. * On the trackpad:
  3486. *
  3487. * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6)
  3488. * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A)
  3489. *
  3490. * On other/older browsers.. it's more complicated as there can be multiple and
  3491. * also missing delta values.
  3492. *
  3493. * The 'wheel' event is more standard:
  3494. *
  3495. * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
  3496. *
  3497. * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
  3498. * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain
  3499. * backward compatibility with older events. Those other values help us
  3500. * better normalize spin speed. Example of what the browsers provide:
  3501. *
  3502. * | event.wheelDelta | event.detail
  3503. * ------------------+------------------+--------------
  3504. * Safari v5/OS X | -120 | 0
  3505. * Safari v5/Win7 | -120 | 0
  3506. * Chrome v17/OS X | -120 | 0
  3507. * Chrome v17/Win7 | -120 | 0
  3508. * IE9/Win7 | -120 | undefined
  3509. * Firefox v4/OS X | undefined | 1
  3510. * Firefox v4/Win7 | undefined | 3
  3511. *
  3512. */
  3513. function normalizeWheel( /*object*/event) /*object*/{
  3514. // Reasonable defaults
  3515. var PIXEL_STEP = 10;
  3516. var LINE_HEIGHT = 40;
  3517. var PAGE_HEIGHT = 800;
  3518. var sX = 0,
  3519. sY = 0,
  3520. // spinX, spinY
  3521. pX = 0,
  3522. pY = 0; // pixelX, pixelY
  3523. // Legacy
  3524. if ('detail' in event) {
  3525. sY = event.detail;
  3526. }
  3527. if ('wheelDelta' in event) {
  3528. sY = -event.wheelDelta / 120;
  3529. }
  3530. if ('wheelDeltaY' in event) {
  3531. sY = -event.wheelDeltaY / 120;
  3532. }
  3533. if ('wheelDeltaX' in event) {
  3534. sX = -event.wheelDeltaX / 120;
  3535. }
  3536. // side scrolling on FF with DOMMouseScroll
  3537. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  3538. sX = sY;
  3539. sY = 0;
  3540. }
  3541. pX = sX * PIXEL_STEP;
  3542. pY = sY * PIXEL_STEP;
  3543. if ('deltaY' in event) {
  3544. pY = event.deltaY;
  3545. }
  3546. if ('deltaX' in event) {
  3547. pX = event.deltaX;
  3548. }
  3549. if ((pX || pY) && event.deltaMode) {
  3550. if (event.deltaMode === 1) {
  3551. // delta in LINE units
  3552. pX *= LINE_HEIGHT;
  3553. pY *= LINE_HEIGHT;
  3554. } else {
  3555. // delta in PAGE units
  3556. pX *= PAGE_HEIGHT;
  3557. pY *= PAGE_HEIGHT;
  3558. }
  3559. }
  3560. // Fall-back if spin cannot be determined
  3561. if (pX && !sX) {
  3562. sX = pX < 1 ? -1 : 1;
  3563. }
  3564. if (pY && !sY) {
  3565. sY = pY < 1 ? -1 : 1;
  3566. }
  3567. return {
  3568. spinX: sX,
  3569. spinY: sY,
  3570. pixelX: pX,
  3571. pixelY: pY
  3572. };
  3573. }
  3574. if (s.params.mousewheelControl) {
  3575. /**
  3576. * The best combination if you prefer spinX + spinY normalization. It favors
  3577. * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with
  3578. * 'wheel' event, making spin speed determination impossible.
  3579. */
  3580. s.mousewheel.event = navigator.userAgent.indexOf('firefox') > -1 ? 'DOMMouseScroll' : isEventSupported() ? 'wheel' : 'mousewheel';
  3581. }
  3582. function handleMousewheel(e) {
  3583. if (e.originalEvent) e = e.originalEvent; //jquery fix
  3584. var delta = 0;
  3585. var rtlFactor = s.rtl ? -1 : 1;
  3586. var data = normalizeWheel(e);
  3587. if (s.params.mousewheelForceToAxis) {
  3588. if (s.isHorizontal()) {
  3589. if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = data.pixelX * rtlFactor;else return;
  3590. } else {
  3591. if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = data.pixelY;else return;
  3592. }
  3593. } else {
  3594. delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;
  3595. }
  3596. if (delta === 0) return;
  3597. if (s.params.mousewheelInvert) delta = -delta;
  3598. if (!s.params.freeMode) {
  3599. if (new window.Date().getTime() - s.mousewheel.lastScrollTime > 60) {
  3600. if (delta < 0) {
  3601. if ((!s.isEnd || s.params.loop) && !s.animating) {
  3602. s.slideNext();
  3603. s.emit('onScroll', s, e);
  3604. } else if (s.params.mousewheelReleaseOnEdges) return true;
  3605. } else {
  3606. if ((!s.isBeginning || s.params.loop) && !s.animating) {
  3607. s.slidePrev();
  3608. s.emit('onScroll', s, e);
  3609. } else if (s.params.mousewheelReleaseOnEdges) return true;
  3610. }
  3611. }
  3612. s.mousewheel.lastScrollTime = new window.Date().getTime();
  3613. } else {
  3614. //Freemode or scrollContainer:
  3615. var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity;
  3616. var wasBeginning = s.isBeginning,
  3617. wasEnd = s.isEnd;
  3618. if (position >= s.minTranslate()) position = s.minTranslate();
  3619. if (position <= s.maxTranslate()) position = s.maxTranslate();
  3620. s.setWrapperTransition(0);
  3621. s.setWrapperTranslate(position);
  3622. s.updateProgress();
  3623. s.updateActiveIndex();
  3624. if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) {
  3625. s.updateClasses();
  3626. }
  3627. if (s.params.freeModeSticky) {
  3628. clearTimeout(s.mousewheel.timeout);
  3629. s.mousewheel.timeout = setTimeout(function () {
  3630. s.slideReset();
  3631. }, 300);
  3632. } else {
  3633. if (s.params.lazyLoading && s.lazy) {
  3634. s.lazy.load();
  3635. }
  3636. }
  3637. // Emit event
  3638. s.emit('onScroll', s, e);
  3639. // Stop autoplay
  3640. if (s.params.autoplay && s.params.autoplayDisableOnInteraction) s.stopAutoplay();
  3641. // Return page scroll on edge positions
  3642. if (position === 0 || position === s.maxTranslate()) return;
  3643. }
  3644. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  3645. return false;
  3646. }
  3647. s.disableMousewheelControl = function () {
  3648. if (!s.mousewheel.event) return false;
  3649. var target = s.container;
  3650. console.log('3913', s.params.mousewheelEventsTarged)
  3651. if (s.params.mousewheelEventsTarged !== 'container') {
  3652. target = $(s.params.mousewheelEventsTarged);
  3653. }
  3654. target.off(s.mousewheel.event, handleMousewheel);
  3655. s.params.mousewheelControl = false;
  3656. return true;
  3657. };
  3658. s.enableMousewheelControl = function () {
  3659. if (!s.mousewheel.event) return false;
  3660. var target = s.container;
  3661. console.log('3925', s.params.mousewheelEventsTarged)
  3662. if (s.params.mousewheelEventsTarged !== 'container') {
  3663. target = $(s.params.mousewheelEventsTarged);
  3664. }
  3665. target.on(s.mousewheel.event, handleMousewheel);
  3666. s.params.mousewheelControl = true;
  3667. return true;
  3668. };
  3669. /*=========================
  3670. Parallax
  3671. ===========================*/
  3672. function setParallaxTransform(el, progress) {
  3673. el = $(el);
  3674. var p, pX, pY;
  3675. var rtlFactor = s.rtl ? -1 : 1;
  3676. p = el.attr('data-swiper-parallax') || '0';
  3677. pX = el.attr('data-swiper-parallax-x');
  3678. pY = el.attr('data-swiper-parallax-y');
  3679. if (pX || pY) {
  3680. pX = pX || '0';
  3681. pY = pY || '0';
  3682. } else {
  3683. if (s.isHorizontal()) {
  3684. pX = p;
  3685. pY = '0';
  3686. } else {
  3687. pY = p;
  3688. pX = '0';
  3689. }
  3690. }
  3691. if (pX.indexOf('%') >= 0) {
  3692. pX = parseInt(pX, 10) * progress * rtlFactor + '%';
  3693. } else {
  3694. pX = pX * progress * rtlFactor + 'px';
  3695. }
  3696. if (pY.indexOf('%') >= 0) {
  3697. pY = parseInt(pY, 10) * progress + '%';
  3698. } else {
  3699. pY = pY * progress + 'px';
  3700. }
  3701. el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
  3702. }
  3703. s.parallax = {
  3704. setTranslate: function setTranslate() {
  3705. s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3706. setParallaxTransform(this, s.progress);
  3707. });
  3708. s.slides.each(function () {
  3709. var slide = $(this);
  3710. slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3711. var progress = Math.min(Math.max(slide[0].progress, -1), 1);
  3712. setParallaxTransform(this, progress);
  3713. });
  3714. });
  3715. },
  3716. setTransition: function setTransition(duration) {
  3717. if (typeof duration === 'undefined') duration = s.params.speed;
  3718. s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
  3719. var el = $(this);
  3720. var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;
  3721. if (duration === 0) parallaxDuration = 0;
  3722. el.transition(parallaxDuration);
  3723. });
  3724. }
  3725. };
  3726. /*=========================
  3727. Zoom
  3728. ===========================*/
  3729. s.zoom = {
  3730. // "Global" Props
  3731. scale: 1,
  3732. currentScale: 1,
  3733. isScaling: false,
  3734. gesture: {
  3735. slide: undefined,
  3736. slideWidth: undefined,
  3737. slideHeight: undefined,
  3738. image: undefined,
  3739. imageWrap: undefined,
  3740. zoomMax: s.params.zoomMax
  3741. },
  3742. image: {
  3743. isTouched: undefined,
  3744. isMoved: undefined,
  3745. currentX: undefined,
  3746. currentY: undefined,
  3747. minX: undefined,
  3748. minY: undefined,
  3749. maxX: undefined,
  3750. maxY: undefined,
  3751. width: undefined,
  3752. height: undefined,
  3753. startX: undefined,
  3754. startY: undefined,
  3755. touchesStart: {},
  3756. touchesCurrent: {}
  3757. },
  3758. velocity: {
  3759. x: undefined,
  3760. y: undefined,
  3761. prevPositionX: undefined,
  3762. prevPositionY: undefined,
  3763. prevTime: undefined
  3764. },
  3765. // Calc Scale From Multi-touches
  3766. getDistanceBetweenTouches: function getDistanceBetweenTouches(e) {
  3767. if (e.targetTouches.length < 2) return 1;
  3768. var x1 = e.targetTouches[0].pageX,
  3769. y1 = e.targetTouches[0].pageY,
  3770. x2 = e.targetTouches[1].pageX,
  3771. y2 = e.targetTouches[1].pageY;
  3772. var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  3773. return distance;
  3774. },
  3775. // Events
  3776. onGestureStart: function onGestureStart(e) {
  3777. var z = s.zoom;
  3778. if (!s.support.gestures) {
  3779. if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) {
  3780. return;
  3781. }
  3782. z.gesture.scaleStart = z.getDistanceBetweenTouches(e);
  3783. }
  3784. if (!z.gesture.slide || !z.gesture.slide.length) {
  3785. z.gesture.slide = $(this);
  3786. if (z.gesture.slide.length === 0) z.gesture.slide = s.slides.eq(s.activeIndex);
  3787. z.gesture.image = z.gesture.slide.find('img, svg, canvas');
  3788. z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);
  3789. z.gesture.zoomMax = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;
  3790. if (z.gesture.imageWrap.length === 0) {
  3791. z.gesture.image = undefined;
  3792. return;
  3793. }
  3794. }
  3795. z.gesture.image.transition(0);
  3796. z.isScaling = true;
  3797. },
  3798. onGestureChange: function onGestureChange(e) {
  3799. var z = s.zoom;
  3800. if (!s.support.gestures) {
  3801. if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) {
  3802. return;
  3803. }
  3804. z.gesture.scaleMove = z.getDistanceBetweenTouches(e);
  3805. }
  3806. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3807. if (s.support.gestures) {
  3808. z.scale = e.scale * z.currentScale;
  3809. } else {
  3810. z.scale = z.gesture.scaleMove / z.gesture.scaleStart * z.currentScale;
  3811. }
  3812. if (z.scale > z.gesture.zoomMax) {
  3813. z.scale = z.gesture.zoomMax - 1 + Math.pow(z.scale - z.gesture.zoomMax + 1, 0.5);
  3814. }
  3815. if (z.scale < s.params.zoomMin) {
  3816. z.scale = s.params.zoomMin + 1 - Math.pow(s.params.zoomMin - z.scale + 1, 0.5);
  3817. }
  3818. z.gesture.image.transform('translate3d(0,0,0) scale(' + z.scale + ')');
  3819. },
  3820. onGestureEnd: function onGestureEnd(e) {
  3821. var z = s.zoom;
  3822. if (!s.support.gestures) {
  3823. if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2) {
  3824. return;
  3825. }
  3826. }
  3827. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3828. z.scale = Math.max(Math.min(z.scale, z.gesture.zoomMax), s.params.zoomMin);
  3829. z.gesture.image.transition(s.params.speed).transform('translate3d(0,0,0) scale(' + z.scale + ')');
  3830. z.currentScale = z.scale;
  3831. z.isScaling = false;
  3832. if (z.scale === 1) z.gesture.slide = undefined;
  3833. },
  3834. onTouchStart: function onTouchStart(s, e) {
  3835. var z = s.zoom;
  3836. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3837. if (z.image.isTouched) return;
  3838. if (s.device.os === 'android') e.preventDefault();
  3839. z.image.isTouched = true;
  3840. z.image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  3841. z.image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  3842. },
  3843. onTouchMove: function onTouchMove(e) {
  3844. var z = s.zoom;
  3845. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3846. s.allowClick = false;
  3847. if (!z.image.isTouched || !z.gesture.slide) return;
  3848. if (!z.image.isMoved) {
  3849. z.image.width = z.gesture.image[0].offsetWidth;
  3850. z.image.height = z.gesture.image[0].offsetHeight;
  3851. z.image.startX = s.getTranslate(z.gesture.imageWrap[0], 'x') || 0;
  3852. z.image.startY = s.getTranslate(z.gesture.imageWrap[0], 'y') || 0;
  3853. z.gesture.slideWidth = z.gesture.slide[0].offsetWidth;
  3854. z.gesture.slideHeight = z.gesture.slide[0].offsetHeight;
  3855. z.gesture.imageWrap.transition(0);
  3856. if (s.rtl) z.image.startX = -z.image.startX;
  3857. if (s.rtl) z.image.startY = -z.image.startY;
  3858. }
  3859. // Define if we need image drag
  3860. var scaledWidth = z.image.width * z.scale;
  3861. var scaledHeight = z.image.height * z.scale;
  3862. if (scaledWidth < z.gesture.slideWidth && scaledHeight < z.gesture.slideHeight) return;
  3863. z.image.minX = Math.min(z.gesture.slideWidth / 2 - scaledWidth / 2, 0);
  3864. z.image.maxX = -z.image.minX;
  3865. z.image.minY = Math.min(z.gesture.slideHeight / 2 - scaledHeight / 2, 0);
  3866. z.image.maxY = -z.image.minY;
  3867. z.image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  3868. z.image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  3869. if (!z.image.isMoved && !z.isScaling) {
  3870. if (s.isHorizontal() && Math.floor(z.image.minX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x < z.image.touchesStart.x || Math.floor(z.image.maxX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x > z.image.touchesStart.x) {
  3871. z.image.isTouched = false;
  3872. return;
  3873. } else if (!s.isHorizontal() && Math.floor(z.image.minY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y < z.image.touchesStart.y || Math.floor(z.image.maxY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y > z.image.touchesStart.y) {
  3874. z.image.isTouched = false;
  3875. return;
  3876. }
  3877. }
  3878. e.preventDefault();
  3879. e.stopPropagation();
  3880. z.image.isMoved = true;
  3881. z.image.currentX = z.image.touchesCurrent.x - z.image.touchesStart.x + z.image.startX;
  3882. z.image.currentY = z.image.touchesCurrent.y - z.image.touchesStart.y + z.image.startY;
  3883. if (z.image.currentX < z.image.minX) {
  3884. z.image.currentX = z.image.minX + 1 - Math.pow(z.image.minX - z.image.currentX + 1, 0.8);
  3885. }
  3886. if (z.image.currentX > z.image.maxX) {
  3887. z.image.currentX = z.image.maxX - 1 + Math.pow(z.image.currentX - z.image.maxX + 1, 0.8);
  3888. }
  3889. if (z.image.currentY < z.image.minY) {
  3890. z.image.currentY = z.image.minY + 1 - Math.pow(z.image.minY - z.image.currentY + 1, 0.8);
  3891. }
  3892. if (z.image.currentY > z.image.maxY) {
  3893. z.image.currentY = z.image.maxY - 1 + Math.pow(z.image.currentY - z.image.maxY + 1, 0.8);
  3894. }
  3895. //Velocity
  3896. if (!z.velocity.prevPositionX) z.velocity.prevPositionX = z.image.touchesCurrent.x;
  3897. if (!z.velocity.prevPositionY) z.velocity.prevPositionY = z.image.touchesCurrent.y;
  3898. if (!z.velocity.prevTime) z.velocity.prevTime = Date.now();
  3899. z.velocity.x = (z.image.touchesCurrent.x - z.velocity.prevPositionX) / (Date.now() - z.velocity.prevTime) / 2;
  3900. z.velocity.y = (z.image.touchesCurrent.y - z.velocity.prevPositionY) / (Date.now() - z.velocity.prevTime) / 2;
  3901. if (Math.abs(z.image.touchesCurrent.x - z.velocity.prevPositionX) < 2) z.velocity.x = 0;
  3902. if (Math.abs(z.image.touchesCurrent.y - z.velocity.prevPositionY) < 2) z.velocity.y = 0;
  3903. z.velocity.prevPositionX = z.image.touchesCurrent.x;
  3904. z.velocity.prevPositionY = z.image.touchesCurrent.y;
  3905. z.velocity.prevTime = Date.now();
  3906. z.gesture.imageWrap.transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
  3907. },
  3908. onTouchEnd: function onTouchEnd(s, e) {
  3909. var z = s.zoom;
  3910. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3911. if (!z.image.isTouched || !z.image.isMoved) {
  3912. z.image.isTouched = false;
  3913. z.image.isMoved = false;
  3914. return;
  3915. }
  3916. z.image.isTouched = false;
  3917. z.image.isMoved = false;
  3918. var momentumDurationX = 300;
  3919. var momentumDurationY = 300;
  3920. var momentumDistanceX = z.velocity.x * momentumDurationX;
  3921. var newPositionX = z.image.currentX + momentumDistanceX;
  3922. var momentumDistanceY = z.velocity.y * momentumDurationY;
  3923. var newPositionY = z.image.currentY + momentumDistanceY;
  3924. //Fix duration
  3925. if (z.velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - z.image.currentX) / z.velocity.x);
  3926. if (z.velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - z.image.currentY) / z.velocity.y);
  3927. var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
  3928. z.image.currentX = newPositionX;
  3929. z.image.currentY = newPositionY;
  3930. // Define if we need image drag
  3931. var scaledWidth = z.image.width * z.scale;
  3932. var scaledHeight = z.image.height * z.scale;
  3933. z.image.minX = Math.min(z.gesture.slideWidth / 2 - scaledWidth / 2, 0);
  3934. z.image.maxX = -z.image.minX;
  3935. z.image.minY = Math.min(z.gesture.slideHeight / 2 - scaledHeight / 2, 0);
  3936. z.image.maxY = -z.image.minY;
  3937. z.image.currentX = Math.max(Math.min(z.image.currentX, z.image.maxX), z.image.minX);
  3938. z.image.currentY = Math.max(Math.min(z.image.currentY, z.image.maxY), z.image.minY);
  3939. z.gesture.imageWrap.transition(momentumDuration).transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
  3940. },
  3941. onTransitionEnd: function onTransitionEnd(s) {
  3942. var z = s.zoom;
  3943. if (z.gesture.slide && s.previousIndex !== s.activeIndex) {
  3944. z.gesture.image.transform('translate3d(0,0,0) scale(1)');
  3945. z.gesture.imageWrap.transform('translate3d(0,0,0)');
  3946. z.gesture.slide = z.gesture.image = z.gesture.imageWrap = undefined;
  3947. z.scale = z.currentScale = 1;
  3948. }
  3949. },
  3950. // Toggle Zoom
  3951. toggleZoom: function toggleZoom(s, e) {
  3952. var z = s.zoom;
  3953. if (!z.gesture.slide) {
  3954. z.gesture.slide = s.clickedSlide ? $(s.clickedSlide) : s.slides.eq(s.activeIndex);
  3955. z.gesture.image = z.gesture.slide.find('img, svg, canvas');
  3956. z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);
  3957. }
  3958. if (!z.gesture.image || z.gesture.image.length === 0) return;
  3959. var touchX, touchY, offsetX, offsetY, diffX, diffY, translateX, translateY, imageWidth, imageHeight, scaledWidth, scaledHeight, translateMinX, translateMinY, translateMaxX, translateMaxY, slideWidth, slideHeight;
  3960. if (typeof z.image.touchesStart.x === 'undefined' && e) {
  3961. touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;
  3962. touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;
  3963. } else {
  3964. touchX = z.image.touchesStart.x;
  3965. touchY = z.image.touchesStart.y;
  3966. }
  3967. if (z.scale && z.scale !== 1) {
  3968. // Zoom Out
  3969. z.scale = z.currentScale = 1;
  3970. z.gesture.imageWrap.transition(300).transform('translate3d(0,0,0)');
  3971. z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(1)');
  3972. z.gesture.slide = undefined;
  3973. } else {
  3974. // Zoom In
  3975. z.scale = z.currentScale = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;
  3976. if (e) {
  3977. slideWidth = z.gesture.slide[0].offsetWidth;
  3978. slideHeight = z.gesture.slide[0].offsetHeight;
  3979. offsetX = z.gesture.slide.offset().left;
  3980. offsetY = z.gesture.slide.offset().top;
  3981. diffX = offsetX + slideWidth / 2 - touchX;
  3982. diffY = offsetY + slideHeight / 2 - touchY;
  3983. imageWidth = z.gesture.image[0].offsetWidth;
  3984. imageHeight = z.gesture.image[0].offsetHeight;
  3985. scaledWidth = imageWidth * z.scale;
  3986. scaledHeight = imageHeight * z.scale;
  3987. translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);
  3988. translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);
  3989. translateMaxX = -translateMinX;
  3990. translateMaxY = -translateMinY;
  3991. translateX = diffX * z.scale;
  3992. translateY = diffY * z.scale;
  3993. if (translateX < translateMinX) {
  3994. translateX = translateMinX;
  3995. }
  3996. if (translateX > translateMaxX) {
  3997. translateX = translateMaxX;
  3998. }
  3999. if (translateY < translateMinY) {
  4000. translateY = translateMinY;
  4001. }
  4002. if (translateY > translateMaxY) {
  4003. translateY = translateMaxY;
  4004. }
  4005. } else {
  4006. translateX = 0;
  4007. translateY = 0;
  4008. }
  4009. z.gesture.imageWrap.transition(300).transform('translate3d(' + translateX + 'px, ' + translateY + 'px,0)');
  4010. z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(' + z.scale + ')');
  4011. }
  4012. },
  4013. // Attach/Detach Events
  4014. attachEvents: function attachEvents(detach) {
  4015. var action = detach ? 'off' : 'on';
  4016. if (s.params.zoom) {
  4017. var target = s.slides;
  4018. var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? { passive: true, capture: false } : false;
  4019. // Scale image
  4020. if (s.support.gestures) {
  4021. s.slides[action]('gesturestart', s.zoom.onGestureStart, passiveListener);
  4022. s.slides[action]('gesturechange', s.zoom.onGestureChange, passiveListener);
  4023. s.slides[action]('gestureend', s.zoom.onGestureEnd, passiveListener);
  4024. } else if (s.touchEvents.start === 'touchstart') {
  4025. s.slides[action](s.touchEvents.start, s.zoom.onGestureStart, passiveListener);
  4026. s.slides[action](s.touchEvents.move, s.zoom.onGestureChange, passiveListener);
  4027. s.slides[action](s.touchEvents.end, s.zoom.onGestureEnd, passiveListener);
  4028. }
  4029. // Move image
  4030. s[action]('touchStart', s.zoom.onTouchStart);
  4031. s.slides.each(function (index, slide) {
  4032. if ($(slide).find('.' + s.params.zoomContainerClass).length > 0) {
  4033. $(slide)[action](s.touchEvents.move, s.zoom.onTouchMove);
  4034. }
  4035. });
  4036. s[action]('touchEnd', s.zoom.onTouchEnd);
  4037. // Scale Out
  4038. s[action]('transitionEnd', s.zoom.onTransitionEnd);
  4039. if (s.params.zoomToggle) {
  4040. s.on('doubleTap', s.zoom.toggleZoom);
  4041. }
  4042. }
  4043. },
  4044. init: function init() {
  4045. s.zoom.attachEvents();
  4046. },
  4047. destroy: function destroy() {
  4048. s.zoom.attachEvents(true);
  4049. }
  4050. };
  4051. /*=========================
  4052. Plugins API. Collect all and init all plugins
  4053. ===========================*/
  4054. s._plugins = [];
  4055. for (var plugin in s.plugins) {
  4056. var p = s.plugins[plugin](s, s.params[plugin]);
  4057. if (p) s._plugins.push(p);
  4058. }
  4059. // Method to call all plugins event/method
  4060. s.callPlugins = function (eventName) {
  4061. for (var i = 0; i < s._plugins.length; i++) {
  4062. if (eventName in s._plugins[i]) {
  4063. s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4064. }
  4065. }
  4066. };
  4067. /*=========================
  4068. Events/Callbacks/Plugins Emitter
  4069. ===========================*/
  4070. function normalizeEventName(eventName) {
  4071. if (eventName.indexOf('on') !== 0) {
  4072. if (eventName[0] !== eventName[0].toUpperCase()) {
  4073. eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);
  4074. } else {
  4075. eventName = 'on' + eventName;
  4076. }
  4077. }
  4078. return eventName;
  4079. }
  4080. s.emitterEventListeners = {};
  4081. s.emit = function (eventName) {
  4082. // Trigger callbacks
  4083. if (s.params[eventName]) {
  4084. s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4085. }
  4086. var i;
  4087. // Trigger events
  4088. if (s.emitterEventListeners[eventName]) {
  4089. for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
  4090. s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4091. }
  4092. }
  4093. // Trigger plugins
  4094. if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
  4095. };
  4096. s.on = function (eventName, handler) {
  4097. eventName = normalizeEventName(eventName);
  4098. if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];
  4099. s.emitterEventListeners[eventName].push(handler);
  4100. return s;
  4101. };
  4102. s.off = function (eventName, handler) {
  4103. var i;
  4104. eventName = normalizeEventName(eventName);
  4105. if (typeof handler === 'undefined') {
  4106. // Remove all handlers for such event
  4107. s.emitterEventListeners[eventName] = [];
  4108. return s;
  4109. }
  4110. if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;
  4111. for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
  4112. if (s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);
  4113. }
  4114. return s;
  4115. };
  4116. s.once = function (eventName, handler) {
  4117. eventName = normalizeEventName(eventName);
  4118. var _handler = function _handler() {
  4119. handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
  4120. s.off(eventName, _handler);
  4121. };
  4122. s.on(eventName, _handler);
  4123. return s;
  4124. };
  4125. // Accessibility tools
  4126. s.a11y = {
  4127. makeFocusable: function makeFocusable($el) {
  4128. $el.attr('tabIndex', '0');
  4129. return $el;
  4130. },
  4131. addRole: function addRole($el, role) {
  4132. $el.attr('role', role);
  4133. return $el;
  4134. },
  4135. addLabel: function addLabel($el, label) {
  4136. $el.attr('aria-label', label);
  4137. return $el;
  4138. },
  4139. disable: function disable($el) {
  4140. $el.attr('aria-disabled', true);
  4141. return $el;
  4142. },
  4143. enable: function enable($el) {
  4144. $el.attr('aria-disabled', false);
  4145. return $el;
  4146. },
  4147. onEnterKey: function onEnterKey(event) {
  4148. if (event.keyCode !== 13) return;
  4149. if ($(event.target).is(s.params.nextButton)) {
  4150. s.onClickNext(event);
  4151. if (s.isEnd) {
  4152. s.a11y.notify(s.params.lastSlideMessage);
  4153. } else {
  4154. s.a11y.notify(s.params.nextSlideMessage);
  4155. }
  4156. } else if ($(event.target).is(s.params.prevButton)) {
  4157. s.onClickPrev(event);
  4158. if (s.isBeginning) {
  4159. s.a11y.notify(s.params.firstSlideMessage);
  4160. } else {
  4161. s.a11y.notify(s.params.prevSlideMessage);
  4162. }
  4163. }
  4164. if ($(event.target).is('.' + s.params.bulletClass)) {
  4165. $(event.target)[0].click();
  4166. }
  4167. },
  4168. liveRegion: $('<span class="' + s.params.notificationClass + '" aria-live="assertive" aria-atomic="true"></span>'),
  4169. notify: function notify(message) {
  4170. var notification = s.a11y.liveRegion;
  4171. if (notification.length === 0) return;
  4172. notification.html('');
  4173. notification.html(message);
  4174. },
  4175. init: function init() {
  4176. // Setup accessibility
  4177. if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
  4178. s.a11y.makeFocusable(s.nextButton);
  4179. s.a11y.addRole(s.nextButton, 'button');
  4180. s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
  4181. }
  4182. if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
  4183. s.a11y.makeFocusable(s.prevButton);
  4184. s.a11y.addRole(s.prevButton, 'button');
  4185. s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
  4186. }
  4187. $(s.container).append(s.a11y.liveRegion);
  4188. },
  4189. initPagination: function initPagination() {
  4190. if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {
  4191. s.bullets.each(function () {
  4192. var bullet = $(this);
  4193. s.a11y.makeFocusable(bullet);
  4194. s.a11y.addRole(bullet, 'button');
  4195. s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));
  4196. });
  4197. }
  4198. },
  4199. destroy: function destroy() {
  4200. if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();
  4201. }
  4202. };
  4203. /*=========================
  4204. Init/Destroy
  4205. ===========================*/
  4206. s.init = function () {
  4207. if (s.params.loop) s.createLoop();
  4208. s.updateContainerSize();
  4209. s.updateSlidesSize();
  4210. s.updatePagination();
  4211. if (s.params.scrollbar && s.scrollbar) {
  4212. s.scrollbar.set();
  4213. if (s.params.scrollbarDraggable) {
  4214. s.scrollbar.enableDraggable();
  4215. }
  4216. }
  4217. if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
  4218. if (!s.params.loop) s.updateProgress();
  4219. s.effects[s.params.effect].setTranslate();
  4220. }
  4221. if (s.params.loop) {
  4222. s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);
  4223. } else {
  4224. s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);
  4225. if (s.params.initialSlide === 0) {
  4226. if (s.parallax && s.params.parallax) s.parallax.setTranslate();
  4227. if (s.lazy && s.params.lazyLoading) {
  4228. s.lazy.load();
  4229. s.lazy.initialImageLoaded = true;
  4230. }
  4231. }
  4232. }
  4233. s.attachEvents();
  4234. if (s.params.observer && s.support.observer) {
  4235. s.initObservers();
  4236. }
  4237. if (s.params.preloadImages && !s.params.lazyLoading) {
  4238. s.preloadImages();
  4239. }
  4240. if (s.params.zoom && s.zoom) {
  4241. s.zoom.init();
  4242. }
  4243. if (s.params.autoplay) {
  4244. s.startAutoplay();
  4245. }
  4246. if (s.params.keyboardControl) {
  4247. if (s.enableKeyboardControl) s.enableKeyboardControl();
  4248. }
  4249. if (s.params.mousewheelControl) {
  4250. if (s.enableMousewheelControl) s.enableMousewheelControl();
  4251. }
  4252. // Deprecated hashnavReplaceState changed to replaceState for use in hashnav and history
  4253. if (s.params.hashnavReplaceState) {
  4254. s.params.replaceState = s.params.hashnavReplaceState;
  4255. }
  4256. if (s.params.history) {
  4257. if (s.history) s.history.init();
  4258. }
  4259. if (s.params.hashnav) {
  4260. if (s.hashnav) s.hashnav.init();
  4261. }
  4262. if (s.params.a11y && s.a11y) s.a11y.init();
  4263. s.emit('onInit', s);
  4264. };
  4265. // Cleanup dynamic styles
  4266. s.cleanupStyles = function () {
  4267. // Container
  4268. s.container.removeClass(s.classNames.join(' ')).removeAttr('style');
  4269. // Wrapper
  4270. s.wrapper.removeAttr('style');
  4271. // Slides
  4272. if (s.slides && s.slides.length) {
  4273. s.slides.removeClass([s.params.slideVisibleClass, s.params.slideActiveClass, s.params.slideNextClass, s.params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-column').removeAttr('data-swiper-row');
  4274. }
  4275. // Pagination/Bullets
  4276. if (s.paginationContainer && s.paginationContainer.length) {
  4277. s.paginationContainer.removeClass(s.params.paginationHiddenClass);
  4278. }
  4279. if (s.bullets && s.bullets.length) {
  4280. s.bullets.removeClass(s.params.bulletActiveClass);
  4281. }
  4282. // Buttons
  4283. if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
  4284. if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
  4285. // Scrollbar
  4286. if (s.params.scrollbar && s.scrollbar) {
  4287. if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');
  4288. if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');
  4289. }
  4290. };
  4291. // Destroy
  4292. s.destroy = function (deleteInstance, cleanupStyles) {
  4293. // Detach evebts
  4294. s.detachEvents();
  4295. // Stop autoplay
  4296. s.stopAutoplay();
  4297. // Disable draggable
  4298. if (s.params.scrollbar && s.scrollbar) {
  4299. if (s.params.scrollbarDraggable) {
  4300. s.scrollbar.disableDraggable();
  4301. }
  4302. }
  4303. // Destroy loop
  4304. if (s.params.loop) {
  4305. s.destroyLoop();
  4306. }
  4307. // Cleanup styles
  4308. if (cleanupStyles) {
  4309. s.cleanupStyles();
  4310. }
  4311. // Disconnect observer
  4312. s.disconnectObservers();
  4313. // Destroy zoom
  4314. if (s.params.zoom && s.zoom) {
  4315. s.zoom.destroy();
  4316. }
  4317. // Disable keyboard/mousewheel
  4318. if (s.params.keyboardControl) {
  4319. if (s.disableKeyboardControl) s.disableKeyboardControl();
  4320. }
  4321. if (s.params.mousewheelControl) {
  4322. if (s.disableMousewheelControl) s.disableMousewheelControl();
  4323. }
  4324. // Disable a11y
  4325. if (s.params.a11y && s.a11y) s.a11y.destroy();
  4326. // Delete history popstate
  4327. if (s.params.history && !s.params.replaceState) {
  4328. window.removeEventListener('popstate', s.history.setHistoryPopState);
  4329. }
  4330. if (s.params.hashnav && s.hashnav) {
  4331. s.hashnav.destroy();
  4332. }
  4333. // Destroy callback
  4334. s.emit('onDestroy');
  4335. // Delete instance
  4336. if (deleteInstance !== false) s = null;
  4337. };
  4338. s.init();
  4339. // Return swiper instance
  4340. return s;
  4341. };
  4342. /*==================================================
  4343. Prototype
  4344. ====================================================*/
  4345. Swiper.prototype = {
  4346. isSafari: function () {
  4347. var ua = window.navigator.userAgent.toLowerCase();
  4348. return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
  4349. }(),
  4350. isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent),
  4351. isArray: function isArray(arr) {
  4352. return Object.prototype.toString.apply(arr) === '[object Array]';
  4353. },
  4354. /*==================================================
  4355. Browser
  4356. ====================================================*/
  4357. browser: {
  4358. ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
  4359. ieTouch: window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1 || window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1,
  4360. lteIE9: function () {
  4361. // create temporary DIV
  4362. var div = document.createElement('div');
  4363. // add content to tmp DIV which is wrapped into the IE HTML conditional statement
  4364. div.innerHTML = '<!--[if lte IE 9]><i></i><![endif]-->';
  4365. // return true / false value based on what will browser render
  4366. return div.getElementsByTagName('i').length === 1;
  4367. }()
  4368. },
  4369. /*==================================================
  4370. Devices
  4371. ====================================================*/
  4372. device: function () {
  4373. var ua = window.navigator.userAgent;
  4374. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  4375. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  4376. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  4377. var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
  4378. return {
  4379. ios: ipad || iphone || ipod,
  4380. android: android
  4381. };
  4382. }(),
  4383. /*==================================================
  4384. Feature Detection
  4385. ====================================================*/
  4386. support: {
  4387. touch: window.Modernizr && Modernizr.touch === true || function () {
  4388. return !!('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch);
  4389. }(),
  4390. transforms3d: window.Modernizr && Modernizr.csstransforms3d === true || function () {
  4391. var div = document.createElement('div').style;
  4392. return 'webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div;
  4393. }(),
  4394. flexbox: function () {
  4395. var div = document.createElement('div').style;
  4396. var styles = 'alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient'.split(' ');
  4397. for (var i = 0; i < styles.length; i++) {
  4398. if (styles[i] in div) return true;
  4399. }
  4400. }(),
  4401. observer: function () {
  4402. return 'MutationObserver' in window || 'WebkitMutationObserver' in window;
  4403. }(),
  4404. passiveListener: function () {
  4405. var supportsPassive = false;
  4406. try {
  4407. var opts = Object.defineProperty({}, 'passive', {
  4408. get: function get() {
  4409. supportsPassive = true;
  4410. }
  4411. });
  4412. window.addEventListener('testPassiveListener', null, opts);
  4413. } catch (e) {}
  4414. return supportsPassive;
  4415. }(),
  4416. gestures: function () {
  4417. return 'ongesturestart' in window;
  4418. }()
  4419. },
  4420. /*==================================================
  4421. Plugins
  4422. ====================================================*/
  4423. plugins: {}
  4424. };
  4425. /*===========================
  4426. Dom7 Library
  4427. ===========================*/
  4428. var Dom7 = function () {
  4429. var Dom7 = function Dom7(arr) {
  4430. var _this = this,
  4431. i = 0;
  4432. // Create array-like object
  4433. for (i = 0; i < arr.length; i++) {
  4434. _this[i] = arr[i];
  4435. }
  4436. _this.length = arr.length;
  4437. // Return collection with methods
  4438. return this;
  4439. };
  4440. var $ = function $(selector, context) {
  4441. var arr = [],
  4442. i = 0;
  4443. if (selector && !context) {
  4444. if (selector instanceof Dom7) {
  4445. return selector;
  4446. }
  4447. }
  4448. if (selector) {
  4449. // String
  4450. if (typeof selector === 'string') {
  4451. var els,
  4452. tempParent,
  4453. html = selector.trim();
  4454. if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
  4455. var toCreate = 'div';
  4456. if (html.indexOf('<li') === 0) toCreate = 'ul';
  4457. if (html.indexOf('<tr') === 0) toCreate = 'tbody';
  4458. if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
  4459. if (html.indexOf('<tbody') === 0) toCreate = 'table';
  4460. if (html.indexOf('<option') === 0) toCreate = 'select';
  4461. tempParent = document.createElement(toCreate);
  4462. tempParent.innerHTML = selector;
  4463. for (i = 0; i < tempParent.childNodes.length; i++) {
  4464. arr.push(tempParent.childNodes[i]);
  4465. }
  4466. } else {
  4467. if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
  4468. // Pure ID selector
  4469. els = [document.getElementById(selector.split('#')[1])];
  4470. } else {
  4471. // Other selectors
  4472. els = (context || document).querySelectorAll(selector);
  4473. }
  4474. for (i = 0; i < els.length; i++) {
  4475. if (els[i]) arr.push(els[i]);
  4476. }
  4477. }
  4478. }
  4479. // Node/element
  4480. else if (selector.nodeType || selector === window || selector === document) {
  4481. arr.push(selector);
  4482. }
  4483. //Array of elements or instance of Dom
  4484. else if (selector.length > 0 && selector[0].nodeType) {
  4485. for (i = 0; i < selector.length; i++) {
  4486. arr.push(selector[i]);
  4487. }
  4488. }
  4489. }
  4490. return new Dom7(arr);
  4491. };
  4492. Dom7.prototype = {
  4493. // Classes and attriutes
  4494. addClass: function addClass(className) {
  4495. if (typeof className === 'undefined') {
  4496. return this;
  4497. }
  4498. var classes = className.split(' ');
  4499. for (var i = 0; i < classes.length; i++) {
  4500. for (var j = 0; j < this.length; j++) {
  4501. this[j].classList.add(classes[i]);
  4502. }
  4503. }
  4504. return this;
  4505. },
  4506. removeClass: function removeClass(className) {
  4507. var classes = className.split(' ');
  4508. for (var i = 0; i < classes.length; i++) {
  4509. for (var j = 0; j < this.length; j++) {
  4510. this[j].classList.remove(classes[i]);
  4511. }
  4512. }
  4513. return this;
  4514. },
  4515. hasClass: function hasClass(className) {
  4516. if (!this[0]) return false;else return this[0].classList.contains(className);
  4517. },
  4518. toggleClass: function toggleClass(className) {
  4519. var classes = className.split(' ');
  4520. for (var i = 0; i < classes.length; i++) {
  4521. for (var j = 0; j < this.length; j++) {
  4522. this[j].classList.toggle(classes[i]);
  4523. }
  4524. }
  4525. return this;
  4526. },
  4527. attr: function attr(attrs, value) {
  4528. if (arguments.length === 1 && typeof attrs === 'string') {
  4529. // Get attr
  4530. if (this[0]) return this[0].getAttribute(attrs);else return undefined;
  4531. } else {
  4532. // Set attrs
  4533. for (var i = 0; i < this.length; i++) {
  4534. if (arguments.length === 2) {
  4535. // String
  4536. this[i].setAttribute(attrs, value);
  4537. } else {
  4538. // Object
  4539. for (var attrName in attrs) {
  4540. this[i][attrName] = attrs[attrName];
  4541. this[i].setAttribute(attrName, attrs[attrName]);
  4542. }
  4543. }
  4544. }
  4545. return this;
  4546. }
  4547. },
  4548. removeAttr: function removeAttr(attr) {
  4549. for (var i = 0; i < this.length; i++) {
  4550. this[i].removeAttribute(attr);
  4551. }
  4552. return this;
  4553. },
  4554. data: function data(key, value) {
  4555. if (typeof value === 'undefined') {
  4556. // Get value
  4557. if (this[0]) {
  4558. var dataKey = this[0].getAttribute('data-' + key);
  4559. if (dataKey) return dataKey;else if (this[0].dom7ElementDataStorage && key in this[0].dom7ElementDataStorage) return this[0].dom7ElementDataStorage[key];else return undefined;
  4560. } else return undefined;
  4561. } else {
  4562. // Set value
  4563. for (var i = 0; i < this.length; i++) {
  4564. var el = this[i];
  4565. if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
  4566. el.dom7ElementDataStorage[key] = value;
  4567. }
  4568. return this;
  4569. }
  4570. },
  4571. // Transforms
  4572. transform: function transform(_transform) {
  4573. for (var i = 0; i < this.length; i++) {
  4574. var elStyle = this[i].style;
  4575. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = _transform;
  4576. }
  4577. return this;
  4578. },
  4579. transition: function transition(duration) {
  4580. if (typeof duration !== 'string') {
  4581. duration = duration + 'ms';
  4582. }
  4583. for (var i = 0; i < this.length; i++) {
  4584. var elStyle = this[i].style;
  4585. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  4586. }
  4587. return this;
  4588. },
  4589. //Events
  4590. on: function on(eventName, targetSelector, listener, capture) {
  4591. function handleLiveEvent(e) {
  4592. var target = e.target;
  4593. if ($(target).is(targetSelector)) listener.call(target, e);else {
  4594. var parents = $(target).parents();
  4595. for (var k = 0; k < parents.length; k++) {
  4596. if ($(parents[k]).is(targetSelector)) listener.call(parents[k], e);
  4597. }
  4598. }
  4599. }
  4600. var events = eventName.split(' ');
  4601. var i, j;
  4602. for (i = 0; i < this.length; i++) {
  4603. if (typeof targetSelector === 'function' || targetSelector === false) {
  4604. // Usual events
  4605. if (typeof targetSelector === 'function') {
  4606. listener = arguments[1];
  4607. capture = arguments[2] || false;
  4608. }
  4609. for (j = 0; j < events.length; j++) {
  4610. this[i].addEventListener(events[j], listener, capture);
  4611. }
  4612. } else {
  4613. //Live events
  4614. for (j = 0; j < events.length; j++) {
  4615. if (!this[i].dom7LiveListeners) this[i].dom7LiveListeners = [];
  4616. this[i].dom7LiveListeners.push({ listener: listener, liveListener: handleLiveEvent });
  4617. this[i].addEventListener(events[j], handleLiveEvent, capture);
  4618. }
  4619. }
  4620. }
  4621. return this;
  4622. },
  4623. off: function off(eventName, targetSelector, listener, capture) {
  4624. var events = eventName.split(' ');
  4625. for (var i = 0; i < events.length; i++) {
  4626. for (var j = 0; j < this.length; j++) {
  4627. if (typeof targetSelector === 'function' || targetSelector === false) {
  4628. // Usual events
  4629. if (typeof targetSelector === 'function') {
  4630. listener = arguments[1];
  4631. capture = arguments[2] || false;
  4632. }
  4633. this[j].removeEventListener(events[i], listener, capture);
  4634. } else {
  4635. // Live event
  4636. if (this[j].dom7LiveListeners) {
  4637. for (var k = 0; k < this[j].dom7LiveListeners.length; k++) {
  4638. if (this[j].dom7LiveListeners[k].listener === listener) {
  4639. this[j].removeEventListener(events[i], this[j].dom7LiveListeners[k].liveListener, capture);
  4640. }
  4641. }
  4642. }
  4643. }
  4644. }
  4645. }
  4646. return this;
  4647. },
  4648. once: function once(eventName, targetSelector, listener, capture) {
  4649. var dom = this;
  4650. if (typeof targetSelector === 'function') {
  4651. targetSelector = false;
  4652. listener = arguments[1];
  4653. capture = arguments[2];
  4654. }
  4655. function proxy(e) {
  4656. listener(e);
  4657. dom.off(eventName, targetSelector, proxy, capture);
  4658. }
  4659. dom.on(eventName, targetSelector, proxy, capture);
  4660. },
  4661. trigger: function trigger(eventName, eventData) {
  4662. for (var i = 0; i < this.length; i++) {
  4663. var evt;
  4664. try {
  4665. evt = new window.CustomEvent(eventName, { detail: eventData, bubbles: true, cancelable: true });
  4666. } catch (e) {
  4667. evt = document.createEvent('Event');
  4668. evt.initEvent(eventName, true, true);
  4669. evt.detail = eventData;
  4670. }
  4671. this[i].dispatchEvent(evt);
  4672. }
  4673. return this;
  4674. },
  4675. transitionEnd: function transitionEnd(callback) {
  4676. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  4677. i,
  4678. j,
  4679. dom = this;
  4680. function fireCallBack(e) {
  4681. /*jshint validthis:true */
  4682. if (e.target !== this) return;
  4683. callback.call(this, e);
  4684. for (i = 0; i < events.length; i++) {
  4685. dom.off(events[i], fireCallBack);
  4686. }
  4687. }
  4688. if (callback) {
  4689. for (i = 0; i < events.length; i++) {
  4690. dom.on(events[i], fireCallBack);
  4691. }
  4692. }
  4693. return this;
  4694. },
  4695. // Sizing/Styles
  4696. width: function width() {
  4697. if (this[0] === window) {
  4698. return window.innerWidth;
  4699. } else {
  4700. if (this.length > 0) {
  4701. return parseFloat(this.css('width'));
  4702. } else {
  4703. return null;
  4704. }
  4705. }
  4706. },
  4707. outerWidth: function outerWidth(includeMargins) {
  4708. if (this.length > 0) {
  4709. if (includeMargins) return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));else return this[0].offsetWidth;
  4710. } else return null;
  4711. },
  4712. height: function height() {
  4713. if (this[0] === window) {
  4714. return window.innerHeight;
  4715. } else {
  4716. if (this.length > 0) {
  4717. return parseFloat(this.css('height'));
  4718. } else {
  4719. return null;
  4720. }
  4721. }
  4722. },
  4723. outerHeight: function outerHeight(includeMargins) {
  4724. if (this.length > 0) {
  4725. if (includeMargins) return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));else return this[0].offsetHeight;
  4726. } else return null;
  4727. },
  4728. offset: function offset() {
  4729. if (this.length > 0) {
  4730. var el = this[0];
  4731. var box = el.getBoundingClientRect();
  4732. var body = document.body;
  4733. var clientTop = el.clientTop || body.clientTop || 0;
  4734. var clientLeft = el.clientLeft || body.clientLeft || 0;
  4735. var scrollTop = window.pageYOffset || el.scrollTop;
  4736. var scrollLeft = window.pageXOffset || el.scrollLeft;
  4737. return {
  4738. top: box.top + scrollTop - clientTop,
  4739. left: box.left + scrollLeft - clientLeft
  4740. };
  4741. } else {
  4742. return null;
  4743. }
  4744. },
  4745. css: function css(props, value) {
  4746. var i;
  4747. if (arguments.length === 1) {
  4748. if (typeof props === 'string') {
  4749. if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
  4750. } else {
  4751. for (i = 0; i < this.length; i++) {
  4752. for (var prop in props) {
  4753. this[i].style[prop] = props[prop];
  4754. }
  4755. }
  4756. return this;
  4757. }
  4758. }
  4759. if (arguments.length === 2 && typeof props === 'string') {
  4760. for (i = 0; i < this.length; i++) {
  4761. this[i].style[props] = value;
  4762. }
  4763. return this;
  4764. }
  4765. return this;
  4766. },
  4767. //Dom manipulation
  4768. each: function each(callback) {
  4769. for (var i = 0; i < this.length; i++) {
  4770. callback.call(this[i], i, this[i]);
  4771. }
  4772. return this;
  4773. },
  4774. html: function html(_html) {
  4775. if (typeof _html === 'undefined') {
  4776. return this[0] ? this[0].innerHTML : undefined;
  4777. } else {
  4778. for (var i = 0; i < this.length; i++) {
  4779. this[i].innerHTML = _html;
  4780. }
  4781. return this;
  4782. }
  4783. },
  4784. text: function text(_text) {
  4785. if (typeof _text === 'undefined') {
  4786. if (this[0]) {
  4787. return this[0].textContent.trim();
  4788. } else return null;
  4789. } else {
  4790. for (var i = 0; i < this.length; i++) {
  4791. this[i].textContent = _text;
  4792. }
  4793. return this;
  4794. }
  4795. },
  4796. is: function is(selector) {
  4797. if (!this[0]) return false;
  4798. var compareWith, i;
  4799. if (typeof selector === 'string') {
  4800. var el = this[0];
  4801. if (el === document) return selector === document;
  4802. if (el === window) return selector === window;
  4803. if (el.matches) return el.matches(selector);else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);else if (el.mozMatchesSelector) return el.mozMatchesSelector(selector);else if (el.msMatchesSelector) return el.msMatchesSelector(selector);else {
  4804. compareWith = $(selector);
  4805. for (i = 0; i < compareWith.length; i++) {
  4806. if (compareWith[i] === this[0]) return true;
  4807. }
  4808. return false;
  4809. }
  4810. } else if (selector === document) return this[0] === document;else if (selector === window) return this[0] === window;else {
  4811. if (selector.nodeType || selector instanceof Dom7) {
  4812. compareWith = selector.nodeType ? [selector] : selector;
  4813. for (i = 0; i < compareWith.length; i++) {
  4814. if (compareWith[i] === this[0]) return true;
  4815. }
  4816. return false;
  4817. }
  4818. return false;
  4819. }
  4820. },
  4821. index: function index() {
  4822. if (this[0]) {
  4823. var child = this[0];
  4824. var i = 0;
  4825. while ((child = child.previousSibling) !== null) {
  4826. if (child.nodeType === 1) i++;
  4827. }
  4828. return i;
  4829. } else return undefined;
  4830. },
  4831. eq: function eq(index) {
  4832. if (typeof index === 'undefined') return this;
  4833. var length = this.length;
  4834. var returnIndex;
  4835. if (index > length - 1) {
  4836. return new Dom7([]);
  4837. }
  4838. if (index < 0) {
  4839. returnIndex = length + index;
  4840. if (returnIndex < 0) return new Dom7([]);else return new Dom7([this[returnIndex]]);
  4841. }
  4842. return new Dom7([this[index]]);
  4843. },
  4844. append: function append(newChild) {
  4845. var i, j;
  4846. for (i = 0; i < this.length; i++) {
  4847. if (typeof newChild === 'string') {
  4848. var tempDiv = document.createElement('div');
  4849. tempDiv.innerHTML = newChild;
  4850. while (tempDiv.firstChild) {
  4851. this[i].appendChild(tempDiv.firstChild);
  4852. }
  4853. } else if (newChild instanceof Dom7) {
  4854. for (j = 0; j < newChild.length; j++) {
  4855. this[i].appendChild(newChild[j]);
  4856. }
  4857. } else {
  4858. this[i].appendChild(newChild);
  4859. }
  4860. }
  4861. return this;
  4862. },
  4863. prepend: function prepend(newChild) {
  4864. var i, j;
  4865. for (i = 0; i < this.length; i++) {
  4866. if (typeof newChild === 'string') {
  4867. var tempDiv = document.createElement('div');
  4868. tempDiv.innerHTML = newChild;
  4869. for (j = tempDiv.childNodes.length - 1; j >= 0; j--) {
  4870. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  4871. }
  4872. // this[i].insertAdjacentHTML('afterbegin', newChild);
  4873. } else if (newChild instanceof Dom7) {
  4874. for (j = 0; j < newChild.length; j++) {
  4875. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  4876. }
  4877. } else {
  4878. this[i].insertBefore(newChild, this[i].childNodes[0]);
  4879. }
  4880. }
  4881. return this;
  4882. },
  4883. insertBefore: function insertBefore(selector) {
  4884. var before = $(selector);
  4885. for (var i = 0; i < this.length; i++) {
  4886. if (before.length === 1) {
  4887. before[0].parentNode.insertBefore(this[i], before[0]);
  4888. } else if (before.length > 1) {
  4889. for (var j = 0; j < before.length; j++) {
  4890. before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
  4891. }
  4892. }
  4893. }
  4894. },
  4895. insertAfter: function insertAfter(selector) {
  4896. var after = $(selector);
  4897. for (var i = 0; i < this.length; i++) {
  4898. if (after.length === 1) {
  4899. after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
  4900. } else if (after.length > 1) {
  4901. for (var j = 0; j < after.length; j++) {
  4902. after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
  4903. }
  4904. }
  4905. }
  4906. },
  4907. next: function next(selector) {
  4908. if (this.length > 0) {
  4909. if (selector) {
  4910. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) return new Dom7([this[0].nextElementSibling]);else return new Dom7([]);
  4911. } else {
  4912. if (this[0].nextElementSibling) return new Dom7([this[0].nextElementSibling]);else return new Dom7([]);
  4913. }
  4914. } else return new Dom7([]);
  4915. },
  4916. nextAll: function nextAll(selector) {
  4917. var nextEls = [];
  4918. var el = this[0];
  4919. if (!el) return new Dom7([]);
  4920. while (el.nextElementSibling) {
  4921. var next = el.nextElementSibling;
  4922. if (selector) {
  4923. if ($(next).is(selector)) nextEls.push(next);
  4924. } else nextEls.push(next);
  4925. el = next;
  4926. }
  4927. return new Dom7(nextEls);
  4928. },
  4929. prev: function prev(selector) {
  4930. if (this.length > 0) {
  4931. if (selector) {
  4932. if (this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector)) return new Dom7([this[0].previousElementSibling]);else return new Dom7([]);
  4933. } else {
  4934. if (this[0].previousElementSibling) return new Dom7([this[0].previousElementSibling]);else return new Dom7([]);
  4935. }
  4936. } else return new Dom7([]);
  4937. },
  4938. prevAll: function prevAll(selector) {
  4939. var prevEls = [];
  4940. var el = this[0];
  4941. if (!el) return new Dom7([]);
  4942. while (el.previousElementSibling) {
  4943. var prev = el.previousElementSibling;
  4944. if (selector) {
  4945. if ($(prev).is(selector)) prevEls.push(prev);
  4946. } else prevEls.push(prev);
  4947. el = prev;
  4948. }
  4949. return new Dom7(prevEls);
  4950. },
  4951. parent: function parent(selector) {
  4952. var parents = [];
  4953. for (var i = 0; i < this.length; i++) {
  4954. if (selector) {
  4955. if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
  4956. } else {
  4957. parents.push(this[i].parentNode);
  4958. }
  4959. }
  4960. return $($.unique(parents));
  4961. },
  4962. parents: function parents(selector) {
  4963. var parents = [];
  4964. for (var i = 0; i < this.length; i++) {
  4965. var parent = this[i].parentNode;
  4966. while (parent) {
  4967. if (selector) {
  4968. if ($(parent).is(selector)) parents.push(parent);
  4969. } else {
  4970. parents.push(parent);
  4971. }
  4972. parent = parent.parentNode;
  4973. }
  4974. }
  4975. return $($.unique(parents));
  4976. },
  4977. find: function find(selector) {
  4978. var foundElements = [];
  4979. for (var i = 0; i < this.length; i++) {
  4980. var found = this[i].querySelectorAll(selector);
  4981. for (var j = 0; j < found.length; j++) {
  4982. foundElements.push(found[j]);
  4983. }
  4984. }
  4985. return new Dom7(foundElements);
  4986. },
  4987. children: function children(selector) {
  4988. var children = [];
  4989. for (var i = 0; i < this.length; i++) {
  4990. var childNodes = this[i].childNodes;
  4991. for (var j = 0; j < childNodes.length; j++) {
  4992. if (!selector) {
  4993. if (childNodes[j].nodeType === 1) children.push(childNodes[j]);
  4994. } else {
  4995. if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) children.push(childNodes[j]);
  4996. }
  4997. }
  4998. }
  4999. return new Dom7($.unique(children));
  5000. },
  5001. remove: function remove() {
  5002. for (var i = 0; i < this.length; i++) {
  5003. if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
  5004. }
  5005. return this;
  5006. },
  5007. add: function add() {
  5008. var dom = this;
  5009. var i, j;
  5010. for (i = 0; i < arguments.length; i++) {
  5011. var toAdd = $(arguments[i]);
  5012. for (j = 0; j < toAdd.length; j++) {
  5013. dom[dom.length] = toAdd[j];
  5014. dom.length++;
  5015. }
  5016. }
  5017. return dom;
  5018. }
  5019. };
  5020. $.fn = Dom7.prototype;
  5021. $.unique = function (arr) {
  5022. var unique = [];
  5023. for (var i = 0; i < arr.length; i++) {
  5024. if (unique.indexOf(arr[i]) === -1) unique.push(arr[i]);
  5025. }
  5026. return unique;
  5027. };
  5028. return $;
  5029. }();
  5030. /*===========================
  5031. Get Dom libraries
  5032. ===========================*/
  5033. var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7'];
  5034. for (var i = 0; i < swiperDomPlugins.length; i++) {
  5035. if (window[swiperDomPlugins[i]]) {
  5036. addLibraryPlugin(window[swiperDomPlugins[i]]);
  5037. }
  5038. }
  5039. // Required DOM Plugins
  5040. var domLib;
  5041. if (typeof Dom7 === 'undefined') {
  5042. domLib = window.Dom7 || window.Zepto || window.jQuery;
  5043. } else {
  5044. domLib = Dom7;
  5045. }
  5046. /*===========================
  5047. Add .swiper plugin from Dom libraries
  5048. ===========================*/
  5049. function addLibraryPlugin(lib) {
  5050. lib.fn.swiper = function (params) {
  5051. var firstInstance;
  5052. lib(this).each(function () {
  5053. var s = new Swiper(this, params);
  5054. if (!firstInstance) firstInstance = s;
  5055. });
  5056. return firstInstance;
  5057. };
  5058. }
  5059. if (domLib) {
  5060. if (!('transitionEnd' in domLib.fn)) {
  5061. domLib.fn.transitionEnd = function (callback) {
  5062. var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
  5063. i,
  5064. j,
  5065. dom = this;
  5066. function fireCallBack(e) {
  5067. /*jshint validthis:true */
  5068. if (e.target !== this) return;
  5069. callback.call(this, e);
  5070. for (i = 0; i < events.length; i++) {
  5071. dom.off(events[i], fireCallBack);
  5072. }
  5073. }
  5074. if (callback) {
  5075. for (i = 0; i < events.length; i++) {
  5076. dom.on(events[i], fireCallBack);
  5077. }
  5078. }
  5079. return this;
  5080. };
  5081. }
  5082. if (!('transform' in domLib.fn)) {
  5083. domLib.fn.transform = function (transform) {
  5084. for (var i = 0; i < this.length; i++) {
  5085. var elStyle = this[i].style;
  5086. elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;
  5087. }
  5088. return this;
  5089. };
  5090. }
  5091. if (!('transition' in domLib.fn)) {
  5092. domLib.fn.transition = function (duration) {
  5093. if (typeof duration !== 'string') {
  5094. duration = duration + 'ms';
  5095. }
  5096. for (var i = 0; i < this.length; i++) {
  5097. var elStyle = this[i].style;
  5098. elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
  5099. }
  5100. return this;
  5101. };
  5102. }
  5103. if (!('outerWidth' in domLib.fn)) {
  5104. domLib.fn.outerWidth = function (includeMargins) {
  5105. if (this.length > 0) {
  5106. if (includeMargins) return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));else return this[0].offsetWidth;
  5107. } else return null;
  5108. };
  5109. }
  5110. }
  5111. window.Swiper = Swiper;
  5112. })();
  5113. /*===========================
  5114. Swiper AMD Export
  5115. ===========================*/
  5116. if (true) {
  5117. module.exports = window.Swiper;
  5118. } else if (typeof define === 'function' && define.amd) {
  5119. define([], function () {
  5120. 'use strict';
  5121. return window.Swiper;
  5122. });
  5123. }
  5124. //# sourceMappingURL=maps/swiper.js.map
  5125. /***/ }),
  5126. /* 5 */
  5127. /***/ (function(module, exports, __webpack_require__) {
  5128. "use strict";
  5129. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  5130. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  5131. /*! tether-drop 1.4.1 */
  5132. (function (root, factory) {
  5133. if (true) {
  5134. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(34)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  5135. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  5136. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  5137. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  5138. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  5139. module.exports = factory(require('tether'));
  5140. } else {
  5141. root.Drop = factory(root.Tether);
  5142. }
  5143. })(undefined, function (Tether) {
  5144. /* global Tether */
  5145. 'use strict';
  5146. var _bind = Function.prototype.bind;
  5147. var _slicedToArray = function () {
  5148. function sliceIterator(arr, i) {
  5149. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  5150. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  5151. _arr.push(_s.value);if (i && _arr.length === i) break;
  5152. }
  5153. } catch (err) {
  5154. _d = true;_e = err;
  5155. } finally {
  5156. try {
  5157. if (!_n && _i['return']) _i['return']();
  5158. } finally {
  5159. if (_d) throw _e;
  5160. }
  5161. }return _arr;
  5162. }return function (arr, i) {
  5163. if (Array.isArray(arr)) {
  5164. return arr;
  5165. } else if (Symbol.iterator in Object(arr)) {
  5166. return sliceIterator(arr, i);
  5167. } else {
  5168. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  5169. }
  5170. };
  5171. }();
  5172. var _createClass = function () {
  5173. function defineProperties(target, props) {
  5174. for (var i = 0; i < props.length; i++) {
  5175. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  5176. }
  5177. }return function (Constructor, protoProps, staticProps) {
  5178. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  5179. };
  5180. }();
  5181. var _get = function get(_x2, _x3, _x4) {
  5182. var _again = true;_function: while (_again) {
  5183. var object = _x2,
  5184. property = _x3,
  5185. receiver = _x4;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
  5186. var parent = Object.getPrototypeOf(object);if (parent === null) {
  5187. return undefined;
  5188. } else {
  5189. _x2 = parent;_x3 = property;_x4 = receiver;_again = true;desc = parent = undefined;continue _function;
  5190. }
  5191. } else if ('value' in desc) {
  5192. return desc.value;
  5193. } else {
  5194. var getter = desc.get;if (getter === undefined) {
  5195. return undefined;
  5196. }return getter.call(receiver);
  5197. }
  5198. }
  5199. };
  5200. function _classCallCheck(instance, Constructor) {
  5201. if (!(instance instanceof Constructor)) {
  5202. throw new TypeError('Cannot call a class as a function');
  5203. }
  5204. }
  5205. function _inherits(subClass, superClass) {
  5206. if (typeof superClass !== 'function' && superClass !== null) {
  5207. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  5208. }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  5209. }
  5210. var _Tether$Utils = Tether.Utils;
  5211. var extend = _Tether$Utils.extend;
  5212. var addClass = _Tether$Utils.addClass;
  5213. var removeClass = _Tether$Utils.removeClass;
  5214. var hasClass = _Tether$Utils.hasClass;
  5215. var Evented = _Tether$Utils.Evented;
  5216. function sortAttach(str) {
  5217. var _str$split = str.split(' ');
  5218. var _str$split2 = _slicedToArray(_str$split, 2);
  5219. var first = _str$split2[0];
  5220. var second = _str$split2[1];
  5221. if (['left', 'right'].indexOf(first) >= 0) {
  5222. var _ref = [second, first];
  5223. first = _ref[0];
  5224. second = _ref[1];
  5225. }
  5226. return [first, second].join(' ');
  5227. }
  5228. function removeFromArray(arr, item) {
  5229. var index = undefined;
  5230. var results = [];
  5231. while ((index = arr.indexOf(item)) !== -1) {
  5232. results.push(arr.splice(index, 1));
  5233. }
  5234. return results;
  5235. }
  5236. var clickEvents = ['click'];
  5237. var transitionEndEvents = {
  5238. 'WebkitTransition': 'webkitTransitionEnd',
  5239. 'MozTransition': 'transitionend',
  5240. 'OTransition': 'otransitionend',
  5241. 'transition': 'transitionend'
  5242. };
  5243. var transitionEndEvent = '';
  5244. for (var _name in transitionEndEvents) {
  5245. if ({}.hasOwnProperty.call(transitionEndEvents, _name)) {
  5246. var tempEl = document.createElement('p');
  5247. if (typeof tempEl.style[_name] !== 'undefined') {
  5248. transitionEndEvent = transitionEndEvents[_name];
  5249. }
  5250. }
  5251. }
  5252. var MIRROR_ATTACH = {
  5253. left: 'right',
  5254. right: 'left',
  5255. top: 'bottom',
  5256. bottom: 'top',
  5257. middle: 'middle',
  5258. center: 'center'
  5259. };
  5260. var allDrops = {};
  5261. // Drop can be included in external libraries. Calling createContext gives you a fresh
  5262. // copy of drop which won't interact with other copies on the page (beyond calling the document events).
  5263. function createContext() {
  5264. var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  5265. var drop = function drop() {
  5266. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  5267. args[_key] = arguments[_key];
  5268. }
  5269. return new (_bind.apply(DropInstance, [null].concat(args)))();
  5270. };
  5271. extend(drop, {
  5272. createContext: createContext,
  5273. drops: [],
  5274. defaults: {}
  5275. });
  5276. var defaultOptions = {
  5277. classPrefix: 'drop',
  5278. defaults: {
  5279. position: 'bottom left',
  5280. openOn: 'click',
  5281. beforeClose: null,
  5282. constrainToScrollParent: true,
  5283. constrainToWindow: true,
  5284. classes: '',
  5285. remove: false,
  5286. openDelay: 0,
  5287. closeDelay: 50,
  5288. // inherited from openDelay and closeDelay if not explicitly defined
  5289. focusDelay: null,
  5290. blurDelay: null,
  5291. hoverOpenDelay: null,
  5292. hoverCloseDelay: null,
  5293. tetherOptions: {}
  5294. }
  5295. };
  5296. extend(drop, defaultOptions, options);
  5297. extend(drop.defaults, defaultOptions.defaults, options.defaults);
  5298. if (typeof allDrops[drop.classPrefix] === 'undefined') {
  5299. allDrops[drop.classPrefix] = [];
  5300. }
  5301. drop.updateBodyClasses = function () {
  5302. // There is only one body, so despite the context concept, we still iterate through all
  5303. // drops which share our classPrefix.
  5304. var anyOpen = false;
  5305. var drops = allDrops[drop.classPrefix];
  5306. var len = drops.length;
  5307. for (var i = 0; i < len; ++i) {
  5308. if (drops[i].isOpened()) {
  5309. anyOpen = true;
  5310. break;
  5311. }
  5312. }
  5313. if (anyOpen) {
  5314. addClass(document.body, drop.classPrefix + '-open');
  5315. } else {
  5316. removeClass(document.body, drop.classPrefix + '-open');
  5317. }
  5318. };
  5319. var DropInstance = function (_Evented) {
  5320. _inherits(DropInstance, _Evented);
  5321. function DropInstance(opts) {
  5322. _classCallCheck(this, DropInstance);
  5323. _get(Object.getPrototypeOf(DropInstance.prototype), 'constructor', this).call(this);
  5324. this.options = extend({}, drop.defaults, opts);
  5325. this.target = this.options.target;
  5326. if (typeof this.target === 'undefined') {
  5327. throw new Error('Drop Error: You must provide a target.');
  5328. }
  5329. var dataPrefix = 'data-' + drop.classPrefix;
  5330. var contentAttr = this.target.getAttribute(dataPrefix);
  5331. if (contentAttr && this.options.content == null) {
  5332. this.options.content = contentAttr;
  5333. }
  5334. var attrsOverride = ['position', 'openOn'];
  5335. for (var i = 0; i < attrsOverride.length; ++i) {
  5336. var override = this.target.getAttribute(dataPrefix + '-' + attrsOverride[i]);
  5337. if (override && this.options[attrsOverride[i]] == null) {
  5338. this.options[attrsOverride[i]] = override;
  5339. }
  5340. }
  5341. if (this.options.classes && this.options.addTargetClasses !== false) {
  5342. addClass(this.target, this.options.classes);
  5343. }
  5344. drop.drops.push(this);
  5345. allDrops[drop.classPrefix].push(this);
  5346. this._boundEvents = [];
  5347. this.bindMethods();
  5348. this.setupElements();
  5349. this.setupEvents();
  5350. this.setupTether();
  5351. }
  5352. _createClass(DropInstance, [{
  5353. key: '_on',
  5354. value: function _on(element, event, handler) {
  5355. this._boundEvents.push({ element: element, event: event, handler: handler });
  5356. element.addEventListener(event, handler);
  5357. }
  5358. }, {
  5359. key: 'bindMethods',
  5360. value: function bindMethods() {
  5361. this.transitionEndHandler = this._transitionEndHandler.bind(this);
  5362. }
  5363. }, {
  5364. key: 'setupElements',
  5365. value: function setupElements() {
  5366. var _this = this;
  5367. this.drop = document.createElement('div');
  5368. addClass(this.drop, drop.classPrefix);
  5369. if (this.options.classes) {
  5370. addClass(this.drop, this.options.classes);
  5371. }
  5372. this.content = document.createElement('div');
  5373. addClass(this.content, drop.classPrefix + '-content');
  5374. if (typeof this.options.content === 'function') {
  5375. var generateAndSetContent = function generateAndSetContent() {
  5376. // content function might return a string or an element
  5377. var contentElementOrHTML = _this.options.content.call(_this, _this);
  5378. if (typeof contentElementOrHTML === 'string') {
  5379. _this.content.innerHTML = contentElementOrHTML;
  5380. } else if ((typeof contentElementOrHTML === 'undefined' ? 'undefined' : _typeof(contentElementOrHTML)) === 'object') {
  5381. _this.content.innerHTML = '';
  5382. _this.content.appendChild(contentElementOrHTML);
  5383. } else {
  5384. throw new Error('Drop Error: Content function should return a string or HTMLElement.');
  5385. }
  5386. };
  5387. generateAndSetContent();
  5388. this.on('open', generateAndSetContent.bind(this));
  5389. } else if (_typeof(this.options.content) === 'object') {
  5390. this.content.appendChild(this.options.content);
  5391. } else {
  5392. this.content.innerHTML = this.options.content;
  5393. }
  5394. this.drop.appendChild(this.content);
  5395. }
  5396. }, {
  5397. key: 'setupTether',
  5398. value: function setupTether() {
  5399. // Tether expects two attachment points, one in the target element, one in the
  5400. // drop. We use a single one, and use the order as well, to allow us to put
  5401. // the drop on either side of any of the four corners. This magic converts between
  5402. // the two:
  5403. var dropAttach = this.options.position.split(' ');
  5404. dropAttach[0] = MIRROR_ATTACH[dropAttach[0]];
  5405. dropAttach = dropAttach.join(' ');
  5406. var constraints = [];
  5407. if (this.options.constrainToScrollParent) {
  5408. constraints.push({
  5409. to: 'scrollParent',
  5410. pin: 'top, bottom',
  5411. attachment: 'together none'
  5412. });
  5413. } else {
  5414. // To get 'out of bounds' classes
  5415. constraints.push({
  5416. to: 'scrollParent'
  5417. });
  5418. }
  5419. if (this.options.constrainToWindow !== false) {
  5420. constraints.push({
  5421. to: 'window',
  5422. attachment: 'together'
  5423. });
  5424. } else {
  5425. // To get 'out of bounds' classes
  5426. constraints.push({
  5427. to: 'window'
  5428. });
  5429. }
  5430. var opts = {
  5431. element: this.drop,
  5432. target: this.target,
  5433. attachment: sortAttach(dropAttach),
  5434. targetAttachment: sortAttach(this.options.position),
  5435. classPrefix: drop.classPrefix,
  5436. offset: '0 0',
  5437. targetOffset: '0 0',
  5438. enabled: false,
  5439. constraints: constraints,
  5440. addTargetClasses: this.options.addTargetClasses
  5441. };
  5442. if (this.options.tetherOptions !== false) {
  5443. this.tether = new Tether(extend({}, opts, this.options.tetherOptions));
  5444. }
  5445. }
  5446. }, {
  5447. key: 'setupEvents',
  5448. value: function setupEvents() {
  5449. var _this2 = this;
  5450. if (!this.options.openOn) {
  5451. return;
  5452. }
  5453. if (this.options.openOn === 'always') {
  5454. setTimeout(this.open.bind(this));
  5455. return;
  5456. }
  5457. var events = this.options.openOn.split(' ');
  5458. if (events.indexOf('click') >= 0) {
  5459. var openHandler = function openHandler(event) {
  5460. _this2.toggle(event);
  5461. event.preventDefault();
  5462. };
  5463. var closeHandler = function closeHandler(event) {
  5464. if (!_this2.isOpened()) {
  5465. return;
  5466. }
  5467. // Clicking inside dropdown
  5468. if (event.target === _this2.drop || _this2.drop.contains(event.target)) {
  5469. return;
  5470. }
  5471. // Clicking target
  5472. if (event.target === _this2.target || _this2.target.contains(event.target)) {
  5473. return;
  5474. }
  5475. _this2.close(event);
  5476. };
  5477. for (var i = 0; i < clickEvents.length; ++i) {
  5478. var clickEvent = clickEvents[i];
  5479. this._on(this.target, clickEvent, openHandler);
  5480. this._on(document, clickEvent, closeHandler);
  5481. }
  5482. }
  5483. var inTimeout = null;
  5484. var outTimeout = null;
  5485. var inHandler = function inHandler(event) {
  5486. if (outTimeout !== null) {
  5487. clearTimeout(outTimeout);
  5488. } else {
  5489. inTimeout = setTimeout(function () {
  5490. _this2.open(event);
  5491. inTimeout = null;
  5492. }, (event.type === 'focus' ? _this2.options.focusDelay : _this2.options.hoverOpenDelay) || _this2.options.openDelay);
  5493. }
  5494. };
  5495. var outHandler = function outHandler(event) {
  5496. if (inTimeout !== null) {
  5497. clearTimeout(inTimeout);
  5498. } else {
  5499. outTimeout = setTimeout(function () {
  5500. _this2.close(event);
  5501. outTimeout = null;
  5502. }, (event.type === 'blur' ? _this2.options.blurDelay : _this2.options.hoverCloseDelay) || _this2.options.closeDelay);
  5503. }
  5504. };
  5505. if (events.indexOf('hover') >= 0) {
  5506. this._on(this.target, 'mouseover', inHandler);
  5507. this._on(this.drop, 'mouseover', inHandler);
  5508. this._on(this.target, 'mouseout', outHandler);
  5509. this._on(this.drop, 'mouseout', outHandler);
  5510. }
  5511. if (events.indexOf('focus') >= 0) {
  5512. this._on(this.target, 'focus', inHandler);
  5513. this._on(this.drop, 'focus', inHandler);
  5514. this._on(this.target, 'blur', outHandler);
  5515. this._on(this.drop, 'blur', outHandler);
  5516. }
  5517. }
  5518. }, {
  5519. key: 'isOpened',
  5520. value: function isOpened() {
  5521. if (this.drop) {
  5522. return hasClass(this.drop, drop.classPrefix + '-open');
  5523. }
  5524. }
  5525. }, {
  5526. key: 'toggle',
  5527. value: function toggle(event) {
  5528. if (this.isOpened()) {
  5529. this.close(event);
  5530. } else {
  5531. this.open(event);
  5532. }
  5533. }
  5534. }, {
  5535. key: 'open',
  5536. value: function open(event) {
  5537. var _this3 = this;
  5538. /* eslint no-unused-vars: 0 */
  5539. if (this.isOpened()) {
  5540. return;
  5541. }
  5542. if (!this.drop.parentNode) {
  5543. document.body.appendChild(this.drop);
  5544. }
  5545. if (typeof this.tether !== 'undefined') {
  5546. this.tether.enable();
  5547. }
  5548. addClass(this.drop, drop.classPrefix + '-open');
  5549. addClass(this.drop, drop.classPrefix + '-open-transitionend');
  5550. setTimeout(function () {
  5551. if (_this3.drop) {
  5552. addClass(_this3.drop, drop.classPrefix + '-after-open');
  5553. }
  5554. });
  5555. if (typeof this.tether !== 'undefined') {
  5556. this.tether.position();
  5557. }
  5558. this.trigger('open');
  5559. drop.updateBodyClasses();
  5560. }
  5561. }, {
  5562. key: '_transitionEndHandler',
  5563. value: function _transitionEndHandler(e) {
  5564. if (e.target !== e.currentTarget) {
  5565. return;
  5566. }
  5567. if (!hasClass(this.drop, drop.classPrefix + '-open')) {
  5568. removeClass(this.drop, drop.classPrefix + '-open-transitionend');
  5569. }
  5570. this.drop.removeEventListener(transitionEndEvent, this.transitionEndHandler);
  5571. }
  5572. }, {
  5573. key: 'beforeCloseHandler',
  5574. value: function beforeCloseHandler(event) {
  5575. var shouldClose = true;
  5576. if (!this.isClosing && typeof this.options.beforeClose === 'function') {
  5577. this.isClosing = true;
  5578. shouldClose = this.options.beforeClose(event, this) !== false;
  5579. }
  5580. this.isClosing = false;
  5581. return shouldClose;
  5582. }
  5583. }, {
  5584. key: 'close',
  5585. value: function close(event) {
  5586. if (!this.isOpened()) {
  5587. return;
  5588. }
  5589. if (!this.beforeCloseHandler(event)) {
  5590. return;
  5591. }
  5592. removeClass(this.drop, drop.classPrefix + '-open');
  5593. removeClass(this.drop, drop.classPrefix + '-after-open');
  5594. this.drop.addEventListener(transitionEndEvent, this.transitionEndHandler);
  5595. this.trigger('close');
  5596. if (typeof this.tether !== 'undefined') {
  5597. this.tether.disable();
  5598. }
  5599. drop.updateBodyClasses();
  5600. if (this.options.remove) {
  5601. this.remove(event);
  5602. }
  5603. }
  5604. }, {
  5605. key: 'remove',
  5606. value: function remove(event) {
  5607. this.close(event);
  5608. if (this.drop.parentNode) {
  5609. this.drop.parentNode.removeChild(this.drop);
  5610. }
  5611. }
  5612. }, {
  5613. key: 'position',
  5614. value: function position() {
  5615. if (this.isOpened() && typeof this.tether !== 'undefined') {
  5616. this.tether.position();
  5617. }
  5618. }
  5619. }, {
  5620. key: 'destroy',
  5621. value: function destroy() {
  5622. this.remove();
  5623. if (typeof this.tether !== 'undefined') {
  5624. this.tether.destroy();
  5625. }
  5626. for (var i = 0; i < this._boundEvents.length; ++i) {
  5627. var _boundEvents$i = this._boundEvents[i];
  5628. var element = _boundEvents$i.element;
  5629. var _event = _boundEvents$i.event;
  5630. var handler = _boundEvents$i.handler;
  5631. element.removeEventListener(_event, handler);
  5632. }
  5633. this._boundEvents = [];
  5634. this.tether = null;
  5635. this.drop = null;
  5636. this.content = null;
  5637. this.target = null;
  5638. removeFromArray(allDrops[drop.classPrefix], this);
  5639. removeFromArray(drop.drops, this);
  5640. }
  5641. }]);
  5642. return DropInstance;
  5643. }(Evented);
  5644. return drop;
  5645. }
  5646. var Drop = createContext();
  5647. document.addEventListener('DOMContentLoaded', function () {
  5648. Drop.updateBodyClasses();
  5649. });
  5650. return Drop;
  5651. });
  5652. /***/ }),
  5653. /* 6 */
  5654. /***/ (function(module, exports, __webpack_require__) {
  5655. "use strict";
  5656. Object.defineProperty(exports, "__esModule", {
  5657. value: true
  5658. });
  5659. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  5660. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5661. var _jquery = __webpack_require__(1);
  5662. var _jquery2 = _interopRequireDefault(_jquery);
  5663. var _util = __webpack_require__(0);
  5664. var _util2 = _interopRequireDefault(_util);
  5665. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5666. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5667. /**
  5668. * --------------------------------------------------------------------------
  5669. * Bootstrap (v4.0.0-beta): collapse.js
  5670. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5671. * --------------------------------------------------------------------------
  5672. */
  5673. var Collapse = function () {
  5674. /**
  5675. * ------------------------------------------------------------------------
  5676. * Constants
  5677. * ------------------------------------------------------------------------
  5678. */
  5679. var NAME = 'collapse';
  5680. var VERSION = '4.0.0-beta';
  5681. var DATA_KEY = 'bs.collapse';
  5682. var EVENT_KEY = '.' + DATA_KEY;
  5683. var DATA_API_KEY = '.data-api';
  5684. var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
  5685. var TRANSITION_DURATION = 600;
  5686. var Default = {
  5687. toggle: true,
  5688. parent: ''
  5689. };
  5690. var DefaultType = {
  5691. toggle: 'boolean',
  5692. parent: '(string|element)'
  5693. };
  5694. var Event = {
  5695. SHOW: 'show' + EVENT_KEY,
  5696. SHOWN: 'shown' + EVENT_KEY,
  5697. HIDE: 'hide' + EVENT_KEY,
  5698. HIDDEN: 'hidden' + EVENT_KEY,
  5699. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  5700. };
  5701. var ClassName = {
  5702. SHOW: 'show',
  5703. COLLAPSE: 'collapse',
  5704. COLLAPSING: 'collapsing',
  5705. COLLAPSED: 'collapsed'
  5706. };
  5707. var Dimension = {
  5708. WIDTH: 'width',
  5709. HEIGHT: 'height'
  5710. };
  5711. var Selector = {
  5712. ACTIVES: '.show, .collapsing',
  5713. DATA_TOGGLE: '[data-toggle="lu-collapse"]'
  5714. /**
  5715. * ------------------------------------------------------------------------
  5716. * Class Definition
  5717. * ------------------------------------------------------------------------
  5718. */
  5719. };
  5720. var Collapse = function () {
  5721. function Collapse(element, config) {
  5722. _classCallCheck(this, Collapse);
  5723. this._isTransitioning = false;
  5724. this._element = element;
  5725. this._config = this._getConfig(config);
  5726. this._triggerArray = _jquery2.default.makeArray((0, _jquery2.default)('[data-toggle="lu-collapse"][href="#' + element.id + '"],' + ('[data-toggle="lu-collapse"][data-target="#' + element.id + '"]')));
  5727. var tabToggles = (0, _jquery2.default)(Selector.DATA_TOGGLE);
  5728. for (var i = 0; i < tabToggles.length; i++) {
  5729. var elem = tabToggles[i];
  5730. var selector = _util2.default.getSelectorFromElement(elem);
  5731. if (selector !== null && (0, _jquery2.default)(selector).filter(element).length > 0) {
  5732. this._triggerArray.push(elem);
  5733. }
  5734. }
  5735. this._parent = this._config.parent ? this._getParent() : null;
  5736. if (!this._config.parent) {
  5737. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  5738. }
  5739. if (this._config.toggle) {
  5740. this.toggle();
  5741. }
  5742. }
  5743. // getters
  5744. _createClass(Collapse, [{
  5745. key: 'toggle',
  5746. // public
  5747. value: function toggle() {
  5748. if ((0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5749. this.hide();
  5750. } else {
  5751. this.show();
  5752. }
  5753. }
  5754. }, {
  5755. key: 'show',
  5756. value: function show() {
  5757. var _this = this;
  5758. if (this._isTransitioning || (0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5759. return;
  5760. }
  5761. var actives = void 0;
  5762. var activesData = void 0;
  5763. if (this._parent) {
  5764. actives = _jquery2.default.makeArray((0, _jquery2.default)(this._parent).children().children(Selector.ACTIVES));
  5765. if (!actives.length) {
  5766. actives = null;
  5767. }
  5768. }
  5769. if (actives) {
  5770. activesData = (0, _jquery2.default)(actives).data(DATA_KEY);
  5771. if (activesData && activesData._isTransitioning) {
  5772. return;
  5773. }
  5774. }
  5775. var startEvent = _jquery2.default.Event(Event.SHOW);
  5776. (0, _jquery2.default)(this._element).trigger(startEvent);
  5777. if (startEvent.isDefaultPrevented()) {
  5778. return;
  5779. }
  5780. if (actives) {
  5781. Collapse._jQueryInterface.call((0, _jquery2.default)(actives), 'hide');
  5782. if (!activesData) {
  5783. (0, _jquery2.default)(actives).data(DATA_KEY, null);
  5784. }
  5785. }
  5786. var dimension = this._getDimension();
  5787. (0, _jquery2.default)(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
  5788. this._element.style[dimension] = 0;
  5789. if (this._triggerArray.length) {
  5790. (0, _jquery2.default)(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
  5791. }
  5792. this.setTransitioning(true);
  5793. var complete = function complete() {
  5794. (0, _jquery2.default)(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
  5795. _this._element.style[dimension] = '';
  5796. _this.setTransitioning(false);
  5797. (0, _jquery2.default)(_this._element).trigger(Event.SHOWN);
  5798. };
  5799. if (!_util2.default.supportsTransitionEnd()) {
  5800. complete();
  5801. return;
  5802. }
  5803. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  5804. var scrollSize = 'scroll' + capitalizedDimension;
  5805. (0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  5806. this._element.style[dimension] = this._element[scrollSize] + 'px';
  5807. }
  5808. }, {
  5809. key: 'hide',
  5810. value: function hide() {
  5811. var _this2 = this;
  5812. if (this._isTransitioning || !(0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
  5813. return;
  5814. }
  5815. var startEvent = _jquery2.default.Event(Event.HIDE);
  5816. (0, _jquery2.default)(this._element).trigger(startEvent);
  5817. if (startEvent.isDefaultPrevented()) {
  5818. return;
  5819. }
  5820. var dimension = this._getDimension();
  5821. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + 'px';
  5822. _util2.default.reflow(this._element);
  5823. (0, _jquery2.default)(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
  5824. if (this._triggerArray.length) {
  5825. for (var i = 0; i < this._triggerArray.length; i++) {
  5826. var trigger = this._triggerArray[i];
  5827. var selector = _util2.default.getSelectorFromElement(trigger);
  5828. if (selector !== null) {
  5829. var $elem = (0, _jquery2.default)(selector);
  5830. if (!$elem.hasClass(ClassName.SHOW)) {
  5831. (0, _jquery2.default)(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
  5832. }
  5833. }
  5834. }
  5835. }
  5836. this.setTransitioning(true);
  5837. var complete = function complete() {
  5838. _this2.setTransitioning(false);
  5839. (0, _jquery2.default)(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
  5840. };
  5841. this._element.style[dimension] = '';
  5842. if (!_util2.default.supportsTransitionEnd()) {
  5843. complete();
  5844. return;
  5845. }
  5846. (0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  5847. }
  5848. }, {
  5849. key: 'setTransitioning',
  5850. value: function setTransitioning(isTransitioning) {
  5851. this._isTransitioning = isTransitioning;
  5852. }
  5853. }, {
  5854. key: 'dispose',
  5855. value: function dispose() {
  5856. _jquery2.default.removeData(this._element, DATA_KEY);
  5857. this._config = null;
  5858. this._parent = null;
  5859. this._element = null;
  5860. this._triggerArray = null;
  5861. this._isTransitioning = null;
  5862. }
  5863. // private
  5864. }, {
  5865. key: '_getConfig',
  5866. value: function _getConfig(config) {
  5867. config = _jquery2.default.extend({}, Default, config);
  5868. config.toggle = Boolean(config.toggle); // coerce string values
  5869. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  5870. return config;
  5871. }
  5872. }, {
  5873. key: '_getDimension',
  5874. value: function _getDimension() {
  5875. var hasWidth = (0, _jquery2.default)(this._element).hasClass(Dimension.WIDTH);
  5876. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  5877. }
  5878. }, {
  5879. key: '_getParent',
  5880. value: function _getParent() {
  5881. var _this3 = this;
  5882. var parent = null;
  5883. if (_util2.default.isElement(this._config.parent)) {
  5884. parent = this._config.parent;
  5885. // it's a jQuery object
  5886. if (typeof this._config.parent.jquery !== 'undefined') {
  5887. parent = this._config.parent[0];
  5888. }
  5889. } else {
  5890. parent = (0, _jquery2.default)(this._config.parent)[0];
  5891. }
  5892. var selector = '[data-toggle="lu-collapse"][data-parent="' + this._config.parent + '"]';
  5893. (0, _jquery2.default)(parent).find(selector).each(function (i, element) {
  5894. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  5895. });
  5896. return parent;
  5897. }
  5898. }, {
  5899. key: '_addAriaAndCollapsedClass',
  5900. value: function _addAriaAndCollapsedClass(element, triggerArray) {
  5901. if (element) {
  5902. var isOpen = (0, _jquery2.default)(element).hasClass(ClassName.SHOW);
  5903. if (triggerArray.length) {
  5904. (0, _jquery2.default)(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  5905. }
  5906. }
  5907. }
  5908. // static
  5909. }], [{
  5910. key: '_getTargetFromElement',
  5911. value: function _getTargetFromElement(element) {
  5912. var selector = _util2.default.getSelectorFromElement(element);
  5913. return selector ? (0, _jquery2.default)(selector)[0] : null;
  5914. }
  5915. }, {
  5916. key: '_jQueryInterface',
  5917. value: function _jQueryInterface(config) {
  5918. return this.each(function () {
  5919. var $this = (0, _jquery2.default)(this);
  5920. var data = $this.data(DATA_KEY);
  5921. var _config = _jquery2.default.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  5922. if (!data && _config.toggle && /show|hide/.test(config)) {
  5923. _config.toggle = false;
  5924. }
  5925. if (!data) {
  5926. data = new Collapse(this, _config);
  5927. $this.data(DATA_KEY, data);
  5928. }
  5929. if (typeof config === 'string') {
  5930. if (typeof data[config] === 'undefined') {
  5931. throw new Error('No method named "' + config + '"');
  5932. }
  5933. data[config]();
  5934. }
  5935. });
  5936. }
  5937. }, {
  5938. key: 'VERSION',
  5939. get: function get() {
  5940. return VERSION;
  5941. }
  5942. }, {
  5943. key: 'Default',
  5944. get: function get() {
  5945. return Default;
  5946. }
  5947. }]);
  5948. return Collapse;
  5949. }();
  5950. /**
  5951. * ------------------------------------------------------------------------
  5952. * Data Api implementation
  5953. * ------------------------------------------------------------------------
  5954. */
  5955. (0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  5956. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  5957. if (event.currentTarget.tagName === 'A') {
  5958. event.preventDefault();
  5959. }
  5960. var $trigger = (0, _jquery2.default)(this);
  5961. var selector = _util2.default.getSelectorFromElement(this);
  5962. (0, _jquery2.default)(selector).each(function () {
  5963. var $target = (0, _jquery2.default)(this);
  5964. var data = $target.data(DATA_KEY);
  5965. var config = data ? 'toggle' : $trigger.data();
  5966. Collapse._jQueryInterface.call($target, config);
  5967. });
  5968. });
  5969. /**
  5970. * ------------------------------------------------------------------------
  5971. * jQuery
  5972. * ------------------------------------------------------------------------
  5973. */
  5974. _jquery2.default.fn[NAME] = Collapse._jQueryInterface;
  5975. _jquery2.default.fn[NAME].Constructor = Collapse;
  5976. _jquery2.default.fn[NAME].noConflict = function () {
  5977. _jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
  5978. return Collapse._jQueryInterface;
  5979. };
  5980. return Collapse;
  5981. }(_jquery2.default);
  5982. exports.default = Collapse;
  5983. /***/ }),
  5984. /* 7 */
  5985. /***/ (function(module, exports, __webpack_require__) {
  5986. "use strict";
  5987. Object.defineProperty(exports, "__esModule", {
  5988. value: true
  5989. });
  5990. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5991. var _Swiper = __webpack_require__(4);
  5992. var _Swiper2 = _interopRequireDefault(_Swiper);
  5993. var _util = __webpack_require__(0);
  5994. var _util2 = _interopRequireDefault(_util);
  5995. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5996. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5997. var SELECTORS = {
  5998. container: '[data-content-slider]'
  5999. };
  6000. var Default = {
  6001. slideToClickedSlide: false,
  6002. navStorage: 'normal'
  6003. };
  6004. var contentSlider = function () {
  6005. function contentSlider(container, options) {
  6006. _classCallCheck(this, contentSlider);
  6007. this.container = container;
  6008. this.options = options;
  6009. this.isInit = false;
  6010. this.getConfig();
  6011. this.initPLugin();
  6012. this.bindEvents();
  6013. }
  6014. _createClass(contentSlider, [{
  6015. key: 'getConfig',
  6016. value: function getConfig() {
  6017. var dataConfig = this.container.data();
  6018. if (dataConfig.options) {
  6019. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6020. } else {
  6021. this.dataOptions = {};
  6022. }
  6023. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6024. }
  6025. }, {
  6026. key: 'bindEvents',
  6027. value: function bindEvents() {}
  6028. }, {
  6029. key: 'initPLugin',
  6030. value: function initPLugin() {
  6031. var that = this;
  6032. this.swiperInstance = new _Swiper2.default(this.container, {
  6033. scrollbarHide: true,
  6034. effect: false,
  6035. resistance: true,
  6036. resistanceRatio: 0,
  6037. slidesPerView: 'auto',
  6038. watchSlidesVisibility: true,
  6039. onInit: function onInit(swiper) {
  6040. that.onInit(swiper);
  6041. },
  6042. onTap: function onTap(swiper, event) {
  6043. that.changeActiveSlide(swiper);
  6044. if (that.config.slideToClickedSlide) {
  6045. that.slideToClickedSlide(swiper, event);
  6046. }
  6047. that.onClick();
  6048. }
  6049. });
  6050. }
  6051. }, {
  6052. key: 'changeActiveSlide',
  6053. value: function changeActiveSlide(swiper) {
  6054. if (!this.isInit) {
  6055. return;
  6056. }
  6057. var slides = swiper.slides;
  6058. switch (this.config.navStorage) {
  6059. case 'normal':
  6060. break;
  6061. case 'hash':
  6062. break;
  6063. case 'localStorage':
  6064. $(slides).removeClass('is-active');
  6065. window.localStorage.setItem('content-slider-' + this.config.localStorageId, swiper.clickedIndex);
  6066. break;
  6067. }
  6068. }
  6069. }, {
  6070. key: 'slideToClickedSlide',
  6071. value: function slideToClickedSlide(swiper, event) {
  6072. var clickedIndex = swiper.clickedIndex,
  6073. slides = swiper.slides;
  6074. swiper.updateActiveIndex();
  6075. if (!$(slides[clickedIndex - 1]).hasClass('swiper-slide-visible')) {
  6076. swiper.slideTo(swiper.activeIndex - 1);
  6077. }
  6078. if (!$(slides[clickedIndex + 1]).hasClass('swiper-slide-visible')) {
  6079. swiper.slideTo(swiper.activeIndex + 1);
  6080. }
  6081. }
  6082. }, {
  6083. key: 'onInit',
  6084. value: function onInit(swiper) {
  6085. switch (this.config.navStorage) {
  6086. case 'normal':
  6087. var activeSlideIndex = 0,
  6088. slides = swiper.slides;
  6089. $(slides).each(function (index) {
  6090. if ($(this).hasClass('is-active')) {
  6091. activeSlideIndex = index;
  6092. }
  6093. });
  6094. swiper.slideTo(activeSlideIndex, 0);
  6095. break;
  6096. case 'hash':
  6097. if (window.location.hash) {
  6098. var slide = $(swiper.container).find('[href="' + window.location.hash + '"]'),
  6099. slideIndex = slide.closest('.swiper-slide').index();
  6100. slide.trigger('click');
  6101. swiper.slideTo(slideIndex, 0);
  6102. }
  6103. break;
  6104. case 'localStorage':
  6105. var index = window.localStorage.getItem('content-slider-' + this.config.localStorageId);
  6106. if (index) {
  6107. swiper.slideTo(index, 0);
  6108. } else {
  6109. swiper.slideTo(0, 0);
  6110. }
  6111. $(swiper.slides[index]).find('a').trigger('click');
  6112. break;
  6113. }
  6114. this.showSlider(swiper);
  6115. this.isInit = true;
  6116. }
  6117. }, {
  6118. key: 'showSlider',
  6119. value: function showSlider(swiper) {
  6120. swiper.container.css({
  6121. visibility: 'visible'
  6122. });
  6123. }
  6124. }, {
  6125. key: 'onClick',
  6126. value: function onClick() {}
  6127. }, {
  6128. key: 'onSlideChangeStart',
  6129. value: function onSlideChangeStart() {}
  6130. }, {
  6131. key: 'onSlideChangeEnd',
  6132. value: function onSlideChangeEnd() {}
  6133. }]);
  6134. return contentSlider;
  6135. }();
  6136. function initDataSelectors() {
  6137. $(SELECTORS.container).each(function () {
  6138. new contentSlider($(this));
  6139. });
  6140. }
  6141. function initJqueryPlugin() {
  6142. $.fn.luContentSlider = function (options) {
  6143. return this.each(function () {
  6144. new contentSlider($(this), options);
  6145. });
  6146. };
  6147. }
  6148. var init = {
  6149. initDataSelectors: initDataSelectors,
  6150. initJqueryPlugin: initJqueryPlugin
  6151. };
  6152. exports.default = init;
  6153. /***/ }),
  6154. /* 8 */
  6155. /***/ (function(module, exports, __webpack_require__) {
  6156. "use strict";
  6157. Object.defineProperty(exports, "__esModule", {
  6158. value: true
  6159. });
  6160. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6161. var _drop = __webpack_require__(5);
  6162. var _drop2 = _interopRequireDefault(_drop);
  6163. var _selectInput = __webpack_require__(3);
  6164. var _selectInput2 = _interopRequireDefault(_selectInput);
  6165. var _util = __webpack_require__(0);
  6166. var _util2 = _interopRequireDefault(_util);
  6167. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6168. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6169. var SELECTORS = {
  6170. dropdownToggle: '[data-toggle="lu-dropdown"], [data-dropdown]',
  6171. dropdownParent: '.has-dropdown',
  6172. dropdownMenu: '[data-dropdown-menu]',
  6173. dropdownArrowTarget: '[data-arrow-target]',
  6174. dropdownPlacement: '[data-placement]',
  6175. dropdownOpen: '[data-open]',
  6176. dropdownClasses: '[data-class]',
  6177. width: '[data-width]'
  6178. };
  6179. var Default = {
  6180. open: 'click',
  6181. placement: 'bottom left',
  6182. width: null,
  6183. class: ''
  6184. };
  6185. var dropdown = function () {
  6186. function dropdown(_dropdown, options) {
  6187. _classCallCheck(this, dropdown);
  6188. this.dropdown = $(_dropdown);
  6189. this.options = options;
  6190. this.dropdownParent = this.dropdown.closest(SELECTORS.dropdownParent);
  6191. this.dropdownArrowTarget = $(this.dropdownParent).find(SELECTORS.dropdownArrowTarget);
  6192. this.dropdownToggle = $(this.dropdownParent).find(SELECTORS.dropdownToggle);
  6193. this.dropdownMenu = $(this.dropdownParent).find(SELECTORS.dropdownMenu);
  6194. this.getConfig();
  6195. this.initPlugin();
  6196. this.bindEvents();
  6197. if (this.dropdown.find('[data-input-content-target]').length) {
  6198. this.initSelect();
  6199. }
  6200. }
  6201. _createClass(dropdown, [{
  6202. key: 'bindEvents',
  6203. value: function bindEvents() {
  6204. this.dropdown.on('closeDropdown', this.close.bind(this));
  6205. this.dropdown.on('openDropdown', this.open.bind(this));
  6206. }
  6207. }, {
  6208. key: 'getConfig',
  6209. value: function getConfig() {
  6210. var dataConfig = this.dropdown.data();
  6211. if (dataConfig.options) {
  6212. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6213. } else {
  6214. this.dataOptions = {};
  6215. }
  6216. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6217. this.setDropdownWidth();
  6218. if (!this.dropdownArrowTarget.length) {
  6219. this.dropdownArrowTarget = this.dropdown;
  6220. }
  6221. }
  6222. }, {
  6223. key: 'initPlugin',
  6224. value: function initPlugin() {
  6225. this.drop = new _drop2.default({
  6226. target: this.dropdown[0],
  6227. content: this.dropdownMenu[0],
  6228. position: this.config.placement,
  6229. classes: this.config.class,
  6230. openOn: this.config.open
  6231. });
  6232. if (this.config.onInit) {
  6233. this.config.onInit(this.drop);
  6234. }
  6235. this.drop.on('open', this.onOpen.bind(this));
  6236. this.drop.on('close', this.onClose.bind(this));
  6237. }
  6238. }, {
  6239. key: 'getArrowTargetPoition',
  6240. value: function getArrowTargetPoition() {
  6241. var dropdownOffset = this.dropdown.offset();
  6242. var arrowTargetOffset = this.dropdownArrowTarget.offset();
  6243. var arrowTargetWidth = this.dropdownArrowTarget.outerWidth();
  6244. if (/left/i.test(this.config.placement)) {
  6245. this.arrowTargetPosition = arrowTargetOffset.left - dropdownOffset.left + arrowTargetWidth / 2;
  6246. } else if (/right/i.test(this.config.placement)) {
  6247. this.arrowTargetPosition = this.dropdown.outerWidth() - (arrowTargetOffset.left - dropdownOffset.left) - arrowTargetWidth / 2;
  6248. }
  6249. }
  6250. }, {
  6251. key: 'setArrowPostion',
  6252. value: function setArrowPostion() {
  6253. var arrow = $(this.drop.drop).find('[data-arrow]');
  6254. if (!arrow) {
  6255. return;
  6256. }
  6257. this.getArrowTargetPoition();
  6258. var arrowBorderWidth = arrow.outerWidth() / 2;
  6259. if (/center/i.test(this.config.placement)) {
  6260. arrow.css({
  6261. left: '0',
  6262. right: '0',
  6263. margin: 'auto'
  6264. });
  6265. } else if (/left/i.test(this.config.placement)) {
  6266. arrow.css({
  6267. left: this.arrowTargetPosition - arrowBorderWidth
  6268. });
  6269. } else if (/right/i.test(this.config.placement)) {
  6270. arrow.css({
  6271. left: 'auto',
  6272. right: this.arrowTargetPosition - arrowBorderWidth
  6273. });
  6274. }
  6275. }
  6276. }, {
  6277. key: 'setDropdownWidth',
  6278. value: function setDropdownWidth() {
  6279. if (!this.config.width) {
  6280. return;
  6281. }
  6282. $(this.dropdownMenu).css({ opacity: 0, position: 'absolute', left: -10000 });
  6283. var width = parseInt(this.config.width);
  6284. var parentWidth = this.dropdownParent.outerWidth();
  6285. $(this.dropdownMenu).css({
  6286. width: width * parentWidth / 100,
  6287. 'min-width': width * parentWidth / 100
  6288. });
  6289. $(this.dropdownMenu).css({ opacity: '', position: '', left: '' });
  6290. }
  6291. }, {
  6292. key: 'onOpen',
  6293. value: function onOpen() {
  6294. this.setArrowPostion();
  6295. this.setDropdownWidth();
  6296. if (typeof this.config.onOpen === 'function') {
  6297. this.config.onOpen(this.drop);
  6298. }
  6299. }
  6300. }, {
  6301. key: 'onClose',
  6302. value: function onClose() {
  6303. if (typeof this.config.onClose === 'function') {
  6304. this.config.onClose(this.drop);
  6305. }
  6306. }
  6307. }, {
  6308. key: 'open',
  6309. value: function open() {
  6310. this.drop.open();
  6311. }
  6312. }, {
  6313. key: 'close',
  6314. value: function close() {
  6315. this.drop.close();
  6316. }
  6317. }, {
  6318. key: 'initSelect',
  6319. value: function initSelect() {
  6320. _selectInput2.default.init($(this.drop.drop), this.drop);
  6321. }
  6322. }]);
  6323. return dropdown;
  6324. }();
  6325. function initDataSelectors() {
  6326. $(SELECTORS.dropdownToggle).each(function () {
  6327. new dropdown($(this));
  6328. });
  6329. }
  6330. function initJqueryPlugin() {
  6331. $.fn.luDropdown = function (options) {
  6332. return this.each(function () {
  6333. new dropdown($(this), options);
  6334. });
  6335. };
  6336. }
  6337. function closeAllDropdowns() {
  6338. for (var i = 0; i < _drop2.default.drops.length; i++) {
  6339. _drop2.default.drops[i].close();
  6340. }
  6341. }
  6342. var init = {
  6343. initDataSelectors: initDataSelectors,
  6344. initJqueryPlugin: initJqueryPlugin,
  6345. closeAllDropdowns: closeAllDropdowns
  6346. };
  6347. exports.default = init;
  6348. /***/ }),
  6349. /* 9 */
  6350. /***/ (function(module, exports, __webpack_require__) {
  6351. "use strict";
  6352. Object.defineProperty(exports, "__esModule", {
  6353. value: true
  6354. });
  6355. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6356. var _drop = __webpack_require__(5);
  6357. var _drop2 = _interopRequireDefault(_drop);
  6358. var _util = __webpack_require__(0);
  6359. var _util2 = _interopRequireDefault(_util);
  6360. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6361. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6362. var SELECTORS = {
  6363. toggle: '[data-toggle="lu-tooltip"], [data-tooltip]'
  6364. };
  6365. var Default = {
  6366. open: 'hover',
  6367. placement: 'top center',
  6368. class: 'lu-tooltip'
  6369. };
  6370. var tooltip = function () {
  6371. function tooltip(_tooltip, options) {
  6372. _classCallCheck(this, tooltip);
  6373. this.tooltip = $(_tooltip);
  6374. this.options = options;
  6375. this.getConfig();
  6376. this.getContent();
  6377. this.initPlugin();
  6378. }
  6379. _createClass(tooltip, [{
  6380. key: 'getConfig',
  6381. value: function getConfig() {
  6382. var dataConfig = this.tooltip.data();
  6383. if (dataConfig.options) {
  6384. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6385. } else {
  6386. this.dataOptions = {};
  6387. }
  6388. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6389. }
  6390. }, {
  6391. key: 'getContent',
  6392. value: function getContent() {
  6393. if ($(this.tooltip).attr('data-title')) {
  6394. this.tooltipContent = $(this.tooltip).attr('data-title');
  6395. } else {
  6396. $(this.tooltip).attr('data-title', $(this.tooltip).attr('title'));
  6397. $(this.tooltip).removeAttr('title');
  6398. this.tooltipContent = $(this.tooltip).attr('data-title');
  6399. }
  6400. }
  6401. }, {
  6402. key: 'initPlugin',
  6403. value: function initPlugin() {
  6404. this.drop = new _drop2.default({
  6405. target: this.tooltip[0],
  6406. content: this.tooltipContent,
  6407. position: this.config.placement,
  6408. classes: this.config.class,
  6409. openOn: this.config.open
  6410. });
  6411. this.drop.on('open', this.onOpen.bind(this));
  6412. }
  6413. }, {
  6414. key: 'getArrowTargetPoition',
  6415. value: function getArrowTargetPoition() {
  6416. var tooltipwitdh = this.tooltip.outerWidth();
  6417. if (/left/i.test(this.config.placement)) {
  6418. this.arrowTargetPosition = tooltipwitdh / 2;
  6419. } else if (/right/i.test(this.config.placement)) {
  6420. this.arrowTargetPosition = tooltipwitdh / 2;
  6421. }
  6422. }
  6423. }, {
  6424. key: 'setArrowPostion',
  6425. value: function setArrowPostion() {
  6426. console.log(this.drop.drop);
  6427. $(this.drop.drop).find('.lu-tooltip__arrow').remove();
  6428. $(this.drop.drop).append('<div class="lu-tooltip__arrow" data-arrow></div>');
  6429. var arrow = $(this.drop.drop).find('[data-arrow]');
  6430. if (!arrow) {
  6431. return;
  6432. }
  6433. this.getArrowTargetPoition();
  6434. var arrowBorderWidth = arrow.outerWidth() / 2;
  6435. if (/center/i.test(this.config.placement)) {
  6436. arrow.css({
  6437. left: '0',
  6438. right: '0',
  6439. margin: 'auto'
  6440. });
  6441. } else if (/left/i.test(this.config.placement)) {
  6442. arrow.css({
  6443. left: this.arrowTargetPosition,
  6444. marginLeft: -arrowBorderWidth
  6445. });
  6446. } else if (/right/i.test(this.config.placement)) {
  6447. arrow.css({
  6448. left: 'auto',
  6449. right: this.arrowTargetPosition,
  6450. marginRight: -arrowBorderWidth
  6451. });
  6452. }
  6453. }
  6454. }, {
  6455. key: 'onOpen',
  6456. value: function onOpen() {
  6457. this.setArrowPostion();
  6458. }
  6459. }]);
  6460. return tooltip;
  6461. }();
  6462. function initDataSelectors() {
  6463. $(SELECTORS.toggle).each(function () {
  6464. new tooltip($(this));
  6465. });
  6466. }
  6467. function initJqueryPlugin() {
  6468. $.fn.luTooltip = function (options) {
  6469. return this.each(function () {
  6470. new tooltip($(this), options);
  6471. });
  6472. };
  6473. }
  6474. var init = {
  6475. initDataSelectors: initDataSelectors,
  6476. initJqueryPlugin: initJqueryPlugin
  6477. };
  6478. exports.default = init;
  6479. /***/ }),
  6480. /* 10 */
  6481. /***/ (function(module, exports, __webpack_require__) {
  6482. "use strict";
  6483. Object.defineProperty(exports, "__esModule", {
  6484. value: true
  6485. });
  6486. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6487. var _util = __webpack_require__(0);
  6488. var _util2 = _interopRequireDefault(_util);
  6489. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6490. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6491. var SELECTORS = {
  6492. container: '[data-check-container]',
  6493. checkAll: '[data-check-all]',
  6494. childs: 'input:checkbox.table-mass-action-check:enabled',
  6495. counterView: '[data-checkbox-counter]'
  6496. };
  6497. var Default = {};
  6498. var CheckAll = function () {
  6499. function CheckAll(container, options) {
  6500. _classCallCheck(this, CheckAll);
  6501. this.container = container;
  6502. this.checkAllBtn = this.container.find(SELECTORS.checkAll);
  6503. this.childs = this.container.find(SELECTORS.childs).not(SELECTORS.checkAll);
  6504. this.counterView = this.container.find(SELECTORS.counterView);
  6505. this.checkCounter = 0;
  6506. this.options = options;
  6507. this.getConfig();
  6508. this.initCounter();
  6509. this.bindEvents();
  6510. }
  6511. _createClass(CheckAll, [{
  6512. key: 'bindEvents',
  6513. value: function bindEvents() {
  6514. this.checkAllBtn.on('change', this.checkAll.bind(this));
  6515. this.childs.on('change', this.updateCounter.bind(this));
  6516. }
  6517. }, {
  6518. key: 'getConfig',
  6519. value: function getConfig() {
  6520. var dataConfig = this.container.data();
  6521. if (dataConfig.options) {
  6522. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6523. } else {
  6524. this.dataOptions = {};
  6525. }
  6526. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6527. }
  6528. }, {
  6529. key: 'checkAll',
  6530. value: function checkAll(event) {
  6531. this.childs.prop('checked', event.target.checked);
  6532. if (event.target.checked) {
  6533. this.checkCounter = this.childs.length;
  6534. } else {
  6535. this.checkCounter = 0;
  6536. }
  6537. this.updateCounterView();
  6538. }
  6539. }, {
  6540. key: 'toggleCheckAllBtn',
  6541. value: function toggleCheckAllBtn() {
  6542. if (this.childs.length == this.checkCounter) {
  6543. this.checkAllBtn.prop('checked', true);
  6544. } else {
  6545. this.checkAllBtn.prop('checked', false);
  6546. }
  6547. if (typeof this.config.onCheckAll === 'function') {
  6548. this.config.onCheckAll(this.container, this.checkCounter);
  6549. }
  6550. }
  6551. }, {
  6552. key: 'initCounter',
  6553. value: function initCounter() {
  6554. if (this.checkAllBtn.is(':checked')) {
  6555. this.checkCounter = this.childs.length;
  6556. this.childs.prop('checked', true);
  6557. } else {
  6558. this.checkCounter = this.childs.filter(':checked').length;
  6559. }
  6560. }
  6561. }, {
  6562. key: 'updateCounter',
  6563. value: function updateCounter(event) {
  6564. if (event.target.checked) {
  6565. this.checkCounter++;
  6566. this.toggleCheckAllBtn();
  6567. } else {
  6568. this.checkCounter--;
  6569. this.toggleCheckAllBtn();
  6570. }
  6571. this.updateCounterView();
  6572. }
  6573. }, {
  6574. key: 'updateCounterView',
  6575. value: function updateCounterView() {
  6576. if (typeof this.config.onCheck === 'function') {
  6577. this.config.onCheck(this.container, this.checkCounter);
  6578. }
  6579. this.counterView.text(this.checkCounter);
  6580. }
  6581. }]);
  6582. return CheckAll;
  6583. }();
  6584. function initDataSelectors() {
  6585. $(SELECTORS.container).each(function () {
  6586. new CheckAll($(this));
  6587. });
  6588. }
  6589. function initJqueryPlugin() {
  6590. $.fn.luCheckAll = function (options) {
  6591. return this.each(function () {
  6592. new CheckAll($(this), options);
  6593. });
  6594. };
  6595. }
  6596. var init = {
  6597. initDataSelectors: initDataSelectors,
  6598. initJqueryPlugin: initJqueryPlugin
  6599. };
  6600. exports.default = init;
  6601. /***/ }),
  6602. /* 11 */
  6603. /***/ (function(module, exports, __webpack_require__) {
  6604. "use strict";
  6605. var forms = [].slice.call(document.querySelectorAll('.lu-form-control'));
  6606. forms.forEach(function (item) {
  6607. var $item = $(item);
  6608. item.addEventListener('focus', function () {
  6609. $item.closest('.lu-input-group').addClass('is-focus');
  6610. });
  6611. item.addEventListener('blur', function () {
  6612. $item.closest('.lu-input-group').removeClass('is-focus');
  6613. });
  6614. });
  6615. /***/ }),
  6616. /* 12 */
  6617. /***/ (function(module, exports, __webpack_require__) {
  6618. "use strict";
  6619. Object.defineProperty(exports, "__esModule", {
  6620. value: true
  6621. });
  6622. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6623. __webpack_require__(32);
  6624. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6625. var SELECTORS = {
  6626. container: '[data-range-slider]',
  6627. input: 'input',
  6628. slider: '[data-slider]'
  6629. };
  6630. var rangeSlider = function () {
  6631. function rangeSlider(container) {
  6632. _classCallCheck(this, rangeSlider);
  6633. this.container = container;
  6634. this.input = this.container.find(SELECTORS.input);
  6635. this.slider = this.container.find(SELECTORS.slider);
  6636. this.config = this.container.data();
  6637. this.value = this.input.val();
  6638. this.bindEvents();
  6639. this.initSlider();
  6640. }
  6641. _createClass(rangeSlider, [{
  6642. key: 'bindEvents',
  6643. value: function bindEvents() {
  6644. this.input.on('change', this.updateSlider.bind(this));
  6645. }
  6646. }, {
  6647. key: 'initSlider',
  6648. value: function initSlider() {
  6649. var that = this;
  6650. this.sliderInstance = $(this.slider).slider({
  6651. range: "min",
  6652. value: this.value,
  6653. min: this.config.min,
  6654. max: this.config.max,
  6655. step: this.config.step,
  6656. slide: function slide(event, ui) {
  6657. that.updateInput(ui.value);
  6658. }
  6659. });
  6660. }
  6661. }, {
  6662. key: 'updateInput',
  6663. value: function updateInput(value) {
  6664. this.input.val(value);
  6665. }
  6666. }, {
  6667. key: 'updateSlider',
  6668. value: function updateSlider(evnet) {
  6669. this.sliderInstance.slider("value", event.target.value);
  6670. $('input[name^="outputadditionalDiskSize"]').rangeSlider.not(this).max("20");
  6671. }
  6672. }], [{
  6673. key: 'init',
  6674. value: function init(container) {
  6675. if (container) {
  6676. new rangeSlider($(container).find(SELECTORS.container));
  6677. } else {
  6678. $(SELECTORS.container).each(function () {
  6679. new rangeSlider($(this));
  6680. });
  6681. }
  6682. }
  6683. }, {
  6684. key: 'reload',
  6685. value: function reload(container) {}
  6686. }]);
  6687. return rangeSlider;
  6688. }();
  6689. function initDataSelectors() {
  6690. $(SELECTORS.select).each(function () {
  6691. new Select($(this));
  6692. });
  6693. }
  6694. function initJqueryPlugin() {
  6695. $.fn.luSelect = function (options) {
  6696. return this.each(function () {
  6697. new Select($(this), options);
  6698. });
  6699. };
  6700. }
  6701. var init = {
  6702. initDataSelectors: initDataSelectors,
  6703. initJqueryPlugin: initJqueryPlugin
  6704. };
  6705. exports.default = rangeSlider;
  6706. /***/ }),
  6707. /* 13 */
  6708. /***/ (function(module, exports, __webpack_require__) {
  6709. "use strict";
  6710. Object.defineProperty(exports, "__esModule", {
  6711. value: true
  6712. });
  6713. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6714. var _Selectize = __webpack_require__(29);
  6715. var _Selectize2 = _interopRequireDefault(_Selectize);
  6716. var _util = __webpack_require__(0);
  6717. var _util2 = _interopRequireDefault(_util);
  6718. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6719. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6720. //init selects only inside of #layers in order not to break other templates
  6721. var SELECTORS = {
  6722. select: '#layers select',
  6723. rawSelect: '#layers .lu-form-control--basic'
  6724. };
  6725. var Default = {
  6726. maxItems: 1,
  6727. removeButton: false,
  6728. resotreOnBackspace: false,
  6729. dragAndDrop: false
  6730. };
  6731. var Select = function () {
  6732. function Select(element, options) {
  6733. _classCallCheck(this, Select);
  6734. this.element = element;
  6735. this.options = options;
  6736. this.getConfig();
  6737. this.directionDetector();
  6738. this.additionalPlugins();
  6739. this.initPlugin();
  6740. }
  6741. _createClass(Select, [{
  6742. key: 'initPlugin',
  6743. value: function initPlugin() {
  6744. var plugins = this.additionalPlugins();
  6745. this.element.selectize({
  6746. placeholder: '',
  6747. maxItems: this.config.maxItems,
  6748. createOnBlur: true,
  6749. plugins: plugins,
  6750. copyClassesToDropdown: false
  6751. });
  6752. }
  6753. }, {
  6754. key: 'getConfig',
  6755. value: function getConfig() {
  6756. var dataConfig = this.element.data();
  6757. if (dataConfig.options) {
  6758. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  6759. } else {
  6760. this.dataOptions = {};
  6761. }
  6762. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6763. }
  6764. }, {
  6765. key: 'directionDetector',
  6766. value: function directionDetector() {
  6767. _Selectize2.default.define('directionDetector', function (options) {
  6768. var self = this;
  6769. this.positionDropdown = function () {
  6770. var original = self.positionDropdown;
  6771. return function () {
  6772. this.offset = this.settings.dropdownParent === 'body' ? this.$control.offset() : this.$control.position();
  6773. this.offset.top += this.$control.outerHeight(true);
  6774. var controlHeight = this.$control.innerHeight();
  6775. var controlPositon = $(this.$control).offset().top - $(window).scrollTop();
  6776. var dropdownOffset = controlHeight + controlPositon + this.$dropdown.outerHeight(true);
  6777. if ($(window).innerHeight() - dropdownOffset < 0) {
  6778. this.$dropdown.css({
  6779. 'top': 'auto',
  6780. 'bottom': 8 + controlHeight,
  6781. 'left': this.offset.left,
  6782. 'width': this.$control[0].getBoundingClientRect().width
  6783. });
  6784. } else {
  6785. this.$dropdown.css({
  6786. 'width': this.$control[0].getBoundingClientRect().width,
  6787. 'top': this.offset.top,
  6788. 'left': this.offset.left,
  6789. 'bottom': 'auto'
  6790. });
  6791. }
  6792. };
  6793. }();
  6794. });
  6795. }
  6796. }, {
  6797. key: 'additionalPlugins',
  6798. value: function additionalPlugins() {
  6799. var plugins = ['directionDetector'];
  6800. if (this.config.removeButton) {
  6801. plugins.push('remove_button');
  6802. }
  6803. if (this.config.resotreOnBackspace) {
  6804. plugins.push('restore_on_backspace');
  6805. }
  6806. if (this.config.drag_drop) {
  6807. plugins.push('drag_drop');
  6808. }
  6809. return plugins;
  6810. }
  6811. }]);
  6812. return Select;
  6813. }();
  6814. function initDataSelectors() {
  6815. // $(SELECTORS.select).not(SELECTORS.rawSelect).each(function () {
  6816. // new Select($(this));
  6817. // });
  6818. }
  6819. function initJqueryPlugin() {
  6820. $.fn.luSelect = function (options) {
  6821. return this.each(function () {
  6822. new Select($(this), options);
  6823. });
  6824. };
  6825. }
  6826. var init = {
  6827. initDataSelectors: initDataSelectors,
  6828. initJqueryPlugin: initJqueryPlugin
  6829. };
  6830. exports.default = init;
  6831. /***/ }),
  6832. /* 14 */
  6833. /***/ (function(module, exports, __webpack_require__) {
  6834. "use strict";
  6835. Object.defineProperty(exports, "__esModule", {
  6836. value: true
  6837. });
  6838. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6839. var _autosize = __webpack_require__(30);
  6840. var _autosize2 = _interopRequireDefault(_autosize);
  6841. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6842. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6843. var SELECTORS = {
  6844. container: '[data-editable-cell]',
  6845. input: '[data-editable-input]',
  6846. content: '[data-editable-contnet]',
  6847. init: '[data-init-edit]',
  6848. abort: '[data-abort-edit]',
  6849. accept: '[data-accept-edit]'
  6850. };
  6851. var Default = {};
  6852. var editableCell = function () {
  6853. function editableCell(container, options) {
  6854. _classCallCheck(this, editableCell);
  6855. this.container = container;
  6856. this.options = options;
  6857. this.input = this.container.find(SELECTORS.input);
  6858. this.content = this.container.find(SELECTORS.content);
  6859. this.init = this.container.find(SELECTORS.init);
  6860. this.abort = this.container.find(SELECTORS.abort);
  6861. this.accept = this.container.find(SELECTORS.accept);
  6862. this.oldInputValue = this.input.val().trim();
  6863. this.getConfig();
  6864. this.initEvents();
  6865. this.trimInputContent();
  6866. this.textareaAutosize();
  6867. this.blockNewLine();
  6868. }
  6869. _createClass(editableCell, [{
  6870. key: 'getConfig',
  6871. value: function getConfig() {
  6872. var dataConfig = this.container.data();
  6873. if (dataConfig.options) {
  6874. this.dataOptions = util.parseDataOptions(dataConfig.options);
  6875. } else {
  6876. this.dataOptions = {};
  6877. }
  6878. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  6879. }
  6880. }, {
  6881. key: 'bindEvents',
  6882. value: function bindEvents() {
  6883. $(this.init).on('click', this.initEdit.bind(this));
  6884. $(this.abort).on('click', this.abortEdit.bind(this));
  6885. $(this.accept).on('click', this.acceptEdit.bind(this));
  6886. }
  6887. }, {
  6888. key: 'initEdit',
  6889. value: function initEdit(event) {
  6890. this.content.addClass('hidden');
  6891. this.init.addClass('hidden');
  6892. this.accept.removeClass('hidden');
  6893. this.abort.removeClass('hidden');
  6894. this.input.removeClass('hidden');
  6895. this.textareaAutosizeUpdate();
  6896. $(this.input).focus();
  6897. }
  6898. }, {
  6899. key: 'abortEdit',
  6900. value: function abortEdit(event) {
  6901. this.content.removeClass('hidden');
  6902. this.init.removeClass('hidden');
  6903. this.accept.addClass('hidden');
  6904. this.abort.addClass('hidden');
  6905. this.input.addClass('hidden');
  6906. this.input.val(this.oldInputValue);
  6907. }
  6908. }, {
  6909. key: 'textareaAutosize',
  6910. value: function textareaAutosize() {
  6911. (0, _autosize2.default)(this.input);
  6912. }
  6913. }, {
  6914. key: 'textareaAutosizeUpdate',
  6915. value: function textareaAutosizeUpdate() {
  6916. _autosize2.default.update(this.input);
  6917. }
  6918. }, {
  6919. key: 'trimInputContent',
  6920. value: function trimInputContent() {
  6921. $(this.input).val($(this.input).val().trim());
  6922. }
  6923. }, {
  6924. key: 'blockNewLine',
  6925. value: function blockNewLine() {
  6926. $(this.input).on('keypress', function (e) {
  6927. if ((e.keyCode || e.which) == 13) {
  6928. e.preventDefault();
  6929. }
  6930. });
  6931. }
  6932. }, {
  6933. key: 'acceptEdit',
  6934. value: function acceptEdit(event) {
  6935. this.content.text(this.input.val());
  6936. this.content.removeClass('hidden');
  6937. this.init.removeClass('hidden');
  6938. this.accept.addClass('hidden');
  6939. this.abort.addClass('hidden');
  6940. this.input.addClass('hidden');
  6941. }
  6942. }]);
  6943. return editableCell;
  6944. }();
  6945. function initDataSelectors() {
  6946. $(SELECTORS.container).each(function () {
  6947. new editableCell($(this));
  6948. });
  6949. }
  6950. function initJqueryPlugin() {
  6951. $.fn.luEditableCell = function (options) {
  6952. return this.each(function () {
  6953. new editableCell($(this), options);
  6954. });
  6955. };
  6956. }
  6957. var init = {
  6958. initDataSelectors: initDataSelectors,
  6959. initJqueryPlugin: initJqueryPlugin
  6960. };
  6961. exports.default = init;
  6962. /***/ }),
  6963. /* 15 */
  6964. /***/ (function(module, exports, __webpack_require__) {
  6965. "use strict";
  6966. Object.defineProperty(exports, "__esModule", {
  6967. value: true
  6968. });
  6969. var _toastr = __webpack_require__(35);
  6970. var _toastr2 = _interopRequireDefault(_toastr);
  6971. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6972. /**
  6973. * --------------------------------------------------------------------------
  6974. * Bootstrap (v4.0.0-beta): alert.js
  6975. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  6976. * --------------------------------------------------------------------------
  6977. */
  6978. var alert = {
  6979. init: function init() {
  6980. this.cacheDom();
  6981. this.bindEvents();
  6982. },
  6983. cacheDom: function cacheDom() {
  6984. this.$showAlert = $("[data-toggle='lu-alert']");
  6985. this.$alertFixedTop = $('.alert--fixed-top');
  6986. this.$alertFixedBottom = $('.alert--fixed-bottom');
  6987. },
  6988. bindEvents: function bindEvents() {
  6989. this.$showAlert.on('click', this.getData.bind(this));
  6990. },
  6991. //default settings
  6992. settings: function settings() {
  6993. // alert icon true by default
  6994. if (this.$alertIcon == false) {
  6995. this.$icon = '';
  6996. } else {
  6997. this.$icon = 'lu-alert--icon';
  6998. }
  6999. // default alert timeout if not defined in data attributes
  7000. if (!this.$alertTimeout) {
  7001. this.$alertTimeout = 100000;
  7002. }
  7003. if (this.$alertActions) {
  7004. this.$actions = this.$alertActions;
  7005. }
  7006. },
  7007. // create alert with data stored in array
  7008. create: function create(event) {
  7009. this.$alertPosition = event.$alertPosition;
  7010. this.$alertSize = event.$alertSize;
  7011. this.$alertStatus = event.$alertStatus;
  7012. this.$alertTitle = event.$alertTitle;
  7013. this.$alertBody = event.$alertBody;
  7014. this.$alertIcon = event.$alertIcon;
  7015. this.$alertActions = event.$alertActions;
  7016. this.$alertTimeout = event.$alertTimeout;
  7017. this.show(event);
  7018. },
  7019. // get data from data attributes
  7020. getData: function getData(event) {
  7021. var target = $(event.currentTarget);
  7022. this.$alertPosition = target.data('alert-position');
  7023. this.$alertSize = target.data('alert-size');
  7024. this.$alertStatus = target.data('alert-status');
  7025. this.$alertTitle = target.data('alert-title');
  7026. this.$alertBody = target.data('alert-body');
  7027. this.$alertIcon = target.data('alert-icon');
  7028. this.$alertActions = target.data('alert-actions');
  7029. this.$alertTimeout = target.data('alert-timeout');
  7030. this.show(event);
  7031. },
  7032. // main function that showing alerts
  7033. show: function show(event) {
  7034. this.settings();
  7035. if (this.$alertPosition == 'top' || this.$alertPosition == 'bottom') {
  7036. // animation delay
  7037. this.delay = 400;
  7038. var that = this;
  7039. if (this.$alertPosition == 'top') {
  7040. var that = this;
  7041. $('body').prepend(this.getTemplate());
  7042. this.$alertFixedTop = $('.alert--fixed-top');
  7043. this.$alertHeight = that.$alertFixedTop.outerHeight();
  7044. this.$alertFixedTop.css('margin-top', -this.$alertHeight).animate({ 'margin-top': 0 }, this.delay);
  7045. $(window).resize(function () {
  7046. if (that.$alertFixedTop.hasClass('is-active')) {
  7047. this.$alertHeight = that.$alertFixedTop.outerHeight();
  7048. }
  7049. });
  7050. this.$hideAlert = this.$alertFixedTop.closest('.alert').find('.btn--close');
  7051. this.$hideAlert.on('click', this.hideT.bind(this));
  7052. } else {
  7053. $('body').append(this.getTemplate());
  7054. this.$alertFixedBottom = $('.alert--fixed-bottom');
  7055. this.$alertBottomHeight = this.$alertFixedBottom.outerHeight();
  7056. this.$alertFixedBottom.css('margin-bottom', -this.$alertBottomHeight).animate({ 'margin-bottom': '0' }, this.delay);
  7057. this.$hideAlert = this.$alertFixedBottom.closest('.alert').find('.btn--close');
  7058. this.$hideAlert.on('click', this.hideB.bind(this));
  7059. }
  7060. } else {
  7061. _toastr2.default.success(this.getTemplate());
  7062. }
  7063. },
  7064. hideT: function hideT(event) {
  7065. var that = this;
  7066. this.$alertHeight = this.$alertFixedTop.outerHeight();
  7067. this.$alertFixedTop.animate({ 'margin-top': -this.$alertHeight }, this.delay);
  7068. setTimeout(function () {
  7069. that.$alertFixedTop.removeClass('is-active').remove();
  7070. }, this.delay);
  7071. },
  7072. hideB: function hideB() {
  7073. var that = this;
  7074. this.$alertHeight = this.$alertFixedBottom.outerHeight();
  7075. this.$alertFixedBottom.animate({ 'margin-bottom': -this.$alertHeight }, this.delay);
  7076. setTimeout(function () {
  7077. that.$alertFixedBottom.removeClass('is-active').remove();
  7078. }, this.delay);
  7079. },
  7080. getTemplate: function getTemplate() {
  7081. _toastr2.default.options = {
  7082. "positionClass": "lu-toast--" + this.$alertPosition,
  7083. "timeOut": this.$alertTimeout
  7084. };
  7085. this.$actions = '';
  7086. if (this.$alertActions) {
  7087. this.$actions = '<div class="lu-alert__actions">' + this.$alertActions + '</div>';
  7088. }
  7089. var $titleTemplate = '';
  7090. if (this.$alertTitle) {
  7091. $titleTemplate = '<div class="lu-alert__title">' + this.$alertTitle + ' </div>';
  7092. }
  7093. // main alert template
  7094. 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>';
  7095. // template of top and bottom alert
  7096. 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>';
  7097. var $tmpl = $primaryTemplate;
  7098. if (this.$alertPosition == 'top' || this.$alertPosition == 'bottom') {
  7099. $tmpl = $secondaryTemplate;
  7100. }
  7101. return $tmpl;
  7102. }
  7103. };
  7104. exports.default = alert;
  7105. /***/ }),
  7106. /* 16 */
  7107. /***/ (function(module, exports, __webpack_require__) {
  7108. "use strict";
  7109. Object.defineProperty(exports, "__esModule", {
  7110. value: true
  7111. });
  7112. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7113. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7114. var _util = __webpack_require__(0);
  7115. var _util2 = _interopRequireDefault(_util);
  7116. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7117. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7118. /**
  7119. * --------------------------------------------------------------------------
  7120. * Bootstrap (v4.0.0-beta.2): modal.js
  7121. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7122. * --------------------------------------------------------------------------
  7123. */
  7124. var Modal = function () {
  7125. /**
  7126. * ------------------------------------------------------------------------
  7127. * Constants
  7128. * ------------------------------------------------------------------------
  7129. */
  7130. var NAME = 'luModal';
  7131. var VERSION = '4.0.0-beta.2';
  7132. var DATA_KEY = 'bs.modal';
  7133. var EVENT_KEY = '.' + DATA_KEY;
  7134. var DATA_API_KEY = '.data-api';
  7135. var JQUERY_NO_CONFLICT = $.fn[NAME];
  7136. var TRANSITION_DURATION = 300;
  7137. var BACKDROP_TRANSITION_DURATION = 150;
  7138. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  7139. var Default = {
  7140. backdrop: true,
  7141. keyboard: true,
  7142. focus: true,
  7143. show: true
  7144. };
  7145. var DefaultType = {
  7146. backdrop: '(boolean|string)',
  7147. keyboard: 'boolean',
  7148. focus: 'boolean',
  7149. show: 'boolean'
  7150. };
  7151. var Event = {
  7152. HIDE: 'hide' + EVENT_KEY,
  7153. HIDDEN: 'hidden' + EVENT_KEY,
  7154. SHOW: 'show' + EVENT_KEY,
  7155. SHOWN: 'shown' + EVENT_KEY,
  7156. FOCUSIN: 'focusin' + EVENT_KEY,
  7157. RESIZE: 'resize' + EVENT_KEY,
  7158. CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
  7159. KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
  7160. MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
  7161. MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
  7162. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  7163. };
  7164. var ClassName = {
  7165. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  7166. BACKDROP: 'modal-backdrop',
  7167. OPEN: 'modal-open',
  7168. FADE: 'fade',
  7169. SHOW: 'show'
  7170. };
  7171. var Selector = {
  7172. DIALOG: '.modal-dialog, .lu-modal__dialog',
  7173. DATA_TOGGLE: '[data-toggle="lu-modal"], [data-lu-modal]',
  7174. DATA_DISMISS: '[data-dismiss="lu-modal"]',
  7175. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  7176. STICKY_CONTENT: '.sticky-top',
  7177. NAVBAR_TOGGLER: '.navbar-toggler'
  7178. /**
  7179. * ------------------------------------------------------------------------
  7180. * Class Definition
  7181. * ------------------------------------------------------------------------
  7182. */
  7183. };
  7184. var Modal = function () {
  7185. function Modal(element, config) {
  7186. _classCallCheck(this, Modal);
  7187. this._config = this._getConfig(config);
  7188. this._element = element;
  7189. this._dialog = $(element).find(Selector.DIALOG)[0];
  7190. this._backdrop = null;
  7191. this._isShown = false;
  7192. this._isBodyOverflowing = false;
  7193. this._ignoreBackdropClick = false;
  7194. this._originalBodyPadding = 0;
  7195. this._scrollbarWidth = 0;
  7196. }
  7197. // getters
  7198. _createClass(Modal, [{
  7199. key: 'toggle',
  7200. // public
  7201. value: function toggle(relatedTarget) {
  7202. return this._isShown ? this.hide() : this.show(relatedTarget);
  7203. }
  7204. }, {
  7205. key: 'show',
  7206. value: function show(relatedTarget) {
  7207. var _this = this;
  7208. if (this._isTransitioning || this._isShown) {
  7209. return;
  7210. }
  7211. if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  7212. this._isTransitioning = true;
  7213. }
  7214. var showEvent = $.Event(Event.SHOW, {
  7215. relatedTarget: relatedTarget
  7216. });
  7217. $(this._element).trigger(showEvent);
  7218. if (this._isShown || showEvent.isDefaultPrevented()) {
  7219. return;
  7220. }
  7221. this._isShown = true;
  7222. this._checkScrollbar();
  7223. this._setScrollbar();
  7224. this._adjustDialog();
  7225. $(document.body).addClass(ClassName.OPEN);
  7226. this._setEscapeEvent();
  7227. this._setResizeEvent();
  7228. $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
  7229. return _this.hide(event);
  7230. });
  7231. $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
  7232. $(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
  7233. if ($(event.target).is(_this._element)) {
  7234. _this._ignoreBackdropClick = true;
  7235. }
  7236. });
  7237. });
  7238. this._showBackdrop(function () {
  7239. return _this._showElement(relatedTarget);
  7240. });
  7241. }
  7242. }, {
  7243. key: 'hide',
  7244. value: function hide(event) {
  7245. var _this2 = this;
  7246. if (event) {
  7247. event.preventDefault();
  7248. }
  7249. if (this._isTransitioning || !this._isShown) {
  7250. return;
  7251. }
  7252. var hideEvent = $.Event(Event.HIDE);
  7253. $(this._element).trigger(hideEvent);
  7254. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  7255. return;
  7256. }
  7257. this._isShown = false;
  7258. var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  7259. if (transition) {
  7260. this._isTransitioning = true;
  7261. }
  7262. this._setEscapeEvent();
  7263. this._setResizeEvent();
  7264. $(document).off(Event.FOCUSIN);
  7265. $(this._element).removeClass(ClassName.SHOW);
  7266. $(this._element).off(Event.CLICK_DISMISS);
  7267. $(this._dialog).off(Event.MOUSEDOWN_DISMISS);
  7268. if (transition) {
  7269. $(this._element).one(_util2.default.TRANSITION_END, function (event) {
  7270. return _this2._hideModal(event);
  7271. }).emulateTransitionEnd(TRANSITION_DURATION);
  7272. } else {
  7273. this._hideModal();
  7274. }
  7275. }
  7276. }, {
  7277. key: 'dispose',
  7278. value: function dispose() {
  7279. $.removeData(this._element, DATA_KEY);
  7280. $(window, document, this._element, this._backdrop).off(EVENT_KEY);
  7281. this._config = null;
  7282. this._element = null;
  7283. this._dialog = null;
  7284. this._backdrop = null;
  7285. this._isShown = null;
  7286. this._isBodyOverflowing = null;
  7287. this._ignoreBackdropClick = null;
  7288. this._scrollbarWidth = null;
  7289. }
  7290. }, {
  7291. key: 'handleUpdate',
  7292. value: function handleUpdate() {
  7293. this._adjustDialog();
  7294. }
  7295. // private
  7296. }, {
  7297. key: '_getConfig',
  7298. value: function _getConfig(config) {
  7299. config = $.extend({}, Default, config);
  7300. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  7301. return config;
  7302. }
  7303. }, {
  7304. key: '_showElement',
  7305. value: function _showElement(relatedTarget) {
  7306. var _this3 = this;
  7307. var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  7308. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  7309. // don't move modals dom position
  7310. document.body.appendChild(this._element);
  7311. }
  7312. this._element.style.display = 'block';
  7313. this._element.removeAttribute('aria-hidden');
  7314. this._element.scrollTop = 0;
  7315. if (transition) {
  7316. _util2.default.reflow(this._element);
  7317. }
  7318. $(this._element).addClass(ClassName.SHOW);
  7319. if (this._config.focus) {
  7320. this._enforceFocus();
  7321. }
  7322. var shownEvent = $.Event(Event.SHOWN, {
  7323. relatedTarget: relatedTarget
  7324. });
  7325. var transitionComplete = function transitionComplete() {
  7326. if (_this3._config.focus) {
  7327. _this3._element.focus();
  7328. }
  7329. _this3._isTransitioning = false;
  7330. $(_this3._element).trigger(shownEvent);
  7331. };
  7332. if (transition) {
  7333. $(this._dialog).one(_util2.default.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
  7334. } else {
  7335. transitionComplete();
  7336. }
  7337. }
  7338. }, {
  7339. key: '_enforceFocus',
  7340. value: function _enforceFocus() {
  7341. var _this4 = this;
  7342. $(document).off(Event.FOCUSIN) // guard against infinite focus loop
  7343. .on(Event.FOCUSIN, function (event) {
  7344. if (document !== event.target && _this4._element !== event.target && !$(_this4._element).has(event.target).length) {
  7345. _this4._element.focus();
  7346. }
  7347. });
  7348. }
  7349. }, {
  7350. key: '_setEscapeEvent',
  7351. value: function _setEscapeEvent() {
  7352. var _this5 = this;
  7353. if (this._isShown && this._config.keyboard) {
  7354. $(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
  7355. if (event.which === ESCAPE_KEYCODE) {
  7356. event.preventDefault();
  7357. _this5.hide();
  7358. }
  7359. });
  7360. } else if (!this._isShown) {
  7361. $(this._element).off(Event.KEYDOWN_DISMISS);
  7362. }
  7363. }
  7364. }, {
  7365. key: '_setResizeEvent',
  7366. value: function _setResizeEvent() {
  7367. var _this6 = this;
  7368. if (this._isShown) {
  7369. $(window).on(Event.RESIZE, function (event) {
  7370. return _this6.handleUpdate(event);
  7371. });
  7372. } else {
  7373. $(window).off(Event.RESIZE);
  7374. }
  7375. }
  7376. }, {
  7377. key: '_hideModal',
  7378. value: function _hideModal() {
  7379. var _this7 = this;
  7380. this._element.style.display = 'none';
  7381. this._element.setAttribute('aria-hidden', true);
  7382. this._isTransitioning = false;
  7383. this._showBackdrop(function () {
  7384. $(document.body).removeClass(ClassName.OPEN);
  7385. _this7._resetAdjustments();
  7386. _this7._resetScrollbar();
  7387. $(_this7._element).trigger(Event.HIDDEN);
  7388. });
  7389. }
  7390. }, {
  7391. key: '_removeBackdrop',
  7392. value: function _removeBackdrop() {
  7393. if (this._backdrop) {
  7394. $(this._backdrop).remove();
  7395. this._backdrop = null;
  7396. }
  7397. }
  7398. }, {
  7399. key: '_showBackdrop',
  7400. value: function _showBackdrop(callback) {
  7401. var _this8 = this;
  7402. var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
  7403. if (this._isShown && this._config.backdrop) {
  7404. var doAnimate = _util2.default.supportsTransitionEnd() && animate;
  7405. this._backdrop = document.createElement('div');
  7406. this._backdrop.className = ClassName.BACKDROP;
  7407. if (animate) {
  7408. $(this._backdrop).addClass(animate);
  7409. }
  7410. $(this._backdrop).appendTo(document.body);
  7411. $(this._element).on(Event.CLICK_DISMISS, function (event) {
  7412. if (_this8._ignoreBackdropClick) {
  7413. _this8._ignoreBackdropClick = false;
  7414. return;
  7415. }
  7416. if (event.target !== event.currentTarget) {
  7417. return;
  7418. }
  7419. if (_this8._config.backdrop === 'static') {
  7420. _this8._element.focus();
  7421. } else {
  7422. _this8.hide();
  7423. }
  7424. });
  7425. if (doAnimate) {
  7426. _util2.default.reflow(this._backdrop);
  7427. }
  7428. $(this._backdrop).addClass(ClassName.SHOW);
  7429. if (!callback) {
  7430. return;
  7431. }
  7432. if (!doAnimate) {
  7433. callback();
  7434. return;
  7435. }
  7436. $(this._backdrop).one(_util2.default.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  7437. } else if (!this._isShown && this._backdrop) {
  7438. $(this._backdrop).removeClass(ClassName.SHOW);
  7439. var callbackRemove = function callbackRemove() {
  7440. _this8._removeBackdrop();
  7441. if (callback) {
  7442. callback();
  7443. }
  7444. };
  7445. if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  7446. $(this._backdrop).one(_util2.default.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  7447. } else {
  7448. callbackRemove();
  7449. }
  7450. } else if (callback) {
  7451. callback();
  7452. }
  7453. }
  7454. // ----------------------------------------------------------------------
  7455. // the following methods are used to handle overflowing modals
  7456. // todo (fat): these should probably be refactored out of modal.js
  7457. // ----------------------------------------------------------------------
  7458. }, {
  7459. key: '_adjustDialog',
  7460. value: function _adjustDialog() {
  7461. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  7462. if (!this._isBodyOverflowing && isModalOverflowing) {
  7463. this._element.style.paddingLeft = this._scrollbarWidth + 'px';
  7464. }
  7465. if (this._isBodyOverflowing && !isModalOverflowing) {
  7466. this._element.style.paddingRight = this._scrollbarWidth + 'px';
  7467. }
  7468. }
  7469. }, {
  7470. key: '_resetAdjustments',
  7471. value: function _resetAdjustments() {
  7472. this._element.style.paddingLeft = '';
  7473. this._element.style.paddingRight = '';
  7474. }
  7475. }, {
  7476. key: '_checkScrollbar',
  7477. value: function _checkScrollbar() {
  7478. var rect = document.body.getBoundingClientRect();
  7479. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  7480. this._scrollbarWidth = this._getScrollbarWidth();
  7481. }
  7482. }, {
  7483. key: '_setScrollbar',
  7484. value: function _setScrollbar() {
  7485. var _this9 = this;
  7486. if (this._isBodyOverflowing) {
  7487. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  7488. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  7489. // Adjust fixed content padding
  7490. $(Selector.FIXED_CONTENT).each(function (index, element) {
  7491. var actualPadding = $(element)[0].style.paddingRight;
  7492. var calculatedPadding = $(element).css('padding-right');
  7493. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + 'px');
  7494. });
  7495. // Adjust sticky content margin
  7496. $(Selector.STICKY_CONTENT).each(function (index, element) {
  7497. var actualMargin = $(element)[0].style.marginRight;
  7498. var calculatedMargin = $(element).css('margin-right');
  7499. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + 'px');
  7500. });
  7501. // Adjust navbar-toggler margin
  7502. $(Selector.NAVBAR_TOGGLER).each(function (index, element) {
  7503. var actualMargin = $(element)[0].style.marginRight;
  7504. var calculatedMargin = $(element).css('margin-right');
  7505. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + 'px');
  7506. });
  7507. // Adjust body padding
  7508. var actualPadding = document.body.style.paddingRight;
  7509. var calculatedPadding = $('body').css('padding-right');
  7510. $('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + 'px');
  7511. }
  7512. }
  7513. }, {
  7514. key: '_resetScrollbar',
  7515. value: function _resetScrollbar() {
  7516. // Restore fixed content padding
  7517. $(Selector.FIXED_CONTENT).each(function (index, element) {
  7518. var padding = $(element).data('padding-right');
  7519. if (typeof padding !== 'undefined') {
  7520. $(element).css('padding-right', padding).removeData('padding-right');
  7521. }
  7522. });
  7523. // Restore sticky content and navbar-toggler margin
  7524. $(Selector.STICKY_CONTENT + ', ' + Selector.NAVBAR_TOGGLER).each(function (index, element) {
  7525. var margin = $(element).data('margin-right');
  7526. if (typeof margin !== 'undefined') {
  7527. $(element).css('margin-right', margin).removeData('margin-right');
  7528. }
  7529. });
  7530. // Restore body padding
  7531. var padding = $('body').data('padding-right');
  7532. if (typeof padding !== 'undefined') {
  7533. $('body').css('padding-right', padding).removeData('padding-right');
  7534. }
  7535. }
  7536. }, {
  7537. key: '_getScrollbarWidth',
  7538. value: function _getScrollbarWidth() {
  7539. // thx d.walsh
  7540. var scrollDiv = document.createElement('div');
  7541. scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
  7542. document.body.appendChild(scrollDiv);
  7543. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  7544. document.body.removeChild(scrollDiv);
  7545. return scrollbarWidth;
  7546. }
  7547. // static
  7548. }], [{
  7549. key: '_jQueryInterface',
  7550. value: function _jQueryInterface(config, relatedTarget) {
  7551. return this.each(function () {
  7552. var data = $(this).data(DATA_KEY);
  7553. var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  7554. if (!data) {
  7555. data = new Modal(this, _config);
  7556. $(this).data(DATA_KEY, data);
  7557. }
  7558. if (typeof config === 'string') {
  7559. if (typeof data[config] === 'undefined') {
  7560. throw new Error('No method named "' + config + '"');
  7561. }
  7562. data[config](relatedTarget);
  7563. } else if (_config.show) {
  7564. data.show(relatedTarget);
  7565. }
  7566. });
  7567. }
  7568. }, {
  7569. key: 'VERSION',
  7570. get: function get() {
  7571. return VERSION;
  7572. }
  7573. }, {
  7574. key: 'Default',
  7575. get: function get() {
  7576. return Default;
  7577. }
  7578. }]);
  7579. return Modal;
  7580. }();
  7581. /**
  7582. * ------------------------------------------------------------------------
  7583. * Data Api implementation
  7584. * ------------------------------------------------------------------------
  7585. */
  7586. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  7587. var _this10 = this;
  7588. var target = void 0;
  7589. var selector = _util2.default.getSelectorFromElement(this);
  7590. if (selector) {
  7591. target = $(selector)[0];
  7592. }
  7593. var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
  7594. if (this.tagName === 'A' || this.tagName === 'AREA') {
  7595. event.preventDefault();
  7596. }
  7597. var $target = $(target).one(Event.SHOW, function (showEvent) {
  7598. if (showEvent.isDefaultPrevented()) {
  7599. // only register focus restorer if modal will actually get shown
  7600. return;
  7601. }
  7602. $target.one(Event.HIDDEN, function () {
  7603. if ($(_this10).is(':visible')) {
  7604. _this10.focus();
  7605. }
  7606. });
  7607. });
  7608. Modal._jQueryInterface.call($(target), config, this);
  7609. });
  7610. /**
  7611. * ------------------------------------------------------------------------
  7612. * jQuery
  7613. * ------------------------------------------------------------------------
  7614. */
  7615. $.fn[NAME] = Modal._jQueryInterface;
  7616. $.fn[NAME].Constructor = Modal;
  7617. $.fn[NAME].noConflict = function () {
  7618. $.fn[NAME] = JQUERY_NO_CONFLICT;
  7619. return Modal._jQueryInterface;
  7620. };
  7621. return Modal;
  7622. }(_util2.default.jQuery);
  7623. exports.default = Modal;
  7624. /***/ }),
  7625. /* 17 */
  7626. /***/ (function(module, exports, __webpack_require__) {
  7627. "use strict";
  7628. Object.defineProperty(exports, "__esModule", {
  7629. value: true
  7630. });
  7631. var _enquire = __webpack_require__(31);
  7632. var _enquire2 = _interopRequireDefault(_enquire);
  7633. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7634. var layersNav = {
  7635. init: function init() {
  7636. this.cacheDom();
  7637. this.bindEvents();
  7638. },
  7639. cacheDom: function cacheDom() {
  7640. this.$nav = $('.lu-nav');
  7641. this.$navigationDroDownLi = this.$nav.find('.lu-nav__item.has-dropdown');
  7642. },
  7643. bindEvents: function bindEvents() {
  7644. var that = this;
  7645. this.$navigationDroDownLi.on('click', this.checkDropDownStatus.bind(this));
  7646. var isMobile = false; //initiate as false
  7647. // device detection
  7648. 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) {
  7649. isMobile = true;
  7650. };
  7651. _enquire2.default.register("screen and (min-width: 0) and (max-width: 751px)", {
  7652. match: function match() {
  7653. $('.has-dropdown > a').on('click', function (event) {
  7654. event.preventDefault();
  7655. });
  7656. },
  7657. unmatch: function unmatch() {
  7658. $('.has-dropdown > a').on('click', function (event) {
  7659. if (isMobile == true || $(this).parents('.navbar--thin').length == 0) {
  7660. event.preventDefault(); // I need to change that
  7661. }
  7662. });
  7663. }
  7664. });
  7665. _enquire2.default.register("screen and (min-width: 752px)", {
  7666. match: function match(event) {
  7667. $('.has-dropdown > a').on('click', function (event) {
  7668. if ($(this).parents('.navigation').length == 0 && (isMobile == true || $(this).parents('.navbar--thin').length == 0)) {
  7669. event.preventDefault(); // I need to change that
  7670. }
  7671. });
  7672. },
  7673. unmatch: function unmatch() {
  7674. $('.has-dropdown > a').on('click', function (event) {
  7675. event.preventDefault();
  7676. });
  7677. }
  7678. });
  7679. $(window).on('click', function (event) {
  7680. $('.nav .has-dropdown').removeClass('is-open');
  7681. }.bind(this));
  7682. },
  7683. checkDropDownStatus: function checkDropDownStatus(event) {
  7684. var toggleBack = this.$nav.find('[data-toggle="back"]');
  7685. var toggleBackI = this.$nav.find('[data-toggle="back"] i');
  7686. if (toggleBack.is(event.target) || toggleBackI.is(event.target)) {} else {
  7687. if ($(event.currentTarget).hasClass('is-open')) {
  7688. this.hideDropDown(event);
  7689. } else {
  7690. this.showDropDown(event);
  7691. }
  7692. }
  7693. },
  7694. showDropDown: function showDropDown(event) {
  7695. event.stopPropagation(); // I need to change that
  7696. var dropDownElement = $(event.currentTarget);
  7697. var dropDownContainer = $(event.currentTarget).find('.has-dropdown');
  7698. dropDownElement.closest('.lu-nav').find('.is-open').removeClass('is-open');
  7699. dropDownElement.addClass('is-open');
  7700. },
  7701. hideDropDown: function hideDropDown(event) {
  7702. var dropDownElement = $(event.currentTarget);
  7703. var dropDownContainer = $(event.currentTarget).find('.has-dropdown');
  7704. dropDownElement.removeClass('is-open');
  7705. }
  7706. }; // import enquire from 'enquire';
  7707. // import superfish from 'superfish';
  7708. // const SELECTORS = {
  7709. // container: '.nav',
  7710. // item: '.has-dropdown',
  7711. // };
  7712. // const Default = {
  7713. // active: '.is-open',
  7714. // open: 'hover'
  7715. // };
  7716. // class Nav{
  7717. // constructor(container, options){
  7718. // this.container = container;
  7719. // this.items = $(container).find(SELECTORS.item);
  7720. // this.options = options;
  7721. // this.getConfig();
  7722. // this.bindEvents();
  7723. // }
  7724. // bindEvents(){
  7725. // this.items.on('click', this.checkStatus.bind(this));
  7726. // $(document).on('click', this.clickOutside.bind(this));
  7727. // }
  7728. // getConfig(){
  7729. // var dataConfig = this.container.data();
  7730. // if(dataConfig.options){
  7731. // this.dataOptions = util.parseDataOptions(dataConfig.options);
  7732. // }else{
  7733. // this.dataOptions = {};
  7734. // }
  7735. // this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7736. // }
  7737. // checkStatus(event){
  7738. // if ($(event.currentTarget).hasClass('is-open')) {
  7739. // this.hide(event);
  7740. // } else {
  7741. // this.show(event);
  7742. // }
  7743. // }
  7744. // show(event) {
  7745. // let item = $(event.currentTarget);
  7746. // event.stopPropagation();
  7747. // if(this.config.open == 'click'){
  7748. // this.hideOld();
  7749. // item.addClass('is-open');
  7750. // }else if(this.config.open == 'hover'){
  7751. // this.initSuperFish();
  7752. // console.log('test');
  7753. // }
  7754. // }
  7755. // hide(event) {
  7756. // let item = $(event.currentTarget);
  7757. // item.removeClass('is-open');
  7758. // }
  7759. // hideOld(){
  7760. // this.container.find('.is-open').removeClass('is-open');
  7761. // }
  7762. // initSuperFish(){
  7763. // $(this.container).superfish({
  7764. // hoverClass: 'is-open',
  7765. // popUpSelector: '.has-dropdown',
  7766. // delay: 600,
  7767. // animation: {}
  7768. // });
  7769. // }
  7770. // clickOutside(){
  7771. // if(!$(event.target).closest(SELECTORS.container).length) {
  7772. // if($(SELECTORS.container).is(":visible")) {
  7773. // this.hideOld();
  7774. // }
  7775. // }
  7776. // }
  7777. // }
  7778. // function initDataSelectors(){
  7779. // $(SELECTORS.container).each(function(){
  7780. // new Nav($(this));
  7781. // });
  7782. // }
  7783. // function initJqueryPlugin(){
  7784. // $.fn.luNav = function( options ) {
  7785. // return this.each(function() {
  7786. // new Nav($(this), options);
  7787. // });
  7788. // };
  7789. // }
  7790. // const init = {
  7791. // initDataSelectors,
  7792. // initJqueryPlugin,
  7793. // };
  7794. // export default init;
  7795. exports.default = layersNav;
  7796. /***/ }),
  7797. /* 18 */
  7798. /***/ (function(module, exports, __webpack_require__) {
  7799. "use strict";
  7800. Object.defineProperty(exports, "__esModule", {
  7801. value: true
  7802. });
  7803. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7804. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7805. /**
  7806. * Switcher.js
  7807. * Copyright 2016, RSstudio
  7808. *
  7809. * http://rsstudio.net
  7810. *
  7811. * All rights reserved
  7812. *
  7813. */
  7814. var SELECTORS = {
  7815. container: '[data-switcher]',
  7816. item: '[data-switcher-item]',
  7817. itemHighlight: '[data-switcher-highlight]'
  7818. };
  7819. var Default = {
  7820. activeElement: 2,
  7821. transition: 'all 500ms cubic-bezier(.250, .250, .000, 1.015)'
  7822. };
  7823. var Switcher = function () {
  7824. function Switcher(element, options) {
  7825. _classCallCheck(this, Switcher);
  7826. this.element = $(element);
  7827. this.items = element.find(SELECTORS.item);
  7828. this.itemHighlight = this.element.find(SELECTORS.itemHighlight);
  7829. this.options = options;
  7830. this.activeItemData = {};
  7831. this.isInit = false;
  7832. this.getConfig();
  7833. this.setActiveItem(this.config.activeElement);
  7834. this.bindEvents();
  7835. }
  7836. _createClass(Switcher, [{
  7837. key: 'getConfig',
  7838. value: function getConfig() {
  7839. var dataConfig = this.element.data();
  7840. if (dataConfig.options) {
  7841. this.dataOptions = util.parseDataOptions(dataConfig.options);
  7842. } else {
  7843. this.dataOptions = {};
  7844. }
  7845. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  7846. }
  7847. }, {
  7848. key: 'bindEvents',
  7849. value: function bindEvents() {
  7850. var _this = this;
  7851. this.items.on('click', function (event) {
  7852. return _this.slideToItem(event.currentTarget);
  7853. });
  7854. $(window).on('resize', function (event) {
  7855. return _this.onResize(event);
  7856. });
  7857. }
  7858. }, {
  7859. key: 'setActiveItem',
  7860. value: function setActiveItem(itemIndex) {
  7861. this.slideToItem(this.items[itemIndex]);
  7862. }
  7863. }, {
  7864. key: 'getItemPosition',
  7865. value: function getItemPosition(element) {
  7866. this.activeItemData.element = $(element);
  7867. this.activeItemData.width = $(this.activeItemData.element).outerWidth();
  7868. this.activeItemData.position = $(this.activeItemData.element).position().left;
  7869. }
  7870. }, {
  7871. key: 'slideToItem',
  7872. value: function slideToItem(element) {
  7873. if (this.activeItemData.element) {
  7874. this.activeItemData.element.removeClass('is-active');
  7875. }
  7876. this.getItemPosition(element);
  7877. this.itemHighlight.css({
  7878. 'transform': 'translateX(' + this.activeItemData.position + 'px)',
  7879. 'width': this.activeItemData.width
  7880. });
  7881. if (this.isInit) {
  7882. this.itemHighlight.css({
  7883. transition: this.config.transition
  7884. });
  7885. } else {
  7886. this.onInit();
  7887. this.isInit = true;
  7888. }
  7889. this.onSlide();
  7890. }
  7891. }, {
  7892. key: 'onInit',
  7893. value: function onInit() {
  7894. if (typeof this.config.onInit === 'function') {
  7895. this.config.onInit(this.element, this.activeItemData.element);
  7896. }
  7897. }
  7898. }, {
  7899. key: 'onSlide',
  7900. value: function onSlide() {
  7901. if (typeof this.config.onSlide === 'function') {
  7902. this.config.onSlide(this.element, this.activeItemData.element);
  7903. }
  7904. this.activeItemData.element.addClass('is-active');
  7905. }
  7906. }, {
  7907. key: 'onResize',
  7908. value: function onResize() {
  7909. if (typeof this.config.onSlide === 'function') {
  7910. this.config.onResize(this.element, this.activeItemData.element);
  7911. }
  7912. this.activeItemData.element.trigger('click');
  7913. }
  7914. }]);
  7915. return Switcher;
  7916. }();
  7917. function initDataSelectors() {
  7918. $(document).ready(function () {
  7919. $(SELECTORS.container).each(function () {
  7920. new Switcher($(this));
  7921. });
  7922. });
  7923. }
  7924. function initJqueryPlugin() {
  7925. $.fn.luSwitcher = function (options) {
  7926. return this.each(function () {
  7927. var switcher = new Switcher($(this), options);
  7928. });
  7929. };
  7930. }
  7931. var init = {
  7932. initDataSelectors: initDataSelectors,
  7933. initJqueryPlugin: initJqueryPlugin
  7934. };
  7935. exports.default = init;
  7936. /***/ }),
  7937. /* 19 */
  7938. /***/ (function(module, exports, __webpack_require__) {
  7939. "use strict";
  7940. Object.defineProperty(exports, "__esModule", {
  7941. value: true
  7942. });
  7943. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7944. var _util = __webpack_require__(0);
  7945. var _util2 = _interopRequireDefault(_util);
  7946. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7947. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7948. /**
  7949. * --------------------------------------------------------------------------
  7950. * Bootstrap (v4.0.0-beta.2): tab.js
  7951. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  7952. * --------------------------------------------------------------------------
  7953. */
  7954. var Tab = function () {
  7955. /**
  7956. * ------------------------------------------------------------------------
  7957. * Constants
  7958. * ------------------------------------------------------------------------
  7959. */
  7960. var NAME = 'lu-tab';
  7961. var VERSION = '4.0.0-beta.2';
  7962. var DATA_KEY = 'bs.tab';
  7963. var EVENT_KEY = '.' + DATA_KEY;
  7964. var DATA_API_KEY = '.data-api';
  7965. var JQUERY_NO_CONFLICT = $.fn[NAME];
  7966. var TRANSITION_DURATION = 150;
  7967. var Event = {
  7968. HIDE: 'hide' + EVENT_KEY,
  7969. HIDDEN: 'hidden' + EVENT_KEY,
  7970. SHOW: 'show' + EVENT_KEY,
  7971. SHOWN: 'shown' + EVENT_KEY,
  7972. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  7973. };
  7974. var ClassName = {
  7975. DROPDOWN_MENU: 'dropdown-menu',
  7976. ACTIVE: 'is-active',
  7977. DISABLED: 'disabled',
  7978. FADE: 'fade',
  7979. SHOW: 'show'
  7980. };
  7981. var Selector = {
  7982. DROPDOWN: '.dropdown',
  7983. NAV_LIST_GROUP: '.lu-nav, .lu-list-group',
  7984. ACTIVE: '.is-active',
  7985. ACTIVE_UL: '> .is-active',
  7986. DATA_TOGGLE: '[data-toggle="lu-tab"], [data-toggle="pill"], [data-toggle="list"]',
  7987. DROPDOWN_TOGGLE: '.dropdown-toggle',
  7988. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .is-active'
  7989. /**
  7990. * ------------------------------------------------------------------------
  7991. * Class Definition
  7992. * ------------------------------------------------------------------------
  7993. */
  7994. };
  7995. var Tab = function () {
  7996. function Tab(element) {
  7997. _classCallCheck(this, Tab);
  7998. this._element = element;
  7999. }
  8000. // getters
  8001. _createClass(Tab, [{
  8002. key: 'show',
  8003. // public
  8004. value: function show() {
  8005. var _this = this;
  8006. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
  8007. return;
  8008. }
  8009. var target = void 0;
  8010. var previous = void 0;
  8011. var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
  8012. var selector = _util2.default.getSelectorFromElement(this._element);
  8013. if (listElement) {
  8014. var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
  8015. previous = $.makeArray($(listElement).find(itemSelector));
  8016. previous = previous[previous.length - 1];
  8017. }
  8018. var hideEvent = $.Event(Event.HIDE, {
  8019. relatedTarget: this._element
  8020. });
  8021. var showEvent = $.Event(Event.SHOW, {
  8022. relatedTarget: previous
  8023. });
  8024. if (previous) {
  8025. $(previous).trigger(hideEvent);
  8026. }
  8027. $(this._element).trigger(showEvent);
  8028. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  8029. return;
  8030. }
  8031. if (selector) {
  8032. target = $(selector)[0];
  8033. }
  8034. this._activate(this._element, listElement);
  8035. var complete = function complete() {
  8036. var hiddenEvent = $.Event(Event.HIDDEN, {
  8037. relatedTarget: _this._element
  8038. });
  8039. var shownEvent = $.Event(Event.SHOWN, {
  8040. relatedTarget: previous
  8041. });
  8042. $(previous).trigger(hiddenEvent);
  8043. $(_this._element).trigger(shownEvent);
  8044. };
  8045. if (target) {
  8046. this._activate(target, target.parentNode, complete);
  8047. } else {
  8048. complete();
  8049. }
  8050. }
  8051. }, {
  8052. key: 'dispose',
  8053. value: function dispose() {
  8054. $.removeData(this._element, DATA_KEY);
  8055. this._element = null;
  8056. }
  8057. // private
  8058. }, {
  8059. key: '_activate',
  8060. value: function _activate(element, container, callback) {
  8061. var _this2 = this;
  8062. var activeElements = void 0;
  8063. if (container.nodeName === 'UL') {
  8064. activeElements = $(container).find(Selector.ACTIVE_UL);
  8065. } else {
  8066. activeElements = $(container).children(Selector.ACTIVE);
  8067. }
  8068. var active = activeElements[0];
  8069. var isTransitioning = callback && _util2.default.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
  8070. var complete = function complete() {
  8071. return _this2._transitionComplete(element, active, isTransitioning, callback);
  8072. };
  8073. if (active && isTransitioning) {
  8074. $(active).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  8075. } else {
  8076. complete();
  8077. }
  8078. if (active) {
  8079. $(active).removeClass(ClassName.SHOW);
  8080. }
  8081. }
  8082. }, {
  8083. key: '_transitionComplete',
  8084. value: function _transitionComplete(element, active, isTransitioning, callback) {
  8085. if (active) {
  8086. $(active).removeClass(ClassName.ACTIVE);
  8087. var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
  8088. if (dropdownChild) {
  8089. $(dropdownChild).removeClass(ClassName.ACTIVE);
  8090. }
  8091. if (active.getAttribute('role') === 'tab') {
  8092. active.setAttribute('aria-selected', false);
  8093. }
  8094. }
  8095. if ($(element).is("a")) {
  8096. $(element).parent().addClass(ClassName.ACTIVE);
  8097. } else {
  8098. $(element).addClass(ClassName.ACTIVE);
  8099. }
  8100. if (element.getAttribute('role') === 'tab') {
  8101. element.setAttribute('aria-selected', true);
  8102. }
  8103. if (isTransitioning) {
  8104. _util2.default.reflow(element);
  8105. $(element).addClass(ClassName.SHOW);
  8106. } else {
  8107. $(element).removeClass(ClassName.FADE);
  8108. }
  8109. if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
  8110. var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
  8111. if (dropdownElement) {
  8112. $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  8113. }
  8114. element.setAttribute('aria-expanded', true);
  8115. }
  8116. if (callback) {
  8117. callback();
  8118. }
  8119. }
  8120. // static
  8121. }], [{
  8122. key: '_jQueryInterface',
  8123. value: function _jQueryInterface(config) {
  8124. return this.each(function () {
  8125. var $this = $(this);
  8126. var data = $this.data(DATA_KEY);
  8127. if (!data) {
  8128. data = new Tab(this);
  8129. $this.data(DATA_KEY, data);
  8130. }
  8131. if (typeof config === 'string') {
  8132. if (typeof data[config] === 'undefined') {
  8133. throw new Error('No method named "' + config + '"');
  8134. }
  8135. data[config]();
  8136. }
  8137. });
  8138. }
  8139. }, {
  8140. key: 'VERSION',
  8141. get: function get() {
  8142. return VERSION;
  8143. }
  8144. }]);
  8145. return Tab;
  8146. }();
  8147. /**
  8148. * ------------------------------------------------------------------------
  8149. * Data Api implementation
  8150. * ------------------------------------------------------------------------
  8151. */
  8152. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  8153. event.preventDefault();
  8154. Tab._jQueryInterface.call($(this), 'show');
  8155. });
  8156. /**
  8157. * ------------------------------------------------------------------------
  8158. * jQuery
  8159. * ------------------------------------------------------------------------
  8160. */
  8161. $.fn[NAME] = Tab._jQueryInterface;
  8162. $.fn[NAME].Constructor = Tab;
  8163. $.fn[NAME].noConflict = function () {
  8164. $.fn[NAME] = JQUERY_NO_CONFLICT;
  8165. return Tab._jQueryInterface;
  8166. };
  8167. return Tab;
  8168. }(_util2.default.jQuery);
  8169. exports.default = Tab;
  8170. /***/ }),
  8171. /* 20 */
  8172. /***/ (function(module, exports, __webpack_require__) {
  8173. "use strict";
  8174. Object.defineProperty(exports, "__esModule", {
  8175. value: true
  8176. });
  8177. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8178. var _Swiper = __webpack_require__(4);
  8179. var _Swiper2 = _interopRequireDefault(_Swiper);
  8180. var _util = __webpack_require__(0);
  8181. var _util2 = _interopRequireDefault(_util);
  8182. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8183. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8184. var SELECTORS = {
  8185. button: '[data-toggle="offCanvas"]',
  8186. overlayers: '.overlayer',
  8187. dismiss: '[data-dismiss="offCanvas"]'
  8188. };
  8189. var Default = {
  8190. position: 'right',
  8191. activeClass: 'is-open',
  8192. mode: 'normal',
  8193. tranition: 400,
  8194. overlayer: false,
  8195. bodyClass: 'off-canvas-is-active'
  8196. };
  8197. var OffCanvas = function () {
  8198. function OffCanvas(element, options) {
  8199. _classCallCheck(this, OffCanvas);
  8200. this.element = element;
  8201. this.options = options;
  8202. this.getConfig();
  8203. this.bindEvents();
  8204. }
  8205. _createClass(OffCanvas, [{
  8206. key: 'getConfig',
  8207. value: function getConfig() {
  8208. var dataConfig = this.element.data();
  8209. if (dataConfig.options) {
  8210. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8211. } else {
  8212. this.dataOptions = {};
  8213. }
  8214. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8215. this.target = $(this.config.target);
  8216. this.dismiss = this.target.find(SELECTORS.dismiss);
  8217. }
  8218. }, {
  8219. key: 'bindEvents',
  8220. value: function bindEvents() {
  8221. var _this = this;
  8222. this.element.on('click', function (event) {
  8223. return _this.checkState(event);
  8224. });
  8225. this.dismiss.on('click', function () {
  8226. return _this.close();
  8227. });
  8228. $(document).on('click', function (event) {
  8229. return _this.addEventClickOutside(event);
  8230. });
  8231. }
  8232. }, {
  8233. key: 'checkState',
  8234. value: function checkState() {
  8235. if (this.target.hasClass(this.config.activeClass)) {
  8236. this.close();
  8237. } else {
  8238. this.open();
  8239. }
  8240. }
  8241. }, {
  8242. key: 'open',
  8243. value: function open(evnet) {
  8244. $(this.target).addClass(this.config.activeClass);
  8245. $('body').addClass(this.config.bodyClass);
  8246. }
  8247. }, {
  8248. key: 'close',
  8249. value: function close(event) {
  8250. $(this.target).removeClass(this.config.activeClass);
  8251. $('body').removeClass(this.config.bodyClass);
  8252. }
  8253. }, {
  8254. key: 'addEventClickOutside',
  8255. value: function addEventClickOutside(event) {
  8256. if (!$(event.target).closest(this.target).length && !$(event.target).closest(this.element).length) {
  8257. if ($(this.target).is(":visible")) {
  8258. this.close();
  8259. }
  8260. }
  8261. }
  8262. }]);
  8263. return OffCanvas;
  8264. }();
  8265. function initDataSelectors() {
  8266. $(SELECTORS.button).each(function () {
  8267. new OffCanvas($(this));
  8268. });
  8269. }
  8270. function initJqueryPlugin() {
  8271. $.fn.luOffCanvas = function (options) {
  8272. return this.each(function () {
  8273. new OffCanvas($(this), options);
  8274. });
  8275. };
  8276. }
  8277. var init = {
  8278. initDataSelectors: initDataSelectors,
  8279. initJqueryPlugin: initJqueryPlugin
  8280. };
  8281. exports.default = init;
  8282. /***/ }),
  8283. /* 21 */
  8284. /***/ (function(module, exports, __webpack_require__) {
  8285. "use strict";
  8286. Object.defineProperty(exports, "__esModule", {
  8287. value: true
  8288. });
  8289. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8290. var _util = __webpack_require__(0);
  8291. var _util2 = _interopRequireDefault(_util);
  8292. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8293. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8294. var SELECTORS = {
  8295. link: '[data-scroll-to]'
  8296. };
  8297. var Default = {
  8298. topOffset: 10,
  8299. animation: 'normal',
  8300. speed: 400,
  8301. constantSpeed: false
  8302. };
  8303. var ScrollTo = function () {
  8304. function ScrollTo(element, options) {
  8305. _classCallCheck(this, ScrollTo);
  8306. this.element = element;
  8307. this.options = options;
  8308. this.hash = $(element).attr('href');
  8309. this.target = $(this.hash);
  8310. if (!this.target.length) {
  8311. return;
  8312. }
  8313. this.getConfig();
  8314. this.bindEvents();
  8315. this.targetVisibility();
  8316. }
  8317. _createClass(ScrollTo, [{
  8318. key: 'bindEvents',
  8319. value: function bindEvents() {
  8320. var _this = this;
  8321. $(this.element).on('click', function (event) {
  8322. return _this.startScroll(event);
  8323. });
  8324. $(window).on('scroll', function (event) {
  8325. return _this.targetVisibility(event);
  8326. });
  8327. }
  8328. }, {
  8329. key: 'getConfig',
  8330. value: function getConfig() {
  8331. var dataConfig = this.element.data();
  8332. if (dataConfig.options) {
  8333. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8334. } else {
  8335. this.dataOptions = {};
  8336. }
  8337. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8338. }
  8339. }, {
  8340. key: 'startScroll',
  8341. value: function startScroll(event) {
  8342. this.targetPosition = this.target.offset().top + this.config.topOffset;
  8343. console.log(this.getAnimationSpeed());
  8344. $("body, html").stop().animate({
  8345. scrollTop: this.targetPosition
  8346. }, this.config.speed);
  8347. }
  8348. }, {
  8349. key: 'isOnScreen',
  8350. value: function isOnScreen() {
  8351. var win = $(window);
  8352. var viewport = {
  8353. top: win.scrollTop(),
  8354. left: win.scrollLeft()
  8355. };
  8356. viewport.right = viewport.left + win.width();
  8357. viewport.bottom = viewport.top + win.height();
  8358. var bounds = this.target.offset();
  8359. bounds.right = bounds.left + this.target.outerWidth();
  8360. bounds.bottom = bounds.top + this.target.outerHeight();
  8361. return !(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom);
  8362. }
  8363. }, {
  8364. key: 'targetVisibility',
  8365. value: function targetVisibility() {
  8366. if (this.isOnScreen()) {
  8367. this.onScreen();
  8368. } else {
  8369. this.outScreen();
  8370. }
  8371. }
  8372. }, {
  8373. key: 'onScreen',
  8374. value: function onScreen() {
  8375. if (typeof this.config.onScreen === 'function') {
  8376. this.config.onScreen(this.element, this.target);
  8377. }
  8378. }
  8379. }, {
  8380. key: 'outScreen',
  8381. value: function outScreen() {
  8382. if (typeof this.config.outScreen === 'function') {
  8383. this.config.outScreen(this.element, this.target);
  8384. }
  8385. }
  8386. }, {
  8387. key: 'getOffset',
  8388. value: function getOffset() {
  8389. return Math.abs(this.target.offset().top - $(window).scrollTop());
  8390. }
  8391. }, {
  8392. key: 'getAnimationSpeed',
  8393. value: function getAnimationSpeed() {
  8394. return this.getOffset() / this.config.speed * this.config.speed;
  8395. }
  8396. }]);
  8397. return ScrollTo;
  8398. }();
  8399. function initDataSelectors() {
  8400. $(SELECTORS.link).each(function () {
  8401. new ScrollTo($(this));
  8402. });
  8403. }
  8404. function initJqueryPlugin() {
  8405. $.fn.luScrollTo = function (options) {
  8406. return this.each(function () {
  8407. new ScrollTo($(this), options);
  8408. });
  8409. };
  8410. }
  8411. var init = {
  8412. initDataSelectors: initDataSelectors,
  8413. initJqueryPlugin: initJqueryPlugin
  8414. };
  8415. exports.default = init;
  8416. /***/ }),
  8417. /* 22 */
  8418. /***/ (function(module, exports, __webpack_require__) {
  8419. "use strict";
  8420. Object.defineProperty(exports, "__esModule", {
  8421. value: true
  8422. });
  8423. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  8424. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8425. var _jquery = __webpack_require__(1);
  8426. var _jquery2 = _interopRequireDefault(_jquery);
  8427. var _util = __webpack_require__(0);
  8428. var _util2 = _interopRequireDefault(_util);
  8429. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8430. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8431. /**
  8432. * --------------------------------------------------------------------------
  8433. * Bootstrap (v4.0.0-beta): scrollspy.js
  8434. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  8435. * --------------------------------------------------------------------------
  8436. */
  8437. var ScrollSpy = function () {
  8438. /**
  8439. * ------------------------------------------------------------------------
  8440. * Constants
  8441. * ------------------------------------------------------------------------
  8442. */
  8443. var NAME = 'scrollspy';
  8444. var VERSION = '4.0.0-beta';
  8445. var DATA_KEY = 'bs.scrollspy';
  8446. var EVENT_KEY = '.' + DATA_KEY;
  8447. var DATA_API_KEY = '.data-api';
  8448. var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
  8449. var Default = {
  8450. offset: 10,
  8451. method: 'auto',
  8452. target: ''
  8453. };
  8454. var DefaultType = {
  8455. offset: 'number',
  8456. method: 'string',
  8457. target: '(string|element)'
  8458. };
  8459. var Event = {
  8460. ACTIVATE: 'activate' + EVENT_KEY,
  8461. SCROLL: 'scroll' + EVENT_KEY,
  8462. LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
  8463. };
  8464. var ClassName = {
  8465. DROPDOWN_ITEM: 'dropdown-item',
  8466. DROPDOWN_MENU: 'dropdown-menu',
  8467. ACTIVE: 'is-active'
  8468. };
  8469. var Selector = {
  8470. DATA_SPY: '[data-spy="scroll"]',
  8471. ACTIVE: '.is-active',
  8472. NAV_LIST_GROUP: '.nav, .list-group',
  8473. NAV_LINKS: '.nav__link',
  8474. NAV_ITEMS: '.nav__item',
  8475. LIST_ITEMS: '.list-group-item',
  8476. DROPDOWN: '.dropdown',
  8477. DROPDOWN_ITEMS: '.dropdown-item',
  8478. DROPDOWN_TOGGLE: '.dropdown-toggle'
  8479. };
  8480. var OffsetMethod = {
  8481. OFFSET: 'offset',
  8482. POSITION: 'position'
  8483. /**
  8484. * ------------------------------------------------------------------------
  8485. * Class Definition
  8486. * ------------------------------------------------------------------------
  8487. */
  8488. };
  8489. var ScrollSpy = function () {
  8490. function ScrollSpy(element, config) {
  8491. var _this = this;
  8492. _classCallCheck(this, ScrollSpy);
  8493. this._element = element;
  8494. this._scrollElement = element.tagName === 'BODY' ? window : element;
  8495. this._config = this._getConfig(config);
  8496. this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
  8497. this._offsets = [];
  8498. this._targets = [];
  8499. this._activeTarget = null;
  8500. this._scrollHeight = 0;
  8501. (0, _jquery2.default)(this._scrollElement).on(Event.SCROLL, function (event) {
  8502. return _this._process(event);
  8503. });
  8504. this.refresh();
  8505. this._process();
  8506. }
  8507. // getters
  8508. _createClass(ScrollSpy, [{
  8509. key: 'refresh',
  8510. // public
  8511. value: function refresh() {
  8512. var _this2 = this;
  8513. var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
  8514. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  8515. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  8516. this._offsets = [];
  8517. this._targets = [];
  8518. this._scrollHeight = this._getScrollHeight();
  8519. var targets = _jquery2.default.makeArray((0, _jquery2.default)(this._selector));
  8520. targets.map(function (element) {
  8521. var target = void 0;
  8522. var targetSelector = _util2.default.getSelectorFromElement(element);
  8523. if (targetSelector) {
  8524. target = (0, _jquery2.default)(targetSelector)[0];
  8525. }
  8526. if (target) {
  8527. var targetBCR = target.getBoundingClientRect();
  8528. if (targetBCR.width || targetBCR.height) {
  8529. // todo (fat): remove sketch reliance on jQuery position/offset
  8530. return [(0, _jquery2.default)(target)[offsetMethod]().top + offsetBase, targetSelector];
  8531. }
  8532. }
  8533. return null;
  8534. }).filter(function (item) {
  8535. return item;
  8536. }).sort(function (a, b) {
  8537. return a[0] - b[0];
  8538. }).forEach(function (item) {
  8539. _this2._offsets.push(item[0]);
  8540. _this2._targets.push(item[1]);
  8541. });
  8542. }
  8543. }, {
  8544. key: 'dispose',
  8545. value: function dispose() {
  8546. _jquery2.default.removeData(this._element, DATA_KEY);
  8547. (0, _jquery2.default)(this._scrollElement).off(EVENT_KEY);
  8548. this._element = null;
  8549. this._scrollElement = null;
  8550. this._config = null;
  8551. this._selector = null;
  8552. this._offsets = null;
  8553. this._targets = null;
  8554. this._activeTarget = null;
  8555. this._scrollHeight = null;
  8556. }
  8557. // private
  8558. }, {
  8559. key: '_getConfig',
  8560. value: function _getConfig(config) {
  8561. config = _jquery2.default.extend({}, Default, config);
  8562. if (typeof config.target !== 'string') {
  8563. var id = (0, _jquery2.default)(config.target).attr('id');
  8564. if (!id) {
  8565. id = _util2.default.getUID(NAME);
  8566. (0, _jquery2.default)(config.target).attr('id', id);
  8567. }
  8568. config.target = '#' + id;
  8569. }
  8570. _util2.default.typeCheckConfig(NAME, config, DefaultType);
  8571. return config;
  8572. }
  8573. }, {
  8574. key: '_getScrollTop',
  8575. value: function _getScrollTop() {
  8576. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  8577. }
  8578. }, {
  8579. key: '_getScrollHeight',
  8580. value: function _getScrollHeight() {
  8581. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  8582. }
  8583. }, {
  8584. key: '_getOffsetHeight',
  8585. value: function _getOffsetHeight() {
  8586. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  8587. }
  8588. }, {
  8589. key: '_process',
  8590. value: function _process() {
  8591. var scrollTop = this._getScrollTop() + this._config.offset;
  8592. var scrollHeight = this._getScrollHeight();
  8593. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  8594. if (this._scrollHeight !== scrollHeight) {
  8595. this.refresh();
  8596. }
  8597. if (scrollTop >= maxScroll) {
  8598. var target = this._targets[this._targets.length - 1];
  8599. if (this._activeTarget !== target) {
  8600. this._activate(target);
  8601. }
  8602. return;
  8603. }
  8604. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  8605. this._activeTarget = null;
  8606. this._clear();
  8607. return;
  8608. }
  8609. for (var i = this._offsets.length; i--;) {
  8610. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  8611. if (isActiveTarget) {
  8612. this._activate(this._targets[i]);
  8613. }
  8614. }
  8615. }
  8616. }, {
  8617. key: '_activate',
  8618. value: function _activate(target) {
  8619. this._activeTarget = target;
  8620. this._clear();
  8621. var queries = this._selector.split(',');
  8622. // eslint-disable-next-line arrow-body-style
  8623. queries = queries.map(function (selector) {
  8624. return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
  8625. });
  8626. var $link = (0, _jquery2.default)(queries.join(','));
  8627. if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
  8628. $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  8629. $link.addClass(ClassName.ACTIVE);
  8630. } else {
  8631. // Set triggered link as active
  8632. $link.addClass(ClassName.ACTIVE);
  8633. // Set triggered links parents as active
  8634. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  8635. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE);
  8636. // Handle special case when .nav-link is inside .nav-item
  8637. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).addClass(ClassName.ACTIVE);
  8638. }
  8639. (0, _jquery2.default)(this._scrollElement).trigger(Event.ACTIVATE, {
  8640. relatedTarget: target
  8641. });
  8642. }
  8643. }, {
  8644. key: '_clear',
  8645. value: function _clear() {
  8646. (0, _jquery2.default)(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  8647. }
  8648. // static
  8649. }], [{
  8650. key: '_jQueryInterface',
  8651. value: function _jQueryInterface(config) {
  8652. return this.each(function () {
  8653. var data = (0, _jquery2.default)(this).data(DATA_KEY);
  8654. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
  8655. if (!data) {
  8656. data = new ScrollSpy(this, _config);
  8657. (0, _jquery2.default)(this).data(DATA_KEY, data);
  8658. }
  8659. if (typeof config === 'string') {
  8660. if (typeof data[config] === 'undefined') {
  8661. throw new Error('No method named "' + config + '"');
  8662. }
  8663. data[config]();
  8664. }
  8665. });
  8666. }
  8667. }, {
  8668. key: 'VERSION',
  8669. get: function get() {
  8670. return VERSION;
  8671. }
  8672. }, {
  8673. key: 'Default',
  8674. get: function get() {
  8675. return Default;
  8676. }
  8677. }]);
  8678. return ScrollSpy;
  8679. }();
  8680. /**
  8681. * ------------------------------------------------------------------------
  8682. * Data Api implementation
  8683. * ------------------------------------------------------------------------
  8684. */
  8685. (0, _jquery2.default)(window).on(Event.LOAD_DATA_API, function () {
  8686. var scrollSpys = _jquery2.default.makeArray((0, _jquery2.default)(Selector.DATA_SPY));
  8687. for (var i = scrollSpys.length; i--;) {
  8688. var $spy = (0, _jquery2.default)(scrollSpys[i]);
  8689. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  8690. }
  8691. });
  8692. /**
  8693. * ------------------------------------------------------------------------
  8694. * jQuery
  8695. * ------------------------------------------------------------------------
  8696. */
  8697. _jquery2.default.fn[NAME] = ScrollSpy._jQueryInterface;
  8698. _jquery2.default.fn[NAME].Constructor = ScrollSpy;
  8699. _jquery2.default.fn[NAME].noConflict = function () {
  8700. _jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
  8701. return ScrollSpy._jQueryInterface;
  8702. };
  8703. return ScrollSpy;
  8704. }(_jquery2.default);
  8705. exports.default = ScrollSpy;
  8706. /***/ }),
  8707. /* 23 */
  8708. /***/ (function(module, exports, __webpack_require__) {
  8709. "use strict";
  8710. Object.defineProperty(exports, "__esModule", {
  8711. value: true
  8712. });
  8713. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8714. var _stickySidebar = __webpack_require__(33);
  8715. var _stickySidebar2 = _interopRequireDefault(_stickySidebar);
  8716. var _util = __webpack_require__(0);
  8717. var _util2 = _interopRequireDefault(_util);
  8718. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8719. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8720. var SELECTORS = {
  8721. stickyElement: '[data-sticky]'
  8722. };
  8723. var Default = {
  8724. topOffset: 0,
  8725. bottomOffset: 0
  8726. };
  8727. var Sticky = function () {
  8728. function Sticky(element, options) {
  8729. _classCallCheck(this, Sticky);
  8730. this.element = element;
  8731. this.options = options;
  8732. this.getConfig();
  8733. this.initPlugn();
  8734. this.bindEvents();
  8735. }
  8736. _createClass(Sticky, [{
  8737. key: 'getConfig',
  8738. value: function getConfig() {
  8739. var dataConfig = this.element.data();
  8740. if (dataConfig.options) {
  8741. this.dataOptions = _util2.default.parseDataOptions(dataConfig.options);
  8742. } else {
  8743. this.dataOptions = {};
  8744. }
  8745. this.config = $.extend({}, Default, dataConfig, this.dataOptions, this.options);
  8746. }
  8747. }, {
  8748. key: 'initPlugn',
  8749. value: function initPlugn() {
  8750. this.stickyInstance = new _stickySidebar2.default(this.element[0], {
  8751. topSpacing: this.config.topOffset,
  8752. bottomSpacing: this.config.bottomOffset,
  8753. containerSelector: this.config.container,
  8754. resizeSensor: true,
  8755. stickyClass: 'is-sticky'
  8756. });
  8757. if (typeof this.config.onOpen === 'function') {
  8758. this.config.onInit(this.stickyInstance);
  8759. }
  8760. }
  8761. }, {
  8762. key: 'bindEvents',
  8763. value: function bindEvents() {}
  8764. }]);
  8765. return Sticky;
  8766. }();
  8767. function initDataSelectors() {
  8768. $(SELECTORS.stickyElement).each(function () {
  8769. new Sticky($(this));
  8770. });
  8771. }
  8772. function initJqueryPlugin() {
  8773. $.fn.luSticky = function (options) {
  8774. return this.each(function () {
  8775. new Sticky($(this), options);
  8776. });
  8777. };
  8778. }
  8779. var init = {
  8780. initDataSelectors: initDataSelectors,
  8781. initJqueryPlugin: initJqueryPlugin
  8782. };
  8783. exports.default = init;
  8784. /***/ }),
  8785. /* 24 */
  8786. /***/ (function(module, exports, __webpack_require__) {
  8787. "use strict";
  8788. Object.defineProperty(exports, "__esModule", {
  8789. value: true
  8790. });
  8791. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8792. var _util = __webpack_require__(0);
  8793. var _util2 = _interopRequireDefault(_util);
  8794. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8795. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8796. var SELECTORS = {
  8797. toggler: '[data-toggler]',
  8798. togglerOptions: '[data-toggler-options]'
  8799. };
  8800. var Default = {
  8801. selectors: '',
  8802. container: 'body'
  8803. };
  8804. var Toggler = function () {
  8805. function Toggler(element, options) {
  8806. _classCallCheck(this, Toggler);
  8807. this.element = element;
  8808. this.targets = [];
  8809. this.getConfig();
  8810. this.targetsNames = this.config.selectors.split(',');
  8811. this.setTargetElements();
  8812. this.bindEvents();
  8813. }
  8814. _createClass(Toggler, [{
  8815. key: 'bindEvents',
  8816. value: function bindEvents() {
  8817. var _this = this;
  8818. this.config = this.element.on('click', function () {
  8819. return _this.toggle();
  8820. });
  8821. }
  8822. }, {
  8823. key: 'getConfig',
  8824. value: function getConfig() {
  8825. var dataToggler = this.getTogglerOptions(this.element.data('toggler'));
  8826. this.config = $.extend({}, Default, dataToggler);
  8827. }
  8828. }, {
  8829. key: 'getTogglerOptions',
  8830. value: function getTogglerOptions(options) {
  8831. if (options) {
  8832. return _util2.default.parseDataOptions(options);
  8833. } else {
  8834. return [];
  8835. }
  8836. }
  8837. }, {
  8838. key: 'setTargetElements',
  8839. value: function setTargetElements() {
  8840. this.container = this.element.closest(this.config.container);
  8841. if (this.targetsNames.length > 1) {
  8842. var _iteratorNormalCompletion = true;
  8843. var _didIteratorError = false;
  8844. var _iteratorError = undefined;
  8845. try {
  8846. for (var _iterator = this.targetsNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  8847. var target = _step.value;
  8848. var element = this.container.find(target);
  8849. this.targets.push({
  8850. element: element,
  8851. options: this.getTogglerOptions(element.data('toggler-options'))
  8852. });
  8853. }
  8854. } catch (err) {
  8855. _didIteratorError = true;
  8856. _iteratorError = err;
  8857. } finally {
  8858. try {
  8859. if (!_iteratorNormalCompletion && _iterator.return) {
  8860. _iterator.return();
  8861. }
  8862. } finally {
  8863. if (_didIteratorError) {
  8864. throw _iteratorError;
  8865. }
  8866. }
  8867. }
  8868. }
  8869. if (this.container) {
  8870. this.targets.push({
  8871. element: this.container,
  8872. options: this.getTogglerOptions(this.container.data('toggler-options'))
  8873. });
  8874. }
  8875. }
  8876. }, {
  8877. key: 'toggle',
  8878. value: function toggle() {
  8879. for (var targetName in this.targets) {
  8880. var _targets$targetName = this.targets[targetName],
  8881. element = _targets$targetName.element,
  8882. options = _targets$targetName.options;
  8883. if (options.addClass) element.addClass(options.addClass);
  8884. if (options.removeClass) element.removeClass(options.removeClass);
  8885. if (options.toggleClass) element.toggleClass(options.toggleClass);
  8886. }
  8887. }
  8888. }]);
  8889. return Toggler;
  8890. }();
  8891. function initDataSelectors() {
  8892. $(SELECTORS.toggler).each(function () {
  8893. new Toggler($(this));
  8894. });
  8895. }
  8896. function initJqueryPlugin() {
  8897. $.fn.luToggler = function (options) {
  8898. return this.each(function () {
  8899. new Toggler($(this), options);
  8900. });
  8901. };
  8902. }
  8903. var init = {
  8904. initDataSelectors: initDataSelectors,
  8905. initJqueryPlugin: initJqueryPlugin
  8906. };
  8907. exports.default = init;
  8908. /***/ }),
  8909. /* 25 */,
  8910. /* 26 */,
  8911. /* 27 */,
  8912. /* 28 */
  8913. /***/ (function(module, exports, __webpack_require__) {
  8914. "use strict";
  8915. var _navs = __webpack_require__(17);
  8916. var _navs2 = _interopRequireDefault(_navs);
  8917. var _switcher = __webpack_require__(18);
  8918. var _switcher2 = _interopRequireDefault(_switcher);
  8919. __webpack_require__(19);
  8920. __webpack_require__(11);
  8921. var _selects = __webpack_require__(13);
  8922. var _selects2 = _interopRequireDefault(_selects);
  8923. var _selectInput = __webpack_require__(3);
  8924. var _selectInput2 = _interopRequireDefault(_selectInput);
  8925. var _CheckAll = __webpack_require__(10);
  8926. var _CheckAll2 = _interopRequireDefault(_CheckAll);
  8927. var _rangeSlider = __webpack_require__(12);
  8928. var _rangeSlider2 = _interopRequireDefault(_rangeSlider);
  8929. var _dropdown = __webpack_require__(8);
  8930. var _dropdown2 = _interopRequireDefault(_dropdown);
  8931. var _tooltips = __webpack_require__(9);
  8932. var _tooltips2 = _interopRequireDefault(_tooltips);
  8933. __webpack_require__(16);
  8934. var _alert = __webpack_require__(15);
  8935. var _alert2 = _interopRequireDefault(_alert);
  8936. var _contentSlider = __webpack_require__(7);
  8937. var _contentSlider2 = _interopRequireDefault(_contentSlider);
  8938. var _scrollTo = __webpack_require__(21);
  8939. var _scrollTo2 = _interopRequireDefault(_scrollTo);
  8940. var _offCanvas = __webpack_require__(20);
  8941. var _offCanvas2 = _interopRequireDefault(_offCanvas);
  8942. var _inlineEditor = __webpack_require__(14);
  8943. var _inlineEditor2 = _interopRequireDefault(_inlineEditor);
  8944. __webpack_require__(6);
  8945. var _sticky = __webpack_require__(23);
  8946. var _sticky2 = _interopRequireDefault(_sticky);
  8947. var _toggler = __webpack_require__(24);
  8948. var _toggler2 = _interopRequireDefault(_toggler);
  8949. __webpack_require__(22);
  8950. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8951. $ = window.jQuery;
  8952. //navs
  8953. //forms
  8954. //dropdowns
  8955. //modals
  8956. //other
  8957. // *** Init plugin via data atributes ***
  8958. //init (old)
  8959. _selectInput2.default.init();
  8960. _rangeSlider2.default.init();
  8961. window.layers = {
  8962. alert: _alert2.default
  8963. };
  8964. $(document).ready(function () {
  8965. //navs
  8966. // navs.initDataSelectors();
  8967. // navs.initJqueryPlugin();
  8968. _navs2.default.init();
  8969. //Alerts
  8970. // alert.initDataSelectors();
  8971. // alert.initJqueryPlugin();
  8972. _alert2.default.init();
  8973. //Dropdown
  8974. _dropdown2.default.initDataSelectors();
  8975. //Tooltips
  8976. _tooltips2.default.initDataSelectors();
  8977. //Inline Editor
  8978. _inlineEditor2.default.initDataSelectors();
  8979. //Content Slider
  8980. _contentSlider2.default.initDataSelectors();
  8981. //Selects
  8982. _selects2.default.initDataSelectors();
  8983. //Check all
  8984. _CheckAll2.default.initDataSelectors();
  8985. //Sticky
  8986. _sticky2.default.initDataSelectors();
  8987. //Scroll To
  8988. _scrollTo2.default.initDataSelectors();
  8989. //off Canvas
  8990. _offCanvas2.default.initDataSelectors();
  8991. //toggler
  8992. _toggler2.default.initDataSelectors();
  8993. //Switcher
  8994. _switcher2.default.initDataSelectors();
  8995. });
  8996. //*** Add plugins to juqery interface ***
  8997. //Dropdown
  8998. _dropdown2.default.initJqueryPlugin();
  8999. //Tooltips
  9000. _tooltips2.default.initJqueryPlugin();
  9001. //Inline Editor
  9002. _inlineEditor2.default.initJqueryPlugin();
  9003. //Content Slider
  9004. _contentSlider2.default.initJqueryPlugin();
  9005. //Switcher
  9006. _switcher2.default.initJqueryPlugin();
  9007. //Selects
  9008. _selects2.default.initJqueryPlugin();
  9009. //Check all
  9010. _CheckAll2.default.initJqueryPlugin();
  9011. //Sticky
  9012. _sticky2.default.initJqueryPlugin();
  9013. //Scroll To
  9014. _scrollTo2.default.initJqueryPlugin();
  9015. //off Canvas
  9016. _offCanvas2.default.initJqueryPlugin();
  9017. //toggler
  9018. _toggler2.default.initJqueryPlugin();
  9019. /***/ }),
  9020. /* 29 */
  9021. /***/ (function(module, exports, __webpack_require__) {
  9022. "use strict";
  9023. var __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_0__factory, __WEBPACK_LOCAL_MODULE_0__module;var __WEBPACK_LOCAL_MODULE_1__, __WEBPACK_LOCAL_MODULE_1__factory, __WEBPACK_LOCAL_MODULE_1__module;var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  9024. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  9025. /**
  9026. * sifter.js
  9027. * Copyright (c) 2013 Brian Reavis & contributors
  9028. *
  9029. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9030. * file except in compliance with the License. You may obtain a copy of the License at:
  9031. * http://www.apache.org/licenses/LICENSE-2.0
  9032. *
  9033. * Unless required by applicable law or agreed to in writing, software distributed under
  9034. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9035. * ANY KIND, either express or implied. See the License for the specific language
  9036. * governing permissions and limitations under the License.
  9037. *
  9038. * @author Brian Reavis <brian@thirdroute.com>
  9039. */
  9040. (function (root, factory) {
  9041. if (true) {
  9042. !(__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));
  9043. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9044. module.exports = factory();
  9045. } else {
  9046. root.Sifter = factory();
  9047. }
  9048. })(undefined, function () {
  9049. /**
  9050. * Textually searches arrays and hashes of objects
  9051. * by property (or multiple properties). Designed
  9052. * specifically for autocomplete.
  9053. *
  9054. * @constructor
  9055. * @param {array|object} items
  9056. * @param {object} items
  9057. */
  9058. var Sifter = function Sifter(items, settings) {
  9059. this.items = items;
  9060. this.settings = settings || { diacritics: true };
  9061. };
  9062. /**
  9063. * Splits a search string into an array of individual
  9064. * regexps to be used to match results.
  9065. *
  9066. * @param {string} query
  9067. * @returns {array}
  9068. */
  9069. Sifter.prototype.tokenize = function (query) {
  9070. query = trim(String(query || '').toLowerCase());
  9071. if (!query || !query.length) return [];
  9072. var i, n, regex, letter;
  9073. var tokens = [];
  9074. var words = query.split(/ +/);
  9075. for (i = 0, n = words.length; i < n; i++) {
  9076. regex = escape_regex(words[i]);
  9077. if (this.settings.diacritics) {
  9078. for (letter in DIACRITICS) {
  9079. if (DIACRITICS.hasOwnProperty(letter)) {
  9080. regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);
  9081. }
  9082. }
  9083. }
  9084. tokens.push({
  9085. string: words[i],
  9086. regex: new RegExp(regex, 'i')
  9087. });
  9088. }
  9089. return tokens;
  9090. };
  9091. /**
  9092. * Iterates over arrays and hashes.
  9093. *
  9094. * ```
  9095. * this.iterator(this.items, function(item, id) {
  9096. * // invoked for each item
  9097. * });
  9098. * ```
  9099. *
  9100. * @param {array|object} object
  9101. */
  9102. Sifter.prototype.iterator = function (object, callback) {
  9103. var iterator;
  9104. if (is_array(object)) {
  9105. iterator = Array.prototype.forEach || function (callback) {
  9106. for (var i = 0, n = this.length; i < n; i++) {
  9107. callback(this[i], i, this);
  9108. }
  9109. };
  9110. } else {
  9111. iterator = function iterator(callback) {
  9112. for (var key in this) {
  9113. if (this.hasOwnProperty(key)) {
  9114. callback(this[key], key, this);
  9115. }
  9116. }
  9117. };
  9118. }
  9119. iterator.apply(object, [callback]);
  9120. };
  9121. /**
  9122. * Returns a function to be used to score individual results.
  9123. *
  9124. * Good matches will have a higher score than poor matches.
  9125. * If an item is not a match, 0 will be returned by the function.
  9126. *
  9127. * @param {object|string} search
  9128. * @param {object} options (optional)
  9129. * @returns {function}
  9130. */
  9131. Sifter.prototype.getScoreFunction = function (search, options) {
  9132. var self, fields, tokens, token_count, nesting;
  9133. self = this;
  9134. search = self.prepareSearch(search, options);
  9135. tokens = search.tokens;
  9136. fields = search.options.fields;
  9137. token_count = tokens.length;
  9138. nesting = search.options.nesting;
  9139. /**
  9140. * Calculates how close of a match the
  9141. * given value is against a search token.
  9142. *
  9143. * @param {mixed} value
  9144. * @param {object} token
  9145. * @return {number}
  9146. */
  9147. var scoreValue = function scoreValue(value, token) {
  9148. var score, pos;
  9149. if (!value) return 0;
  9150. value = String(value || '');
  9151. pos = value.search(token.regex);
  9152. if (pos === -1) return 0;
  9153. score = token.string.length / value.length;
  9154. if (pos === 0) score += 0.5;
  9155. return score;
  9156. };
  9157. /**
  9158. * Calculates the score of an object
  9159. * against the search query.
  9160. *
  9161. * @param {object} token
  9162. * @param {object} data
  9163. * @return {number}
  9164. */
  9165. var scoreObject = function () {
  9166. var field_count = fields.length;
  9167. if (!field_count) {
  9168. return function () {
  9169. return 0;
  9170. };
  9171. }
  9172. if (field_count === 1) {
  9173. return function (token, data) {
  9174. return scoreValue(getattr(data, fields[0], nesting), token);
  9175. };
  9176. }
  9177. return function (token, data) {
  9178. for (var i = 0, sum = 0; i < field_count; i++) {
  9179. sum += scoreValue(getattr(data, fields[i], nesting), token);
  9180. }
  9181. return sum / field_count;
  9182. };
  9183. }();
  9184. if (!token_count) {
  9185. return function () {
  9186. return 0;
  9187. };
  9188. }
  9189. if (token_count === 1) {
  9190. return function (data) {
  9191. return scoreObject(tokens[0], data);
  9192. };
  9193. }
  9194. if (search.options.conjunction === 'and') {
  9195. return function (data) {
  9196. var score;
  9197. for (var i = 0, sum = 0; i < token_count; i++) {
  9198. score = scoreObject(tokens[i], data);
  9199. if (score <= 0) return 0;
  9200. sum += score;
  9201. }
  9202. return sum / token_count;
  9203. };
  9204. } else {
  9205. return function (data) {
  9206. for (var i = 0, sum = 0; i < token_count; i++) {
  9207. sum += scoreObject(tokens[i], data);
  9208. }
  9209. return sum / token_count;
  9210. };
  9211. }
  9212. };
  9213. /**
  9214. * Returns a function that can be used to compare two
  9215. * results, for sorting purposes. If no sorting should
  9216. * be performed, `null` will be returned.
  9217. *
  9218. * @param {string|object} search
  9219. * @param {object} options
  9220. * @return function(a,b)
  9221. */
  9222. Sifter.prototype.getSortFunction = function (search, options) {
  9223. var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
  9224. self = this;
  9225. search = self.prepareSearch(search, options);
  9226. sort = !search.query && options.sort_empty || options.sort;
  9227. /**
  9228. * Fetches the specified sort field value
  9229. * from a search result item.
  9230. *
  9231. * @param {string} name
  9232. * @param {object} result
  9233. * @return {mixed}
  9234. */
  9235. get_field = function get_field(name, result) {
  9236. if (name === '$score') return result.score;
  9237. return getattr(self.items[result.id], name, options.nesting);
  9238. };
  9239. // parse options
  9240. fields = [];
  9241. if (sort) {
  9242. for (i = 0, n = sort.length; i < n; i++) {
  9243. if (search.query || sort[i].field !== '$score') {
  9244. fields.push(sort[i]);
  9245. }
  9246. }
  9247. }
  9248. // the "$score" field is implied to be the primary
  9249. // sort field, unless it's manually specified
  9250. if (search.query) {
  9251. implicit_score = true;
  9252. for (i = 0, n = fields.length; i < n; i++) {
  9253. if (fields[i].field === '$score') {
  9254. implicit_score = false;
  9255. break;
  9256. }
  9257. }
  9258. if (implicit_score) {
  9259. fields.unshift({ field: '$score', direction: 'desc' });
  9260. }
  9261. } else {
  9262. for (i = 0, n = fields.length; i < n; i++) {
  9263. if (fields[i].field === '$score') {
  9264. fields.splice(i, 1);
  9265. break;
  9266. }
  9267. }
  9268. }
  9269. multipliers = [];
  9270. for (i = 0, n = fields.length; i < n; i++) {
  9271. multipliers.push(fields[i].direction === 'desc' ? -1 : 1);
  9272. }
  9273. // build function
  9274. fields_count = fields.length;
  9275. if (!fields_count) {
  9276. return null;
  9277. } else if (fields_count === 1) {
  9278. field = fields[0].field;
  9279. multiplier = multipliers[0];
  9280. return function (a, b) {
  9281. return multiplier * cmp(get_field(field, a), get_field(field, b));
  9282. };
  9283. } else {
  9284. return function (a, b) {
  9285. var i, result, a_value, b_value, field;
  9286. for (i = 0; i < fields_count; i++) {
  9287. field = fields[i].field;
  9288. result = multipliers[i] * cmp(get_field(field, a), get_field(field, b));
  9289. if (result) return result;
  9290. }
  9291. return 0;
  9292. };
  9293. }
  9294. };
  9295. /**
  9296. * Parses a search query and returns an object
  9297. * with tokens and fields ready to be populated
  9298. * with results.
  9299. *
  9300. * @param {string} query
  9301. * @param {object} options
  9302. * @returns {object}
  9303. */
  9304. Sifter.prototype.prepareSearch = function (query, options) {
  9305. if ((typeof query === 'undefined' ? 'undefined' : _typeof(query)) === 'object') return query;
  9306. options = extend({}, options);
  9307. var option_fields = options.fields;
  9308. var option_sort = options.sort;
  9309. var option_sort_empty = options.sort_empty;
  9310. if (option_fields && !is_array(option_fields)) options.fields = [option_fields];
  9311. if (option_sort && !is_array(option_sort)) options.sort = [option_sort];
  9312. if (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty];
  9313. return {
  9314. options: options,
  9315. query: String(query || '').toLowerCase(),
  9316. tokens: this.tokenize(query),
  9317. total: 0,
  9318. items: []
  9319. };
  9320. };
  9321. /**
  9322. * Searches through all items and returns a sorted array of matches.
  9323. *
  9324. * The `options` parameter can contain:
  9325. *
  9326. * - fields {string|array}
  9327. * - sort {array}
  9328. * - score {function}
  9329. * - filter {bool}
  9330. * - limit {integer}
  9331. *
  9332. * Returns an object containing:
  9333. *
  9334. * - options {object}
  9335. * - query {string}
  9336. * - tokens {array}
  9337. * - total {int}
  9338. * - items {array}
  9339. *
  9340. * @param {string} query
  9341. * @param {object} options
  9342. * @returns {object}
  9343. */
  9344. Sifter.prototype.search = function (query, options) {
  9345. var self = this,
  9346. value,
  9347. score,
  9348. search,
  9349. calculateScore;
  9350. var fn_sort;
  9351. var fn_score;
  9352. search = this.prepareSearch(query, options);
  9353. options = search.options;
  9354. query = search.query;
  9355. // generate result scoring function
  9356. fn_score = options.score || self.getScoreFunction(search);
  9357. // perform search and sort
  9358. if (query.length) {
  9359. self.iterator(self.items, function (item, id) {
  9360. score = fn_score(item);
  9361. if (options.filter === false || score > 0) {
  9362. search.items.push({ 'score': score, 'id': id });
  9363. }
  9364. });
  9365. } else {
  9366. self.iterator(self.items, function (item, id) {
  9367. search.items.push({ 'score': 1, 'id': id });
  9368. });
  9369. }
  9370. fn_sort = self.getSortFunction(search, options);
  9371. if (fn_sort) search.items.sort(fn_sort);
  9372. // apply limits
  9373. search.total = search.items.length;
  9374. if (typeof options.limit === 'number') {
  9375. search.items = search.items.slice(0, options.limit);
  9376. }
  9377. return search;
  9378. };
  9379. // utilities
  9380. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9381. var cmp = function cmp(a, b) {
  9382. if (typeof a === 'number' && typeof b === 'number') {
  9383. return a > b ? 1 : a < b ? -1 : 0;
  9384. }
  9385. a = asciifold(String(a || ''));
  9386. b = asciifold(String(b || ''));
  9387. if (a > b) return 1;
  9388. if (b > a) return -1;
  9389. return 0;
  9390. };
  9391. var extend = function extend(a, b) {
  9392. var i, n, k, object;
  9393. for (i = 1, n = arguments.length; i < n; i++) {
  9394. object = arguments[i];
  9395. if (!object) continue;
  9396. for (k in object) {
  9397. if (object.hasOwnProperty(k)) {
  9398. a[k] = object[k];
  9399. }
  9400. }
  9401. }
  9402. return a;
  9403. };
  9404. /**
  9405. * A property getter resolving dot-notation
  9406. * @param {Object} obj The root object to fetch property on
  9407. * @param {String} name The optionally dotted property name to fetch
  9408. * @param {Boolean} nesting Handle nesting or not
  9409. * @return {Object} The resolved property value
  9410. */
  9411. var getattr = function getattr(obj, name, nesting) {
  9412. if (!obj || !name) return;
  9413. if (!nesting) return obj[name];
  9414. var names = name.split(".");
  9415. while (names.length && (obj = obj[names.shift()])) {}
  9416. return obj;
  9417. };
  9418. var trim = function trim(str) {
  9419. return (str + '').replace(/^\s+|\s+$|/g, '');
  9420. };
  9421. var escape_regex = function escape_regex(str) {
  9422. return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
  9423. };
  9424. var is_array = Array.isArray || typeof $ !== 'undefined' && $.isArray || function (object) {
  9425. return Object.prototype.toString.call(object) === '[object Array]';
  9426. };
  9427. var DIACRITICS = {
  9428. 'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',
  9429. 'b': '[b␢βΒB฿𐌁ᛒ]',
  9430. 'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',
  9431. 'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',
  9432. 'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',
  9433. 'f': '[fƑƒḞḟ]',
  9434. 'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',
  9435. 'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',
  9436. 'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',
  9437. 'j': '[jȷĴĵɈɉʝɟʲ]',
  9438. 'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',
  9439. 'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',
  9440. 'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',
  9441. 'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',
  9442. 'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',
  9443. 'q': '[qꝖꝗʠɊɋꝘꝙq̃]',
  9444. 'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',
  9445. 's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',
  9446. 't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',
  9447. 'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',
  9448. 'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',
  9449. 'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',
  9450. 'x': '[xẌẍẊẋχ]',
  9451. 'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',
  9452. 'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'
  9453. };
  9454. var asciifold = function () {
  9455. var i, n, k, chunk;
  9456. var foreignletters = '';
  9457. var lookup = {};
  9458. for (k in DIACRITICS) {
  9459. if (DIACRITICS.hasOwnProperty(k)) {
  9460. chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);
  9461. foreignletters += chunk;
  9462. for (i = 0, n = chunk.length; i < n; i++) {
  9463. lookup[chunk.charAt(i)] = k;
  9464. }
  9465. }
  9466. }
  9467. var regexp = new RegExp('[' + foreignletters + ']', 'g');
  9468. return function (str) {
  9469. return str.replace(regexp, function (foreignletter) {
  9470. return lookup[foreignletter];
  9471. }).toLowerCase();
  9472. };
  9473. }();
  9474. // export
  9475. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9476. return Sifter;
  9477. });
  9478. /**
  9479. * microplugin.js
  9480. * Copyright (c) 2013 Brian Reavis & contributors
  9481. *
  9482. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9483. * file except in compliance with the License. You may obtain a copy of the License at:
  9484. * http://www.apache.org/licenses/LICENSE-2.0
  9485. *
  9486. * Unless required by applicable law or agreed to in writing, software distributed under
  9487. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9488. * ANY KIND, either express or implied. See the License for the specific language
  9489. * governing permissions and limitations under the License.
  9490. *
  9491. * @author Brian Reavis <brian@thirdroute.com>
  9492. */
  9493. (function (root, factory) {
  9494. if (true) {
  9495. !(__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));
  9496. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9497. module.exports = factory();
  9498. } else {
  9499. root.MicroPlugin = factory();
  9500. }
  9501. })(undefined, function () {
  9502. var MicroPlugin = {};
  9503. MicroPlugin.mixin = function (Interface) {
  9504. Interface.plugins = {};
  9505. /**
  9506. * Initializes the listed plugins (with options).
  9507. * Acceptable formats:
  9508. *
  9509. * List (without options):
  9510. * ['a', 'b', 'c']
  9511. *
  9512. * List (with options):
  9513. * [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
  9514. *
  9515. * Hash (with options):
  9516. * {'a': { ... }, 'b': { ... }, 'c': { ... }}
  9517. *
  9518. * @param {mixed} plugins
  9519. */
  9520. Interface.prototype.initializePlugins = function (plugins) {
  9521. var i, n, key;
  9522. var self = this;
  9523. var queue = [];
  9524. self.plugins = {
  9525. names: [],
  9526. settings: {},
  9527. requested: {},
  9528. loaded: {}
  9529. };
  9530. if (utils.isArray(plugins)) {
  9531. for (i = 0, n = plugins.length; i < n; i++) {
  9532. if (typeof plugins[i] === 'string') {
  9533. queue.push(plugins[i]);
  9534. } else {
  9535. self.plugins.settings[plugins[i].name] = plugins[i].options;
  9536. queue.push(plugins[i].name);
  9537. }
  9538. }
  9539. } else if (plugins) {
  9540. for (key in plugins) {
  9541. if (plugins.hasOwnProperty(key)) {
  9542. self.plugins.settings[key] = plugins[key];
  9543. queue.push(key);
  9544. }
  9545. }
  9546. }
  9547. while (queue.length) {
  9548. self.require(queue.shift());
  9549. }
  9550. };
  9551. Interface.prototype.loadPlugin = function (name) {
  9552. var self = this;
  9553. var plugins = self.plugins;
  9554. var plugin = Interface.plugins[name];
  9555. if (!Interface.plugins.hasOwnProperty(name)) {
  9556. //throw new Error('Unable to find "' + name + '" plugin');
  9557. }
  9558. else{
  9559. plugins.requested[name] = true;
  9560. plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);
  9561. plugins.names.push(name);
  9562. }
  9563. };
  9564. /**
  9565. * Initializes a plugin.
  9566. *
  9567. * @param {string} name
  9568. */
  9569. Interface.prototype.require = function (name) {
  9570. var self = this;
  9571. var plugins = self.plugins;
  9572. if (!self.plugins.loaded.hasOwnProperty(name)) {
  9573. if (plugins.requested[name]) {
  9574. throw new Error('Plugin has circular dependency ("' + name + '")');
  9575. }
  9576. self.loadPlugin(name);
  9577. }
  9578. return plugins.loaded[name];
  9579. };
  9580. /**
  9581. * Registers a plugin.
  9582. *
  9583. * @param {string} name
  9584. * @param {function} fn
  9585. */
  9586. Interface.define = function (name, fn) {
  9587. Interface.plugins[name] = {
  9588. 'name': name,
  9589. 'fn': fn
  9590. };
  9591. };
  9592. };
  9593. var utils = {
  9594. isArray: Array.isArray || function (vArg) {
  9595. return Object.prototype.toString.call(vArg) === '[object Array]';
  9596. }
  9597. };
  9598. return MicroPlugin;
  9599. });
  9600. /**
  9601. * selectize.js (v0.12.4)
  9602. * Copyright (c) 2013–2015 Brian Reavis & contributors
  9603. *
  9604. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  9605. * file except in compliance with the License. You may obtain a copy of the License at:
  9606. * http://www.apache.org/licenses/LICENSE-2.0
  9607. *
  9608. * Unless required by applicable law or agreed to in writing, software distributed under
  9609. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  9610. * ANY KIND, either express or implied. See the License for the specific language
  9611. * governing permissions and limitations under the License.
  9612. *
  9613. * @author Brian Reavis <brian@thirdroute.com>
  9614. */
  9615. /*jshint curly:false */
  9616. /*jshint browser:true */
  9617. (function (root, factory) {
  9618. if (true) {
  9619. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_1__], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  9620. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  9621. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  9622. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  9623. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  9624. module.exports = factory(require('jquery'), require('sifter'), require('microplugin'));
  9625. } else {
  9626. root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
  9627. }
  9628. })(undefined, function ($, Sifter, MicroPlugin) {
  9629. 'use strict';
  9630. var highlight = function highlight($element, pattern) {
  9631. if (typeof pattern === 'string' && !pattern.length) return;
  9632. var regex = typeof pattern === 'string' ? new RegExp(pattern, 'i') : pattern;
  9633. var highlight = function highlight(node) {
  9634. var skip = 0;
  9635. if (node.nodeType === 3) {
  9636. var pos = node.data.search(regex);
  9637. if (pos >= 0 && node.data.length > 0) {
  9638. var match = node.data.match(regex);
  9639. var spannode = document.createElement('span');
  9640. spannode.className = 'highlight';
  9641. var middlebit = node.splitText(pos);
  9642. var endbit = middlebit.splitText(match[0].length);
  9643. var middleclone = middlebit.cloneNode(true);
  9644. spannode.appendChild(middleclone);
  9645. middlebit.parentNode.replaceChild(spannode, middlebit);
  9646. skip = 1;
  9647. }
  9648. } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
  9649. for (var i = 0; i < node.childNodes.length; ++i) {
  9650. i += highlight(node.childNodes[i]);
  9651. }
  9652. }
  9653. return skip;
  9654. };
  9655. return $element.each(function () {
  9656. highlight(this);
  9657. });
  9658. };
  9659. /**
  9660. * removeHighlight fn copied from highlight v5 and
  9661. * edited to remove with() and pass js strict mode
  9662. */
  9663. $.fn.removeHighlight = function () {
  9664. return this.find("span.highlight").each(function () {
  9665. this.parentNode.firstChild.nodeName;
  9666. var parent = this.parentNode;
  9667. parent.replaceChild(this.firstChild, this);
  9668. parent.normalize();
  9669. }).end();
  9670. };
  9671. var MicroEvent = function MicroEvent() {};
  9672. MicroEvent.prototype = {
  9673. on: function on(event, fct) {
  9674. this._events = this._events || {};
  9675. this._events[event] = this._events[event] || [];
  9676. this._events[event].push(fct);
  9677. },
  9678. off: function off(event, fct) {
  9679. var n = arguments.length;
  9680. if (n === 0) return delete this._events;
  9681. if (n === 1) return delete this._events[event];
  9682. this._events = this._events || {};
  9683. if (event in this._events === false) return;
  9684. this._events[event].splice(this._events[event].indexOf(fct), 1);
  9685. },
  9686. trigger: function trigger(event /* , args... */) {
  9687. this._events = this._events || {};
  9688. if (event in this._events === false) return;
  9689. for (var i = 0; i < this._events[event].length; i++) {
  9690. this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
  9691. }
  9692. }
  9693. };
  9694. /**
  9695. * Mixin will delegate all MicroEvent.js function in the destination object.
  9696. *
  9697. * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent
  9698. *
  9699. * @param {object} the object which will support MicroEvent
  9700. */
  9701. MicroEvent.mixin = function (destObject) {
  9702. var props = ['on', 'off', 'trigger'];
  9703. for (var i = 0; i < props.length; i++) {
  9704. destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
  9705. }
  9706. };
  9707. var IS_MAC = /Mac/.test(navigator.userAgent);
  9708. var KEY_A = 65;
  9709. var KEY_COMMA = 188;
  9710. var KEY_RETURN = 13;
  9711. var KEY_ESC = 27;
  9712. var KEY_LEFT = 37;
  9713. var KEY_UP = 38;
  9714. var KEY_P = 80;
  9715. var KEY_RIGHT = 39;
  9716. var KEY_DOWN = 40;
  9717. var KEY_N = 78;
  9718. var KEY_BACKSPACE = 8;
  9719. var KEY_DELETE = 46;
  9720. var KEY_SHIFT = 16;
  9721. var KEY_CMD = IS_MAC ? 91 : 17;
  9722. var KEY_CTRL = IS_MAC ? 18 : 17;
  9723. var KEY_TAB = 9;
  9724. var TAG_SELECT = 1;
  9725. var TAG_INPUT = 2;
  9726. // for now, android support in general is too spotty to support validity
  9727. var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
  9728. var isset = function isset(object) {
  9729. return typeof object !== 'undefined';
  9730. };
  9731. /**
  9732. * Converts a scalar to its best string representation
  9733. * for hash keys and HTML attribute values.
  9734. *
  9735. * Transformations:
  9736. * 'str' -> 'str'
  9737. * null -> ''
  9738. * undefined -> ''
  9739. * true -> '1'
  9740. * false -> '0'
  9741. * 0 -> '0'
  9742. * 1 -> '1'
  9743. *
  9744. * @param {string} value
  9745. * @returns {string|null}
  9746. */
  9747. var hash_key = function hash_key(value) {
  9748. if (typeof value === 'undefined' || value === null) return null;
  9749. if (typeof value === 'boolean') return value ? '1' : '0';
  9750. return value + '';
  9751. };
  9752. /**
  9753. * Escapes a string for use within HTML.
  9754. *
  9755. * @param {string} str
  9756. * @returns {string}
  9757. */
  9758. var escape_html = function escape_html(str) {
  9759. return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  9760. };
  9761. /**
  9762. * Escapes "$" characters in replacement strings.
  9763. *
  9764. * @param {string} str
  9765. * @returns {string}
  9766. */
  9767. var escape_replace = function escape_replace(str) {
  9768. return (str + '').replace(/\$/g, '$$$$');
  9769. };
  9770. var hook = {};
  9771. /**
  9772. * Wraps `method` on `self` so that `fn`
  9773. * is invoked before the original method.
  9774. *
  9775. * @param {object} self
  9776. * @param {string} method
  9777. * @param {function} fn
  9778. */
  9779. hook.before = function (self, method, fn) {
  9780. var original = self[method];
  9781. self[method] = function () {
  9782. fn.apply(self, arguments);
  9783. return original.apply(self, arguments);
  9784. };
  9785. };
  9786. /**
  9787. * Wraps `method` on `self` so that `fn`
  9788. * is invoked after the original method.
  9789. *
  9790. * @param {object} self
  9791. * @param {string} method
  9792. * @param {function} fn
  9793. */
  9794. hook.after = function (self, method, fn) {
  9795. var original = self[method];
  9796. self[method] = function () {
  9797. var result = original.apply(self, arguments);
  9798. fn.apply(self, arguments);
  9799. return result;
  9800. };
  9801. };
  9802. /**
  9803. * Wraps `fn` so that it can only be invoked once.
  9804. *
  9805. * @param {function} fn
  9806. * @returns {function}
  9807. */
  9808. var once = function once(fn) {
  9809. var called = false;
  9810. return function () {
  9811. if (called) return;
  9812. called = true;
  9813. fn.apply(this, arguments);
  9814. };
  9815. };
  9816. /**
  9817. * Wraps `fn` so that it can only be called once
  9818. * every `delay` milliseconds (invoked on the falling edge).
  9819. *
  9820. * @param {function} fn
  9821. * @param {int} delay
  9822. * @returns {function}
  9823. */
  9824. var debounce = function debounce(fn, delay) {
  9825. var timeout;
  9826. return function () {
  9827. var self = this;
  9828. var args = arguments;
  9829. window.clearTimeout(timeout);
  9830. timeout = window.setTimeout(function () {
  9831. fn.apply(self, args);
  9832. }, delay);
  9833. };
  9834. };
  9835. /**
  9836. * Debounce all fired events types listed in `types`
  9837. * while executing the provided `fn`.
  9838. *
  9839. * @param {object} self
  9840. * @param {array} types
  9841. * @param {function} fn
  9842. */
  9843. var debounce_events = function debounce_events(self, types, fn) {
  9844. var type;
  9845. var trigger = self.trigger;
  9846. var event_args = {};
  9847. // override trigger method
  9848. self.trigger = function () {
  9849. var type = arguments[0];
  9850. if (types.indexOf(type) !== -1) {
  9851. event_args[type] = arguments;
  9852. } else {
  9853. return trigger.apply(self, arguments);
  9854. }
  9855. };
  9856. // invoke provided function
  9857. fn.apply(self, []);
  9858. self.trigger = trigger;
  9859. // trigger queued events
  9860. for (type in event_args) {
  9861. if (event_args.hasOwnProperty(type)) {
  9862. trigger.apply(self, event_args[type]);
  9863. }
  9864. }
  9865. };
  9866. /**
  9867. * A workaround for http://bugs.jquery.com/ticket/6696
  9868. *
  9869. * @param {object} $parent - Parent element to listen on.
  9870. * @param {string} event - Event name.
  9871. * @param {string} selector - Descendant selector to filter by.
  9872. * @param {function} fn - Event handler.
  9873. */
  9874. var watchChildEvent = function watchChildEvent($parent, event, selector, fn) {
  9875. $parent.on(event, selector, function (e) {
  9876. var child = e.target;
  9877. while (child && child.parentNode !== $parent[0]) {
  9878. child = child.parentNode;
  9879. }
  9880. e.currentTarget = child;
  9881. return fn.apply(this, [e]);
  9882. });
  9883. };
  9884. /**
  9885. * Determines the current selection within a text input control.
  9886. * Returns an object containing:
  9887. * - start
  9888. * - length
  9889. *
  9890. * @param {object} input
  9891. * @returns {object}
  9892. */
  9893. var getSelection = function getSelection(input) {
  9894. var result = {};
  9895. if ('selectionStart' in input) {
  9896. result.start = input.selectionStart;
  9897. result.length = input.selectionEnd - result.start;
  9898. } else if (document.selection) {
  9899. input.focus();
  9900. var sel = document.selection.createRange();
  9901. var selLen = document.selection.createRange().text.length;
  9902. sel.moveStart('character', -input.value.length);
  9903. result.start = sel.text.length - selLen;
  9904. result.length = selLen;
  9905. }
  9906. return result;
  9907. };
  9908. /**
  9909. * Copies CSS properties from one element to another.
  9910. *
  9911. * @param {object} $from
  9912. * @param {object} $to
  9913. * @param {array} properties
  9914. */
  9915. var transferStyles = function transferStyles($from, $to, properties) {
  9916. var i,
  9917. n,
  9918. styles = {};
  9919. if (properties) {
  9920. for (i = 0, n = properties.length; i < n; i++) {
  9921. styles[properties[i]] = $from.css(properties[i]);
  9922. }
  9923. } else {
  9924. styles = $from.css();
  9925. }
  9926. $to.css(styles);
  9927. };
  9928. /**
  9929. * Measures the width of a string within a
  9930. * parent element (in pixels).
  9931. *
  9932. * @param {string} str
  9933. * @param {object} $parent
  9934. * @returns {int}
  9935. */
  9936. var measureString = function measureString(str, $parent) {
  9937. if (!str) {
  9938. return 0;
  9939. }
  9940. var $test = $('<test>').css({
  9941. position: 'absolute',
  9942. top: -99999,
  9943. left: -99999,
  9944. width: 'auto',
  9945. padding: 0,
  9946. whiteSpace: 'pre'
  9947. }).text(str).appendTo('body');
  9948. transferStyles($parent, $test, ['letterSpacing', 'fontSize', 'fontFamily', 'fontWeight', 'textTransform']);
  9949. var width = $test.width();
  9950. $test.remove();
  9951. return width;
  9952. };
  9953. /**
  9954. * Sets up an input to grow horizontally as the user
  9955. * types. If the value is changed manually, you can
  9956. * trigger the "update" handler to resize:
  9957. *
  9958. * $input.trigger('update');
  9959. *
  9960. * @param {object} $input
  9961. */
  9962. var autoGrow = function autoGrow($input) {
  9963. var currentWidth = null;
  9964. var update = function update(e, options) {
  9965. var value, keyCode, printable, placeholder, width;
  9966. var shift, character, selection;
  9967. e = e || window.event || {};
  9968. options = options || {};
  9969. if (e.metaKey || e.altKey) return;
  9970. if (!options.force && $input.data('grow') === false) return;
  9971. value = $input.val();
  9972. if (e.type && e.type.toLowerCase() === 'keydown') {
  9973. keyCode = e.keyCode;
  9974. printable = keyCode >= 97 && keyCode <= 122 || // a-z
  9975. keyCode >= 65 && keyCode <= 90 || // A-Z
  9976. keyCode >= 48 && keyCode <= 57 || // 0-9
  9977. keyCode === 32 // space
  9978. ;
  9979. if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
  9980. selection = getSelection($input[0]);
  9981. if (selection.length) {
  9982. value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
  9983. } else if (keyCode === KEY_BACKSPACE && selection.start) {
  9984. value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
  9985. } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
  9986. value = value.substring(0, selection.start) + value.substring(selection.start + 1);
  9987. }
  9988. } else if (printable) {
  9989. shift = e.shiftKey;
  9990. character = String.fromCharCode(e.keyCode);
  9991. if (shift) character = character.toUpperCase();else character = character.toLowerCase();
  9992. value += character;
  9993. }
  9994. }
  9995. placeholder = $input.attr('placeholder');
  9996. if (!value && placeholder) {
  9997. value = placeholder;
  9998. }
  9999. width = measureString(value, $input) + 4;
  10000. if (width !== currentWidth) {
  10001. currentWidth = width;
  10002. $input.width(width);
  10003. $input.triggerHandler('resize');
  10004. }
  10005. };
  10006. $input.on('keydown keyup update blur', update);
  10007. update();
  10008. };
  10009. var domToString = function domToString(d) {
  10010. var tmp = document.createElement('div');
  10011. tmp.appendChild(d.cloneNode(true));
  10012. return tmp.innerHTML;
  10013. };
  10014. var logError = function logError(message, options) {
  10015. if (!options) options = {};
  10016. var component = "Selectize";
  10017. console.error(component + ": " + message);
  10018. if (options.explanation) {
  10019. // console.group is undefined in <IE11
  10020. if (console.group) console.group();
  10021. console.error(options.explanation);
  10022. if (console.group) console.groupEnd();
  10023. }
  10024. };
  10025. var Selectize = function Selectize($input, settings) {
  10026. var key,
  10027. i,
  10028. n,
  10029. dir,
  10030. input,
  10031. self = this;
  10032. input = $input[0];
  10033. input.selectize = self;
  10034. // detect rtl environment
  10035. var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
  10036. dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
  10037. dir = dir || $input.parents('[dir]:first').attr('dir') || '';
  10038. // setup default state
  10039. $.extend(self, {
  10040. order: 0,
  10041. settings: settings,
  10042. $input: $input,
  10043. tabIndex: $input.attr('tabindex') || '',
  10044. tagType: input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
  10045. rtl: /rtl/i.test(dir),
  10046. eventNS: '.selectize' + ++Selectize.count,
  10047. highlightedValue: null,
  10048. isOpen: false,
  10049. isDisabled: false,
  10050. isRequired: $input.is('[required]'),
  10051. isInvalid: false,
  10052. isLocked: false,
  10053. isFocused: false,
  10054. isInputHidden: false,
  10055. isSetup: false,
  10056. isShiftDown: false,
  10057. isCmdDown: false,
  10058. isCtrlDown: false,
  10059. ignoreFocus: false,
  10060. ignoreBlur: false,
  10061. ignoreHover: false,
  10062. hasOptions: false,
  10063. currentResults: null,
  10064. lastValue: '',
  10065. caretPos: 0,
  10066. loading: 0,
  10067. loadedSearches: {},
  10068. $activeOption: null,
  10069. $activeItems: [],
  10070. optgroups: {},
  10071. options: {},
  10072. userOptions: {},
  10073. items: [],
  10074. renderCache: {},
  10075. onSearchChange: settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)
  10076. });
  10077. // search system
  10078. self.sifter = new Sifter(this.options, { diacritics: settings.diacritics });
  10079. // build options table
  10080. if (self.settings.options) {
  10081. for (i = 0, n = self.settings.options.length; i < n; i++) {
  10082. self.registerOption(self.settings.options[i]);
  10083. }
  10084. delete self.settings.options;
  10085. }
  10086. // build optgroup table
  10087. if (self.settings.optgroups) {
  10088. for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
  10089. self.registerOptionGroup(self.settings.optgroups[i]);
  10090. }
  10091. delete self.settings.optgroups;
  10092. }
  10093. // option-dependent defaults
  10094. self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');
  10095. if (typeof self.settings.hideSelected !== 'boolean') {
  10096. self.settings.hideSelected = self.settings.mode === 'multi';
  10097. }
  10098. self.initializePlugins(self.settings.plugins);
  10099. self.setupCallbacks();
  10100. self.setupTemplates();
  10101. self.setup();
  10102. };
  10103. // mixins
  10104. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10105. MicroEvent.mixin(Selectize);
  10106. if (typeof MicroPlugin !== "undefined") {
  10107. MicroPlugin.mixin(Selectize);
  10108. } else {
  10109. 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." });
  10110. }
  10111. // methods
  10112. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10113. $.extend(Selectize.prototype, {
  10114. /**
  10115. * Creates all elements and sets up event bindings.
  10116. */
  10117. setup: function setup() {
  10118. var self = this;
  10119. var settings = self.settings;
  10120. var eventNS = self.eventNS;
  10121. var $window = $(window);
  10122. var $document = $(document);
  10123. var $input = self.$input;
  10124. var $wrapper;
  10125. var $control;
  10126. var $control_input;
  10127. var $dropdown;
  10128. var $dropdown_content;
  10129. var $dropdown_parent;
  10130. var inputMode;
  10131. var timeout_blur;
  10132. var timeout_focus;
  10133. var classes;
  10134. var classes_plugins;
  10135. var inputId;
  10136. inputMode = self.settings.mode;
  10137. classes = $input.attr('class') || '';
  10138. $wrapper = $('<div>').addClass(settings.wrapperClass).addClass(inputMode);
  10139. $control = $('<div>').addClass(settings.inputClass + ' ' + classes).addClass('items').appendTo($wrapper);
  10140. $control_input = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
  10141. $dropdown_parent = $(settings.dropdownParent || $wrapper);
  10142. $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
  10143. $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
  10144. if (inputId = $input.attr('id')) {
  10145. $control_input.attr('id', inputId + '-selectized');
  10146. $("label[for='" + inputId + "']").attr('for', inputId + '-selectized');
  10147. }
  10148. if (self.settings.copyClassesToDropdown) {
  10149. $dropdown.addClass(classes);
  10150. }
  10151. $wrapper.css({
  10152. width: $input[0].style.width
  10153. });
  10154. if (self.plugins.names.length) {
  10155. classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
  10156. $wrapper.addClass(classes_plugins);
  10157. $dropdown.addClass(classes_plugins);
  10158. }
  10159. if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {
  10160. $input.attr('multiple', 'multiple');
  10161. }
  10162. if (self.settings.placeholder) {
  10163. $control_input.attr('placeholder', settings.placeholder);
  10164. }
  10165. // if splitOn was not passed in, construct it from the delimiter to allow pasting universally
  10166. if (!self.settings.splitOn && self.settings.delimiter) {
  10167. var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  10168. self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
  10169. }
  10170. if ($input.attr('autocorrect')) {
  10171. $control_input.attr('autocorrect', $input.attr('autocorrect'));
  10172. }
  10173. if ($input.attr('autocapitalize')) {
  10174. $control_input.attr('autocapitalize', $input.attr('autocapitalize'));
  10175. }
  10176. self.$wrapper = $wrapper;
  10177. self.$control = $control;
  10178. self.$control_input = $control_input;
  10179. self.$dropdown = $dropdown;
  10180. self.$dropdown_content = $dropdown_content;
  10181. $dropdown.on('mouseenter', '[data-selectable]', function () {
  10182. return self.onOptionHover.apply(self, arguments);
  10183. });
  10184. $dropdown.on('mousedown click', '[data-selectable]', function () {
  10185. return self.onOptionSelect.apply(self, arguments);
  10186. });
  10187. watchChildEvent($control, 'mousedown', '*:not(input)', function () {
  10188. return self.onItemSelect.apply(self, arguments);
  10189. });
  10190. autoGrow($control_input);
  10191. $control.on({
  10192. mousedown: function mousedown() {
  10193. return self.onMouseDown.apply(self, arguments);
  10194. },
  10195. click: function click() {
  10196. return self.onClick.apply(self, arguments);
  10197. }
  10198. });
  10199. $control_input.on({
  10200. mousedown: function mousedown(e) {
  10201. e.stopPropagation();
  10202. },
  10203. keydown: function keydown() {
  10204. return self.onKeyDown.apply(self, arguments);
  10205. },
  10206. keyup: function keyup() {
  10207. return self.onKeyUp.apply(self, arguments);
  10208. },
  10209. keypress: function keypress() {
  10210. return self.onKeyPress.apply(self, arguments);
  10211. },
  10212. resize: function resize() {
  10213. self.positionDropdown.apply(self, []);
  10214. },
  10215. blur: function blur() {
  10216. return self.onBlur.apply(self, arguments);
  10217. },
  10218. focus: function focus() {
  10219. self.ignoreBlur = false;return self.onFocus.apply(self, arguments);
  10220. },
  10221. paste: function paste() {
  10222. return self.onPaste.apply(self, arguments);
  10223. }
  10224. });
  10225. $document.on('keydown' + eventNS, function (e) {
  10226. self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
  10227. self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
  10228. self.isShiftDown = e.shiftKey;
  10229. });
  10230. $document.on('keyup' + eventNS, function (e) {
  10231. if (e.keyCode === KEY_CTRL) self.isCtrlDown = false;
  10232. if (e.keyCode === KEY_SHIFT) self.isShiftDown = false;
  10233. if (e.keyCode === KEY_CMD) self.isCmdDown = false;
  10234. });
  10235. $document.on('mousedown' + eventNS, function (e) {
  10236. if (self.isFocused) {
  10237. // prevent events on the dropdown scrollbar from causing the control to blur
  10238. if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
  10239. return false;
  10240. }
  10241. // blur on click outside
  10242. if (!self.$control.has(e.target).length && e.target !== self.$control[0]) {
  10243. self.blur(e.target);
  10244. }
  10245. }
  10246. });
  10247. $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function () {
  10248. if (self.isOpen) {
  10249. self.positionDropdown.apply(self, arguments);
  10250. }
  10251. });
  10252. $window.on('mousemove' + eventNS, function () {
  10253. self.ignoreHover = false;
  10254. });
  10255. // store original children and tab index so that they can be
  10256. // restored when the destroy() method is called.
  10257. this.revertSettings = {
  10258. $children: $input.children().detach(),
  10259. tabindex: $input.attr('tabindex')
  10260. };
  10261. $input.attr('tabindex', -1).hide().after(self.$wrapper);
  10262. if ($.isArray(settings.items)) {
  10263. self.setValue(settings.items);
  10264. delete settings.items;
  10265. }
  10266. // feature detect for the validation API
  10267. if (SUPPORTS_VALIDITY_API) {
  10268. $input.on('invalid' + eventNS, function (e) {
  10269. e.preventDefault();
  10270. self.isInvalid = true;
  10271. self.refreshState();
  10272. });
  10273. }
  10274. self.updateOriginalInput();
  10275. self.refreshItems();
  10276. self.refreshState();
  10277. self.updatePlaceholder();
  10278. self.isSetup = true;
  10279. if ($input.is(':disabled')) {
  10280. self.disable();
  10281. }
  10282. self.on('change', this.onChange);
  10283. $input.data('selectize', self);
  10284. $input.addClass('selectized');
  10285. self.trigger('initialize');
  10286. // preload options
  10287. if (settings.preload === true) {
  10288. self.onSearchChange('');
  10289. }
  10290. },
  10291. /**
  10292. * Sets up default rendering functions.
  10293. */
  10294. setupTemplates: function setupTemplates() {
  10295. var self = this;
  10296. var field_label = self.settings.labelField;
  10297. var field_optgroup = self.settings.optgroupLabelField;
  10298. var templates = {
  10299. 'optgroup': function optgroup(data) {
  10300. return '<div class="optgroup">' + data.html + '</div>';
  10301. },
  10302. 'optgroup_header': function optgroup_header(data, escape) {
  10303. return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
  10304. },
  10305. 'option': function option(data, escape) {
  10306. if(data.description) {
  10307. return '<div class="option">'
  10308. + '<div class="title" style="font-size: 16px;">'+escape(data[field_label])+'</div>'
  10309. + '<div class="desc">'
  10310. //+ escape(data['description'])
  10311. + data['description']
  10312. + '</div>'
  10313. + '</div>';
  10314. }
  10315. return '<div class="option">' + escape(data[field_label]) + '</div>';
  10316. },
  10317. 'item': function item(data, escape) {
  10318. if(data.description) {
  10319. console.log("DESCRIPTION 2: " + data['description']);
  10320. return '<div class="item">'
  10321. + '<div class="title" style="font-size: 16px;">'+escape(data[field_label])+'</div>'
  10322. + '<div class="desc">'
  10323. //+ escape(data['description'])
  10324. + data['description']
  10325. + '</div>'
  10326. + '</div>';
  10327. }
  10328. return '<div class="item">' + escape(data[field_label]) + '</div>';
  10329. },
  10330. 'option_create': function option_create(data, escape) {
  10331. return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
  10332. }
  10333. };
  10334. self.settings.render = $.extend({}, templates, self.settings.render);
  10335. },
  10336. /**
  10337. * Maps fired events to callbacks provided
  10338. * in the settings used when creating the control.
  10339. */
  10340. setupCallbacks: function setupCallbacks() {
  10341. var key,
  10342. fn,
  10343. callbacks = {
  10344. 'initialize': 'onInitialize',
  10345. 'change': 'onChange',
  10346. 'item_add': 'onItemAdd',
  10347. 'item_remove': 'onItemRemove',
  10348. 'clear': 'onClear',
  10349. 'option_add': 'onOptionAdd',
  10350. 'option_remove': 'onOptionRemove',
  10351. 'option_clear': 'onOptionClear',
  10352. 'optgroup_add': 'onOptionGroupAdd',
  10353. 'optgroup_remove': 'onOptionGroupRemove',
  10354. 'optgroup_clear': 'onOptionGroupClear',
  10355. 'dropdown_open': 'onDropdownOpen',
  10356. 'dropdown_close': 'onDropdownClose',
  10357. 'type': 'onType',
  10358. 'load': 'onLoad',
  10359. 'focus': 'onFocus',
  10360. 'blur': 'onBlur'
  10361. };
  10362. for (key in callbacks) {
  10363. if (callbacks.hasOwnProperty(key)) {
  10364. fn = this.settings[callbacks[key]];
  10365. if (fn) this.on(key, fn);
  10366. }
  10367. }
  10368. },
  10369. /**
  10370. * Triggered when the main control element
  10371. * has a click event.
  10372. *
  10373. * @param {object} e
  10374. * @return {boolean}
  10375. */
  10376. onClick: function onClick(e) {
  10377. var self = this;
  10378. // necessary for mobile webkit devices (manual focus triggering
  10379. // is ignored unless invoked within a click event)
  10380. if (!self.isFocused) {
  10381. self.focus();
  10382. e.preventDefault();
  10383. }
  10384. },
  10385. /**
  10386. * Triggered when the main control element
  10387. * has a mouse down event.
  10388. *
  10389. * @param {object} e
  10390. * @return {boolean}
  10391. */
  10392. onMouseDown: function onMouseDown(e) {
  10393. var self = this;
  10394. var defaultPrevented = e.isDefaultPrevented();
  10395. var $target = $(e.target);
  10396. if (self.isFocused) {
  10397. // retain focus by preventing native handling. if the
  10398. // event target is the input it should not be modified.
  10399. // otherwise, text selection within the input won't work.
  10400. if (e.target !== self.$control_input[0]) {
  10401. if (self.settings.mode === 'single') {
  10402. // toggle dropdown
  10403. self.isOpen ? self.close() : self.open();
  10404. } else if (!defaultPrevented) {
  10405. self.setActiveItem(null);
  10406. }
  10407. return false;
  10408. }
  10409. } else {
  10410. // give control focus
  10411. if (!defaultPrevented) {
  10412. window.setTimeout(function () {
  10413. self.focus();
  10414. }, 0);
  10415. }
  10416. }
  10417. },
  10418. /**
  10419. * Triggered when the value of the control has been changed.
  10420. * This should propagate the event to the original DOM
  10421. * input / select element.
  10422. */
  10423. onChange: function onChange() {
  10424. this.$input.trigger('change');
  10425. },
  10426. /**
  10427. * Triggered on <input> paste.
  10428. *
  10429. * @param {object} e
  10430. * @returns {boolean}
  10431. */
  10432. onPaste: function onPaste(e) {
  10433. var self = this;
  10434. if (self.isFull() || self.isInputHidden || self.isLocked) {
  10435. e.preventDefault();
  10436. return;
  10437. }
  10438. // If a regex or string is included, this will split the pasted
  10439. // input and create Items for each separate value
  10440. if (self.settings.splitOn) {
  10441. // Wait for pasted text to be recognized in value
  10442. setTimeout(function () {
  10443. var pastedText = self.$control_input.val();
  10444. if (!pastedText.match(self.settings.splitOn)) {
  10445. return;
  10446. }
  10447. var splitInput = $.trim(pastedText).split(self.settings.splitOn);
  10448. for (var i = 0, n = splitInput.length; i < n; i++) {
  10449. self.createItem(splitInput[i]);
  10450. }
  10451. }, 0);
  10452. }
  10453. },
  10454. /**
  10455. * Triggered on <input> keypress.
  10456. *
  10457. * @param {object} e
  10458. * @returns {boolean}
  10459. */
  10460. onKeyPress: function onKeyPress(e) {
  10461. if (this.isLocked) return e && e.preventDefault();
  10462. var character = String.fromCharCode(e.keyCode || e.which);
  10463. if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
  10464. this.createItem();
  10465. e.preventDefault();
  10466. return false;
  10467. }
  10468. },
  10469. /**
  10470. * Triggered on <input> keydown.
  10471. *
  10472. * @param {object} e
  10473. * @returns {boolean}
  10474. */
  10475. onKeyDown: function onKeyDown(e) {
  10476. var isInput = e.target === this.$control_input[0];
  10477. var self = this;
  10478. if (self.isLocked) {
  10479. if (e.keyCode !== KEY_TAB) {
  10480. e.preventDefault();
  10481. }
  10482. return;
  10483. }
  10484. switch (e.keyCode) {
  10485. case KEY_A:
  10486. if (self.isCmdDown) {
  10487. self.selectAll();
  10488. return;
  10489. }
  10490. break;
  10491. case KEY_ESC:
  10492. if (self.isOpen) {
  10493. e.preventDefault();
  10494. e.stopPropagation();
  10495. self.close();
  10496. }
  10497. return;
  10498. case KEY_N:
  10499. if (!e.ctrlKey || e.altKey) break;
  10500. case KEY_DOWN:
  10501. if (!self.isOpen && self.hasOptions) {
  10502. self.open();
  10503. } else if (self.$activeOption) {
  10504. self.ignoreHover = true;
  10505. var $next = self.getAdjacentOption(self.$activeOption, 1);
  10506. if ($next.length) self.setActiveOption($next, true, true);
  10507. }
  10508. e.preventDefault();
  10509. return;
  10510. case KEY_P:
  10511. if (!e.ctrlKey || e.altKey) break;
  10512. case KEY_UP:
  10513. if (self.$activeOption) {
  10514. self.ignoreHover = true;
  10515. var $prev = self.getAdjacentOption(self.$activeOption, -1);
  10516. if ($prev.length) self.setActiveOption($prev, true, true);
  10517. }
  10518. e.preventDefault();
  10519. return;
  10520. case KEY_RETURN:
  10521. if (self.isOpen && self.$activeOption) {
  10522. self.onOptionSelect({ currentTarget: self.$activeOption });
  10523. e.preventDefault();
  10524. }
  10525. return;
  10526. case KEY_LEFT:
  10527. self.advanceSelection(-1, e);
  10528. return;
  10529. case KEY_RIGHT:
  10530. self.advanceSelection(1, e);
  10531. return;
  10532. case KEY_TAB:
  10533. if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
  10534. self.onOptionSelect({ currentTarget: self.$activeOption });
  10535. // Default behaviour is to jump to the next field, we only want this
  10536. // if the current field doesn't accept any more entries
  10537. if (!self.isFull()) {
  10538. e.preventDefault();
  10539. }
  10540. }
  10541. if (self.settings.create && self.createItem()) {
  10542. e.preventDefault();
  10543. }
  10544. return;
  10545. case KEY_BACKSPACE:
  10546. case KEY_DELETE:
  10547. self.deleteSelection(e);
  10548. return;
  10549. }
  10550. if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
  10551. e.preventDefault();
  10552. return;
  10553. }
  10554. },
  10555. /**
  10556. * Triggered on <input> keyup.
  10557. *
  10558. * @param {object} e
  10559. * @returns {boolean}
  10560. */
  10561. onKeyUp: function onKeyUp(e) {
  10562. var self = this;
  10563. if (self.isLocked) return e && e.preventDefault();
  10564. var value = self.$control_input.val() || '';
  10565. if (self.lastValue !== value) {
  10566. self.lastValue = value;
  10567. self.onSearchChange(value);
  10568. self.refreshOptions();
  10569. self.trigger('type', value);
  10570. }
  10571. },
  10572. /**
  10573. * Invokes the user-provide option provider / loader.
  10574. *
  10575. * Note: this function is debounced in the Selectize
  10576. * constructor (by `settings.loadThrottle` milliseconds)
  10577. *
  10578. * @param {string} value
  10579. */
  10580. onSearchChange: function onSearchChange(value) {
  10581. var self = this;
  10582. var fn = self.settings.load;
  10583. if (!fn) return;
  10584. if (self.loadedSearches.hasOwnProperty(value)) return;
  10585. self.loadedSearches[value] = true;
  10586. self.load(function (callback) {
  10587. fn.apply(self, [value, callback]);
  10588. });
  10589. },
  10590. /**
  10591. * Triggered on <input> focus.
  10592. *
  10593. * @param {object} e (optional)
  10594. * @returns {boolean}
  10595. */
  10596. onFocus: function onFocus(e) {
  10597. var self = this;
  10598. var wasFocused = self.isFocused;
  10599. if (self.isDisabled) {
  10600. self.blur();
  10601. e && e.preventDefault();
  10602. return false;
  10603. }
  10604. if (self.ignoreFocus) return;
  10605. self.isFocused = true;
  10606. if (self.settings.preload === 'focus') self.onSearchChange('');
  10607. if (!wasFocused) self.trigger('focus');
  10608. if (!self.$activeItems.length) {
  10609. self.showInput();
  10610. self.setActiveItem(null);
  10611. self.refreshOptions(!!self.settings.openOnFocus);
  10612. }
  10613. self.refreshState();
  10614. },
  10615. /**
  10616. * Triggered on <input> blur.
  10617. *
  10618. * @param {object} e
  10619. * @param {Element} dest
  10620. */
  10621. onBlur: function onBlur(e, dest) {
  10622. var self = this;
  10623. if (!self.isFocused) return;
  10624. self.isFocused = false;
  10625. if (self.ignoreFocus) {
  10626. return;
  10627. } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
  10628. // necessary to prevent IE closing the dropdown when the scrollbar is clicked
  10629. self.ignoreBlur = true;
  10630. self.onFocus(e);
  10631. return;
  10632. }
  10633. var deactivate = function deactivate() {
  10634. self.close();
  10635. self.setTextboxValue('');
  10636. self.setActiveItem(null);
  10637. self.setActiveOption(null);
  10638. self.setCaret(self.items.length);
  10639. self.refreshState();
  10640. // IE11 bug: element still marked as active
  10641. dest && dest.focus && dest.focus();
  10642. self.ignoreFocus = false;
  10643. self.trigger('blur');
  10644. };
  10645. self.ignoreFocus = true;
  10646. if (self.settings.create && self.settings.createOnBlur) {
  10647. self.createItem(null, false, deactivate);
  10648. } else {
  10649. deactivate();
  10650. }
  10651. },
  10652. /**
  10653. * Triggered when the user rolls over
  10654. * an option in the autocomplete dropdown menu.
  10655. *
  10656. * @param {object} e
  10657. * @returns {boolean}
  10658. */
  10659. onOptionHover: function onOptionHover(e) {
  10660. if (this.ignoreHover) return;
  10661. this.setActiveOption(e.currentTarget, false);
  10662. },
  10663. /**
  10664. * Triggered when the user clicks on an option
  10665. * in the autocomplete dropdown menu.
  10666. *
  10667. * @param {object} e
  10668. * @returns {boolean}
  10669. */
  10670. onOptionSelect: function onOptionSelect(e) {
  10671. var value,
  10672. $target,
  10673. $option,
  10674. self = this;
  10675. if (e.preventDefault) {
  10676. e.preventDefault();
  10677. e.stopPropagation();
  10678. }
  10679. $target = $(e.currentTarget);
  10680. if ($target.hasClass('create')) {
  10681. self.createItem(null, function () {
  10682. if (self.settings.closeAfterSelect) {
  10683. self.close();
  10684. }
  10685. });
  10686. } else {
  10687. value = $target.attr('data-value');
  10688. if (typeof value !== 'undefined') {
  10689. self.lastQuery = null;
  10690. self.setTextboxValue('');
  10691. self.addItem(value);
  10692. if (self.settings.closeAfterSelect) {
  10693. self.close();
  10694. } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
  10695. self.setActiveOption(self.getOption(value));
  10696. }
  10697. }
  10698. }
  10699. },
  10700. /**
  10701. * Triggered when the user clicks on an item
  10702. * that has been selected.
  10703. *
  10704. * @param {object} e
  10705. * @returns {boolean}
  10706. */
  10707. onItemSelect: function onItemSelect(e) {
  10708. var self = this;
  10709. if (self.isLocked) return;
  10710. if (self.settings.mode === 'multi') {
  10711. e.preventDefault();
  10712. self.setActiveItem(e.currentTarget, e);
  10713. }
  10714. },
  10715. /**
  10716. * Invokes the provided method that provides
  10717. * results to a callback---which are then added
  10718. * as options to the control.
  10719. *
  10720. * @param {function} fn
  10721. */
  10722. load: function load(fn) {
  10723. var self = this;
  10724. var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
  10725. self.loading++;
  10726. fn.apply(self, [function (results) {
  10727. self.loading = Math.max(self.loading - 1, 0);
  10728. if (results && results.length) {
  10729. self.addOption(results);
  10730. self.refreshOptions(self.isFocused && !self.isInputHidden);
  10731. }
  10732. if (!self.loading) {
  10733. $wrapper.removeClass(self.settings.loadingClass);
  10734. }
  10735. self.trigger('load', results);
  10736. }]);
  10737. },
  10738. /**
  10739. * Sets the input field of the control to the specified value.
  10740. *
  10741. * @param {string} value
  10742. */
  10743. setTextboxValue: function setTextboxValue(value) {
  10744. var $input = this.$control_input;
  10745. var changed = $input.val() !== value;
  10746. if (changed) {
  10747. $input.val(value).triggerHandler('update');
  10748. this.lastValue = value;
  10749. }
  10750. },
  10751. /**
  10752. * Returns the value of the control. If multiple items
  10753. * can be selected (e.g. <select multiple>), this returns
  10754. * an array. If only one item can be selected, this
  10755. * returns a string.
  10756. *
  10757. * @returns {mixed}
  10758. */
  10759. getValue: function getValue() {
  10760. if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
  10761. return this.items;
  10762. } else {
  10763. return this.items.join(this.settings.delimiter);
  10764. }
  10765. },
  10766. /**
  10767. * Resets the selected items to the given value.
  10768. *
  10769. * @param {mixed} value
  10770. */
  10771. setValue: function setValue(value, silent) {
  10772. var events = silent ? [] : ['change'];
  10773. debounce_events(this, events, function () {
  10774. this.clear(silent);
  10775. this.addItems(value, silent);
  10776. });
  10777. },
  10778. /**
  10779. * Sets the selected item.
  10780. *
  10781. * @param {object} $item
  10782. * @param {object} e (optional)
  10783. */
  10784. setActiveItem: function setActiveItem($item, e) {
  10785. var self = this;
  10786. var eventName;
  10787. var i, idx, begin, end, item, swap;
  10788. var $last;
  10789. if (self.settings.mode === 'single') return;
  10790. $item = $($item);
  10791. // clear the active selection
  10792. if (!$item.length) {
  10793. $(self.$activeItems).removeClass('active');
  10794. self.$activeItems = [];
  10795. if (self.isFocused) {
  10796. self.showInput();
  10797. }
  10798. return;
  10799. }
  10800. // modify selection
  10801. eventName = e && e.type.toLowerCase();
  10802. if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
  10803. $last = self.$control.children('.active:last');
  10804. begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
  10805. end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
  10806. if (begin > end) {
  10807. swap = begin;
  10808. begin = end;
  10809. end = swap;
  10810. }
  10811. for (i = begin; i <= end; i++) {
  10812. item = self.$control[0].childNodes[i];
  10813. if (self.$activeItems.indexOf(item) === -1) {
  10814. $(item).addClass('active');
  10815. self.$activeItems.push(item);
  10816. }
  10817. }
  10818. e.preventDefault();
  10819. } else if (eventName === 'mousedown' && self.isCtrlDown || eventName === 'keydown' && this.isShiftDown) {
  10820. if ($item.hasClass('active')) {
  10821. idx = self.$activeItems.indexOf($item[0]);
  10822. self.$activeItems.splice(idx, 1);
  10823. $item.removeClass('active');
  10824. } else {
  10825. self.$activeItems.push($item.addClass('active')[0]);
  10826. }
  10827. } else {
  10828. $(self.$activeItems).removeClass('active');
  10829. self.$activeItems = [$item.addClass('active')[0]];
  10830. }
  10831. // ensure control has focus
  10832. self.hideInput();
  10833. if (!this.isFocused) {
  10834. self.focus();
  10835. }
  10836. },
  10837. /**
  10838. * Sets the selected item in the dropdown menu
  10839. * of available options.
  10840. *
  10841. * @param {object} $object
  10842. * @param {boolean} scroll
  10843. * @param {boolean} animate
  10844. */
  10845. setActiveOption: function setActiveOption($option, scroll, animate) {
  10846. var height_menu, height_item, y;
  10847. var scroll_top, scroll_bottom;
  10848. var self = this;
  10849. if (self.$activeOption) self.$activeOption.removeClass('active');
  10850. self.$activeOption = null;
  10851. $option = $($option);
  10852. if (!$option.length) return;
  10853. self.$activeOption = $option.addClass('active');
  10854. if (scroll || !isset(scroll)) {
  10855. height_menu = self.$dropdown_content.height();
  10856. height_item = self.$activeOption.outerHeight(true);
  10857. scroll = self.$dropdown_content.scrollTop() || 0;
  10858. y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
  10859. scroll_top = y;
  10860. scroll_bottom = y - height_menu + height_item;
  10861. if (y + height_item > height_menu + scroll) {
  10862. self.$dropdown_content.stop().animate({ scrollTop: scroll_bottom }, animate ? self.settings.scrollDuration : 0);
  10863. } else if (y < scroll) {
  10864. self.$dropdown_content.stop().animate({ scrollTop: scroll_top }, animate ? self.settings.scrollDuration : 0);
  10865. }
  10866. }
  10867. },
  10868. /**
  10869. * Selects all items (CTRL + A).
  10870. */
  10871. selectAll: function selectAll() {
  10872. var self = this;
  10873. if (self.settings.mode === 'single') return;
  10874. self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
  10875. if (self.$activeItems.length) {
  10876. self.hideInput();
  10877. self.close();
  10878. }
  10879. self.focus();
  10880. },
  10881. /**
  10882. * Hides the input element out of view, while
  10883. * retaining its focus.
  10884. */
  10885. hideInput: function hideInput() {
  10886. var self = this;
  10887. self.setTextboxValue('');
  10888. self.$control_input.css({ opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000 });
  10889. self.isInputHidden = true;
  10890. },
  10891. /**
  10892. * Restores input visibility.
  10893. */
  10894. showInput: function showInput() {
  10895. this.$control_input.css({ opacity: 1, position: 'relative', left: 0 });
  10896. this.isInputHidden = false;
  10897. },
  10898. /**
  10899. * Gives the control focus.
  10900. */
  10901. focus: function focus() {
  10902. var self = this;
  10903. if (self.isDisabled) return;
  10904. self.ignoreFocus = true;
  10905. self.$control_input[0].focus();
  10906. window.setTimeout(function () {
  10907. self.ignoreFocus = false;
  10908. self.onFocus();
  10909. }, 0);
  10910. },
  10911. /**
  10912. * Forces the control out of focus.
  10913. *
  10914. * @param {Element} dest
  10915. */
  10916. blur: function blur(dest) {
  10917. this.$control_input[0].blur();
  10918. this.onBlur(null, dest);
  10919. },
  10920. /**
  10921. * Returns a function that scores an object
  10922. * to show how good of a match it is to the
  10923. * provided query.
  10924. *
  10925. * @param {string} query
  10926. * @param {object} options
  10927. * @return {function}
  10928. */
  10929. getScoreFunction: function getScoreFunction(query) {
  10930. return this.sifter.getScoreFunction(query, this.getSearchOptions());
  10931. },
  10932. /**
  10933. * Returns search options for sifter (the system
  10934. * for scoring and sorting results).
  10935. *
  10936. * @see https://github.com/brianreavis/sifter.js
  10937. * @return {object}
  10938. */
  10939. getSearchOptions: function getSearchOptions() {
  10940. var settings = this.settings;
  10941. var sort = settings.sortField;
  10942. if (typeof sort === 'string') {
  10943. sort = [{ field: sort }];
  10944. }
  10945. return {
  10946. fields: settings.searchField,
  10947. conjunction: settings.searchConjunction,
  10948. sort: sort
  10949. };
  10950. },
  10951. /**
  10952. * Searches through available options and returns
  10953. * a sorted array of matches.
  10954. *
  10955. * Returns an object containing:
  10956. *
  10957. * - query {string}
  10958. * - tokens {array}
  10959. * - total {int}
  10960. * - items {array}
  10961. *
  10962. * @param {string} query
  10963. * @returns {object}
  10964. */
  10965. search: function search(query) {
  10966. var i, value, score, result, calculateScore;
  10967. var self = this;
  10968. var settings = self.settings;
  10969. var options = this.getSearchOptions();
  10970. // validate user-provided result scoring function
  10971. if (settings.score) {
  10972. calculateScore = self.settings.score.apply(this, [query]);
  10973. if (typeof calculateScore !== 'function') {
  10974. throw new Error('Selectize "score" setting must be a function that returns a function');
  10975. }
  10976. }
  10977. // perform search
  10978. if (query !== self.lastQuery) {
  10979. self.lastQuery = query;
  10980. result = self.sifter.search(query, $.extend(options, { score: calculateScore }));
  10981. self.currentResults = result;
  10982. } else {
  10983. result = $.extend(true, {}, self.currentResults);
  10984. }
  10985. // filter out selected items
  10986. if (settings.hideSelected) {
  10987. for (i = result.items.length - 1; i >= 0; i--) {
  10988. if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
  10989. result.items.splice(i, 1);
  10990. }
  10991. }
  10992. }
  10993. return result;
  10994. },
  10995. /**
  10996. * Refreshes the list of available options shown
  10997. * in the autocomplete dropdown menu.
  10998. *
  10999. * @param {boolean} triggerDropdown
  11000. */
  11001. refreshOptions: function refreshOptions(triggerDropdown) {
  11002. var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
  11003. var $active, $active_before, $create;
  11004. if (typeof triggerDropdown === 'undefined') {
  11005. triggerDropdown = true;
  11006. }
  11007. var self = this;
  11008. var query = $.trim(self.$control_input.val());
  11009. var results = self.search(query);
  11010. var $dropdown_content = self.$dropdown_content;
  11011. var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
  11012. // build markup
  11013. n = results.items.length;
  11014. if (typeof self.settings.maxOptions === 'number') {
  11015. n = Math.min(n, self.settings.maxOptions);
  11016. }
  11017. // render and group available options individually
  11018. groups = {};
  11019. groups_order = [];
  11020. for (i = 0; i < n; i++) {
  11021. option = self.options[results.items[i].id];
  11022. option_html = self.render('option', option);
  11023. optgroup = option[self.settings.optgroupField] || '';
  11024. optgroups = $.isArray(optgroup) ? optgroup : [optgroup];
  11025. for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
  11026. optgroup = optgroups[j];
  11027. if (!self.optgroups.hasOwnProperty(optgroup)) {
  11028. optgroup = '';
  11029. }
  11030. if (!groups.hasOwnProperty(optgroup)) {
  11031. groups[optgroup] = document.createDocumentFragment();
  11032. groups_order.push(optgroup);
  11033. }
  11034. groups[optgroup].appendChild(option_html);
  11035. }
  11036. }
  11037. // sort optgroups
  11038. if (this.settings.lockOptgroupOrder) {
  11039. groups_order.sort(function (a, b) {
  11040. var a_order = self.optgroups[a].$order || 0;
  11041. var b_order = self.optgroups[b].$order || 0;
  11042. return a_order - b_order;
  11043. });
  11044. }
  11045. // render optgroup headers & join groups
  11046. html = document.createDocumentFragment();
  11047. for (i = 0, n = groups_order.length; i < n; i++) {
  11048. optgroup = groups_order[i];
  11049. if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
  11050. // render the optgroup header and options within it,
  11051. // then pass it to the wrapper template
  11052. html_children = document.createDocumentFragment();
  11053. html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
  11054. html_children.appendChild(groups[optgroup]);
  11055. html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
  11056. html: domToString(html_children),
  11057. dom: html_children
  11058. })));
  11059. } else {
  11060. html.appendChild(groups[optgroup]);
  11061. }
  11062. }
  11063. $dropdown_content.html(html);
  11064. // highlight matching terms inline
  11065. if (self.settings.highlight && results.query.length && results.tokens.length) {
  11066. $dropdown_content.removeHighlight();
  11067. for (i = 0, n = results.tokens.length; i < n; i++) {
  11068. highlight($dropdown_content, results.tokens[i].regex);
  11069. }
  11070. }
  11071. // add "selected" class to selected options
  11072. if (!self.settings.hideSelected) {
  11073. for (i = 0, n = self.items.length; i < n; i++) {
  11074. self.getOption(self.items[i]).addClass('selected');
  11075. }
  11076. }
  11077. // add create option
  11078. has_create_option = self.canCreate(query);
  11079. if (has_create_option) {
  11080. $dropdown_content.prepend(self.render('option_create', { input: query }));
  11081. $create = $($dropdown_content[0].childNodes[0]);
  11082. }
  11083. // activate
  11084. self.hasOptions = results.items.length > 0 || has_create_option;
  11085. if (self.hasOptions) {
  11086. if (results.items.length > 0) {
  11087. $active_before = active_before && self.getOption(active_before);
  11088. if ($active_before && $active_before.length) {
  11089. $active = $active_before;
  11090. } else if (self.settings.mode === 'single' && self.items.length) {
  11091. $active = self.getOption(self.items[0]);
  11092. }
  11093. if (!$active || !$active.length) {
  11094. if ($create && !self.settings.addPrecedence) {
  11095. $active = self.getAdjacentOption($create, 1);
  11096. } else {
  11097. $active = $dropdown_content.find('[data-selectable]:first');
  11098. }
  11099. }
  11100. } else {
  11101. $active = $create;
  11102. }
  11103. self.setActiveOption($active);
  11104. if (triggerDropdown && !self.isOpen) {
  11105. self.open();
  11106. }
  11107. } else {
  11108. self.setActiveOption(null);
  11109. if (triggerDropdown && self.isOpen) {
  11110. self.close();
  11111. }
  11112. }
  11113. },
  11114. /**
  11115. * Adds an available option. If it already exists,
  11116. * nothing will happen. Note: this does not refresh
  11117. * the options list dropdown (use `refreshOptions`
  11118. * for that).
  11119. *
  11120. * Usage:
  11121. *
  11122. * this.addOption(data)
  11123. *
  11124. * @param {object|array} data
  11125. */
  11126. addOption: function addOption(data) {
  11127. var i,
  11128. n,
  11129. value,
  11130. self = this;
  11131. if ($.isArray(data)) {
  11132. for (i = 0, n = data.length; i < n; i++) {
  11133. self.addOption(data[i]);
  11134. }
  11135. return;
  11136. }
  11137. if (value = self.registerOption(data)) {
  11138. self.userOptions[value] = true;
  11139. self.lastQuery = null;
  11140. self.trigger('option_add', value, data);
  11141. }
  11142. },
  11143. /**
  11144. * Registers an option to the pool of options.
  11145. *
  11146. * @param {object} data
  11147. * @return {boolean|string}
  11148. */
  11149. registerOption: function registerOption(data) {
  11150. var key = hash_key(data[this.settings.valueField]);
  11151. if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
  11152. data.$order = data.$order || ++this.order;
  11153. this.options[key] = data;
  11154. return key;
  11155. },
  11156. /**
  11157. * Registers an option group to the pool of option groups.
  11158. *
  11159. * @param {object} data
  11160. * @return {boolean|string}
  11161. */
  11162. registerOptionGroup: function registerOptionGroup(data) {
  11163. var key = hash_key(data[this.settings.optgroupValueField]);
  11164. if (!key) return false;
  11165. data.$order = data.$order || ++this.order;
  11166. this.optgroups[key] = data;
  11167. return key;
  11168. },
  11169. /**
  11170. * Registers a new optgroup for options
  11171. * to be bucketed into.
  11172. *
  11173. * @param {string} id
  11174. * @param {object} data
  11175. */
  11176. addOptionGroup: function addOptionGroup(id, data) {
  11177. data[this.settings.optgroupValueField] = id;
  11178. if (id = this.registerOptionGroup(data)) {
  11179. this.trigger('optgroup_add', id, data);
  11180. }
  11181. },
  11182. /**
  11183. * Removes an existing option group.
  11184. *
  11185. * @param {string} id
  11186. */
  11187. removeOptionGroup: function removeOptionGroup(id) {
  11188. if (this.optgroups.hasOwnProperty(id)) {
  11189. delete this.optgroups[id];
  11190. this.renderCache = {};
  11191. this.trigger('optgroup_remove', id);
  11192. }
  11193. },
  11194. /**
  11195. * Clears all existing option groups.
  11196. */
  11197. clearOptionGroups: function clearOptionGroups() {
  11198. this.optgroups = {};
  11199. this.renderCache = {};
  11200. this.trigger('optgroup_clear');
  11201. },
  11202. /**
  11203. * Updates an option available for selection. If
  11204. * it is visible in the selected items or options
  11205. * dropdown, it will be re-rendered automatically.
  11206. *
  11207. * @param {string} value
  11208. * @param {object} data
  11209. */
  11210. updateOption: function updateOption(value, data) {
  11211. var self = this;
  11212. var $item, $item_new;
  11213. var value_new, index_item, cache_items, cache_options, order_old;
  11214. value = hash_key(value);
  11215. value_new = hash_key(data[self.settings.valueField]);
  11216. // sanity checks
  11217. if (value === null) return;
  11218. if (!self.options.hasOwnProperty(value)) return;
  11219. if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
  11220. order_old = self.options[value].$order;
  11221. // update references
  11222. if (value_new !== value) {
  11223. delete self.options[value];
  11224. index_item = self.items.indexOf(value);
  11225. if (index_item !== -1) {
  11226. self.items.splice(index_item, 1, value_new);
  11227. }
  11228. }
  11229. data.$order = data.$order || order_old;
  11230. self.options[value_new] = data;
  11231. // invalidate render cache
  11232. cache_items = self.renderCache['item'];
  11233. cache_options = self.renderCache['option'];
  11234. if (cache_items) {
  11235. delete cache_items[value];
  11236. delete cache_items[value_new];
  11237. }
  11238. if (cache_options) {
  11239. delete cache_options[value];
  11240. delete cache_options[value_new];
  11241. }
  11242. // update the item if it's selected
  11243. if (self.items.indexOf(value_new) !== -1) {
  11244. $item = self.getItem(value);
  11245. $item_new = $(self.render('item', data));
  11246. if ($item.hasClass('active')) $item_new.addClass('active');
  11247. $item.replaceWith($item_new);
  11248. }
  11249. // invalidate last query because we might have updated the sortField
  11250. self.lastQuery = null;
  11251. // update dropdown contents
  11252. if (self.isOpen) {
  11253. self.refreshOptions(false);
  11254. }
  11255. },
  11256. /**
  11257. * Removes a single option.
  11258. *
  11259. * @param {string} value
  11260. * @param {boolean} silent
  11261. */
  11262. removeOption: function removeOption(value, silent) {
  11263. var self = this;
  11264. value = hash_key(value);
  11265. var cache_items = self.renderCache['item'];
  11266. var cache_options = self.renderCache['option'];
  11267. if (cache_items) delete cache_items[value];
  11268. if (cache_options) delete cache_options[value];
  11269. delete self.userOptions[value];
  11270. delete self.options[value];
  11271. self.lastQuery = null;
  11272. self.trigger('option_remove', value);
  11273. self.removeItem(value, silent);
  11274. },
  11275. /**
  11276. * Clears all options.
  11277. */
  11278. clearOptions: function clearOptions() {
  11279. var self = this;
  11280. self.loadedSearches = {};
  11281. self.userOptions = {};
  11282. self.renderCache = {};
  11283. self.options = self.sifter.items = {};
  11284. self.lastQuery = null;
  11285. self.trigger('option_clear');
  11286. self.clear();
  11287. },
  11288. /**
  11289. * Returns the jQuery element of the option
  11290. * matching the given value.
  11291. *
  11292. * @param {string} value
  11293. * @returns {object}
  11294. */
  11295. getOption: function getOption(value) {
  11296. return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
  11297. },
  11298. /**
  11299. * Returns the jQuery element of the next or
  11300. * previous selectable option.
  11301. *
  11302. * @param {object} $option
  11303. * @param {int} direction can be 1 for next or -1 for previous
  11304. * @return {object}
  11305. */
  11306. getAdjacentOption: function getAdjacentOption($option, direction) {
  11307. var $options = this.$dropdown.find('[data-selectable]');
  11308. var index = $options.index($option) + direction;
  11309. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  11310. },
  11311. /**
  11312. * Finds the first element with a "data-value" attribute
  11313. * that matches the given value.
  11314. *
  11315. * @param {mixed} value
  11316. * @param {object} $els
  11317. * @return {object}
  11318. */
  11319. getElementWithValue: function getElementWithValue(value, $els) {
  11320. value = hash_key(value);
  11321. if (typeof value !== 'undefined' && value !== null) {
  11322. for (var i = 0, n = $els.length; i < n; i++) {
  11323. if ($els[i].getAttribute('data-value') === value) {
  11324. return $($els[i]);
  11325. }
  11326. }
  11327. }
  11328. return $();
  11329. },
  11330. /**
  11331. * Returns the jQuery element of the item
  11332. * matching the given value.
  11333. *
  11334. * @param {string} value
  11335. * @returns {object}
  11336. */
  11337. getItem: function getItem(value) {
  11338. return this.getElementWithValue(value, this.$control.children());
  11339. },
  11340. /**
  11341. * "Selects" multiple items at once. Adds them to the list
  11342. * at the current caret position.
  11343. *
  11344. * @param {string} value
  11345. * @param {boolean} silent
  11346. */
  11347. addItems: function addItems(values, silent) {
  11348. var items = $.isArray(values) ? values : [values];
  11349. for (var i = 0, n = items.length; i < n; i++) {
  11350. this.isPending = i < n - 1;
  11351. this.addItem(items[i], silent);
  11352. }
  11353. },
  11354. /**
  11355. * "Selects" an item. Adds it to the list
  11356. * at the current caret position.
  11357. *
  11358. * @param {string} value
  11359. * @param {boolean} silent
  11360. */
  11361. addItem: function addItem(value, silent) {
  11362. var events = silent ? [] : ['change'];
  11363. debounce_events(this, events, function () {
  11364. var $item, $option, $options;
  11365. var self = this;
  11366. var inputMode = self.settings.mode;
  11367. var i, active, value_next, wasFull;
  11368. value = hash_key(value);
  11369. if (self.items.indexOf(value) !== -1) {
  11370. if (inputMode === 'single') self.close();
  11371. return;
  11372. }
  11373. if (!self.options.hasOwnProperty(value)) return;
  11374. if (inputMode === 'single') self.clear(silent);
  11375. if (inputMode === 'multi' && self.isFull()) return;
  11376. $item = $(self.render('item', self.options[value]));
  11377. wasFull = self.isFull();
  11378. self.items.splice(self.caretPos, 0, value);
  11379. self.insertAtCaret($item);
  11380. if (!self.isPending || !wasFull && self.isFull()) {
  11381. self.refreshState();
  11382. }
  11383. if (self.isSetup) {
  11384. $options = self.$dropdown_content.find('[data-selectable]');
  11385. // update menu / remove the option (if this is not one item being added as part of series)
  11386. if (!self.isPending) {
  11387. $option = self.getOption(value);
  11388. value_next = self.getAdjacentOption($option, 1).attr('data-value');
  11389. self.refreshOptions(self.isFocused && inputMode !== 'single');
  11390. if (value_next) {
  11391. self.setActiveOption(self.getOption(value_next));
  11392. }
  11393. }
  11394. // hide the menu if the maximum number of items have been selected or no options are left
  11395. if (!$options.length || self.isFull()) {
  11396. self.close();
  11397. } else {
  11398. self.positionDropdown();
  11399. }
  11400. self.updatePlaceholder();
  11401. self.trigger('item_add', value, $item);
  11402. self.updateOriginalInput({ silent: silent });
  11403. }
  11404. });
  11405. },
  11406. /**
  11407. * Removes the selected item matching
  11408. * the provided value.
  11409. *
  11410. * @param {string} value
  11411. */
  11412. removeItem: function removeItem(value, silent) {
  11413. var self = this;
  11414. var $item, i, idx;
  11415. $item = value instanceof $ ? value : self.getItem(value);
  11416. value = hash_key($item.attr('data-value'));
  11417. i = self.items.indexOf(value);
  11418. if (i !== -1) {
  11419. $item.remove();
  11420. if ($item.hasClass('active')) {
  11421. idx = self.$activeItems.indexOf($item[0]);
  11422. self.$activeItems.splice(idx, 1);
  11423. }
  11424. self.items.splice(i, 1);
  11425. self.lastQuery = null;
  11426. if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
  11427. self.removeOption(value, silent);
  11428. }
  11429. if (i < self.caretPos) {
  11430. self.setCaret(self.caretPos - 1);
  11431. }
  11432. self.refreshState();
  11433. self.updatePlaceholder();
  11434. self.updateOriginalInput({ silent: silent });
  11435. self.positionDropdown();
  11436. self.trigger('item_remove', value, $item);
  11437. }
  11438. },
  11439. /**
  11440. * Invokes the `create` method provided in the
  11441. * selectize options that should provide the data
  11442. * for the new item, given the user input.
  11443. *
  11444. * Once this completes, it will be added
  11445. * to the item list.
  11446. *
  11447. * @param {string} value
  11448. * @param {boolean} [triggerDropdown]
  11449. * @param {function} [callback]
  11450. * @return {boolean}
  11451. */
  11452. createItem: function createItem(input, triggerDropdown) {
  11453. var self = this;
  11454. var caret = self.caretPos;
  11455. input = input || $.trim(self.$control_input.val() || '');
  11456. var callback = arguments[arguments.length - 1];
  11457. if (typeof callback !== 'function') callback = function callback() {};
  11458. if (typeof triggerDropdown !== 'boolean') {
  11459. triggerDropdown = true;
  11460. }
  11461. if (!self.canCreate(input)) {
  11462. callback();
  11463. return false;
  11464. }
  11465. self.lock();
  11466. var setup = typeof self.settings.create === 'function' ? this.settings.create : function (input) {
  11467. var data = {};
  11468. data[self.settings.labelField] = input;
  11469. data[self.settings.valueField] = input;
  11470. return data;
  11471. };
  11472. var create = once(function (data) {
  11473. self.unlock();
  11474. if (!data || (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') return callback();
  11475. var value = hash_key(data[self.settings.valueField]);
  11476. if (typeof value !== 'string') return callback();
  11477. self.setTextboxValue('');
  11478. self.addOption(data);
  11479. self.setCaret(caret);
  11480. self.addItem(value);
  11481. self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
  11482. callback(data);
  11483. });
  11484. var output = setup.apply(this, [input, create]);
  11485. if (typeof output !== 'undefined') {
  11486. create(output);
  11487. }
  11488. return true;
  11489. },
  11490. /**
  11491. * Re-renders the selected item lists.
  11492. */
  11493. refreshItems: function refreshItems() {
  11494. this.lastQuery = null;
  11495. if (this.isSetup) {
  11496. this.addItem(this.items);
  11497. }
  11498. this.refreshState();
  11499. this.updateOriginalInput();
  11500. },
  11501. /**
  11502. * Updates all state-dependent attributes
  11503. * and CSS classes.
  11504. */
  11505. refreshState: function refreshState() {
  11506. this.refreshValidityState();
  11507. this.refreshClasses();
  11508. },
  11509. /**
  11510. * Update the `required` attribute of both input and control input.
  11511. *
  11512. * The `required` property needs to be activated on the control input
  11513. * for the error to be displayed at the right place. `required` also
  11514. * needs to be temporarily deactivated on the input since the input is
  11515. * hidden and can't show errors.
  11516. */
  11517. refreshValidityState: function refreshValidityState() {
  11518. if (!this.isRequired) return false;
  11519. var invalid = !this.items.length;
  11520. this.isInvalid = invalid;
  11521. this.$control_input.prop('required', invalid);
  11522. this.$input.prop('required', !invalid);
  11523. },
  11524. /**
  11525. * Updates all state-dependent CSS classes.
  11526. */
  11527. refreshClasses: function refreshClasses() {
  11528. var self = this;
  11529. var isFull = self.isFull();
  11530. var isLocked = self.isLocked;
  11531. self.$wrapper.toggleClass('rtl', self.rtl);
  11532. 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);
  11533. self.$control_input.data('grow', !isFull && !isLocked);
  11534. },
  11535. /**
  11536. * Determines whether or not more items can be added
  11537. * to the control without exceeding the user-defined maximum.
  11538. *
  11539. * @returns {boolean}
  11540. */
  11541. isFull: function isFull() {
  11542. return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
  11543. },
  11544. /**
  11545. * Refreshes the original <select> or <input>
  11546. * element to reflect the current state.
  11547. */
  11548. updateOriginalInput: function updateOriginalInput(opts) {
  11549. var i,
  11550. n,
  11551. options,
  11552. label,
  11553. self = this;
  11554. opts = opts || {};
  11555. if (self.tagType === TAG_SELECT) {
  11556. options = [];
  11557. for (i = 0, n = self.items.length; i < n; i++) {
  11558. label = self.options[self.items[i]][self.settings.labelField] || '';
  11559. options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
  11560. }
  11561. if (!options.length && !this.$input.attr('multiple')) {
  11562. options.push('<option value="" selected="selected"></option>');
  11563. }
  11564. self.$input.html(options.join(''));
  11565. } else {
  11566. self.$input.val(self.getValue());
  11567. self.$input.attr('value', self.$input.val());
  11568. }
  11569. if (self.isSetup) {
  11570. if (!opts.silent) {
  11571. self.trigger('change', self.$input.val());
  11572. }
  11573. }
  11574. },
  11575. /**
  11576. * Shows/hide the input placeholder depending
  11577. * on if there items in the list already.
  11578. */
  11579. updatePlaceholder: function updatePlaceholder() {
  11580. if (!this.settings.placeholder) return;
  11581. var $input = this.$control_input;
  11582. if (this.items.length) {
  11583. $input.removeAttr('placeholder');
  11584. } else {
  11585. $input.attr('placeholder', this.settings.placeholder);
  11586. }
  11587. $input.triggerHandler('update', { force: true });
  11588. },
  11589. /**
  11590. * Shows the autocomplete dropdown containing
  11591. * the available options.
  11592. */
  11593. open: function open() {
  11594. var self = this;
  11595. if (self.isLocked || self.isOpen || self.settings.mode === 'multi' && self.isFull()) return;
  11596. self.focus();
  11597. self.isOpen = true;
  11598. self.refreshState();
  11599. self.$dropdown.css({ visibility: 'hidden', display: 'block' });
  11600. self.positionDropdown();
  11601. self.$dropdown.css({ visibility: 'visible' });
  11602. self.trigger('dropdown_open', self.$dropdown);
  11603. },
  11604. /**
  11605. * Closes the autocomplete dropdown menu.
  11606. */
  11607. close: function close() {
  11608. var self = this;
  11609. var trigger = self.isOpen;
  11610. if (self.settings.mode === 'single' && self.items.length) {
  11611. self.hideInput();
  11612. self.$control_input.blur(); // close keyboard on iOS
  11613. }
  11614. self.isOpen = false;
  11615. self.$dropdown.hide();
  11616. self.setActiveOption(null);
  11617. self.refreshState();
  11618. if (trigger) self.trigger('dropdown_close', self.$dropdown);
  11619. },
  11620. /**
  11621. * Calculates and applies the appropriate
  11622. * position of the dropdown.
  11623. */
  11624. positionDropdown: function positionDropdown() {
  11625. var $control = this.$control;
  11626. var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
  11627. offset.top += $control.outerHeight(true);
  11628. this.$dropdown.css({
  11629. width: $control.outerWidth(),
  11630. top: offset.top,
  11631. left: offset.left
  11632. });
  11633. },
  11634. /**
  11635. * Resets / clears all selected items
  11636. * from the control.
  11637. *
  11638. * @param {boolean} silent
  11639. */
  11640. clear: function clear(silent) {
  11641. var self = this;
  11642. if (!self.items.length) return;
  11643. self.$control.children(':not(input)').remove();
  11644. self.items = [];
  11645. self.lastQuery = null;
  11646. self.setCaret(0);
  11647. self.setActiveItem(null);
  11648. self.updatePlaceholder();
  11649. self.updateOriginalInput({ silent: silent });
  11650. self.refreshState();
  11651. self.showInput();
  11652. self.trigger('clear');
  11653. },
  11654. /**
  11655. * A helper method for inserting an element
  11656. * at the current caret position.
  11657. *
  11658. * @param {object} $el
  11659. */
  11660. insertAtCaret: function insertAtCaret($el) {
  11661. var caret = Math.min(this.caretPos, this.items.length);
  11662. if (caret === 0) {
  11663. this.$control.prepend($el);
  11664. } else {
  11665. $(this.$control[0].childNodes[caret]).before($el);
  11666. }
  11667. this.setCaret(caret + 1);
  11668. },
  11669. /**
  11670. * Removes the current selected item(s).
  11671. *
  11672. * @param {object} e (optional)
  11673. * @returns {boolean}
  11674. */
  11675. deleteSelection: function deleteSelection(e) {
  11676. var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
  11677. var self = this;
  11678. direction = e && e.keyCode === KEY_BACKSPACE ? -1 : 1;
  11679. selection = getSelection(self.$control_input[0]);
  11680. if (self.$activeOption && !self.settings.hideSelected) {
  11681. option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
  11682. }
  11683. // determine items that will be removed
  11684. values = [];
  11685. if (self.$activeItems.length) {
  11686. $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
  11687. caret = self.$control.children(':not(input)').index($tail);
  11688. if (direction > 0) {
  11689. caret++;
  11690. }
  11691. for (i = 0, n = self.$activeItems.length; i < n; i++) {
  11692. values.push($(self.$activeItems[i]).attr('data-value'));
  11693. }
  11694. if (e) {
  11695. e.preventDefault();
  11696. e.stopPropagation();
  11697. }
  11698. } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
  11699. if (direction < 0 && selection.start === 0 && selection.length === 0) {
  11700. values.push(self.items[self.caretPos - 1]);
  11701. } else if (direction > 0 && selection.start === self.$control_input.val().length) {
  11702. values.push(self.items[self.caretPos]);
  11703. }
  11704. }
  11705. // allow the callback to abort
  11706. if (!values.length || typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false) {
  11707. return false;
  11708. }
  11709. // perform removal
  11710. if (typeof caret !== 'undefined') {
  11711. self.setCaret(caret);
  11712. }
  11713. while (values.length) {
  11714. self.removeItem(values.pop());
  11715. }
  11716. self.showInput();
  11717. self.positionDropdown();
  11718. self.refreshOptions(true);
  11719. // select previous option
  11720. if (option_select) {
  11721. $option_select = self.getOption(option_select);
  11722. if ($option_select.length) {
  11723. self.setActiveOption($option_select);
  11724. }
  11725. }
  11726. return true;
  11727. },
  11728. /**
  11729. * Selects the previous / next item (depending
  11730. * on the `direction` argument).
  11731. *
  11732. * > 0 - right
  11733. * < 0 - left
  11734. *
  11735. * @param {int} direction
  11736. * @param {object} e (optional)
  11737. */
  11738. advanceSelection: function advanceSelection(direction, e) {
  11739. var tail, selection, idx, valueLength, cursorAtEdge, $tail;
  11740. var self = this;
  11741. if (direction === 0) return;
  11742. if (self.rtl) direction *= -1;
  11743. tail = direction > 0 ? 'last' : 'first';
  11744. selection = getSelection(self.$control_input[0]);
  11745. if (self.isFocused && !self.isInputHidden) {
  11746. valueLength = self.$control_input.val().length;
  11747. cursorAtEdge = direction < 0 ? selection.start === 0 && selection.length === 0 : selection.start === valueLength;
  11748. if (cursorAtEdge && !valueLength) {
  11749. self.advanceCaret(direction, e);
  11750. }
  11751. } else {
  11752. $tail = self.$control.children('.active:' + tail);
  11753. if ($tail.length) {
  11754. idx = self.$control.children(':not(input)').index($tail);
  11755. self.setActiveItem(null);
  11756. self.setCaret(direction > 0 ? idx + 1 : idx);
  11757. }
  11758. }
  11759. },
  11760. /**
  11761. * Moves the caret left / right.
  11762. *
  11763. * @param {int} direction
  11764. * @param {object} e (optional)
  11765. */
  11766. advanceCaret: function advanceCaret(direction, e) {
  11767. var self = this,
  11768. fn,
  11769. $adj;
  11770. if (direction === 0) return;
  11771. fn = direction > 0 ? 'next' : 'prev';
  11772. if (self.isShiftDown) {
  11773. $adj = self.$control_input[fn]();
  11774. if ($adj.length) {
  11775. self.hideInput();
  11776. self.setActiveItem($adj);
  11777. e && e.preventDefault();
  11778. }
  11779. } else {
  11780. self.setCaret(self.caretPos + direction);
  11781. }
  11782. },
  11783. /**
  11784. * Moves the caret to the specified index.
  11785. *
  11786. * @param {int} i
  11787. */
  11788. setCaret: function setCaret(i) {
  11789. var self = this;
  11790. if (self.settings.mode === 'single') {
  11791. i = self.items.length;
  11792. } else {
  11793. i = Math.max(0, Math.min(self.items.length, i));
  11794. }
  11795. if (!self.isPending) {
  11796. // the input must be moved by leaving it in place and moving the
  11797. // siblings, due to the fact that focus cannot be restored once lost
  11798. // on mobile webkit devices
  11799. var j, n, fn, $children, $child;
  11800. $children = self.$control.children(':not(input)');
  11801. for (j = 0, n = $children.length; j < n; j++) {
  11802. $child = $($children[j]).detach();
  11803. if (j < i) {
  11804. self.$control_input.before($child);
  11805. } else {
  11806. self.$control.append($child);
  11807. }
  11808. }
  11809. }
  11810. self.caretPos = i;
  11811. },
  11812. /**
  11813. * Disables user input on the control. Used while
  11814. * items are being asynchronously created.
  11815. */
  11816. lock: function lock() {
  11817. this.close();
  11818. this.isLocked = true;
  11819. this.refreshState();
  11820. },
  11821. /**
  11822. * Re-enables user input on the control.
  11823. */
  11824. unlock: function unlock() {
  11825. this.isLocked = false;
  11826. this.refreshState();
  11827. },
  11828. /**
  11829. * Disables user input on the control completely.
  11830. * While disabled, it cannot receive focus.
  11831. */
  11832. disable: function disable() {
  11833. var self = this;
  11834. self.$input.prop('disabled', true);
  11835. self.$control_input.prop('disabled', true).prop('tabindex', -1);
  11836. self.isDisabled = true;
  11837. self.lock();
  11838. },
  11839. /**
  11840. * Enables the control so that it can respond
  11841. * to focus and user input.
  11842. */
  11843. enable: function enable() {
  11844. var self = this;
  11845. self.$input.prop('disabled', false);
  11846. self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
  11847. self.isDisabled = false;
  11848. self.unlock();
  11849. },
  11850. /**
  11851. * Completely destroys the control and
  11852. * unbinds all event listeners so that it can
  11853. * be garbage collected.
  11854. */
  11855. destroy: function destroy() {
  11856. var self = this;
  11857. var eventNS = self.eventNS;
  11858. var revertSettings = self.revertSettings;
  11859. self.trigger('destroy');
  11860. self.off();
  11861. self.$wrapper.remove();
  11862. self.$dropdown.remove();
  11863. self.$input.html('').append(revertSettings.$children).removeAttr('tabindex').removeClass('selectized').attr({ tabindex: revertSettings.tabindex }).show();
  11864. self.$control_input.removeData('grow');
  11865. self.$input.removeData('selectize');
  11866. $(window).off(eventNS);
  11867. $(document).off(eventNS);
  11868. $(document.body).off(eventNS);
  11869. delete self.$input[0].selectize;
  11870. },
  11871. /**
  11872. * A helper method for rendering "item" and
  11873. * "option" templates, given the data.
  11874. *
  11875. * @param {string} templateName
  11876. * @param {object} data
  11877. * @returns {string}
  11878. */
  11879. render: function render(templateName, data) {
  11880. var value, id, label;
  11881. var html = '';
  11882. var cache = false;
  11883. var self = this;
  11884. var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
  11885. if (templateName === 'option' || templateName === 'item') {
  11886. value = hash_key(data[self.settings.valueField]);
  11887. cache = !!value;
  11888. }
  11889. // pull markup from cache if it exists
  11890. if (cache) {
  11891. if (!isset(self.renderCache[templateName])) {
  11892. self.renderCache[templateName] = {};
  11893. }
  11894. if (self.renderCache[templateName].hasOwnProperty(value)) {
  11895. return self.renderCache[templateName][value];
  11896. }
  11897. }
  11898. // render markup
  11899. html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
  11900. // add mandatory attributes
  11901. if (templateName === 'option' || templateName === 'option_create') {
  11902. html.attr('data-selectable', '');
  11903. } else if (templateName === 'optgroup') {
  11904. id = data[self.settings.optgroupValueField] || '';
  11905. html.attr('data-group', id);
  11906. }
  11907. if (templateName === 'option' || templateName === 'item') {
  11908. html.attr('data-value', value || '');
  11909. }
  11910. // update cache
  11911. if (cache) {
  11912. self.renderCache[templateName][value] = html[0];
  11913. }
  11914. return html[0];
  11915. },
  11916. /**
  11917. * Clears the render cache for a template. If
  11918. * no template is given, clears all render
  11919. * caches.
  11920. *
  11921. * @param {string} templateName
  11922. */
  11923. clearCache: function clearCache(templateName) {
  11924. var self = this;
  11925. if (typeof templateName === 'undefined') {
  11926. self.renderCache = {};
  11927. } else {
  11928. delete self.renderCache[templateName];
  11929. }
  11930. },
  11931. /**
  11932. * Determines whether or not to display the
  11933. * create item prompt, given a user input.
  11934. *
  11935. * @param {string} input
  11936. * @return {boolean}
  11937. */
  11938. canCreate: function canCreate(input) {
  11939. var self = this;
  11940. if (!self.settings.create) return false;
  11941. var filter = self.settings.createFilter;
  11942. return input.length && (typeof filter !== 'function' || filter.apply(self, [input])) && (typeof filter !== 'string' || new RegExp(filter).test(input)) && (!(filter instanceof RegExp) || filter.test(input));
  11943. }
  11944. });
  11945. Selectize.count = 0;
  11946. Selectize.defaults = {
  11947. options: [],
  11948. optgroups: [],
  11949. plugins: [],
  11950. delimiter: ',',
  11951. splitOn: null, // regexp or string for splitting up values from a paste command
  11952. persist: true,
  11953. diacritics: true,
  11954. create: false,
  11955. createOnBlur: false,
  11956. createFilter: null,
  11957. highlight: true,
  11958. openOnFocus: true,
  11959. maxOptions: 1000,
  11960. maxItems: null,
  11961. hideSelected: null,
  11962. addPrecedence: false,
  11963. selectOnTab: false,
  11964. preload: false,
  11965. allowEmptyOption: false,
  11966. closeAfterSelect: false,
  11967. scrollDuration: 60,
  11968. loadThrottle: 300,
  11969. loadingClass: 'loading',
  11970. dataAttr: 'data-data',
  11971. optgroupField: 'optgroup',
  11972. valueField: 'value',
  11973. labelField: 'text',
  11974. optgroupLabelField: 'label',
  11975. optgroupValueField: 'value',
  11976. lockOptgroupOrder: false,
  11977. sortField: '$order',
  11978. searchField: ['text'],
  11979. searchConjunction: 'and',
  11980. mode: null,
  11981. wrapperClass: 'selectize-control',
  11982. inputClass: 'selectize-input',
  11983. dropdownClass: 'selectize-dropdown',
  11984. dropdownContentClass: 'selectize-dropdown-content',
  11985. dropdownParent: null,
  11986. copyClassesToDropdown: true,
  11987. /*
  11988. load : null, // function(query, callback) { ... }
  11989. score : null, // function(search) { ... }
  11990. onInitialize : null, // function() { ... }
  11991. onChange : null, // function(value) { ... }
  11992. onItemAdd : null, // function(value, $item) { ... }
  11993. onItemRemove : null, // function(value) { ... }
  11994. onClear : null, // function() { ... }
  11995. onOptionAdd : null, // function(value, data) { ... }
  11996. onOptionRemove : null, // function(value) { ... }
  11997. onOptionClear : null, // function() { ... }
  11998. onOptionGroupAdd : null, // function(id, data) { ... }
  11999. onOptionGroupRemove : null, // function(id) { ... }
  12000. onOptionGroupClear : null, // function() { ... }
  12001. onDropdownOpen : null, // function($dropdown) { ... }
  12002. onDropdownClose : null, // function($dropdown) { ... }
  12003. onType : null, // function(str) { ... }
  12004. onDelete : null, // function(values) { ... }
  12005. */
  12006. render: {
  12007. /*
  12008. item: null,
  12009. optgroup: null,
  12010. optgroup_header: null,
  12011. option: null,
  12012. option_create: null
  12013. */
  12014. }
  12015. };
  12016. $.fn.selectize = function (settings_user) {
  12017. var defaults = $.fn.selectize.defaults;
  12018. var settings = $.extend({}, defaults, settings_user);
  12019. var attr_data = settings.dataAttr;
  12020. var field_label = settings.labelField;
  12021. var field_value = settings.valueField;
  12022. var field_optgroup = settings.optgroupField;
  12023. var field_optgroup_label = settings.optgroupLabelField;
  12024. var field_optgroup_value = settings.optgroupValueField;
  12025. /**
  12026. * Initializes selectize from a <input type="text"> element.
  12027. *
  12028. * @param {object} $input
  12029. * @param {object} settings_element
  12030. */
  12031. var init_textbox = function init_textbox($input, settings_element) {
  12032. var i, n, values, option;
  12033. var data_raw = $input.attr(attr_data);
  12034. if (!data_raw) {
  12035. var value = $.trim($input.val() || '');
  12036. if (!settings.allowEmptyOption && !value.length) return;
  12037. values = value.split(settings.delimiter);
  12038. for (i = 0, n = values.length; i < n; i++) {
  12039. option = {};
  12040. option[field_label] = values[i];
  12041. option[field_value] = values[i];
  12042. settings_element.options.push(option);
  12043. }
  12044. settings_element.items = values;
  12045. } else {
  12046. settings_element.options = JSON.parse(data_raw);
  12047. for (i = 0, n = settings_element.options.length; i < n; i++) {
  12048. settings_element.items.push(settings_element.options[i][field_value]);
  12049. }
  12050. }
  12051. };
  12052. /**
  12053. * Initializes selectize from a <select> element.
  12054. *
  12055. * @param {object} $input
  12056. * @param {object} settings_element
  12057. */
  12058. var init_select = function init_select($input, settings_element) {
  12059. var i,
  12060. n,
  12061. tagName,
  12062. $children,
  12063. order = 0;
  12064. var options = settings_element.options;
  12065. var optionsMap = {};
  12066. var readData = function readData($el) {
  12067. var data = attr_data && $el.attr(attr_data);
  12068. if (typeof data === 'string' && data.length) {
  12069. return JSON.parse(data);
  12070. }
  12071. return null;
  12072. };
  12073. var addOption = function addOption($option, group) {
  12074. $option = $($option);
  12075. var value = hash_key($option.val());
  12076. if (!value && !settings.allowEmptyOption) return;
  12077. // if the option already exists, it's probably been
  12078. // duplicated in another optgroup. in this case, push
  12079. // the current group to the "optgroup" property on the
  12080. // existing option so that it's rendered in both places.
  12081. if (optionsMap.hasOwnProperty(value)) {
  12082. if (group) {
  12083. var arr = optionsMap[value][field_optgroup];
  12084. if (!arr) {
  12085. optionsMap[value][field_optgroup] = group;
  12086. } else if (!$.isArray(arr)) {
  12087. optionsMap[value][field_optgroup] = [arr, group];
  12088. } else {
  12089. arr.push(group);
  12090. }
  12091. }
  12092. return;
  12093. }
  12094. var option = readData($option) || {};
  12095. option[field_label] = option[field_label] || $option.text();
  12096. option[field_value] = option[field_value] || value;
  12097. option[field_optgroup] = option[field_optgroup] || group;
  12098. optionsMap[value] = option;
  12099. options.push(option);
  12100. if ($option.is(':selected')) {
  12101. settings_element.items.push(value);
  12102. }
  12103. };
  12104. var addGroup = function addGroup($optgroup) {
  12105. var i, n, id, optgroup, $options;
  12106. $optgroup = $($optgroup);
  12107. id = $optgroup.attr('label');
  12108. if (id) {
  12109. optgroup = readData($optgroup) || {};
  12110. optgroup[field_optgroup_label] = id;
  12111. optgroup[field_optgroup_value] = id;
  12112. settings_element.optgroups.push(optgroup);
  12113. }
  12114. $options = $('option', $optgroup);
  12115. for (i = 0, n = $options.length; i < n; i++) {
  12116. addOption($options[i], id);
  12117. }
  12118. };
  12119. settings_element.maxItems = $input.attr('multiple') ? null : 1;
  12120. $children = $input.children();
  12121. for (i = 0, n = $children.length; i < n; i++) {
  12122. tagName = $children[i].tagName.toLowerCase();
  12123. if (tagName === 'optgroup') {
  12124. addGroup($children[i]);
  12125. } else if (tagName === 'option') {
  12126. addOption($children[i]);
  12127. }
  12128. }
  12129. };
  12130. return this.each(function () {
  12131. if (this.selectize) return;
  12132. var instance;
  12133. var $input = $(this);
  12134. var tag_name = this.tagName.toLowerCase();
  12135. var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
  12136. if (!placeholder && !settings.allowEmptyOption) {
  12137. placeholder = $input.children('option[value=""]').text();
  12138. }
  12139. var settings_element = {
  12140. 'placeholder': placeholder,
  12141. 'options': [],
  12142. 'optgroups': [],
  12143. 'items': []
  12144. };
  12145. if (tag_name === 'select') {
  12146. init_select($input, settings_element);
  12147. } else {
  12148. init_textbox($input, settings_element);
  12149. }
  12150. instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
  12151. });
  12152. };
  12153. $.fn.selectize.defaults = Selectize.defaults;
  12154. $.fn.selectize.support = {
  12155. validity: SUPPORTS_VALIDITY_API
  12156. };
  12157. Selectize.define('drag_drop', function (options) {
  12158. if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
  12159. if (this.settings.mode !== 'multi') return;
  12160. var self = this;
  12161. self.lock = function () {
  12162. var original = self.lock;
  12163. return function () {
  12164. var sortable = self.$control.data('sortable');
  12165. if (sortable) sortable.disable();
  12166. return original.apply(self, arguments);
  12167. };
  12168. }();
  12169. self.unlock = function () {
  12170. var original = self.unlock;
  12171. return function () {
  12172. var sortable = self.$control.data('sortable');
  12173. if (sortable) sortable.enable();
  12174. return original.apply(self, arguments);
  12175. };
  12176. }();
  12177. self.setup = function () {
  12178. var original = self.setup;
  12179. return function () {
  12180. original.apply(this, arguments);
  12181. var $control = self.$control.sortable({
  12182. items: '[data-value]',
  12183. forcePlaceholderSize: true,
  12184. disabled: self.isLocked,
  12185. start: function start(e, ui) {
  12186. ui.placeholder.css('width', ui.helper.css('width'));
  12187. $control.css({ overflow: 'visible' });
  12188. },
  12189. stop: function stop() {
  12190. $control.css({ overflow: 'hidden' });
  12191. var active = self.$activeItems ? self.$activeItems.slice() : null;
  12192. var values = [];
  12193. $control.children('[data-value]').each(function () {
  12194. values.push($(this).attr('data-value'));
  12195. });
  12196. self.setValue(values);
  12197. self.setActiveItem(active);
  12198. }
  12199. });
  12200. };
  12201. }();
  12202. });
  12203. Selectize.define('dropdown_header', function (options) {
  12204. var self = this;
  12205. options = $.extend({
  12206. title: 'Untitled',
  12207. headerClass: 'selectize-dropdown-header',
  12208. titleRowClass: 'selectize-dropdown-header-title',
  12209. labelClass: 'selectize-dropdown-header-label',
  12210. closeClass: 'selectize-dropdown-header-close',
  12211. html: function html(data) {
  12212. 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>';
  12213. }
  12214. }, options);
  12215. self.setup = function () {
  12216. var original = self.setup;
  12217. return function () {
  12218. original.apply(self, arguments);
  12219. self.$dropdown_header = $(options.html(options));
  12220. self.$dropdown.prepend(self.$dropdown_header);
  12221. };
  12222. }();
  12223. });
  12224. Selectize.define('optgroup_columns', function (options) {
  12225. var self = this;
  12226. options = $.extend({
  12227. equalizeWidth: true,
  12228. equalizeHeight: true
  12229. }, options);
  12230. this.getAdjacentOption = function ($option, direction) {
  12231. var $options = $option.closest('[data-group]').find('[data-selectable]');
  12232. var index = $options.index($option) + direction;
  12233. return index >= 0 && index < $options.length ? $options.eq(index) : $();
  12234. };
  12235. this.onKeyDown = function () {
  12236. var original = self.onKeyDown;
  12237. return function (e) {
  12238. var index, $option, $options, $optgroup;
  12239. if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
  12240. self.ignoreHover = true;
  12241. $optgroup = this.$activeOption.closest('[data-group]');
  12242. index = $optgroup.find('[data-selectable]').index(this.$activeOption);
  12243. if (e.keyCode === KEY_LEFT) {
  12244. $optgroup = $optgroup.prev('[data-group]');
  12245. } else {
  12246. $optgroup = $optgroup.next('[data-group]');
  12247. }
  12248. $options = $optgroup.find('[data-selectable]');
  12249. $option = $options.eq(Math.min($options.length - 1, index));
  12250. if ($option.length) {
  12251. this.setActiveOption($option);
  12252. }
  12253. return;
  12254. }
  12255. return original.apply(this, arguments);
  12256. };
  12257. }();
  12258. var getScrollbarWidth = function getScrollbarWidth() {
  12259. var div;
  12260. var width = getScrollbarWidth.width;
  12261. var doc = document;
  12262. if (typeof width === 'undefined') {
  12263. div = doc.createElement('div');
  12264. div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
  12265. div = div.firstChild;
  12266. doc.body.appendChild(div);
  12267. width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
  12268. doc.body.removeChild(div);
  12269. }
  12270. return width;
  12271. };
  12272. var equalizeSizes = function equalizeSizes() {
  12273. var i, n, height_max, width, width_last, width_parent, $optgroups;
  12274. $optgroups = $('[data-group]', self.$dropdown_content);
  12275. n = $optgroups.length;
  12276. if (!n || !self.$dropdown_content.width()) return;
  12277. if (options.equalizeHeight) {
  12278. height_max = 0;
  12279. for (i = 0; i < n; i++) {
  12280. height_max = Math.max(height_max, $optgroups.eq(i).height());
  12281. }
  12282. $optgroups.css({ height: height_max });
  12283. }
  12284. if (options.equalizeWidth) {
  12285. width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
  12286. width = Math.round(width_parent / n);
  12287. $optgroups.css({ width: width });
  12288. if (n > 1) {
  12289. width_last = width_parent - width * (n - 1);
  12290. $optgroups.eq(n - 1).css({ width: width_last });
  12291. }
  12292. }
  12293. };
  12294. if (options.equalizeHeight || options.equalizeWidth) {
  12295. hook.after(this, 'positionDropdown', equalizeSizes);
  12296. hook.after(this, 'refreshOptions', equalizeSizes);
  12297. }
  12298. });
  12299. Selectize.define('remove_button', function (options) {
  12300. options = $.extend({
  12301. label: '&times;',
  12302. title: 'Remove',
  12303. className: 'remove',
  12304. append: true
  12305. }, options);
  12306. var singleClose = function singleClose(thisRef, options) {
  12307. options.className = 'remove-single';
  12308. var self = thisRef;
  12309. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12310. /**
  12311. * Appends an element as a child (with raw HTML).
  12312. *
  12313. * @param {string} html_container
  12314. * @param {string} html_element
  12315. * @return {string}
  12316. */
  12317. var append = function append(html_container, html_element) {
  12318. return html_container + html_element;
  12319. };
  12320. thisRef.setup = function () {
  12321. var original = self.setup;
  12322. return function () {
  12323. // override the item rendering method to add the button to each
  12324. if (options.append) {
  12325. var id = $(self.$input.context).attr('id');
  12326. var selectizer = $('#' + id);
  12327. var render_item = self.settings.render.item;
  12328. self.settings.render.item = function (data) {
  12329. return append(render_item.apply(thisRef, arguments), html);
  12330. };
  12331. }
  12332. original.apply(thisRef, arguments);
  12333. // add event listener
  12334. thisRef.$control.on('click', '.' + options.className, function (e) {
  12335. e.preventDefault();
  12336. if (self.isLocked) return;
  12337. self.clear();
  12338. });
  12339. };
  12340. }();
  12341. };
  12342. var multiClose = function multiClose(thisRef, options) {
  12343. var self = thisRef;
  12344. var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
  12345. /**
  12346. * Appends an element as a child (with raw HTML).
  12347. *
  12348. * @param {string} html_container
  12349. * @param {string} html_element
  12350. * @return {string}
  12351. */
  12352. var append = function append(html_container, html_element) {
  12353. var pos = html_container.search(/(<\/[^>]+>\s*)$/);
  12354. return html_container.substring(0, pos) + html_element + html_container.substring(pos);
  12355. };
  12356. thisRef.setup = function () {
  12357. var original = self.setup;
  12358. return function () {
  12359. // override the item rendering method to add the button to each
  12360. if (options.append) {
  12361. var render_item = self.settings.render.item;
  12362. self.settings.render.item = function (data) {
  12363. return append(render_item.apply(thisRef, arguments), html);
  12364. };
  12365. }
  12366. original.apply(thisRef, arguments);
  12367. // add event listener
  12368. thisRef.$control.on('click', '.' + options.className, function (e) {
  12369. e.preventDefault();
  12370. if (self.isLocked) return;
  12371. var $item = $(e.currentTarget).parent();
  12372. self.setActiveItem($item);
  12373. if (self.deleteSelection()) {
  12374. self.setCaret(self.items.length);
  12375. }
  12376. });
  12377. };
  12378. }();
  12379. };
  12380. if (this.settings.mode === 'single') {
  12381. singleClose(this, options);
  12382. return;
  12383. } else {
  12384. multiClose(this, options);
  12385. }
  12386. });
  12387. Selectize.define('restore_on_backspace', function (options) {
  12388. var self = this;
  12389. options.text = options.text || function (option) {
  12390. return option[this.settings.labelField];
  12391. };
  12392. this.onKeyDown = function () {
  12393. var original = self.onKeyDown;
  12394. return function (e) {
  12395. var index, option;
  12396. if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
  12397. index = this.caretPos - 1;
  12398. if (index >= 0 && index < this.items.length) {
  12399. option = this.options[this.items[index]];
  12400. if (this.deleteSelection(e)) {
  12401. this.setTextboxValue(options.text.apply(this, [option]));
  12402. this.refreshOptions(true);
  12403. }
  12404. e.preventDefault();
  12405. return;
  12406. }
  12407. }
  12408. return original.apply(this, arguments);
  12409. };
  12410. }();
  12411. });
  12412. return Selectize;
  12413. });
  12414. /***/ }),
  12415. /* 30 */
  12416. /***/ (function(module, exports, __webpack_require__) {
  12417. "use strict";
  12418. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12419. /*!
  12420. Autosize 4.0.0
  12421. license: MIT
  12422. http://www.jacklmoore.com/autosize
  12423. */
  12424. (function (global, factory) {
  12425. if (true) {
  12426. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12427. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12428. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12429. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12430. } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
  12431. factory(exports, module);
  12432. } else {
  12433. var mod = {
  12434. exports: {}
  12435. };
  12436. factory(mod.exports, mod);
  12437. global.autosize = mod.exports;
  12438. }
  12439. })(undefined, function (exports, module) {
  12440. 'use strict';
  12441. var map = typeof Map === "function" ? new Map() : function () {
  12442. var keys = [];
  12443. var values = [];
  12444. return {
  12445. has: function has(key) {
  12446. return keys.indexOf(key) > -1;
  12447. },
  12448. get: function get(key) {
  12449. return values[keys.indexOf(key)];
  12450. },
  12451. set: function set(key, value) {
  12452. if (keys.indexOf(key) === -1) {
  12453. keys.push(key);
  12454. values.push(value);
  12455. }
  12456. },
  12457. 'delete': function _delete(key) {
  12458. var index = keys.indexOf(key);
  12459. if (index > -1) {
  12460. keys.splice(index, 1);
  12461. values.splice(index, 1);
  12462. }
  12463. }
  12464. };
  12465. }();
  12466. var createEvent = function createEvent(name) {
  12467. return new Event(name, { bubbles: true });
  12468. };
  12469. try {
  12470. new Event('test');
  12471. } catch (e) {
  12472. // IE does not support `new Event()`
  12473. createEvent = function createEvent(name) {
  12474. var evt = document.createEvent('Event');
  12475. evt.initEvent(name, true, false);
  12476. return evt;
  12477. };
  12478. }
  12479. function assign(ta) {
  12480. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  12481. var heightOffset = null;
  12482. var clientWidth = ta.clientWidth;
  12483. var cachedHeight = null;
  12484. function init() {
  12485. var style = window.getComputedStyle(ta, null);
  12486. if (style.resize === 'vertical') {
  12487. ta.style.resize = 'none';
  12488. } else if (style.resize === 'both') {
  12489. ta.style.resize = 'horizontal';
  12490. }
  12491. if (style.boxSizing === 'content-box') {
  12492. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  12493. } else {
  12494. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  12495. }
  12496. // Fix when a textarea is not on document body and heightOffset is Not a Number
  12497. if (isNaN(heightOffset)) {
  12498. heightOffset = 0;
  12499. }
  12500. update();
  12501. }
  12502. function changeOverflow(value) {
  12503. {
  12504. // Chrome/Safari-specific fix:
  12505. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  12506. // made available by removing the scrollbar. The following forces the necessary text reflow.
  12507. var width = ta.style.width;
  12508. ta.style.width = '0px';
  12509. // Force reflow:
  12510. /* jshint ignore:start */
  12511. ta.offsetWidth;
  12512. /* jshint ignore:end */
  12513. ta.style.width = width;
  12514. }
  12515. ta.style.overflowY = value;
  12516. }
  12517. function getParentOverflows(el) {
  12518. var arr = [];
  12519. while (el && el.parentNode && el.parentNode instanceof Element) {
  12520. if (el.parentNode.scrollTop) {
  12521. arr.push({
  12522. node: el.parentNode,
  12523. scrollTop: el.parentNode.scrollTop
  12524. });
  12525. }
  12526. el = el.parentNode;
  12527. }
  12528. return arr;
  12529. }
  12530. function resize() {
  12531. var originalHeight = ta.style.height;
  12532. var overflows = getParentOverflows(ta);
  12533. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  12534. ta.style.height = '';
  12535. var endHeight = ta.scrollHeight + heightOffset;
  12536. if (ta.scrollHeight === 0) {
  12537. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  12538. ta.style.height = originalHeight;
  12539. return;
  12540. }
  12541. ta.style.height = endHeight + 'px';
  12542. // used to check if an update is actually necessary on window.resize
  12543. clientWidth = ta.clientWidth;
  12544. // prevents scroll-position jumping
  12545. overflows.forEach(function (el) {
  12546. el.node.scrollTop = el.scrollTop;
  12547. });
  12548. if (docTop) {
  12549. document.documentElement.scrollTop = docTop;
  12550. }
  12551. }
  12552. function update() {
  12553. resize();
  12554. var styleHeight = Math.round(parseFloat(ta.style.height));
  12555. var computed = window.getComputedStyle(ta, null);
  12556. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  12557. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  12558. // The actual height not matching the style height (set via the resize method) indicates that
  12559. // the max-height has been exceeded, in which case the overflow should be allowed.
  12560. if (actualHeight !== styleHeight) {
  12561. if (computed.overflowY === 'hidden') {
  12562. changeOverflow('scroll');
  12563. resize();
  12564. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12565. }
  12566. } else {
  12567. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  12568. if (computed.overflowY !== 'hidden') {
  12569. changeOverflow('hidden');
  12570. resize();
  12571. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  12572. }
  12573. }
  12574. if (cachedHeight !== actualHeight) {
  12575. cachedHeight = actualHeight;
  12576. var evt = createEvent('autosize:resized');
  12577. try {
  12578. ta.dispatchEvent(evt);
  12579. } catch (err) {
  12580. // Firefox will throw an error on dispatchEvent for a detached element
  12581. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  12582. }
  12583. }
  12584. }
  12585. var pageResize = function pageResize() {
  12586. if (ta.clientWidth !== clientWidth) {
  12587. update();
  12588. }
  12589. };
  12590. var destroy = function (style) {
  12591. window.removeEventListener('resize', pageResize, false);
  12592. ta.removeEventListener('input', update, false);
  12593. ta.removeEventListener('keyup', update, false);
  12594. ta.removeEventListener('autosize:destroy', destroy, false);
  12595. ta.removeEventListener('autosize:update', update, false);
  12596. Object.keys(style).forEach(function (key) {
  12597. ta.style[key] = style[key];
  12598. });
  12599. map['delete'](ta);
  12600. }.bind(ta, {
  12601. height: ta.style.height,
  12602. resize: ta.style.resize,
  12603. overflowY: ta.style.overflowY,
  12604. overflowX: ta.style.overflowX,
  12605. wordWrap: ta.style.wordWrap
  12606. });
  12607. ta.addEventListener('autosize:destroy', destroy, false);
  12608. // IE9 does not fire onpropertychange or oninput for deletions,
  12609. // so binding to onkeyup to catch most of those events.
  12610. // There is no way that I know of to detect something like 'cut' in IE9.
  12611. if ('onpropertychange' in ta && 'oninput' in ta) {
  12612. ta.addEventListener('keyup', update, false);
  12613. }
  12614. window.addEventListener('resize', pageResize, false);
  12615. ta.addEventListener('input', update, false);
  12616. ta.addEventListener('autosize:update', update, false);
  12617. ta.style.overflowX = 'hidden';
  12618. ta.style.wordWrap = 'break-word';
  12619. map.set(ta, {
  12620. destroy: destroy,
  12621. update: update
  12622. });
  12623. init();
  12624. }
  12625. function destroy(ta) {
  12626. var methods = map.get(ta);
  12627. if (methods) {
  12628. methods.destroy();
  12629. }
  12630. }
  12631. function update(ta) {
  12632. var methods = map.get(ta);
  12633. if (methods) {
  12634. methods.update();
  12635. }
  12636. }
  12637. var autosize = null;
  12638. // Do nothing in Node.js environment and IE8 (or lower)
  12639. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  12640. autosize = function autosize(el) {
  12641. return el;
  12642. };
  12643. autosize.destroy = function (el) {
  12644. return el;
  12645. };
  12646. autosize.update = function (el) {
  12647. return el;
  12648. };
  12649. } else {
  12650. autosize = function autosize(el, options) {
  12651. if (el) {
  12652. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  12653. return assign(x, options);
  12654. });
  12655. }
  12656. return el;
  12657. };
  12658. autosize.destroy = function (el) {
  12659. if (el) {
  12660. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  12661. }
  12662. return el;
  12663. };
  12664. autosize.update = function (el) {
  12665. if (el) {
  12666. Array.prototype.forEach.call(el.length ? el : [el], update);
  12667. }
  12668. return el;
  12669. };
  12670. }
  12671. module.exports = autosize;
  12672. });
  12673. /***/ }),
  12674. /* 31 */
  12675. /***/ (function(module, exports, __webpack_require__) {
  12676. "use strict";
  12677. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;
  12678. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  12679. /*!
  12680. * enquire.js v2.1.6 - Awesome Media Queries in JavaScript
  12681. * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js
  12682. * License: MIT */
  12683. (function (f) {
  12684. if (( false ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
  12685. module.exports = f();
  12686. } else if (true) {
  12687. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (f),
  12688. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12689. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12690. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12691. } else {
  12692. var g;if (typeof window !== "undefined") {
  12693. g = window;
  12694. } else if (typeof global !== "undefined") {
  12695. g = global;
  12696. } else if (typeof self !== "undefined") {
  12697. g = self;
  12698. } else {
  12699. g = this;
  12700. }g.enquire = f();
  12701. }
  12702. })(function () {
  12703. var define, module, exports;return function e(t, n, r) {
  12704. function s(o, u) {
  12705. if (!n[o]) {
  12706. if (!t[o]) {
  12707. var a = typeof require == "function" && require;if (!u && a) return require(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f;
  12708. }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {
  12709. var n = t[o][1][e];return s(n ? n : e);
  12710. }, l, l.exports, e, t, n, r);
  12711. }return n[o].exports;
  12712. }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
  12713. s(r[o]);
  12714. }return s;
  12715. }({ 1: [function (require, module, exports) {
  12716. var QueryHandler = require(3);
  12717. var each = require(4).each;
  12718. /**
  12719. * Represents a single media query, manages it's state and registered handlers for this query
  12720. *
  12721. * @constructor
  12722. * @param {string} query the media query string
  12723. * @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
  12724. */
  12725. function MediaQuery(query, isUnconditional) {
  12726. this.query = query;
  12727. this.isUnconditional = isUnconditional;
  12728. this.handlers = [];
  12729. this.mql = window.matchMedia(query);
  12730. var self = this;
  12731. this.listener = function (mql) {
  12732. // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
  12733. self.mql = mql.currentTarget || mql;
  12734. self.assess();
  12735. };
  12736. this.mql.addListener(this.listener);
  12737. }
  12738. MediaQuery.prototype = {
  12739. constuctor: MediaQuery,
  12740. /**
  12741. * add a handler for this query, triggering if already active
  12742. *
  12743. * @param {object} handler
  12744. * @param {function} handler.match callback for when query is activated
  12745. * @param {function} [handler.unmatch] callback for when query is deactivated
  12746. * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
  12747. * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
  12748. */
  12749. addHandler: function addHandler(handler) {
  12750. var qh = new QueryHandler(handler);
  12751. this.handlers.push(qh);
  12752. this.matches() && qh.on();
  12753. },
  12754. /**
  12755. * removes the given handler from the collection, and calls it's destroy methods
  12756. *
  12757. * @param {object || function} handler the handler to remove
  12758. */
  12759. removeHandler: function removeHandler(handler) {
  12760. var handlers = this.handlers;
  12761. each(handlers, function (h, i) {
  12762. if (h.equals(handler)) {
  12763. h.destroy();
  12764. return !handlers.splice(i, 1); //remove from array and exit each early
  12765. }
  12766. });
  12767. },
  12768. /**
  12769. * Determine whether the media query should be considered a match
  12770. *
  12771. * @return {Boolean} true if media query can be considered a match, false otherwise
  12772. */
  12773. matches: function matches() {
  12774. return this.mql.matches || this.isUnconditional;
  12775. },
  12776. /**
  12777. * Clears all handlers and unbinds events
  12778. */
  12779. clear: function clear() {
  12780. each(this.handlers, function (handler) {
  12781. handler.destroy();
  12782. });
  12783. this.mql.removeListener(this.listener);
  12784. this.handlers.length = 0; //clear array
  12785. },
  12786. /*
  12787. * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
  12788. */
  12789. assess: function assess() {
  12790. var action = this.matches() ? 'on' : 'off';
  12791. each(this.handlers, function (handler) {
  12792. handler[action]();
  12793. });
  12794. }
  12795. };
  12796. module.exports = MediaQuery;
  12797. }, { "3": 3, "4": 4 }], 2: [function (require, module, exports) {
  12798. var MediaQuery = require(1);
  12799. var Util = require(4);
  12800. var each = Util.each;
  12801. var isFunction = Util.isFunction;
  12802. var isArray = Util.isArray;
  12803. /**
  12804. * Allows for registration of query handlers.
  12805. * Manages the query handler's state and is responsible for wiring up browser events
  12806. *
  12807. * @constructor
  12808. */
  12809. function MediaQueryDispatch() {
  12810. if (!window.matchMedia) {
  12811. throw new Error('matchMedia not present, legacy browsers require a polyfill');
  12812. }
  12813. this.queries = {};
  12814. this.browserIsIncapable = !window.matchMedia('only all').matches;
  12815. }
  12816. MediaQueryDispatch.prototype = {
  12817. constructor: MediaQueryDispatch,
  12818. /**
  12819. * Registers a handler for the given media query
  12820. *
  12821. * @param {string} q the media query
  12822. * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
  12823. * @param {function} options.match fired when query matched
  12824. * @param {function} [options.unmatch] fired when a query is no longer matched
  12825. * @param {function} [options.setup] fired when handler first triggered
  12826. * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
  12827. * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
  12828. */
  12829. register: function register(q, options, shouldDegrade) {
  12830. var queries = this.queries,
  12831. isUnconditional = shouldDegrade && this.browserIsIncapable;
  12832. if (!queries[q]) {
  12833. queries[q] = new MediaQuery(q, isUnconditional);
  12834. }
  12835. //normalise to object in an array
  12836. if (isFunction(options)) {
  12837. options = { match: options };
  12838. }
  12839. if (!isArray(options)) {
  12840. options = [options];
  12841. }
  12842. each(options, function (handler) {
  12843. if (isFunction(handler)) {
  12844. handler = { match: handler };
  12845. }
  12846. queries[q].addHandler(handler);
  12847. });
  12848. return this;
  12849. },
  12850. /**
  12851. * unregisters a query and all it's handlers, or a specific handler for a query
  12852. *
  12853. * @param {string} q the media query to target
  12854. * @param {object || function} [handler] specific handler to unregister
  12855. */
  12856. unregister: function unregister(q, handler) {
  12857. var query = this.queries[q];
  12858. if (query) {
  12859. if (handler) {
  12860. query.removeHandler(handler);
  12861. } else {
  12862. query.clear();
  12863. delete this.queries[q];
  12864. }
  12865. }
  12866. return this;
  12867. }
  12868. };
  12869. module.exports = MediaQueryDispatch;
  12870. }, { "1": 1, "4": 4 }], 3: [function (require, module, exports) {
  12871. /**
  12872. * Delegate to handle a media query being matched and unmatched.
  12873. *
  12874. * @param {object} options
  12875. * @param {function} options.match callback for when the media query is matched
  12876. * @param {function} [options.unmatch] callback for when the media query is unmatched
  12877. * @param {function} [options.setup] one-time callback triggered the first time a query is matched
  12878. * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
  12879. * @constructor
  12880. */
  12881. function QueryHandler(options) {
  12882. this.options = options;
  12883. !options.deferSetup && this.setup();
  12884. }
  12885. QueryHandler.prototype = {
  12886. constructor: QueryHandler,
  12887. /**
  12888. * coordinates setup of the handler
  12889. *
  12890. * @function
  12891. */
  12892. setup: function setup() {
  12893. if (this.options.setup) {
  12894. this.options.setup();
  12895. }
  12896. this.initialised = true;
  12897. },
  12898. /**
  12899. * coordinates setup and triggering of the handler
  12900. *
  12901. * @function
  12902. */
  12903. on: function on() {
  12904. !this.initialised && this.setup();
  12905. this.options.match && this.options.match();
  12906. },
  12907. /**
  12908. * coordinates the unmatch event for the handler
  12909. *
  12910. * @function
  12911. */
  12912. off: function off() {
  12913. this.options.unmatch && this.options.unmatch();
  12914. },
  12915. /**
  12916. * called when a handler is to be destroyed.
  12917. * delegates to the destroy or unmatch callbacks, depending on availability.
  12918. *
  12919. * @function
  12920. */
  12921. destroy: function destroy() {
  12922. this.options.destroy ? this.options.destroy() : this.off();
  12923. },
  12924. /**
  12925. * determines equality by reference.
  12926. * if object is supplied compare options, if function, compare match callback
  12927. *
  12928. * @function
  12929. * @param {object || function} [target] the target for comparison
  12930. */
  12931. equals: function equals(target) {
  12932. return this.options === target || this.options.match === target;
  12933. }
  12934. };
  12935. module.exports = QueryHandler;
  12936. }, {}], 4: [function (require, module, exports) {
  12937. /**
  12938. * Helper function for iterating over a collection
  12939. *
  12940. * @param collection
  12941. * @param fn
  12942. */
  12943. function each(collection, fn) {
  12944. var i = 0,
  12945. length = collection.length,
  12946. cont;
  12947. for (i; i < length; i++) {
  12948. cont = fn(collection[i], i);
  12949. if (cont === false) {
  12950. break; //allow early exit
  12951. }
  12952. }
  12953. }
  12954. /**
  12955. * Helper function for determining whether target object is an array
  12956. *
  12957. * @param target the object under test
  12958. * @return {Boolean} true if array, false otherwise
  12959. */
  12960. function isArray(target) {
  12961. return Object.prototype.toString.apply(target) === '[object Array]';
  12962. }
  12963. /**
  12964. * Helper function for determining whether target object is a function
  12965. *
  12966. * @param target the object under test
  12967. * @return {Boolean} true if function, false otherwise
  12968. */
  12969. function isFunction(target) {
  12970. return typeof target === 'function';
  12971. }
  12972. module.exports = {
  12973. isFunction: isFunction,
  12974. isArray: isArray,
  12975. each: each
  12976. };
  12977. }, {}], 5: [function (require, module, exports) {
  12978. var MediaQueryDispatch = require(2);
  12979. module.exports = new MediaQueryDispatch();
  12980. }, { "2": 2 }] }, {}, [5])(5);
  12981. });
  12982. /***/ }),
  12983. /* 32 */
  12984. /***/ (function(module, exports, __webpack_require__) {
  12985. "use strict";
  12986. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  12987. /*! jQuery UI - v1.12.1 - 2017-03-23
  12988. * http://jqueryui.com
  12989. * Includes: widget.js, keycode.js, widgets/mouse.js, widgets/slider.js
  12990. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  12991. (function (factory) {
  12992. if (true) {
  12993. // AMD. Register as an anonymous module.
  12994. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  12995. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  12996. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  12997. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12998. } else {
  12999. // Browser globals
  13000. factory(jQuery);
  13001. }
  13002. })(function ($) {
  13003. $.ui = $.ui || {};
  13004. var version = $.ui.version = "1.12.1";
  13005. /*!
  13006. * jQuery UI Widget 1.12.1
  13007. * http://jqueryui.com
  13008. *
  13009. * Copyright jQuery Foundation and other contributors
  13010. * Released under the MIT license.
  13011. * http://jquery.org/license
  13012. */
  13013. //>>label: Widget
  13014. //>>group: Core
  13015. //>>description: Provides a factory for creating stateful widgets with a common API.
  13016. //>>docs: http://api.jqueryui.com/jQuery.widget/
  13017. //>>demos: http://jqueryui.com/widget/
  13018. var widgetUuid = 0;
  13019. var widgetSlice = Array.prototype.slice;
  13020. $.cleanData = function (orig) {
  13021. return function (elems) {
  13022. var events, elem, i;
  13023. for (i = 0; (elem = elems[i]) != null; i++) {
  13024. try {
  13025. // Only trigger remove when necessary to save time
  13026. events = $._data(elem, "events");
  13027. if (events && events.remove) {
  13028. $(elem).triggerHandler("remove");
  13029. }
  13030. // Http://bugs.jquery.com/ticket/8235
  13031. } catch (e) {}
  13032. }
  13033. orig(elems);
  13034. };
  13035. }($.cleanData);
  13036. $.widget = function (name, base, prototype) {
  13037. var existingConstructor, constructor, basePrototype;
  13038. // ProxiedPrototype allows the provided prototype to remain unmodified
  13039. // so that it can be used as a mixin for multiple widgets (#8876)
  13040. var proxiedPrototype = {};
  13041. var namespace = name.split(".")[0];
  13042. name = name.split(".")[1];
  13043. var fullName = namespace + "-" + name;
  13044. if (!prototype) {
  13045. prototype = base;
  13046. base = $.Widget;
  13047. }
  13048. if ($.isArray(prototype)) {
  13049. prototype = $.extend.apply(null, [{}].concat(prototype));
  13050. }
  13051. // Create selector for plugin
  13052. $.expr[":"][fullName.toLowerCase()] = function (elem) {
  13053. return !!$.data(elem, fullName);
  13054. };
  13055. $[namespace] = $[namespace] || {};
  13056. existingConstructor = $[namespace][name];
  13057. constructor = $[namespace][name] = function (options, element) {
  13058. // Allow instantiation without "new" keyword
  13059. if (!this._createWidget) {
  13060. return new constructor(options, element);
  13061. }
  13062. // Allow instantiation without initializing for simple inheritance
  13063. // must use "new" keyword (the code above always passes args)
  13064. if (arguments.length) {
  13065. this._createWidget(options, element);
  13066. }
  13067. };
  13068. // Extend with the existing constructor to carry over any static properties
  13069. $.extend(constructor, existingConstructor, {
  13070. version: prototype.version,
  13071. // Copy the object used to create the prototype in case we need to
  13072. // redefine the widget later
  13073. _proto: $.extend({}, prototype),
  13074. // Track widgets that inherit from this widget in case this widget is
  13075. // redefined after a widget inherits from it
  13076. _childConstructors: []
  13077. });
  13078. basePrototype = new base();
  13079. // We need to make the options hash a property directly on the new instance
  13080. // otherwise we'll modify the options hash on the prototype that we're
  13081. // inheriting from
  13082. basePrototype.options = $.widget.extend({}, basePrototype.options);
  13083. $.each(prototype, function (prop, value) {
  13084. if (!$.isFunction(value)) {
  13085. proxiedPrototype[prop] = value;
  13086. return;
  13087. }
  13088. proxiedPrototype[prop] = function () {
  13089. function _super() {
  13090. return base.prototype[prop].apply(this, arguments);
  13091. }
  13092. function _superApply(args) {
  13093. return base.prototype[prop].apply(this, args);
  13094. }
  13095. return function () {
  13096. var __super = this._super;
  13097. var __superApply = this._superApply;
  13098. var returnValue;
  13099. this._super = _super;
  13100. this._superApply = _superApply;
  13101. returnValue = value.apply(this, arguments);
  13102. this._super = __super;
  13103. this._superApply = __superApply;
  13104. return returnValue;
  13105. };
  13106. }();
  13107. });
  13108. constructor.prototype = $.widget.extend(basePrototype, {
  13109. // TODO: remove support for widgetEventPrefix
  13110. // always use the name + a colon as the prefix, e.g., draggable:start
  13111. // don't prefix for widgets that aren't DOM-based
  13112. widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name
  13113. }, proxiedPrototype, {
  13114. constructor: constructor,
  13115. namespace: namespace,
  13116. widgetName: name,
  13117. widgetFullName: fullName
  13118. });
  13119. // If this widget is being redefined then we need to find all widgets that
  13120. // are inheriting from it and redefine all of them so that they inherit from
  13121. // the new version of this widget. We're essentially trying to replace one
  13122. // level in the prototype chain.
  13123. if (existingConstructor) {
  13124. $.each(existingConstructor._childConstructors, function (i, child) {
  13125. var childPrototype = child.prototype;
  13126. // Redefine the child widget using the same prototype that was
  13127. // originally used, but inherit from the new version of the base
  13128. $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
  13129. });
  13130. // Remove the list of existing child constructors from the old constructor
  13131. // so the old child constructors can be garbage collected
  13132. delete existingConstructor._childConstructors;
  13133. } else {
  13134. base._childConstructors.push(constructor);
  13135. }
  13136. $.widget.bridge(name, constructor);
  13137. return constructor;
  13138. };
  13139. $.widget.extend = function (target) {
  13140. var input = widgetSlice.call(arguments, 1);
  13141. var inputIndex = 0;
  13142. var inputLength = input.length;
  13143. var key;
  13144. var value;
  13145. for (; inputIndex < inputLength; inputIndex++) {
  13146. for (key in input[inputIndex]) {
  13147. value = input[inputIndex][key];
  13148. if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
  13149. // Clone objects
  13150. if ($.isPlainObject(value)) {
  13151. target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) :
  13152. // Don't extend strings, arrays, etc. with objects
  13153. $.widget.extend({}, value);
  13154. // Copy everything else by reference
  13155. } else {
  13156. target[key] = value;
  13157. }
  13158. }
  13159. }
  13160. }
  13161. return target;
  13162. };
  13163. $.widget.bridge = function (name, object) {
  13164. var fullName = object.prototype.widgetFullName || name;
  13165. $.fn[name] = function (options) {
  13166. var isMethodCall = typeof options === "string";
  13167. var args = widgetSlice.call(arguments, 1);
  13168. var returnValue = this;
  13169. if (isMethodCall) {
  13170. // If this is an empty collection, we need to have the instance method
  13171. // return undefined instead of the jQuery instance
  13172. if (!this.length && options === "instance") {
  13173. returnValue = undefined;
  13174. } else {
  13175. this.each(function () {
  13176. var methodValue;
  13177. var instance = $.data(this, fullName);
  13178. if (options === "instance") {
  13179. returnValue = instance;
  13180. return false;
  13181. }
  13182. if (!instance) {
  13183. return $.error("cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'");
  13184. }
  13185. if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
  13186. return $.error("no such method '" + options + "' for " + name + " widget instance");
  13187. }
  13188. methodValue = instance[options].apply(instance, args);
  13189. if (methodValue !== instance && methodValue !== undefined) {
  13190. returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue;
  13191. return false;
  13192. }
  13193. });
  13194. }
  13195. } else {
  13196. // Allow multiple hashes to be passed on init
  13197. if (args.length) {
  13198. options = $.widget.extend.apply(null, [options].concat(args));
  13199. }
  13200. this.each(function () {
  13201. var instance = $.data(this, fullName);
  13202. if (instance) {
  13203. instance.option(options || {});
  13204. if (instance._init) {
  13205. instance._init();
  13206. }
  13207. } else {
  13208. $.data(this, fullName, new object(options, this));
  13209. }
  13210. });
  13211. }
  13212. return returnValue;
  13213. };
  13214. };
  13215. $.Widget = function () /* options, element */{};
  13216. $.Widget._childConstructors = [];
  13217. $.Widget.prototype = {
  13218. widgetName: "widget",
  13219. widgetEventPrefix: "",
  13220. defaultElement: "<div>",
  13221. options: {
  13222. classes: {},
  13223. disabled: false,
  13224. // Callbacks
  13225. create: null
  13226. },
  13227. _createWidget: function _createWidget(options, element) {
  13228. element = $(element || this.defaultElement || this)[0];
  13229. this.element = $(element);
  13230. this.uuid = widgetUuid++;
  13231. this.eventNamespace = "." + this.widgetName + this.uuid;
  13232. this.bindings = $();
  13233. this.hoverable = $();
  13234. this.focusable = $();
  13235. this.classesElementLookup = {};
  13236. if (element !== this) {
  13237. $.data(element, this.widgetFullName, this);
  13238. this._on(true, this.element, {
  13239. remove: function remove(event) {
  13240. if (event.target === element) {
  13241. this.destroy();
  13242. }
  13243. }
  13244. });
  13245. this.document = $(element.style ?
  13246. // Element within the document
  13247. element.ownerDocument :
  13248. // Element is window or document
  13249. element.document || element);
  13250. this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
  13251. }
  13252. this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options);
  13253. this._create();
  13254. if (this.options.disabled) {
  13255. this._setOptionDisabled(this.options.disabled);
  13256. }
  13257. this._trigger("create", null, this._getCreateEventData());
  13258. this._init();
  13259. },
  13260. _getCreateOptions: function _getCreateOptions() {
  13261. return {};
  13262. },
  13263. _getCreateEventData: $.noop,
  13264. _create: $.noop,
  13265. _init: $.noop,
  13266. destroy: function destroy() {
  13267. var that = this;
  13268. this._destroy();
  13269. $.each(this.classesElementLookup, function (key, value) {
  13270. that._removeClass(value, key);
  13271. });
  13272. // We can probably remove the unbind calls in 2.0
  13273. // all event bindings should go through this._on()
  13274. this.element.off(this.eventNamespace).removeData(this.widgetFullName);
  13275. this.widget().off(this.eventNamespace).removeAttr("aria-disabled");
  13276. // Clean up events and states
  13277. this.bindings.off(this.eventNamespace);
  13278. },
  13279. _destroy: $.noop,
  13280. widget: function widget() {
  13281. return this.element;
  13282. },
  13283. option: function option(key, value) {
  13284. var options = key;
  13285. var parts;
  13286. var curOption;
  13287. var i;
  13288. if (arguments.length === 0) {
  13289. // Don't return a reference to the internal hash
  13290. return $.widget.extend({}, this.options);
  13291. }
  13292. if (typeof key === "string") {
  13293. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  13294. options = {};
  13295. parts = key.split(".");
  13296. key = parts.shift();
  13297. if (parts.length) {
  13298. curOption = options[key] = $.widget.extend({}, this.options[key]);
  13299. for (i = 0; i < parts.length - 1; i++) {
  13300. curOption[parts[i]] = curOption[parts[i]] || {};
  13301. curOption = curOption[parts[i]];
  13302. }
  13303. key = parts.pop();
  13304. if (arguments.length === 1) {
  13305. return curOption[key] === undefined ? null : curOption[key];
  13306. }
  13307. curOption[key] = value;
  13308. } else {
  13309. if (arguments.length === 1) {
  13310. return this.options[key] === undefined ? null : this.options[key];
  13311. }
  13312. options[key] = value;
  13313. }
  13314. }
  13315. this._setOptions(options);
  13316. return this;
  13317. },
  13318. _setOptions: function _setOptions(options) {
  13319. var key;
  13320. for (key in options) {
  13321. this._setOption(key, options[key]);
  13322. }
  13323. return this;
  13324. },
  13325. _setOption: function _setOption(key, value) {
  13326. if (key === "classes") {
  13327. this._setOptionClasses(value);
  13328. }
  13329. this.options[key] = value;
  13330. if (key === "disabled") {
  13331. this._setOptionDisabled(value);
  13332. }
  13333. return this;
  13334. },
  13335. _setOptionClasses: function _setOptionClasses(value) {
  13336. var classKey, elements, currentElements;
  13337. for (classKey in value) {
  13338. currentElements = this.classesElementLookup[classKey];
  13339. if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) {
  13340. continue;
  13341. }
  13342. // We are doing this to create a new jQuery object because the _removeClass() call
  13343. // on the next line is going to destroy the reference to the current elements being
  13344. // tracked. We need to save a copy of this collection so that we can add the new classes
  13345. // below.
  13346. elements = $(currentElements.get());
  13347. this._removeClass(currentElements, classKey);
  13348. // We don't use _addClass() here, because that uses this.options.classes
  13349. // for generating the string of classes. We want to use the value passed in from
  13350. // _setOption(), this is the new value of the classes option which was passed to
  13351. // _setOption(). We pass this value directly to _classes().
  13352. elements.addClass(this._classes({
  13353. element: elements,
  13354. keys: classKey,
  13355. classes: value,
  13356. add: true
  13357. }));
  13358. }
  13359. },
  13360. _setOptionDisabled: function _setOptionDisabled(value) {
  13361. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
  13362. // If the widget is becoming disabled, then nothing is interactive
  13363. if (value) {
  13364. this._removeClass(this.hoverable, null, "ui-state-hover");
  13365. this._removeClass(this.focusable, null, "ui-state-focus");
  13366. }
  13367. },
  13368. enable: function enable() {
  13369. return this._setOptions({ disabled: false });
  13370. },
  13371. disable: function disable() {
  13372. return this._setOptions({ disabled: true });
  13373. },
  13374. _classes: function _classes(options) {
  13375. var full = [];
  13376. var that = this;
  13377. options = $.extend({
  13378. element: this.element,
  13379. classes: this.options.classes || {}
  13380. }, options);
  13381. function processClassString(classes, checkOption) {
  13382. var current, i;
  13383. for (i = 0; i < classes.length; i++) {
  13384. current = that.classesElementLookup[classes[i]] || $();
  13385. if (options.add) {
  13386. current = $($.unique(current.get().concat(options.element.get())));
  13387. } else {
  13388. current = $(current.not(options.element).get());
  13389. }
  13390. that.classesElementLookup[classes[i]] = current;
  13391. full.push(classes[i]);
  13392. if (checkOption && options.classes[classes[i]]) {
  13393. full.push(options.classes[classes[i]]);
  13394. }
  13395. }
  13396. }
  13397. this._on(options.element, {
  13398. "remove": "_untrackClassesElement"
  13399. });
  13400. if (options.keys) {
  13401. processClassString(options.keys.match(/\S+/g) || [], true);
  13402. }
  13403. if (options.extra) {
  13404. processClassString(options.extra.match(/\S+/g) || []);
  13405. }
  13406. return full.join(" ");
  13407. },
  13408. _untrackClassesElement: function _untrackClassesElement(event) {
  13409. var that = this;
  13410. $.each(that.classesElementLookup, function (key, value) {
  13411. if ($.inArray(event.target, value) !== -1) {
  13412. that.classesElementLookup[key] = $(value.not(event.target).get());
  13413. }
  13414. });
  13415. },
  13416. _removeClass: function _removeClass(element, keys, extra) {
  13417. return this._toggleClass(element, keys, extra, false);
  13418. },
  13419. _addClass: function _addClass(element, keys, extra) {
  13420. return this._toggleClass(element, keys, extra, true);
  13421. },
  13422. _toggleClass: function _toggleClass(element, keys, extra, add) {
  13423. add = typeof add === "boolean" ? add : extra;
  13424. var shift = typeof element === "string" || element === null,
  13425. options = {
  13426. extra: shift ? keys : extra,
  13427. keys: shift ? element : keys,
  13428. element: shift ? this.element : element,
  13429. add: add
  13430. };
  13431. options.element.toggleClass(this._classes(options), add);
  13432. return this;
  13433. },
  13434. _on: function _on(suppressDisabledCheck, element, handlers) {
  13435. var delegateElement;
  13436. var instance = this;
  13437. // No suppressDisabledCheck flag, shuffle arguments
  13438. if (typeof suppressDisabledCheck !== "boolean") {
  13439. handlers = element;
  13440. element = suppressDisabledCheck;
  13441. suppressDisabledCheck = false;
  13442. }
  13443. // No element argument, shuffle and use this.element
  13444. if (!handlers) {
  13445. handlers = element;
  13446. element = this.element;
  13447. delegateElement = this.widget();
  13448. } else {
  13449. element = delegateElement = $(element);
  13450. this.bindings = this.bindings.add(element);
  13451. }
  13452. $.each(handlers, function (event, handler) {
  13453. function handlerProxy() {
  13454. // Allow widgets to customize the disabled handling
  13455. // - disabled as an array instead of boolean
  13456. // - disabled class as method for disabling individual parts
  13457. if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass("ui-state-disabled"))) {
  13458. return;
  13459. }
  13460. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13461. }
  13462. // Copy the guid so direct unbinding works
  13463. if (typeof handler !== "string") {
  13464. handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++;
  13465. }
  13466. var match = event.match(/^([\w:-]*)\s*(.*)$/);
  13467. var eventName = match[1] + instance.eventNamespace;
  13468. var selector = match[2];
  13469. if (selector) {
  13470. delegateElement.on(eventName, selector, handlerProxy);
  13471. } else {
  13472. element.on(eventName, handlerProxy);
  13473. }
  13474. });
  13475. },
  13476. _off: function _off(element, eventName) {
  13477. eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
  13478. element.off(eventName).off(eventName);
  13479. // Clear the stack to avoid memory leaks (#10056)
  13480. this.bindings = $(this.bindings.not(element).get());
  13481. this.focusable = $(this.focusable.not(element).get());
  13482. this.hoverable = $(this.hoverable.not(element).get());
  13483. },
  13484. _delay: function _delay(handler, delay) {
  13485. function handlerProxy() {
  13486. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  13487. }
  13488. var instance = this;
  13489. return setTimeout(handlerProxy, delay || 0);
  13490. },
  13491. _hoverable: function _hoverable(element) {
  13492. this.hoverable = this.hoverable.add(element);
  13493. this._on(element, {
  13494. mouseenter: function mouseenter(event) {
  13495. this._addClass($(event.currentTarget), null, "ui-state-hover");
  13496. },
  13497. mouseleave: function mouseleave(event) {
  13498. this._removeClass($(event.currentTarget), null, "ui-state-hover");
  13499. }
  13500. });
  13501. },
  13502. _focusable: function _focusable(element) {
  13503. this.focusable = this.focusable.add(element);
  13504. this._on(element, {
  13505. focusin: function focusin(event) {
  13506. this._addClass($(event.currentTarget), null, "ui-state-focus");
  13507. },
  13508. focusout: function focusout(event) {
  13509. this._removeClass($(event.currentTarget), null, "ui-state-focus");
  13510. }
  13511. });
  13512. },
  13513. _trigger: function _trigger(type, event, data) {
  13514. var prop, orig;
  13515. var callback = this.options[type];
  13516. data = data || {};
  13517. event = $.Event(event);
  13518. event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase();
  13519. // The original event may come from any element
  13520. // so we need to reset the target on the new event
  13521. event.target = this.element[0];
  13522. // Copy original event properties over to the new event
  13523. orig = event.originalEvent;
  13524. if (orig) {
  13525. for (prop in orig) {
  13526. if (!(prop in event)) {
  13527. event[prop] = orig[prop];
  13528. }
  13529. }
  13530. }
  13531. this.element.trigger(event, data);
  13532. return !($.isFunction(callback) && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented());
  13533. }
  13534. };
  13535. $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) {
  13536. $.Widget.prototype["_" + method] = function (element, options, callback) {
  13537. if (typeof options === "string") {
  13538. options = { effect: options };
  13539. }
  13540. var hasOptions;
  13541. var effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect;
  13542. options = options || {};
  13543. if (typeof options === "number") {
  13544. options = { duration: options };
  13545. }
  13546. hasOptions = !$.isEmptyObject(options);
  13547. options.complete = callback;
  13548. if (options.delay) {
  13549. element.delay(options.delay);
  13550. }
  13551. if (hasOptions && $.effects && $.effects.effect[effectName]) {
  13552. element[method](options);
  13553. } else if (effectName !== method && element[effectName]) {
  13554. element[effectName](options.duration, options.easing, callback);
  13555. } else {
  13556. element.queue(function (next) {
  13557. $(this)[method]();
  13558. if (callback) {
  13559. callback.call(element[0]);
  13560. }
  13561. next();
  13562. });
  13563. }
  13564. };
  13565. });
  13566. var widget = $.widget;
  13567. /*!
  13568. * jQuery UI Keycode 1.12.1
  13569. * http://jqueryui.com
  13570. *
  13571. * Copyright jQuery Foundation and other contributors
  13572. * Released under the MIT license.
  13573. * http://jquery.org/license
  13574. */
  13575. //>>label: Keycode
  13576. //>>group: Core
  13577. //>>description: Provide keycodes as keynames
  13578. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  13579. var keycode = $.ui.keyCode = {
  13580. BACKSPACE: 8,
  13581. COMMA: 188,
  13582. DELETE: 46,
  13583. DOWN: 40,
  13584. END: 35,
  13585. ENTER: 13,
  13586. ESCAPE: 27,
  13587. HOME: 36,
  13588. LEFT: 37,
  13589. PAGE_DOWN: 34,
  13590. PAGE_UP: 33,
  13591. PERIOD: 190,
  13592. RIGHT: 39,
  13593. SPACE: 32,
  13594. TAB: 9,
  13595. UP: 38
  13596. };
  13597. // This file is deprecated
  13598. var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
  13599. /*!
  13600. * jQuery UI Mouse 1.12.1
  13601. * http://jqueryui.com
  13602. *
  13603. * Copyright jQuery Foundation and other contributors
  13604. * Released under the MIT license.
  13605. * http://jquery.org/license
  13606. */
  13607. //>>label: Mouse
  13608. //>>group: Widgets
  13609. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  13610. //>>docs: http://api.jqueryui.com/mouse/
  13611. var mouseHandled = false;
  13612. $(document).on("mouseup", function () {
  13613. mouseHandled = false;
  13614. });
  13615. var widgetsMouse = $.widget("ui.mouse", {
  13616. version: "1.12.1",
  13617. options: {
  13618. cancel: "input, textarea, button, select, option",
  13619. distance: 1,
  13620. delay: 0
  13621. },
  13622. _mouseInit: function _mouseInit() {
  13623. var that = this;
  13624. this.element.on("mousedown." + this.widgetName, function (event) {
  13625. return that._mouseDown(event);
  13626. }).on("click." + this.widgetName, function (event) {
  13627. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  13628. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  13629. event.stopImmediatePropagation();
  13630. return false;
  13631. }
  13632. });
  13633. this.started = false;
  13634. },
  13635. // TODO: make sure destroying one instance of mouse doesn't mess with
  13636. // other instances of mouse
  13637. _mouseDestroy: function _mouseDestroy() {
  13638. this.element.off("." + this.widgetName);
  13639. if (this._mouseMoveDelegate) {
  13640. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13641. }
  13642. },
  13643. _mouseDown: function _mouseDown(event) {
  13644. // don't let more than one widget handle mouseStart
  13645. if (mouseHandled) {
  13646. return;
  13647. }
  13648. this._mouseMoved = false;
  13649. // We may have missed mouseup (out of window)
  13650. this._mouseStarted && this._mouseUp(event);
  13651. this._mouseDownEvent = event;
  13652. var that = this,
  13653. btnIsLeft = event.which === 1,
  13654. // event.target.nodeName works around a bug in IE 8 with
  13655. // disabled inputs (#7620)
  13656. elIsCancel = typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false;
  13657. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  13658. return true;
  13659. }
  13660. this.mouseDelayMet = !this.options.delay;
  13661. if (!this.mouseDelayMet) {
  13662. this._mouseDelayTimer = setTimeout(function () {
  13663. that.mouseDelayMet = true;
  13664. }, this.options.delay);
  13665. }
  13666. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13667. this._mouseStarted = this._mouseStart(event) !== false;
  13668. if (!this._mouseStarted) {
  13669. event.preventDefault();
  13670. return true;
  13671. }
  13672. }
  13673. // Click event may never have fired (Gecko & Opera)
  13674. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  13675. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  13676. }
  13677. // These delegates are required to keep context
  13678. this._mouseMoveDelegate = function (event) {
  13679. return that._mouseMove(event);
  13680. };
  13681. this._mouseUpDelegate = function (event) {
  13682. return that._mouseUp(event);
  13683. };
  13684. this.document.on("mousemove." + this.widgetName, this._mouseMoveDelegate).on("mouseup." + this.widgetName, this._mouseUpDelegate);
  13685. event.preventDefault();
  13686. mouseHandled = true;
  13687. return true;
  13688. },
  13689. _mouseMove: function _mouseMove(event) {
  13690. // Only check for mouseups outside the document if you've moved inside the document
  13691. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  13692. // fire a mousemove event if content is placed under the cursor. See #7778
  13693. // Support: IE <9
  13694. if (this._mouseMoved) {
  13695. // IE mouseup check - mouseup happened when mouse was out of window
  13696. if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) {
  13697. return this._mouseUp(event);
  13698. // Iframe mouseup check - mouseup occurred in another document
  13699. } else if (!event.which) {
  13700. // Support: Safari <=8 - 9
  13701. // Safari sets which to 0 if you press any of the following keys
  13702. // during a drag (#14461)
  13703. if (event.originalEvent.altKey || event.originalEvent.ctrlKey || event.originalEvent.metaKey || event.originalEvent.shiftKey) {
  13704. this.ignoreMissingWhich = true;
  13705. } else if (!this.ignoreMissingWhich) {
  13706. return this._mouseUp(event);
  13707. }
  13708. }
  13709. }
  13710. if (event.which || event.button) {
  13711. this._mouseMoved = true;
  13712. }
  13713. if (this._mouseStarted) {
  13714. this._mouseDrag(event);
  13715. return event.preventDefault();
  13716. }
  13717. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  13718. this._mouseStarted = this._mouseStart(this._mouseDownEvent, event) !== false;
  13719. this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event);
  13720. }
  13721. return !this._mouseStarted;
  13722. },
  13723. _mouseUp: function _mouseUp(event) {
  13724. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  13725. if (this._mouseStarted) {
  13726. this._mouseStarted = false;
  13727. if (event.target === this._mouseDownEvent.target) {
  13728. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  13729. }
  13730. this._mouseStop(event);
  13731. }
  13732. if (this._mouseDelayTimer) {
  13733. clearTimeout(this._mouseDelayTimer);
  13734. delete this._mouseDelayTimer;
  13735. }
  13736. this.ignoreMissingWhich = false;
  13737. mouseHandled = false;
  13738. event.preventDefault();
  13739. },
  13740. _mouseDistanceMet: function _mouseDistanceMet(event) {
  13741. return Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance;
  13742. },
  13743. _mouseDelayMet: function _mouseDelayMet() /* event */{
  13744. return this.mouseDelayMet;
  13745. },
  13746. // These are placeholder methods, to be overriden by extending plugin
  13747. _mouseStart: function _mouseStart() /* event */{},
  13748. _mouseDrag: function _mouseDrag() /* event */{},
  13749. _mouseStop: function _mouseStop() /* event */{},
  13750. _mouseCapture: function _mouseCapture() /* event */{
  13751. return true;
  13752. }
  13753. });
  13754. /*!
  13755. * jQuery UI Slider 1.12.1
  13756. * http://jqueryui.com
  13757. *
  13758. * Copyright jQuery Foundation and other contributors
  13759. * Released under the MIT license.
  13760. * http://jquery.org/license
  13761. */
  13762. //>>label: Slider
  13763. //>>group: Widgets
  13764. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  13765. //>>docs: http://api.jqueryui.com/slider/
  13766. //>>demos: http://jqueryui.com/slider/
  13767. //>>css.structure: ../../themes/base/core.css
  13768. //>>css.structure: ../../themes/base/slider.css
  13769. //>>css.theme: ../../themes/base/theme.css
  13770. var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
  13771. version: "1.12.1",
  13772. widgetEventPrefix: "slide",
  13773. options: {
  13774. animate: false,
  13775. classes: {
  13776. "ui-slider": "ui-corner-all",
  13777. "ui-slider-handle": "ui-corner-all",
  13778. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  13779. // element, but worked best visually with a variety of themes
  13780. "ui-slider-range": "ui-corner-all ui-widget-header"
  13781. },
  13782. distance: 0,
  13783. max: 100,
  13784. min: 0,
  13785. orientation: "horizontal",
  13786. range: false,
  13787. step: 1,
  13788. value: 0,
  13789. values: null,
  13790. // Callbacks
  13791. change: null,
  13792. slide: null,
  13793. start: null,
  13794. stop: null
  13795. },
  13796. // Number of pages in a slider
  13797. // (how many times can you page up/down to go through the whole range)
  13798. numPages: 5,
  13799. _create: function _create() {
  13800. this._keySliding = false;
  13801. this._mouseSliding = false;
  13802. this._animateOff = true;
  13803. this._handleIndex = null;
  13804. this._detectOrientation();
  13805. this._mouseInit();
  13806. this._calculateNewMax();
  13807. this._addClass("ui-slider ui-slider-" + this.orientation, "ui-widget ui-widget-content");
  13808. this._refresh();
  13809. this._animateOff = false;
  13810. },
  13811. _refresh: function _refresh() {
  13812. this._createRange();
  13813. this._createHandles();
  13814. this._setupEvents();
  13815. this._refreshValue();
  13816. },
  13817. _createHandles: function _createHandles() {
  13818. var i,
  13819. handleCount,
  13820. options = this.options,
  13821. existingHandles = this.element.find(".ui-slider-handle"),
  13822. handle = "<span tabindex='0'></span>",
  13823. handles = [];
  13824. handleCount = options.values && options.values.length || 1;
  13825. if (existingHandles.length > handleCount) {
  13826. existingHandles.slice(handleCount).remove();
  13827. existingHandles = existingHandles.slice(0, handleCount);
  13828. }
  13829. for (i = existingHandles.length; i < handleCount; i++) {
  13830. handles.push(handle);
  13831. }
  13832. this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));
  13833. this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
  13834. this.handle = this.handles.eq(0);
  13835. this.handles.each(function (i) {
  13836. $(this).data("ui-slider-handle-index", i).attr("tabIndex", 0);
  13837. });
  13838. },
  13839. _createRange: function _createRange() {
  13840. var options = this.options;
  13841. if (options.range) {
  13842. if (options.range === true) {
  13843. if (!options.values) {
  13844. options.values = [this._valueMin(), this._valueMin()];
  13845. } else if (options.values.length && options.values.length !== 2) {
  13846. options.values = [options.values[0], options.values[0]];
  13847. } else if ($.isArray(options.values)) {
  13848. options.values = options.values.slice(0);
  13849. }
  13850. }
  13851. if (!this.range || !this.range.length) {
  13852. this.range = $("<div>").appendTo(this.element);
  13853. this._addClass(this.range, "ui-slider-range");
  13854. } else {
  13855. this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
  13856. // Handle range switching from true to min/max
  13857. this.range.css({
  13858. "left": "",
  13859. "bottom": ""
  13860. });
  13861. }
  13862. if (options.range === "min" || options.range === "max") {
  13863. this._addClass(this.range, "ui-slider-range-" + options.range);
  13864. }
  13865. } else {
  13866. if (this.range) {
  13867. this.range.remove();
  13868. }
  13869. this.range = null;
  13870. }
  13871. },
  13872. _setupEvents: function _setupEvents() {
  13873. this._off(this.handles);
  13874. this._on(this.handles, this._handleEvents);
  13875. this._hoverable(this.handles);
  13876. this._focusable(this.handles);
  13877. },
  13878. _destroy: function _destroy() {
  13879. this.handles.remove();
  13880. if (this.range) {
  13881. this.range.remove();
  13882. }
  13883. this._mouseDestroy();
  13884. },
  13885. _mouseCapture: function _mouseCapture(event) {
  13886. var position,
  13887. normValue,
  13888. distance,
  13889. closestHandle,
  13890. index,
  13891. allowed,
  13892. offset,
  13893. mouseOverHandle,
  13894. that = this,
  13895. o = this.options;
  13896. if (o.disabled) {
  13897. return false;
  13898. }
  13899. this.elementSize = {
  13900. width: this.element.outerWidth(),
  13901. height: this.element.outerHeight()
  13902. };
  13903. this.elementOffset = this.element.offset();
  13904. position = { x: event.pageX, y: event.pageY };
  13905. normValue = this._normValueFromMouse(position);
  13906. distance = this._valueMax() - this._valueMin() + 1;
  13907. this.handles.each(function (i) {
  13908. var thisDistance = Math.abs(normValue - that.values(i));
  13909. if (distance > thisDistance || distance === thisDistance && (i === that._lastChangedValue || that.values(i) === o.min)) {
  13910. distance = thisDistance;
  13911. closestHandle = $(this);
  13912. index = i;
  13913. }
  13914. });
  13915. allowed = this._start(event, index);
  13916. if (allowed === false) {
  13917. return false;
  13918. }
  13919. this._mouseSliding = true;
  13920. this._handleIndex = index;
  13921. this._addClass(closestHandle, null, "ui-state-active");
  13922. closestHandle.trigger("focus");
  13923. offset = closestHandle.offset();
  13924. mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
  13925. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  13926. left: event.pageX - offset.left - closestHandle.width() / 2,
  13927. 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)
  13928. };
  13929. if (!this.handles.hasClass("ui-state-hover")) {
  13930. this._slide(event, index, normValue);
  13931. }
  13932. this._animateOff = true;
  13933. return true;
  13934. },
  13935. _mouseStart: function _mouseStart() {
  13936. return true;
  13937. },
  13938. _mouseDrag: function _mouseDrag(event) {
  13939. var position = { x: event.pageX, y: event.pageY },
  13940. normValue = this._normValueFromMouse(position);
  13941. this._slide(event, this._handleIndex, normValue);
  13942. return false;
  13943. },
  13944. _mouseStop: function _mouseStop(event) {
  13945. this._removeClass(this.handles, null, "ui-state-active");
  13946. this._mouseSliding = false;
  13947. this._stop(event, this._handleIndex);
  13948. this._change(event, this._handleIndex);
  13949. this._handleIndex = null;
  13950. this._clickOffset = null;
  13951. this._animateOff = false;
  13952. return false;
  13953. },
  13954. _detectOrientation: function _detectOrientation() {
  13955. this.orientation = this.options.orientation === "vertical" ? "vertical" : "horizontal";
  13956. },
  13957. _normValueFromMouse: function _normValueFromMouse(position) {
  13958. var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse;
  13959. if (this.orientation === "horizontal") {
  13960. pixelTotal = this.elementSize.width;
  13961. pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
  13962. } else {
  13963. pixelTotal = this.elementSize.height;
  13964. pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
  13965. }
  13966. percentMouse = pixelMouse / pixelTotal;
  13967. if (percentMouse > 1) {
  13968. percentMouse = 1;
  13969. }
  13970. if (percentMouse < 0) {
  13971. percentMouse = 0;
  13972. }
  13973. if (this.orientation === "vertical") {
  13974. percentMouse = 1 - percentMouse;
  13975. }
  13976. valueTotal = this._valueMax() - this._valueMin();
  13977. valueMouse = this._valueMin() + percentMouse * valueTotal;
  13978. return this._trimAlignValue(valueMouse);
  13979. },
  13980. _uiHash: function _uiHash(index, value, values) {
  13981. var uiHash = {
  13982. handle: this.handles[index],
  13983. handleIndex: index,
  13984. value: value !== undefined ? value : this.value()
  13985. };
  13986. if (this._hasMultipleValues()) {
  13987. uiHash.value = value !== undefined ? value : this.values(index);
  13988. uiHash.values = values || this.values();
  13989. }
  13990. return uiHash;
  13991. },
  13992. _hasMultipleValues: function _hasMultipleValues() {
  13993. return this.options.values && this.options.values.length;
  13994. },
  13995. _start: function _start(event, index) {
  13996. return this._trigger("start", event, this._uiHash(index));
  13997. },
  13998. _slide: function _slide(event, index, newVal) {
  13999. var allowed,
  14000. otherVal,
  14001. currentValue = this.value(),
  14002. newValues = this.values();
  14003. if (this._hasMultipleValues()) {
  14004. otherVal = this.values(index ? 0 : 1);
  14005. currentValue = this.values(index);
  14006. if (this.options.values.length === 2 && this.options.range === true) {
  14007. newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
  14008. }
  14009. newValues[index] = newVal;
  14010. }
  14011. if (newVal === currentValue) {
  14012. return;
  14013. }
  14014. allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
  14015. // A slide can be canceled by returning false from the slide callback
  14016. if (allowed === false) {
  14017. return;
  14018. }
  14019. if (this._hasMultipleValues()) {
  14020. this.values(index, newVal);
  14021. } else {
  14022. this.value(newVal);
  14023. }
  14024. },
  14025. _stop: function _stop(event, index) {
  14026. this._trigger("stop", event, this._uiHash(index));
  14027. },
  14028. _change: function _change(event, index) {
  14029. if (!this._keySliding && !this._mouseSliding) {
  14030. //store the last changed value index for reference when handles overlap
  14031. this._lastChangedValue = index;
  14032. this._trigger("change", event, this._uiHash(index));
  14033. }
  14034. },
  14035. value: function value(newValue) {
  14036. if (arguments.length) {
  14037. this.options.value = this._trimAlignValue(newValue);
  14038. this._refreshValue();
  14039. this._change(null, 0);
  14040. return;
  14041. }
  14042. return this._value();
  14043. },
  14044. values: function values(index, newValue) {
  14045. var vals, newValues, i;
  14046. if (arguments.length > 1) {
  14047. this.options.values[index] = this._trimAlignValue(newValue);
  14048. this._refreshValue();
  14049. this._change(null, index);
  14050. return;
  14051. }
  14052. if (arguments.length) {
  14053. if ($.isArray(arguments[0])) {
  14054. vals = this.options.values;
  14055. newValues = arguments[0];
  14056. for (i = 0; i < vals.length; i += 1) {
  14057. vals[i] = this._trimAlignValue(newValues[i]);
  14058. this._change(null, i);
  14059. }
  14060. this._refreshValue();
  14061. } else {
  14062. if (this._hasMultipleValues()) {
  14063. return this._values(index);
  14064. } else {
  14065. return this.value();
  14066. }
  14067. }
  14068. } else {
  14069. return this._values();
  14070. }
  14071. },
  14072. _setOption: function _setOption(key, value) {
  14073. var i,
  14074. valsLength = 0;
  14075. if (key === "range" && this.options.range === true) {
  14076. if (value === "min") {
  14077. this.options.value = this._values(0);
  14078. this.options.values = null;
  14079. } else if (value === "max") {
  14080. this.options.value = this._values(this.options.values.length - 1);
  14081. this.options.values = null;
  14082. }
  14083. }
  14084. if ($.isArray(this.options.values)) {
  14085. valsLength = this.options.values.length;
  14086. }
  14087. this._super(key, value);
  14088. switch (key) {
  14089. case "orientation":
  14090. this._detectOrientation();
  14091. this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-" + this.orientation);
  14092. this._refreshValue();
  14093. if (this.options.range) {
  14094. this._refreshRange(value);
  14095. }
  14096. // Reset positioning from previous orientation
  14097. this.handles.css(value === "horizontal" ? "bottom" : "left", "");
  14098. break;
  14099. case "value":
  14100. this._animateOff = true;
  14101. this._refreshValue();
  14102. this._change(null, 0);
  14103. this._animateOff = false;
  14104. break;
  14105. case "values":
  14106. this._animateOff = true;
  14107. this._refreshValue();
  14108. // Start from the last handle to prevent unreachable handles (#9046)
  14109. for (i = valsLength - 1; i >= 0; i--) {
  14110. this._change(null, i);
  14111. }
  14112. this._animateOff = false;
  14113. break;
  14114. case "step":
  14115. case "min":
  14116. case "max":
  14117. this._animateOff = true;
  14118. this._calculateNewMax();
  14119. this._refreshValue();
  14120. this._animateOff = false;
  14121. break;
  14122. case "range":
  14123. this._animateOff = true;
  14124. this._refresh();
  14125. this._animateOff = false;
  14126. break;
  14127. }
  14128. },
  14129. _setOptionDisabled: function _setOptionDisabled(value) {
  14130. this._super(value);
  14131. this._toggleClass(null, "ui-state-disabled", !!value);
  14132. },
  14133. //internal value getter
  14134. // _value() returns value trimmed by min and max, aligned by step
  14135. _value: function _value() {
  14136. var val = this.options.value;
  14137. val = this._trimAlignValue(val);
  14138. return val;
  14139. },
  14140. //internal values getter
  14141. // _values() returns array of values trimmed by min and max, aligned by step
  14142. // _values( index ) returns single value trimmed by min and max, aligned by step
  14143. _values: function _values(index) {
  14144. var val, vals, i;
  14145. if (arguments.length) {
  14146. val = this.options.values[index];
  14147. val = this._trimAlignValue(val);
  14148. return val;
  14149. } else if (this._hasMultipleValues()) {
  14150. // .slice() creates a copy of the array
  14151. // this copy gets trimmed by min and max and then returned
  14152. vals = this.options.values.slice();
  14153. for (i = 0; i < vals.length; i += 1) {
  14154. vals[i] = this._trimAlignValue(vals[i]);
  14155. }
  14156. return vals;
  14157. } else {
  14158. return [];
  14159. }
  14160. },
  14161. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  14162. _trimAlignValue: function _trimAlignValue(val) {
  14163. if (val <= this._valueMin()) {
  14164. return this._valueMin();
  14165. }
  14166. if (val >= this._valueMax()) {
  14167. return this._valueMax();
  14168. }
  14169. var step = this.options.step > 0 ? this.options.step : 1,
  14170. valModStep = (val - this._valueMin()) % step,
  14171. alignValue = val - valModStep;
  14172. if (Math.abs(valModStep) * 2 >= step) {
  14173. alignValue += valModStep > 0 ? step : -step;
  14174. }
  14175. // Since JavaScript has problems with large floats, round
  14176. // the final value to 5 digits after the decimal point (see #4124)
  14177. return parseFloat(alignValue.toFixed(5));
  14178. },
  14179. _calculateNewMax: function _calculateNewMax() {
  14180. var max = this.options.max,
  14181. min = this._valueMin(),
  14182. step = this.options.step,
  14183. aboveMin = Math.round((max - min) / step) * step;
  14184. max = aboveMin + min;
  14185. if (max > this.options.max) {
  14186. //If max is not divisible by step, rounding off may increase its value
  14187. max -= step;
  14188. }
  14189. this.max = parseFloat(max.toFixed(this._precision()));
  14190. },
  14191. _precision: function _precision() {
  14192. var precision = this._precisionOf(this.options.step);
  14193. if (this.options.min !== null) {
  14194. precision = Math.max(precision, this._precisionOf(this.options.min));
  14195. }
  14196. return precision;
  14197. },
  14198. _precisionOf: function _precisionOf(num) {
  14199. var str = num.toString(),
  14200. decimal = str.indexOf(".");
  14201. return decimal === -1 ? 0 : str.length - decimal - 1;
  14202. },
  14203. _valueMin: function _valueMin() {
  14204. return this.options.min;
  14205. },
  14206. _valueMax: function _valueMax() {
  14207. return this.max;
  14208. },
  14209. _refreshRange: function _refreshRange(orientation) {
  14210. if (orientation === "vertical") {
  14211. this.range.css({ "width": "", "left": "" });
  14212. }
  14213. if (orientation === "horizontal") {
  14214. this.range.css({ "height": "", "bottom": "" });
  14215. }
  14216. },
  14217. _refreshValue: function _refreshValue() {
  14218. var lastValPercent,
  14219. valPercent,
  14220. value,
  14221. valueMin,
  14222. valueMax,
  14223. oRange = this.options.range,
  14224. o = this.options,
  14225. that = this,
  14226. animate = !this._animateOff ? o.animate : false,
  14227. _set = {};
  14228. if (this._hasMultipleValues()) {
  14229. this.handles.each(function (i) {
  14230. valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - that._valueMin()) * 100;
  14231. _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14232. $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14233. if (that.options.range === true) {
  14234. if (that.orientation === "horizontal") {
  14235. if (i === 0) {
  14236. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14237. left: valPercent + "%"
  14238. }, o.animate);
  14239. }
  14240. if (i === 1) {
  14241. that.range[animate ? "animate" : "css"]({
  14242. width: valPercent - lastValPercent + "%"
  14243. }, {
  14244. queue: false,
  14245. duration: o.animate
  14246. });
  14247. }
  14248. } else {
  14249. if (i === 0) {
  14250. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  14251. bottom: valPercent + "%"
  14252. }, o.animate);
  14253. }
  14254. if (i === 1) {
  14255. that.range[animate ? "animate" : "css"]({
  14256. height: valPercent - lastValPercent + "%"
  14257. }, {
  14258. queue: false,
  14259. duration: o.animate
  14260. });
  14261. }
  14262. }
  14263. }
  14264. lastValPercent = valPercent;
  14265. });
  14266. } else {
  14267. value = this.value();
  14268. valueMin = this._valueMin();
  14269. valueMax = this._valueMax();
  14270. valPercent = valueMax !== valueMin ? (value - valueMin) / (valueMax - valueMin) * 100 : 0;
  14271. _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  14272. this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  14273. if (oRange === "min" && this.orientation === "horizontal") {
  14274. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14275. width: valPercent + "%"
  14276. }, o.animate);
  14277. }
  14278. if (oRange === "max" && this.orientation === "horizontal") {
  14279. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14280. width: 100 - valPercent + "%"
  14281. }, o.animate);
  14282. }
  14283. if (oRange === "min" && this.orientation === "vertical") {
  14284. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14285. height: valPercent + "%"
  14286. }, o.animate);
  14287. }
  14288. if (oRange === "max" && this.orientation === "vertical") {
  14289. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  14290. height: 100 - valPercent + "%"
  14291. }, o.animate);
  14292. }
  14293. }
  14294. },
  14295. _handleEvents: {
  14296. keydown: function keydown(event) {
  14297. var allowed,
  14298. curVal,
  14299. newVal,
  14300. step,
  14301. index = $(event.target).data("ui-slider-handle-index");
  14302. switch (event.keyCode) {
  14303. case $.ui.keyCode.HOME:
  14304. case $.ui.keyCode.END:
  14305. case $.ui.keyCode.PAGE_UP:
  14306. case $.ui.keyCode.PAGE_DOWN:
  14307. case $.ui.keyCode.UP:
  14308. case $.ui.keyCode.RIGHT:
  14309. case $.ui.keyCode.DOWN:
  14310. case $.ui.keyCode.LEFT:
  14311. event.preventDefault();
  14312. if (!this._keySliding) {
  14313. this._keySliding = true;
  14314. this._addClass($(event.target), null, "ui-state-active");
  14315. allowed = this._start(event, index);
  14316. if (allowed === false) {
  14317. return;
  14318. }
  14319. }
  14320. break;
  14321. }
  14322. step = this.options.step;
  14323. if (this._hasMultipleValues()) {
  14324. curVal = newVal = this.values(index);
  14325. } else {
  14326. curVal = newVal = this.value();
  14327. }
  14328. switch (event.keyCode) {
  14329. case $.ui.keyCode.HOME:
  14330. newVal = this._valueMin();
  14331. break;
  14332. case $.ui.keyCode.END:
  14333. newVal = this._valueMax();
  14334. break;
  14335. case $.ui.keyCode.PAGE_UP:
  14336. newVal = this._trimAlignValue(curVal + (this._valueMax() - this._valueMin()) / this.numPages);
  14337. break;
  14338. case $.ui.keyCode.PAGE_DOWN:
  14339. newVal = this._trimAlignValue(curVal - (this._valueMax() - this._valueMin()) / this.numPages);
  14340. break;
  14341. case $.ui.keyCode.UP:
  14342. case $.ui.keyCode.RIGHT:
  14343. if (curVal === this._valueMax()) {
  14344. return;
  14345. }
  14346. newVal = this._trimAlignValue(curVal + step);
  14347. break;
  14348. case $.ui.keyCode.DOWN:
  14349. case $.ui.keyCode.LEFT:
  14350. if (curVal === this._valueMin()) {
  14351. return;
  14352. }
  14353. newVal = this._trimAlignValue(curVal - step);
  14354. break;
  14355. }
  14356. this._slide(event, index, newVal);
  14357. },
  14358. keyup: function keyup(event) {
  14359. var index = $(event.target).data("ui-slider-handle-index");
  14360. if (this._keySliding) {
  14361. this._keySliding = false;
  14362. this._stop(event, index);
  14363. this._change(event, index);
  14364. this._removeClass($(event.target), null, "ui-state-active");
  14365. }
  14366. }
  14367. }
  14368. });
  14369. });
  14370. /***/ }),
  14371. /* 33 */
  14372. /***/ (function(module, exports, __webpack_require__) {
  14373. "use strict";
  14374. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14375. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  14376. (function (global, factory) {
  14377. ( false ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14378. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14379. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14380. __WEBPACK_AMD_DEFINE_FACTORY__),
  14381. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : global.StickySidebar = factory();
  14382. })(undefined, function () {
  14383. 'use strict';
  14384. var _createClass = function () {
  14385. function defineProperties(target, props) {
  14386. for (var i = 0; i < props.length; i++) {
  14387. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  14388. }
  14389. }return function (Constructor, protoProps, staticProps) {
  14390. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  14391. };
  14392. }();
  14393. function _classCallCheck(instance, Constructor) {
  14394. if (!(instance instanceof Constructor)) {
  14395. throw new TypeError("Cannot call a class as a function");
  14396. }
  14397. }
  14398. /**
  14399. * Sticky Sidebar JavaScript Plugin.
  14400. * @version 3.2.0
  14401. * @author Ahmed Bouhuolia <a.bouhuolia@gmail.com>
  14402. * @license The MIT License (MIT)
  14403. */
  14404. var StickySidebar = function () {
  14405. // ---------------------------------
  14406. // # Define Constants
  14407. // ---------------------------------
  14408. //
  14409. var EVENT_KEY = '.stickySidebar';
  14410. var DEFAULTS = {
  14411. /**
  14412. * Additional top spacing of the element when it becomes sticky.
  14413. * @type {Numeric|Function}
  14414. */
  14415. topSpacing: 0,
  14416. /**
  14417. * Additional bottom spacing of the element when it becomes sticky.
  14418. * @type {Numeric|Function}
  14419. */
  14420. bottomSpacing: 0,
  14421. /**
  14422. * Container sidebar selector to know what the beginning and end of sticky element.
  14423. * @type {String|False}
  14424. */
  14425. containerSelector: false,
  14426. /**
  14427. * Inner wrapper selector.
  14428. * @type {String}
  14429. */
  14430. innerWrapperSelector: '.inner-wrapper-sticky',
  14431. /**
  14432. * The name of CSS class to apply to elements when they have become stuck.
  14433. * @type {String|False}
  14434. */
  14435. stickyClass: 'is-affixed',
  14436. /**
  14437. * Detect when sidebar and its container change height so re-calculate their dimensions.
  14438. * @type {Boolean}
  14439. */
  14440. resizeSensor: true,
  14441. /**
  14442. * The sidebar returns to its normal position if its width below this value.
  14443. * @type {Numeric}
  14444. */
  14445. minWidth: false
  14446. };
  14447. // ---------------------------------
  14448. // # Class Definition
  14449. // ---------------------------------
  14450. //
  14451. /**
  14452. * Sticky Sidebar Class.
  14453. * @public
  14454. */
  14455. var StickySidebar = function () {
  14456. /**
  14457. * Sticky Sidebar Constructor.
  14458. * @constructor
  14459. * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
  14460. * @param {Object} options - The options of sticky sidebar.
  14461. */
  14462. function StickySidebar(sidebar) {
  14463. var _this = this;
  14464. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  14465. _classCallCheck(this, StickySidebar);
  14466. this.options = StickySidebar.extend(DEFAULTS, options);
  14467. // Sidebar element query if there's no one, throw error.
  14468. this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
  14469. if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
  14470. this.sidebarInner = false;
  14471. this.container = this.sidebar.parentElement;
  14472. // Current Affix Type of sidebar element.
  14473. this.affixedType = 'STATIC';
  14474. this.direction = 'down';
  14475. this.support = {
  14476. transform: false,
  14477. transform3d: false
  14478. };
  14479. this._initialized = false;
  14480. this._breakpoint = false;
  14481. this._resizeListeners = [];
  14482. // Dimenstions of sidebar, container and screen viewport.
  14483. this.dimensions = {
  14484. translateY: 0,
  14485. topSpacing: 0,
  14486. bottomSpacing: 0,
  14487. sidebarHeight: 0,
  14488. sidebarWidth: 0,
  14489. containerTop: 0,
  14490. containerHeight: 0,
  14491. viewportHeight: 0,
  14492. viewportTop: 0,
  14493. lastViewportTop: 0
  14494. };
  14495. // Bind event handlers for referencability.
  14496. ['handleEvent'].forEach(function (method) {
  14497. _this[method] = _this[method].bind(_this);
  14498. });
  14499. // Initialize sticky sidebar for first time.
  14500. this.initialize();
  14501. }
  14502. /**
  14503. * Initializes the sticky sidebar by adding inner wrapper, define its container,
  14504. * min-width breakpoint, calculating dimenstions, adding helper classes and inline style.
  14505. * @private
  14506. */
  14507. _createClass(StickySidebar, [{
  14508. key: 'initialize',
  14509. value: function initialize() {
  14510. var _this2 = this;
  14511. this._setSupportFeatures();
  14512. // Get sticky sidebar inner wrapper, if not found, will create one.
  14513. if (this.options.innerWrapperSelector) {
  14514. this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
  14515. if (null === this.sidebarInner) this.sidebarInner = false;
  14516. }
  14517. if (!this.sidebarInner) {
  14518. var wrapper = document.createElement('div');
  14519. wrapper.setAttribute('class', 'inner-wrapper-sticky');
  14520. this.sidebar.appendChild(wrapper);
  14521. while (this.sidebar.firstChild != wrapper) {
  14522. wrapper.appendChild(this.sidebar.firstChild);
  14523. }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
  14524. }
  14525. // Container wrapper of the sidebar.
  14526. if (this.options.containerSelector) {
  14527. var containers = document.querySelectorAll(this.options.containerSelector);
  14528. containers = Array.prototype.slice.call(containers);
  14529. containers.forEach(function (container, item) {
  14530. if (!container.contains(_this2.sidebar)) return;
  14531. _this2.container = container;
  14532. });
  14533. if (!containers.length) throw new Error("The container does not contains on the sidebar.");
  14534. }
  14535. // If top/bottom spacing is not function parse value to integer.
  14536. if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
  14537. if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
  14538. // Breakdown sticky sidebar if screen width below `options.minWidth`.
  14539. this._widthBreakpoint();
  14540. // Calculate dimensions of sidebar, container and viewport.
  14541. this.calcDimensions();
  14542. // Affix sidebar in proper position.
  14543. this.stickyPosition();
  14544. // Bind all events.
  14545. this.bindEvents();
  14546. // Inform other properties the sticky sidebar is initialized.
  14547. this._initialized = true;
  14548. }
  14549. /**
  14550. * Bind all events of sticky sidebar plugin.
  14551. * @protected
  14552. */
  14553. }, {
  14554. key: 'bindEvents',
  14555. value: function bindEvents() {
  14556. window.addEventListener('resize', this, { passive: true });
  14557. window.addEventListener('scroll', this, { passive: true });
  14558. this.sidebar.addEventListener('update' + EVENT_KEY, this);
  14559. if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14560. new ResizeSensor(this.sidebarInner, this.handleEvent);
  14561. new ResizeSensor(this.container, this.handleEvent);
  14562. }
  14563. }
  14564. /**
  14565. * Handles all events of the plugin.
  14566. * @param {Object} event - Event object passed from listener.
  14567. */
  14568. }, {
  14569. key: 'handleEvent',
  14570. value: function handleEvent(event) {
  14571. this.updateSticky(event);
  14572. }
  14573. /**
  14574. * Calculates dimesntions of sidebar, container and screen viewpoint
  14575. * @public
  14576. */
  14577. }, {
  14578. key: 'calcDimensions',
  14579. value: function calcDimensions() {
  14580. if (this._breakpoint) return;
  14581. var dims = this.dimensions;
  14582. // Container of sticky sidebar dimensions.
  14583. dims.containerTop = StickySidebar.offsetRelative(this.container).top;
  14584. dims.containerHeight = this.container.clientHeight;
  14585. dims.containerBottom = dims.containerTop + dims.containerHeight;
  14586. // Sidebar dimensions.
  14587. dims.sidebarHeight = this.sidebarInner.offsetHeight;
  14588. dims.sidebarWidth = this.sidebar.offsetWidth;
  14589. // Screen viewport dimensions.
  14590. dims.viewportHeight = window.innerHeight;
  14591. this._calcDimensionsWithScroll();
  14592. }
  14593. /**
  14594. * Some dimensions values need to be up-to-date when scrolling the page.
  14595. * @private
  14596. */
  14597. }, {
  14598. key: '_calcDimensionsWithScroll',
  14599. value: function _calcDimensionsWithScroll() {
  14600. var dims = this.dimensions;
  14601. dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
  14602. dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
  14603. dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
  14604. dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  14605. dims.topSpacing = this.options.topSpacing;
  14606. dims.bottomSpacing = this.options.bottomSpacing;
  14607. if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
  14608. if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
  14609. }
  14610. /**
  14611. * Detarmine wheather the sidebar is bigger than viewport.
  14612. * @public
  14613. * @return {Boolean}
  14614. */
  14615. }, {
  14616. key: 'isSidebarFitsViewport',
  14617. value: function isSidebarFitsViewport() {
  14618. return this.dimensions.sidebarHeight < this.dimensions.viewportHeight;
  14619. }
  14620. /**
  14621. * Observe browser scrolling direction top and down.
  14622. */
  14623. }, {
  14624. key: 'observeScrollDir',
  14625. value: function observeScrollDir() {
  14626. var dims = this.dimensions;
  14627. if (dims.lastViewportTop === dims.viewportTop) return;
  14628. var furthest = 'down' === this.direction ? Math.min : Math.max;
  14629. // If the browser is scrolling not in the same direction.
  14630. if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
  14631. }
  14632. /**
  14633. * Gets affix type of sidebar according to current scrollTop and scrollLeft.
  14634. * Holds all logical affix of the sidebar when scrolling up and down and when sidebar
  14635. * is bigger than viewport and vice versa.
  14636. * @public
  14637. * @return {String|False} - Proper affix type.
  14638. */
  14639. }, {
  14640. key: 'getAffixType',
  14641. value: function getAffixType() {
  14642. var dims = this.dimensions,
  14643. affixType = false;
  14644. this._calcDimensionsWithScroll();
  14645. var sidebarBottom = dims.sidebarHeight + dims.containerTop;
  14646. var colliderTop = dims.viewportTop + dims.topSpacing;
  14647. var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
  14648. // When browser is scrolling top.
  14649. if ('up' === this.direction) {
  14650. if (colliderTop <= dims.containerTop) {
  14651. dims.translateY = 0;
  14652. affixType = 'STATIC';
  14653. } else if (colliderTop <= dims.translateY + dims.containerTop) {
  14654. dims.translateY = colliderTop - dims.containerTop;
  14655. affixType = 'VIEWPORT-TOP';
  14656. } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) {
  14657. affixType = 'VIEWPORT-UNBOTTOM';
  14658. }
  14659. // When browser is scrolling up.
  14660. } else {
  14661. // When sidebar element is not bigger than screen viewport.
  14662. if (this.isSidebarFitsViewport()) {
  14663. if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
  14664. dims.translateY = dims.containerBottom - sidebarBottom;
  14665. affixType = 'CONTAINER-BOTTOM';
  14666. } else if (colliderTop >= dims.containerTop) {
  14667. dims.translateY = colliderTop - dims.containerTop;
  14668. affixType = 'VIEWPORT-TOP';
  14669. }
  14670. // When sidebar element is bigger than screen viewport.
  14671. } else {
  14672. if (dims.containerBottom <= colliderBottom) {
  14673. dims.translateY = dims.containerBottom - sidebarBottom;
  14674. affixType = 'CONTAINER-BOTTOM';
  14675. } else if (sidebarBottom + dims.translateY <= colliderBottom) {
  14676. dims.translateY = colliderBottom - sidebarBottom;
  14677. affixType = 'VIEWPORT-BOTTOM';
  14678. } else if (dims.containerTop + dims.translateY <= colliderTop) {
  14679. affixType = 'VIEWPORT-UNBOTTOM';
  14680. }
  14681. }
  14682. }
  14683. // Make sure the translate Y is not bigger than container height.
  14684. dims.translateY = Math.max(0, dims.translateY);
  14685. dims.translateY = Math.min(dims.containerHeight, dims.translateY);
  14686. dims.lastViewportTop = dims.viewportTop;
  14687. return affixType;
  14688. }
  14689. /**
  14690. * Gets inline style of sticky sidebar wrapper and inner wrapper according
  14691. * to its affix type.
  14692. * @private
  14693. * @param {String} affixType - Affix type of sticky sidebar.
  14694. * @return {Object}
  14695. */
  14696. }, {
  14697. key: '_getStyle',
  14698. value: function _getStyle(affixType) {
  14699. if ('undefined' === typeof affixType) return;
  14700. var style = { inner: {}, outer: {} };
  14701. var dims = this.dimensions;
  14702. switch (affixType) {
  14703. case 'VIEWPORT-TOP':
  14704. style.inner = { position: 'fixed', top: this.options.topSpacing,
  14705. left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
  14706. break;
  14707. case 'VIEWPORT-BOTTOM':
  14708. style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
  14709. bottom: this.options.bottomSpacing, width: dims.sidebarWidth };
  14710. break;
  14711. case 'CONTAINER-BOTTOM':
  14712. case 'VIEWPORT-UNBOTTOM':
  14713. var translate = this._getTranslate(0, dims.translateY + 'px');
  14714. if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
  14715. break;
  14716. }
  14717. switch (affixType) {
  14718. case 'VIEWPORT-TOP':
  14719. case 'VIEWPORT-BOTTOM':
  14720. case 'VIEWPORT-UNBOTTOM':
  14721. case 'CONTAINER-BOTTOM':
  14722. style.outer = { height: dims.sidebarHeight, position: 'relative' };
  14723. break;
  14724. }
  14725. style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
  14726. style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
  14727. bottom: '', width: '', transform: this._getTranslate() }, style.inner);
  14728. return style;
  14729. }
  14730. /**
  14731. * Cause the sidebar to be sticky according to affix type by adding inline
  14732. * style, adding helper class and trigger events.
  14733. * @function
  14734. * @protected
  14735. * @param {string} force - Update sticky sidebar position by force.
  14736. */
  14737. }, {
  14738. key: 'stickyPosition',
  14739. value: function stickyPosition(force) {
  14740. if (this._breakpoint) return;
  14741. force = force || false;
  14742. var affixType = this.getAffixType();
  14743. var style = this._getStyle(affixType);
  14744. if ((this.affixedType != affixType || force) && affixType) {
  14745. var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
  14746. StickySidebar.eventTrigger(this.sidebar, affixEvent);
  14747. if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
  14748. for (var key in style.outer) {
  14749. this.sidebar.style[key] = style.outer[key];
  14750. }
  14751. for (var _key in style.inner) {
  14752. var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : '';
  14753. this.sidebarInner.style[_key] = style.inner[_key] + _unit2;
  14754. }
  14755. var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport', '') + EVENT_KEY;
  14756. StickySidebar.eventTrigger(this.sidebar, affixedEvent);
  14757. } else {
  14758. if (this._initialized) this.sidebarInner.style.left = style.inner.left;
  14759. }
  14760. this.affixedType = affixType;
  14761. }
  14762. /**
  14763. * Breakdown sticky sidebar when window width is below `options.minWidth` value.
  14764. * @protected
  14765. */
  14766. }, {
  14767. key: '_widthBreakpoint',
  14768. value: function _widthBreakpoint() {
  14769. if (window.innerWidth <= this.options.minWidth) {
  14770. this._breakpoint = true;
  14771. this.affixedType = 'STATIC';
  14772. this.sidebar.removeAttribute('style');
  14773. StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
  14774. this.sidebarInner.removeAttribute('style');
  14775. } else {
  14776. this._breakpoint = false;
  14777. }
  14778. }
  14779. /**
  14780. * Switchs between functions stack for each event type, if there's no
  14781. * event, it will re-initialize sticky sidebar.
  14782. * @public
  14783. */
  14784. }, {
  14785. key: 'updateSticky',
  14786. value: function updateSticky() {
  14787. var _this3 = this;
  14788. var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  14789. if (this._running) return;
  14790. this._running = true;
  14791. (function (eventType) {
  14792. requestAnimationFrame(function () {
  14793. switch (eventType) {
  14794. // When browser is scrolling and re-calculate just dimensions
  14795. // within scroll.
  14796. case 'scroll':
  14797. _this3._calcDimensionsWithScroll();
  14798. _this3.observeScrollDir();
  14799. _this3.stickyPosition();
  14800. break;
  14801. // When browser is resizing or there's no event, observe width
  14802. // breakpoint and re-calculate dimensions.
  14803. case 'resize':
  14804. default:
  14805. _this3._widthBreakpoint();
  14806. _this3.calcDimensions();
  14807. _this3.stickyPosition(true);
  14808. break;
  14809. }
  14810. _this3._running = false;
  14811. });
  14812. })(event.type);
  14813. }
  14814. /**
  14815. * Set browser support features to the public property.
  14816. * @private
  14817. */
  14818. }, {
  14819. key: '_setSupportFeatures',
  14820. value: function _setSupportFeatures() {
  14821. var support = this.support;
  14822. support.transform = StickySidebar.supportTransform();
  14823. support.transform3d = StickySidebar.supportTransform(true);
  14824. }
  14825. /**
  14826. * Get translate value, if the browser supports transfrom3d, it will adopt it.
  14827. * and the same with translate. if browser doesn't support both return false.
  14828. * @param {Number} y - Value of Y-axis.
  14829. * @param {Number} x - Value of X-axis.
  14830. * @param {Number} z - Value of Z-axis.
  14831. * @return {String|False}
  14832. */
  14833. }, {
  14834. key: '_getTranslate',
  14835. value: function _getTranslate() {
  14836. var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  14837. var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  14838. var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  14839. if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
  14840. }
  14841. /**
  14842. * Destroy sticky sidebar plugin.
  14843. * @public
  14844. */
  14845. }, {
  14846. key: 'destroy',
  14847. value: function destroy() {
  14848. window.removeEventListener('resize', this);
  14849. window.removeEventListener('scroll', this);
  14850. this.sidebar.classList.remove(this.options.stickyClass);
  14851. this.sidebar.style.minHeight = '';
  14852. this.sidebar.removeEventListener('update' + EVENT_KEY, this);
  14853. var styleReset = { inner: {}, outer: {} };
  14854. styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
  14855. styleReset.outer = { height: '', position: '' };
  14856. for (var key in styleReset.outer) {
  14857. this.sidebar.style[key] = styleReset.outer[key];
  14858. }for (var _key2 in styleReset.inner) {
  14859. this.sidebarInner.style[_key2] = styleReset.inner[_key2];
  14860. }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
  14861. ResizeSensor.detach(this.sidebarInner, this.handleEvent);
  14862. ResizeSensor.detach(this.container, this.handleEvent);
  14863. }
  14864. }
  14865. /**
  14866. * Detarmine if the browser supports CSS transfrom feature.
  14867. * @function
  14868. * @static
  14869. * @param {Boolean} transform3d - Detect transform with translate3d.
  14870. * @return {String}
  14871. */
  14872. }], [{
  14873. key: 'supportTransform',
  14874. value: function supportTransform(transform3d) {
  14875. var result = false,
  14876. property = transform3d ? 'perspective' : 'transform',
  14877. upper = property.charAt(0).toUpperCase() + property.slice(1),
  14878. prefixes = ['Webkit', 'Moz', 'O', 'ms'],
  14879. support = document.createElement('support'),
  14880. style = support.style;
  14881. (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
  14882. if (style[property] !== undefined) {
  14883. result = property;
  14884. return false;
  14885. }
  14886. });
  14887. return result;
  14888. }
  14889. /**
  14890. * Trigger custom event.
  14891. * @static
  14892. * @param {DOMObject} element - Target element on the DOM.
  14893. * @param {String} eventName - Event name.
  14894. * @param {Object} data -
  14895. */
  14896. }, {
  14897. key: 'eventTrigger',
  14898. value: function eventTrigger(element, eventName, data) {
  14899. try {
  14900. var event = new CustomEvent(eventName, { detail: data });
  14901. } catch (e) {
  14902. var event = document.createEvent('CustomEvent');
  14903. event.initCustomEvent(eventName, true, true, data);
  14904. }
  14905. element.dispatchEvent(event);
  14906. }
  14907. /**
  14908. * Extend options object with defaults.
  14909. * @function
  14910. * @static
  14911. */
  14912. }, {
  14913. key: 'extend',
  14914. value: function extend(defaults, options) {
  14915. var results = {};
  14916. for (var key in defaults) {
  14917. if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
  14918. }
  14919. return results;
  14920. }
  14921. /**
  14922. * Get current coordinates left and top of specific element.
  14923. * @static
  14924. */
  14925. }, {
  14926. key: 'offsetRelative',
  14927. value: function offsetRelative(element) {
  14928. var result = { left: 0, top: 0 };
  14929. do {
  14930. var offsetTop = element.offsetTop;
  14931. var offsetLeft = element.offsetLeft;
  14932. if (!isNaN(offsetTop)) result.top += offsetTop;
  14933. if (!isNaN(offsetLeft)) result.left += offsetLeft;
  14934. } while (element = element.offsetParent);
  14935. return result;
  14936. }
  14937. /**
  14938. * Add specific class name to specific element.
  14939. * @static
  14940. * @param {ObjectDOM} element
  14941. * @param {String} className
  14942. */
  14943. }, {
  14944. key: 'addClass',
  14945. value: function addClass(element, className) {
  14946. if (!StickySidebar.hasClass(element, className)) {
  14947. if (element.classList) element.classList.add(className);else element.className += ' ' + className;
  14948. }
  14949. }
  14950. /**
  14951. * Remove specific class name to specific element
  14952. * @static
  14953. * @param {ObjectDOM} element
  14954. * @param {String} className
  14955. */
  14956. }, {
  14957. key: 'removeClass',
  14958. value: function removeClass(element, className) {
  14959. if (StickySidebar.hasClass(element, className)) {
  14960. if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
  14961. }
  14962. }
  14963. /**
  14964. * Detarmine weather the element has specific class name.
  14965. * @static
  14966. * @param {ObjectDOM} element
  14967. * @param {String} className
  14968. */
  14969. }, {
  14970. key: 'hasClass',
  14971. value: function hasClass(element, className) {
  14972. if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
  14973. }
  14974. }]);
  14975. return StickySidebar;
  14976. }();
  14977. return StickySidebar;
  14978. }();
  14979. // Global
  14980. // -------------------------
  14981. window.StickySidebar = StickySidebar;
  14982. return StickySidebar;
  14983. });
  14984. //# sourceMappingURL=sticky-sidebar.js.map
  14985. /***/ }),
  14986. /* 34 */
  14987. /***/ (function(module, exports, __webpack_require__) {
  14988. "use strict";
  14989. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  14990. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  14991. /*! tether 1.4.0 */
  14992. (function (root, factory) {
  14993. if (true) {
  14994. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  14995. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14996. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  14997. __WEBPACK_AMD_DEFINE_FACTORY__),
  14998. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  14999. } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
  15000. module.exports = factory(require, exports, module);
  15001. } else {
  15002. root.Tether = factory();
  15003. }
  15004. })(undefined, function (require, exports, module) {
  15005. 'use strict';
  15006. var _createClass = function () {
  15007. function defineProperties(target, props) {
  15008. for (var i = 0; i < props.length; i++) {
  15009. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  15010. }
  15011. }return function (Constructor, protoProps, staticProps) {
  15012. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  15013. };
  15014. }();
  15015. function _classCallCheck(instance, Constructor) {
  15016. if (!(instance instanceof Constructor)) {
  15017. throw new TypeError('Cannot call a class as a function');
  15018. }
  15019. }
  15020. var TetherBase = undefined;
  15021. if (typeof TetherBase === 'undefined') {
  15022. TetherBase = { modules: [] };
  15023. }
  15024. var zeroElement = null;
  15025. // Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
  15026. // if the element lies within a nested document (<frame> or <iframe>-like).
  15027. function getActualBoundingClientRect(node) {
  15028. var boundingRect = node.getBoundingClientRect();
  15029. // The original object returned by getBoundingClientRect is immutable, so we clone it
  15030. // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
  15031. var rect = {};
  15032. for (var k in boundingRect) {
  15033. rect[k] = boundingRect[k];
  15034. }
  15035. if (node.ownerDocument !== document) {
  15036. var _frameElement = node.ownerDocument.defaultView.frameElement;
  15037. if (_frameElement) {
  15038. var frameRect = getActualBoundingClientRect(_frameElement);
  15039. rect.top += frameRect.top;
  15040. rect.bottom += frameRect.top;
  15041. rect.left += frameRect.left;
  15042. rect.right += frameRect.left;
  15043. }
  15044. }
  15045. return rect;
  15046. }
  15047. function getScrollParents(el) {
  15048. // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
  15049. // https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  15050. var computedStyle = getComputedStyle(el) || {};
  15051. var position = computedStyle.position;
  15052. var parents = [];
  15053. if (position === 'fixed') {
  15054. return [el];
  15055. }
  15056. var parent = el;
  15057. while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
  15058. var style = undefined;
  15059. try {
  15060. style = getComputedStyle(parent);
  15061. } catch (err) {}
  15062. if (typeof style === 'undefined' || style === null) {
  15063. parents.push(parent);
  15064. return parents;
  15065. }
  15066. var _style = style;
  15067. var overflow = _style.overflow;
  15068. var overflowX = _style.overflowX;
  15069. var overflowY = _style.overflowY;
  15070. if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
  15071. if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
  15072. parents.push(parent);
  15073. }
  15074. }
  15075. }
  15076. parents.push(el.ownerDocument.body);
  15077. // If the node is within a frame, account for the parent window scroll
  15078. if (el.ownerDocument !== document) {
  15079. parents.push(el.ownerDocument.defaultView);
  15080. }
  15081. return parents;
  15082. }
  15083. var uniqueId = function () {
  15084. var id = 0;
  15085. return function () {
  15086. return ++id;
  15087. };
  15088. }();
  15089. var zeroPosCache = {};
  15090. var getOrigin = function getOrigin() {
  15091. // getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
  15092. // jitter as the user scrolls that messes with our ability to detect if two positions
  15093. // are equivilant or not. We place an element at the top left of the page that will
  15094. // get the same jitter, so we can cancel the two out.
  15095. var node = zeroElement;
  15096. if (!node || !document.body.contains(node)) {
  15097. node = document.createElement('div');
  15098. node.setAttribute('data-tether-id', uniqueId());
  15099. extend(node.style, {
  15100. top: 0,
  15101. left: 0,
  15102. position: 'absolute'
  15103. });
  15104. document.body.appendChild(node);
  15105. zeroElement = node;
  15106. }
  15107. var id = node.getAttribute('data-tether-id');
  15108. if (typeof zeroPosCache[id] === 'undefined') {
  15109. zeroPosCache[id] = getActualBoundingClientRect(node);
  15110. // Clear the cache when this position call is done
  15111. defer(function () {
  15112. delete zeroPosCache[id];
  15113. });
  15114. }
  15115. return zeroPosCache[id];
  15116. };
  15117. function removeUtilElements() {
  15118. if (zeroElement) {
  15119. document.body.removeChild(zeroElement);
  15120. }
  15121. zeroElement = null;
  15122. };
  15123. function getBounds(el) {
  15124. var doc = undefined;
  15125. if (el === document) {
  15126. doc = document;
  15127. el = document.documentElement;
  15128. } else {
  15129. doc = el.ownerDocument;
  15130. }
  15131. var docEl = doc.documentElement;
  15132. var box = getActualBoundingClientRect(el);
  15133. var origin = getOrigin();
  15134. box.top -= origin.top;
  15135. box.left -= origin.left;
  15136. if (typeof box.width === 'undefined') {
  15137. box.width = document.body.scrollWidth - box.left - box.right;
  15138. }
  15139. if (typeof box.height === 'undefined') {
  15140. box.height = document.body.scrollHeight - box.top - box.bottom;
  15141. }
  15142. box.top = box.top - docEl.clientTop;
  15143. box.left = box.left - docEl.clientLeft;
  15144. box.right = doc.body.clientWidth - box.width - box.left;
  15145. box.bottom = doc.body.clientHeight - box.height - box.top;
  15146. return box;
  15147. }
  15148. function getOffsetParent(el) {
  15149. return el.offsetParent || document.documentElement;
  15150. }
  15151. var _scrollBarSize = null;
  15152. function getScrollBarSize() {
  15153. if (_scrollBarSize) {
  15154. return _scrollBarSize;
  15155. }
  15156. var inner = document.createElement('div');
  15157. inner.style.width = '100%';
  15158. inner.style.height = '200px';
  15159. var outer = document.createElement('div');
  15160. extend(outer.style, {
  15161. position: 'absolute',
  15162. top: 0,
  15163. left: 0,
  15164. pointerEvents: 'none',
  15165. visibility: 'hidden',
  15166. width: '200px',
  15167. height: '150px',
  15168. overflow: 'hidden'
  15169. });
  15170. outer.appendChild(inner);
  15171. document.body.appendChild(outer);
  15172. var widthContained = inner.offsetWidth;
  15173. outer.style.overflow = 'scroll';
  15174. var widthScroll = inner.offsetWidth;
  15175. if (widthContained === widthScroll) {
  15176. widthScroll = outer.clientWidth;
  15177. }
  15178. document.body.removeChild(outer);
  15179. var width = widthContained - widthScroll;
  15180. _scrollBarSize = { width: width, height: width };
  15181. return _scrollBarSize;
  15182. }
  15183. function extend() {
  15184. var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  15185. var args = [];
  15186. Array.prototype.push.apply(args, arguments);
  15187. args.slice(1).forEach(function (obj) {
  15188. if (obj) {
  15189. for (var key in obj) {
  15190. if ({}.hasOwnProperty.call(obj, key)) {
  15191. out[key] = obj[key];
  15192. }
  15193. }
  15194. }
  15195. });
  15196. return out;
  15197. }
  15198. function removeClass(el, name) {
  15199. if (typeof el.classList !== 'undefined') {
  15200. name.split(' ').forEach(function (cls) {
  15201. if (cls.trim()) {
  15202. el.classList.remove(cls);
  15203. }
  15204. });
  15205. } else {
  15206. var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
  15207. var className = getClassName(el).replace(regex, ' ');
  15208. setClassName(el, className);
  15209. }
  15210. }
  15211. function addClass(el, name) {
  15212. if (typeof el.classList !== 'undefined') {
  15213. name.split(' ').forEach(function (cls) {
  15214. if (cls.trim()) {
  15215. el.classList.add(cls);
  15216. }
  15217. });
  15218. } else {
  15219. removeClass(el, name);
  15220. var cls = getClassName(el) + (' ' + name);
  15221. setClassName(el, cls);
  15222. }
  15223. }
  15224. function hasClass(el, name) {
  15225. if (typeof el.classList !== 'undefined') {
  15226. return el.classList.contains(name);
  15227. }
  15228. var className = getClassName(el);
  15229. return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
  15230. }
  15231. function getClassName(el) {
  15232. // Can't use just SVGAnimatedString here since nodes within a Frame in IE have
  15233. // completely separately SVGAnimatedString base classes
  15234. if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
  15235. return el.className.baseVal;
  15236. }
  15237. return el.className;
  15238. }
  15239. function setClassName(el, className) {
  15240. el.setAttribute('class', className);
  15241. }
  15242. function updateClasses(el, add, all) {
  15243. // Of the set of 'all' classes, we need the 'add' classes, and only the
  15244. // 'add' classes to be set.
  15245. all.forEach(function (cls) {
  15246. if (add.indexOf(cls) === -1 && hasClass(el, cls)) {
  15247. removeClass(el, cls);
  15248. }
  15249. });
  15250. add.forEach(function (cls) {
  15251. if (!hasClass(el, cls)) {
  15252. addClass(el, cls);
  15253. }
  15254. });
  15255. }
  15256. var deferred = [];
  15257. var defer = function defer(fn) {
  15258. deferred.push(fn);
  15259. };
  15260. var flush = function flush() {
  15261. var fn = undefined;
  15262. while (fn = deferred.pop()) {
  15263. fn();
  15264. }
  15265. };
  15266. var Evented = function () {
  15267. function Evented() {
  15268. _classCallCheck(this, Evented);
  15269. }
  15270. _createClass(Evented, [{
  15271. key: 'on',
  15272. value: function on(event, handler, ctx) {
  15273. var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
  15274. if (typeof this.bindings === 'undefined') {
  15275. this.bindings = {};
  15276. }
  15277. if (typeof this.bindings[event] === 'undefined') {
  15278. this.bindings[event] = [];
  15279. }
  15280. this.bindings[event].push({ handler: handler, ctx: ctx, once: once });
  15281. }
  15282. }, {
  15283. key: 'once',
  15284. value: function once(event, handler, ctx) {
  15285. this.on(event, handler, ctx, true);
  15286. }
  15287. }, {
  15288. key: 'off',
  15289. value: function off(event, handler) {
  15290. if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
  15291. return;
  15292. }
  15293. if (typeof handler === 'undefined') {
  15294. delete this.bindings[event];
  15295. } else {
  15296. var i = 0;
  15297. while (i < this.bindings[event].length) {
  15298. if (this.bindings[event][i].handler === handler) {
  15299. this.bindings[event].splice(i, 1);
  15300. } else {
  15301. ++i;
  15302. }
  15303. }
  15304. }
  15305. }
  15306. }, {
  15307. key: 'trigger',
  15308. value: function trigger(event) {
  15309. if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
  15310. var i = 0;
  15311. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  15312. args[_key - 1] = arguments[_key];
  15313. }
  15314. while (i < this.bindings[event].length) {
  15315. var _bindings$event$i = this.bindings[event][i];
  15316. var handler = _bindings$event$i.handler;
  15317. var ctx = _bindings$event$i.ctx;
  15318. var once = _bindings$event$i.once;
  15319. var context = ctx;
  15320. if (typeof context === 'undefined') {
  15321. context = this;
  15322. }
  15323. handler.apply(context, args);
  15324. if (once) {
  15325. this.bindings[event].splice(i, 1);
  15326. } else {
  15327. ++i;
  15328. }
  15329. }
  15330. }
  15331. }
  15332. }]);
  15333. return Evented;
  15334. }();
  15335. TetherBase.Utils = {
  15336. getActualBoundingClientRect: getActualBoundingClientRect,
  15337. getScrollParents: getScrollParents,
  15338. getBounds: getBounds,
  15339. getOffsetParent: getOffsetParent,
  15340. extend: extend,
  15341. addClass: addClass,
  15342. removeClass: removeClass,
  15343. hasClass: hasClass,
  15344. updateClasses: updateClasses,
  15345. defer: defer,
  15346. flush: flush,
  15347. uniqueId: uniqueId,
  15348. Evented: Evented,
  15349. getScrollBarSize: getScrollBarSize,
  15350. removeUtilElements: removeUtilElements
  15351. };
  15352. /* globals TetherBase, performance */
  15353. 'use strict';
  15354. var _slicedToArray = function () {
  15355. function sliceIterator(arr, i) {
  15356. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  15357. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  15358. _arr.push(_s.value);if (i && _arr.length === i) break;
  15359. }
  15360. } catch (err) {
  15361. _d = true;_e = err;
  15362. } finally {
  15363. try {
  15364. if (!_n && _i['return']) _i['return']();
  15365. } finally {
  15366. if (_d) throw _e;
  15367. }
  15368. }return _arr;
  15369. }return function (arr, i) {
  15370. if (Array.isArray(arr)) {
  15371. return arr;
  15372. } else if (Symbol.iterator in Object(arr)) {
  15373. return sliceIterator(arr, i);
  15374. } else {
  15375. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  15376. }
  15377. };
  15378. }();
  15379. var _createClass = function () {
  15380. function defineProperties(target, props) {
  15381. for (var i = 0; i < props.length; i++) {
  15382. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  15383. }
  15384. }return function (Constructor, protoProps, staticProps) {
  15385. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  15386. };
  15387. }();
  15388. var _get = function get(_x6, _x7, _x8) {
  15389. var _again = true;_function: while (_again) {
  15390. var object = _x6,
  15391. property = _x7,
  15392. receiver = _x8;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
  15393. var parent = Object.getPrototypeOf(object);if (parent === null) {
  15394. return undefined;
  15395. } else {
  15396. _x6 = parent;_x7 = property;_x8 = receiver;_again = true;desc = parent = undefined;continue _function;
  15397. }
  15398. } else if ('value' in desc) {
  15399. return desc.value;
  15400. } else {
  15401. var getter = desc.get;if (getter === undefined) {
  15402. return undefined;
  15403. }return getter.call(receiver);
  15404. }
  15405. }
  15406. };
  15407. function _classCallCheck(instance, Constructor) {
  15408. if (!(instance instanceof Constructor)) {
  15409. throw new TypeError('Cannot call a class as a function');
  15410. }
  15411. }
  15412. function _inherits(subClass, superClass) {
  15413. if (typeof superClass !== 'function' && superClass !== null) {
  15414. throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
  15415. }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  15416. }
  15417. if (typeof TetherBase === 'undefined') {
  15418. throw new Error('You must include the utils.js file before tether.js');
  15419. }
  15420. var _TetherBase$Utils = TetherBase.Utils;
  15421. var getScrollParents = _TetherBase$Utils.getScrollParents;
  15422. var getBounds = _TetherBase$Utils.getBounds;
  15423. var getOffsetParent = _TetherBase$Utils.getOffsetParent;
  15424. var extend = _TetherBase$Utils.extend;
  15425. var addClass = _TetherBase$Utils.addClass;
  15426. var removeClass = _TetherBase$Utils.removeClass;
  15427. var updateClasses = _TetherBase$Utils.updateClasses;
  15428. var defer = _TetherBase$Utils.defer;
  15429. var flush = _TetherBase$Utils.flush;
  15430. var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
  15431. var removeUtilElements = _TetherBase$Utils.removeUtilElements;
  15432. function within(a, b) {
  15433. var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
  15434. return a + diff >= b && b >= a - diff;
  15435. }
  15436. var transformKey = function () {
  15437. if (typeof document === 'undefined') {
  15438. return '';
  15439. }
  15440. var el = document.createElement('div');
  15441. var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
  15442. for (var i = 0; i < transforms.length; ++i) {
  15443. var key = transforms[i];
  15444. if (el.style[key] !== undefined) {
  15445. return key;
  15446. }
  15447. }
  15448. }();
  15449. var tethers = [];
  15450. var position = function position() {
  15451. tethers.forEach(function (tether) {
  15452. tether.position(false);
  15453. });
  15454. flush();
  15455. };
  15456. function now() {
  15457. if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
  15458. return performance.now();
  15459. }
  15460. return +new Date();
  15461. }
  15462. (function () {
  15463. var lastCall = null;
  15464. var lastDuration = null;
  15465. var pendingTimeout = null;
  15466. var tick = function tick() {
  15467. if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
  15468. // We voluntarily throttle ourselves if we can't manage 60fps
  15469. lastDuration = Math.min(lastDuration - 16, 250);
  15470. // Just in case this is the last event, remember to position just once more
  15471. pendingTimeout = setTimeout(tick, 250);
  15472. return;
  15473. }
  15474. if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
  15475. // Some browsers call events a little too frequently, refuse to run more than is reasonable
  15476. return;
  15477. }
  15478. if (pendingTimeout != null) {
  15479. clearTimeout(pendingTimeout);
  15480. pendingTimeout = null;
  15481. }
  15482. lastCall = now();
  15483. position();
  15484. lastDuration = now() - lastCall;
  15485. };
  15486. if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
  15487. ['resize', 'scroll', 'touchmove'].forEach(function (event) {
  15488. window.addEventListener(event, tick);
  15489. });
  15490. }
  15491. })();
  15492. var MIRROR_LR = {
  15493. center: 'center',
  15494. left: 'right',
  15495. right: 'left'
  15496. };
  15497. var MIRROR_TB = {
  15498. middle: 'middle',
  15499. top: 'bottom',
  15500. bottom: 'top'
  15501. };
  15502. var OFFSET_MAP = {
  15503. top: 0,
  15504. left: 0,
  15505. middle: '50%',
  15506. center: '50%',
  15507. bottom: '100%',
  15508. right: '100%'
  15509. };
  15510. var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
  15511. var left = attachment.left;
  15512. var top = attachment.top;
  15513. if (left === 'auto') {
  15514. left = MIRROR_LR[relativeToAttachment.left];
  15515. }
  15516. if (top === 'auto') {
  15517. top = MIRROR_TB[relativeToAttachment.top];
  15518. }
  15519. return { left: left, top: top };
  15520. };
  15521. var attachmentToOffset = function attachmentToOffset(attachment) {
  15522. var left = attachment.left;
  15523. var top = attachment.top;
  15524. if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
  15525. left = OFFSET_MAP[attachment.left];
  15526. }
  15527. if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
  15528. top = OFFSET_MAP[attachment.top];
  15529. }
  15530. return { left: left, top: top };
  15531. };
  15532. function addOffset() {
  15533. var out = { top: 0, left: 0 };
  15534. for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
  15535. offsets[_key] = arguments[_key];
  15536. }
  15537. offsets.forEach(function (_ref) {
  15538. var top = _ref.top;
  15539. var left = _ref.left;
  15540. if (typeof top === 'string') {
  15541. top = parseFloat(top, 10);
  15542. }
  15543. if (typeof left === 'string') {
  15544. left = parseFloat(left, 10);
  15545. }
  15546. out.top += top;
  15547. out.left += left;
  15548. });
  15549. return out;
  15550. }
  15551. function offsetToPx(offset, size) {
  15552. if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
  15553. offset.left = parseFloat(offset.left, 10) / 100 * size.width;
  15554. }
  15555. if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
  15556. offset.top = parseFloat(offset.top, 10) / 100 * size.height;
  15557. }
  15558. return offset;
  15559. }
  15560. var parseOffset = function parseOffset(value) {
  15561. var _value$split = value.split(' ');
  15562. var _value$split2 = _slicedToArray(_value$split, 2);
  15563. var top = _value$split2[0];
  15564. var left = _value$split2[1];
  15565. return { top: top, left: left };
  15566. };
  15567. var parseAttachment = parseOffset;
  15568. var TetherClass = function (_Evented) {
  15569. _inherits(TetherClass, _Evented);
  15570. function TetherClass(options) {
  15571. var _this = this;
  15572. _classCallCheck(this, TetherClass);
  15573. _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
  15574. this.position = this.position.bind(this);
  15575. tethers.push(this);
  15576. this.history = [];
  15577. this.setOptions(options, false);
  15578. TetherBase.modules.forEach(function (module) {
  15579. if (typeof module.initialize !== 'undefined') {
  15580. module.initialize.call(_this);
  15581. }
  15582. });
  15583. this.position();
  15584. }
  15585. _createClass(TetherClass, [{
  15586. key: 'getClass',
  15587. value: function getClass() {
  15588. var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  15589. var classes = this.options.classes;
  15590. if (typeof classes !== 'undefined' && classes[key]) {
  15591. return this.options.classes[key];
  15592. } else if (this.options.classPrefix) {
  15593. return this.options.classPrefix + '-' + key;
  15594. } else {
  15595. return key;
  15596. }
  15597. }
  15598. }, {
  15599. key: 'setOptions',
  15600. value: function setOptions(options) {
  15601. var _this2 = this;
  15602. var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
  15603. var defaults = {
  15604. offset: '0 0',
  15605. targetOffset: '0 0',
  15606. targetAttachment: 'auto auto',
  15607. classPrefix: 'tether'
  15608. };
  15609. this.options = extend(defaults, options);
  15610. var _options = this.options;
  15611. var element = _options.element;
  15612. var target = _options.target;
  15613. var targetModifier = _options.targetModifier;
  15614. this.element = element;
  15615. this.target = target;
  15616. this.targetModifier = targetModifier;
  15617. if (this.target === 'viewport') {
  15618. this.target = document.body;
  15619. this.targetModifier = 'visible';
  15620. } else if (this.target === 'scroll-handle') {
  15621. this.target = document.body;
  15622. this.targetModifier = 'scroll-handle';
  15623. }
  15624. ['element', 'target'].forEach(function (key) {
  15625. if (typeof _this2[key] === 'undefined') {
  15626. throw new Error('Tether Error: Both element and target must be defined');
  15627. }
  15628. if (typeof _this2[key].jquery !== 'undefined') {
  15629. _this2[key] = _this2[key][0];
  15630. } else if (typeof _this2[key] === 'string') {
  15631. _this2[key] = document.querySelector(_this2[key]);
  15632. }
  15633. });
  15634. addClass(this.element, this.getClass('element'));
  15635. if (!(this.options.addTargetClasses === false)) {
  15636. addClass(this.target, this.getClass('target'));
  15637. }
  15638. if (!this.options.attachment) {
  15639. throw new Error('Tether Error: You must provide an attachment');
  15640. }
  15641. this.targetAttachment = parseAttachment(this.options.targetAttachment);
  15642. this.attachment = parseAttachment(this.options.attachment);
  15643. this.offset = parseOffset(this.options.offset);
  15644. this.targetOffset = parseOffset(this.options.targetOffset);
  15645. if (typeof this.scrollParents !== 'undefined') {
  15646. this.disable();
  15647. }
  15648. if (this.targetModifier === 'scroll-handle') {
  15649. this.scrollParents = [this.target];
  15650. } else {
  15651. this.scrollParents = getScrollParents(this.target);
  15652. }
  15653. if (!(this.options.enabled === false)) {
  15654. this.enable(pos);
  15655. }
  15656. }
  15657. }, {
  15658. key: 'getTargetBounds',
  15659. value: function getTargetBounds() {
  15660. if (typeof this.targetModifier !== 'undefined') {
  15661. if (this.targetModifier === 'visible') {
  15662. if (this.target === document.body) {
  15663. return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
  15664. } else {
  15665. var bounds = getBounds(this.target);
  15666. var out = {
  15667. height: bounds.height,
  15668. width: bounds.width,
  15669. top: bounds.top,
  15670. left: bounds.left
  15671. };
  15672. out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
  15673. out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
  15674. out.height = Math.min(innerHeight, out.height);
  15675. out.height -= 2;
  15676. out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
  15677. out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
  15678. out.width = Math.min(innerWidth, out.width);
  15679. out.width -= 2;
  15680. if (out.top < pageYOffset) {
  15681. out.top = pageYOffset;
  15682. }
  15683. if (out.left < pageXOffset) {
  15684. out.left = pageXOffset;
  15685. }
  15686. return out;
  15687. }
  15688. } else if (this.targetModifier === 'scroll-handle') {
  15689. var bounds = undefined;
  15690. var target = this.target;
  15691. if (target === document.body) {
  15692. target = document.documentElement;
  15693. bounds = {
  15694. left: pageXOffset,
  15695. top: pageYOffset,
  15696. height: innerHeight,
  15697. width: innerWidth
  15698. };
  15699. } else {
  15700. bounds = getBounds(target);
  15701. }
  15702. var style = getComputedStyle(target);
  15703. var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
  15704. var scrollBottom = 0;
  15705. if (hasBottomScroll) {
  15706. scrollBottom = 15;
  15707. }
  15708. var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
  15709. var out = {
  15710. width: 15,
  15711. height: height * 0.975 * (height / target.scrollHeight),
  15712. left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
  15713. };
  15714. var fitAdj = 0;
  15715. if (height < 408 && this.target === document.body) {
  15716. fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
  15717. }
  15718. if (this.target !== document.body) {
  15719. out.height = Math.max(out.height, 24);
  15720. }
  15721. var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
  15722. out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
  15723. if (this.target === document.body) {
  15724. out.height = Math.max(out.height, 24);
  15725. }
  15726. return out;
  15727. }
  15728. } else {
  15729. return getBounds(this.target);
  15730. }
  15731. }
  15732. }, {
  15733. key: 'clearCache',
  15734. value: function clearCache() {
  15735. this._cache = {};
  15736. }
  15737. }, {
  15738. key: 'cache',
  15739. value: function cache(k, getter) {
  15740. // More than one module will often need the same DOM info, so
  15741. // we keep a cache which is cleared on each position call
  15742. if (typeof this._cache === 'undefined') {
  15743. this._cache = {};
  15744. }
  15745. if (typeof this._cache[k] === 'undefined') {
  15746. this._cache[k] = getter.call(this);
  15747. }
  15748. return this._cache[k];
  15749. }
  15750. }, {
  15751. key: 'enable',
  15752. value: function enable() {
  15753. var _this3 = this;
  15754. var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15755. if (!(this.options.addTargetClasses === false)) {
  15756. addClass(this.target, this.getClass('enabled'));
  15757. }
  15758. addClass(this.element, this.getClass('enabled'));
  15759. this.enabled = true;
  15760. this.scrollParents.forEach(function (parent) {
  15761. if (parent !== _this3.target.ownerDocument) {
  15762. parent.addEventListener('scroll', _this3.position);
  15763. }
  15764. });
  15765. if (pos) {
  15766. this.position();
  15767. }
  15768. }
  15769. }, {
  15770. key: 'disable',
  15771. value: function disable() {
  15772. var _this4 = this;
  15773. removeClass(this.target, this.getClass('enabled'));
  15774. removeClass(this.element, this.getClass('enabled'));
  15775. this.enabled = false;
  15776. if (typeof this.scrollParents !== 'undefined') {
  15777. this.scrollParents.forEach(function (parent) {
  15778. parent.removeEventListener('scroll', _this4.position);
  15779. });
  15780. }
  15781. }
  15782. }, {
  15783. key: 'destroy',
  15784. value: function destroy() {
  15785. var _this5 = this;
  15786. this.disable();
  15787. tethers.forEach(function (tether, i) {
  15788. if (tether === _this5) {
  15789. tethers.splice(i, 1);
  15790. }
  15791. });
  15792. // Remove any elements we were using for convenience from the DOM
  15793. if (tethers.length === 0) {
  15794. removeUtilElements();
  15795. }
  15796. }
  15797. }, {
  15798. key: 'updateAttachClasses',
  15799. value: function updateAttachClasses(elementAttach, targetAttach) {
  15800. var _this6 = this;
  15801. elementAttach = elementAttach || this.attachment;
  15802. targetAttach = targetAttach || this.targetAttachment;
  15803. var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
  15804. if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
  15805. // updateAttachClasses can be called more than once in a position call, so
  15806. // we need to clean up after ourselves such that when the last defer gets
  15807. // ran it doesn't add any extra classes from previous calls.
  15808. this._addAttachClasses.splice(0, this._addAttachClasses.length);
  15809. }
  15810. if (typeof this._addAttachClasses === 'undefined') {
  15811. this._addAttachClasses = [];
  15812. }
  15813. var add = this._addAttachClasses;
  15814. if (elementAttach.top) {
  15815. add.push(this.getClass('element-attached') + '-' + elementAttach.top);
  15816. }
  15817. if (elementAttach.left) {
  15818. add.push(this.getClass('element-attached') + '-' + elementAttach.left);
  15819. }
  15820. if (targetAttach.top) {
  15821. add.push(this.getClass('target-attached') + '-' + targetAttach.top);
  15822. }
  15823. if (targetAttach.left) {
  15824. add.push(this.getClass('target-attached') + '-' + targetAttach.left);
  15825. }
  15826. var all = [];
  15827. sides.forEach(function (side) {
  15828. all.push(_this6.getClass('element-attached') + '-' + side);
  15829. all.push(_this6.getClass('target-attached') + '-' + side);
  15830. });
  15831. defer(function () {
  15832. if (!(typeof _this6._addAttachClasses !== 'undefined')) {
  15833. return;
  15834. }
  15835. updateClasses(_this6.element, _this6._addAttachClasses, all);
  15836. if (!(_this6.options.addTargetClasses === false)) {
  15837. updateClasses(_this6.target, _this6._addAttachClasses, all);
  15838. }
  15839. delete _this6._addAttachClasses;
  15840. });
  15841. }
  15842. }, {
  15843. key: 'position',
  15844. value: function position() {
  15845. var _this7 = this;
  15846. var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  15847. // flushChanges commits the changes immediately, leave true unless you are positioning multiple
  15848. // tethers (in which case call Tether.Utils.flush yourself when you're done)
  15849. if (!this.enabled) {
  15850. return;
  15851. }
  15852. this.clearCache();
  15853. // Turn 'auto' attachments into the appropriate corner or edge
  15854. var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
  15855. this.updateAttachClasses(this.attachment, targetAttachment);
  15856. var elementPos = this.cache('element-bounds', function () {
  15857. return getBounds(_this7.element);
  15858. });
  15859. var width = elementPos.width;
  15860. var height = elementPos.height;
  15861. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  15862. var _lastSize = this.lastSize;
  15863. // We cache the height and width to make it possible to position elements that are
  15864. // getting hidden.
  15865. width = _lastSize.width;
  15866. height = _lastSize.height;
  15867. } else {
  15868. this.lastSize = { width: width, height: height };
  15869. }
  15870. var targetPos = this.cache('target-bounds', function () {
  15871. return _this7.getTargetBounds();
  15872. });
  15873. var targetSize = targetPos;
  15874. // Get an actual px offset from the attachment
  15875. var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
  15876. var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
  15877. var manualOffset = offsetToPx(this.offset, { width: width, height: height });
  15878. var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
  15879. // Add the manually provided offset
  15880. offset = addOffset(offset, manualOffset);
  15881. targetOffset = addOffset(targetOffset, manualTargetOffset);
  15882. // It's now our goal to make (element position + offset) == (target position + target offset)
  15883. var left = targetPos.left + targetOffset.left - offset.left;
  15884. var top = targetPos.top + targetOffset.top - offset.top;
  15885. for (var i = 0; i < TetherBase.modules.length; ++i) {
  15886. var _module2 = TetherBase.modules[i];
  15887. var ret = _module2.position.call(this, {
  15888. left: left,
  15889. top: top,
  15890. targetAttachment: targetAttachment,
  15891. targetPos: targetPos,
  15892. elementPos: elementPos,
  15893. offset: offset,
  15894. targetOffset: targetOffset,
  15895. manualOffset: manualOffset,
  15896. manualTargetOffset: manualTargetOffset,
  15897. scrollbarSize: scrollbarSize,
  15898. attachment: this.attachment
  15899. });
  15900. if (ret === false) {
  15901. return false;
  15902. } else if (typeof ret === 'undefined' || (typeof ret === 'undefined' ? 'undefined' : _typeof(ret)) !== 'object') {
  15903. continue;
  15904. } else {
  15905. top = ret.top;
  15906. left = ret.left;
  15907. }
  15908. }
  15909. // We describe the position three different ways to give the optimizer
  15910. // a chance to decide the best possible way to position the element
  15911. // with the fewest repaints.
  15912. var next = {
  15913. // It's position relative to the page (absolute positioning when
  15914. // the element is a child of the body)
  15915. page: {
  15916. top: top,
  15917. left: left
  15918. },
  15919. // It's position relative to the viewport (fixed positioning)
  15920. viewport: {
  15921. top: top - pageYOffset,
  15922. bottom: pageYOffset - top - height + innerHeight,
  15923. left: left - pageXOffset,
  15924. right: pageXOffset - left - width + innerWidth
  15925. }
  15926. };
  15927. var doc = this.target.ownerDocument;
  15928. var win = doc.defaultView;
  15929. var scrollbarSize = undefined;
  15930. if (win.innerHeight > doc.documentElement.clientHeight) {
  15931. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15932. next.viewport.bottom -= scrollbarSize.height;
  15933. }
  15934. if (win.innerWidth > doc.documentElement.clientWidth) {
  15935. scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
  15936. next.viewport.right -= scrollbarSize.width;
  15937. }
  15938. if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
  15939. // Absolute positioning in the body will be relative to the page, not the 'initial containing block'
  15940. next.page.bottom = doc.body.scrollHeight - top - height;
  15941. next.page.right = doc.body.scrollWidth - left - width;
  15942. }
  15943. if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
  15944. (function () {
  15945. var offsetParent = _this7.cache('target-offsetparent', function () {
  15946. return getOffsetParent(_this7.target);
  15947. });
  15948. var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
  15949. return getBounds(offsetParent);
  15950. });
  15951. var offsetParentStyle = getComputedStyle(offsetParent);
  15952. var offsetParentSize = offsetPosition;
  15953. var offsetBorder = {};
  15954. ['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
  15955. offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
  15956. });
  15957. offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
  15958. offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
  15959. if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
  15960. if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
  15961. // We're within the visible part of the target's scroll parent
  15962. var scrollTop = offsetParent.scrollTop;
  15963. var scrollLeft = offsetParent.scrollLeft;
  15964. // It's position relative to the target's offset parent (absolute positioning when
  15965. // the element is moved to be a child of the target's offset parent).
  15966. next.offset = {
  15967. top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
  15968. left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
  15969. };
  15970. }
  15971. }
  15972. })();
  15973. }
  15974. // We could also travel up the DOM and try each containing context, rather than only
  15975. // looking at the body, but we're gonna get diminishing returns.
  15976. this.move(next);
  15977. this.history.unshift(next);
  15978. if (this.history.length > 3) {
  15979. this.history.pop();
  15980. }
  15981. if (flushChanges) {
  15982. flush();
  15983. }
  15984. return true;
  15985. }
  15986. // THE ISSUE
  15987. }, {
  15988. key: 'move',
  15989. value: function move(pos) {
  15990. var _this8 = this;
  15991. if (!(typeof this.element.parentNode !== 'undefined')) {
  15992. return;
  15993. }
  15994. var same = {};
  15995. for (var type in pos) {
  15996. same[type] = {};
  15997. for (var key in pos[type]) {
  15998. var found = false;
  15999. for (var i = 0; i < this.history.length; ++i) {
  16000. var point = this.history[i];
  16001. if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
  16002. found = true;
  16003. break;
  16004. }
  16005. }
  16006. if (!found) {
  16007. same[type][key] = true;
  16008. }
  16009. }
  16010. }
  16011. var css = { top: '', left: '', right: '', bottom: '' };
  16012. var transcribe = function transcribe(_same, _pos) {
  16013. var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
  16014. var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
  16015. if (gpu !== false) {
  16016. var yPos = undefined,
  16017. xPos = undefined;
  16018. if (_same.top) {
  16019. css.top = 0;
  16020. yPos = _pos.top;
  16021. } else {
  16022. css.bottom = 0;
  16023. yPos = -_pos.bottom;
  16024. }
  16025. if (_same.left) {
  16026. css.left = 0;
  16027. xPos = _pos.left;
  16028. } else {
  16029. css.right = 0;
  16030. xPos = -_pos.right;
  16031. }
  16032. if (window.matchMedia) {
  16033. // HubSpot/tether#207
  16034. 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;
  16035. if (!retina) {
  16036. xPos = Math.round(xPos);
  16037. yPos = Math.round(yPos);
  16038. }
  16039. }
  16040. css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
  16041. if (transformKey !== 'msTransform') {
  16042. // The Z transform will keep this in the GPU (faster, and prevents artifacts),
  16043. // but IE9 doesn't support 3d transforms and will choke.
  16044. css[transformKey] += " translateZ(0)";
  16045. }
  16046. } else {
  16047. if (_same.top) {
  16048. css.top = _pos.top + 'px';
  16049. } else {
  16050. css.bottom = _pos.bottom + 'px';
  16051. }
  16052. if (_same.left) {
  16053. css.left = _pos.left + 'px';
  16054. } else {
  16055. css.right = _pos.right + 'px';
  16056. }
  16057. }
  16058. };
  16059. var moved = false;
  16060. if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
  16061. css.position = 'absolute';
  16062. transcribe(same.page, pos.page);
  16063. } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
  16064. css.position = 'fixed';
  16065. transcribe(same.viewport, pos.viewport);
  16066. } else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
  16067. (function () {
  16068. css.position = 'absolute';
  16069. var offsetParent = _this8.cache('target-offsetparent', function () {
  16070. return getOffsetParent(_this8.target);
  16071. });
  16072. if (getOffsetParent(_this8.element) !== offsetParent) {
  16073. defer(function () {
  16074. _this8.element.parentNode.removeChild(_this8.element);
  16075. offsetParent.appendChild(_this8.element);
  16076. });
  16077. }
  16078. transcribe(same.offset, pos.offset);
  16079. moved = true;
  16080. })();
  16081. } else {
  16082. css.position = 'absolute';
  16083. transcribe({ top: true, left: true }, pos.page);
  16084. }
  16085. if (!moved) {
  16086. if (this.options.bodyElement) {
  16087. this.options.bodyElement.appendChild(this.element);
  16088. } else {
  16089. var offsetParentIsBody = true;
  16090. var currentNode = this.element.parentNode;
  16091. while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
  16092. if (getComputedStyle(currentNode).position !== 'static') {
  16093. offsetParentIsBody = false;
  16094. break;
  16095. }
  16096. currentNode = currentNode.parentNode;
  16097. }
  16098. if (!offsetParentIsBody) {
  16099. this.element.parentNode.removeChild(this.element);
  16100. this.element.ownerDocument.body.appendChild(this.element);
  16101. }
  16102. }
  16103. }
  16104. // Any css change will trigger a repaint, so let's avoid one if nothing changed
  16105. var writeCSS = {};
  16106. var write = false;
  16107. for (var key in css) {
  16108. var val = css[key];
  16109. var elVal = this.element.style[key];
  16110. if (elVal !== val) {
  16111. write = true;
  16112. writeCSS[key] = val;
  16113. }
  16114. }
  16115. if (write) {
  16116. defer(function () {
  16117. extend(_this8.element.style, writeCSS);
  16118. _this8.trigger('repositioned');
  16119. });
  16120. }
  16121. }
  16122. }]);
  16123. return TetherClass;
  16124. }(Evented);
  16125. TetherClass.modules = [];
  16126. TetherBase.position = position;
  16127. var Tether = extend(TetherClass, TetherBase);
  16128. /* globals TetherBase */
  16129. 'use strict';
  16130. var _slicedToArray = function () {
  16131. function sliceIterator(arr, i) {
  16132. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16133. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16134. _arr.push(_s.value);if (i && _arr.length === i) break;
  16135. }
  16136. } catch (err) {
  16137. _d = true;_e = err;
  16138. } finally {
  16139. try {
  16140. if (!_n && _i['return']) _i['return']();
  16141. } finally {
  16142. if (_d) throw _e;
  16143. }
  16144. }return _arr;
  16145. }return function (arr, i) {
  16146. if (Array.isArray(arr)) {
  16147. return arr;
  16148. } else if (Symbol.iterator in Object(arr)) {
  16149. return sliceIterator(arr, i);
  16150. } else {
  16151. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16152. }
  16153. };
  16154. }();
  16155. var _TetherBase$Utils = TetherBase.Utils;
  16156. var getBounds = _TetherBase$Utils.getBounds;
  16157. var extend = _TetherBase$Utils.extend;
  16158. var updateClasses = _TetherBase$Utils.updateClasses;
  16159. var defer = _TetherBase$Utils.defer;
  16160. var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
  16161. function getBoundingRect(tether, to) {
  16162. if (to === 'scrollParent') {
  16163. to = tether.scrollParents[0];
  16164. } else if (to === 'window') {
  16165. to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
  16166. }
  16167. if (to === document) {
  16168. to = to.documentElement;
  16169. }
  16170. if (typeof to.nodeType !== 'undefined') {
  16171. (function () {
  16172. var node = to;
  16173. var size = getBounds(to);
  16174. var pos = size;
  16175. var style = getComputedStyle(to);
  16176. to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
  16177. // Account any parent Frames scroll offset
  16178. if (node.ownerDocument !== document) {
  16179. var win = node.ownerDocument.defaultView;
  16180. to[0] += win.pageXOffset;
  16181. to[1] += win.pageYOffset;
  16182. to[2] += win.pageXOffset;
  16183. to[3] += win.pageYOffset;
  16184. }
  16185. BOUNDS_FORMAT.forEach(function (side, i) {
  16186. side = side[0].toUpperCase() + side.substr(1);
  16187. if (side === 'Top' || side === 'Left') {
  16188. to[i] += parseFloat(style['border' + side + 'Width']);
  16189. } else {
  16190. to[i] -= parseFloat(style['border' + side + 'Width']);
  16191. }
  16192. });
  16193. })();
  16194. }
  16195. return to;
  16196. }
  16197. TetherBase.modules.push({
  16198. position: function position(_ref) {
  16199. var _this = this;
  16200. var top = _ref.top;
  16201. var left = _ref.left;
  16202. var targetAttachment = _ref.targetAttachment;
  16203. if (!this.options.constraints) {
  16204. return true;
  16205. }
  16206. var _cache = this.cache('element-bounds', function () {
  16207. return getBounds(_this.element);
  16208. });
  16209. var height = _cache.height;
  16210. var width = _cache.width;
  16211. if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
  16212. var _lastSize = this.lastSize;
  16213. // Handle the item getting hidden as a result of our positioning without glitching
  16214. // the classes in and out
  16215. width = _lastSize.width;
  16216. height = _lastSize.height;
  16217. }
  16218. var targetSize = this.cache('target-bounds', function () {
  16219. return _this.getTargetBounds();
  16220. });
  16221. var targetHeight = targetSize.height;
  16222. var targetWidth = targetSize.width;
  16223. var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
  16224. this.options.constraints.forEach(function (constraint) {
  16225. var outOfBoundsClass = constraint.outOfBoundsClass;
  16226. var pinnedClass = constraint.pinnedClass;
  16227. if (outOfBoundsClass) {
  16228. allClasses.push(outOfBoundsClass);
  16229. }
  16230. if (pinnedClass) {
  16231. allClasses.push(pinnedClass);
  16232. }
  16233. });
  16234. allClasses.forEach(function (cls) {
  16235. ['left', 'top', 'right', 'bottom'].forEach(function (side) {
  16236. allClasses.push(cls + '-' + side);
  16237. });
  16238. });
  16239. var addClasses = [];
  16240. var tAttachment = extend({}, targetAttachment);
  16241. var eAttachment = extend({}, this.attachment);
  16242. this.options.constraints.forEach(function (constraint) {
  16243. var to = constraint.to;
  16244. var attachment = constraint.attachment;
  16245. var pin = constraint.pin;
  16246. if (typeof attachment === 'undefined') {
  16247. attachment = '';
  16248. }
  16249. var changeAttachX = undefined,
  16250. changeAttachY = undefined;
  16251. if (attachment.indexOf(' ') >= 0) {
  16252. var _attachment$split = attachment.split(' ');
  16253. var _attachment$split2 = _slicedToArray(_attachment$split, 2);
  16254. changeAttachY = _attachment$split2[0];
  16255. changeAttachX = _attachment$split2[1];
  16256. } else {
  16257. changeAttachX = changeAttachY = attachment;
  16258. }
  16259. var bounds = getBoundingRect(_this, to);
  16260. if (changeAttachY === 'target' || changeAttachY === 'both') {
  16261. if (top < bounds[1] && tAttachment.top === 'top') {
  16262. top += targetHeight;
  16263. tAttachment.top = 'bottom';
  16264. }
  16265. if (top + height > bounds[3] && tAttachment.top === 'bottom') {
  16266. top -= targetHeight;
  16267. tAttachment.top = 'top';
  16268. }
  16269. }
  16270. if (changeAttachY === 'together') {
  16271. if (tAttachment.top === 'top') {
  16272. if (eAttachment.top === 'bottom' && top < bounds[1]) {
  16273. top += targetHeight;
  16274. tAttachment.top = 'bottom';
  16275. top += height;
  16276. eAttachment.top = 'top';
  16277. } else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
  16278. top -= height - targetHeight;
  16279. tAttachment.top = 'bottom';
  16280. eAttachment.top = 'bottom';
  16281. }
  16282. }
  16283. if (tAttachment.top === 'bottom') {
  16284. if (eAttachment.top === 'top' && top + height > bounds[3]) {
  16285. top -= targetHeight;
  16286. tAttachment.top = 'top';
  16287. top -= height;
  16288. eAttachment.top = 'bottom';
  16289. } else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
  16290. top += height - targetHeight;
  16291. tAttachment.top = 'top';
  16292. eAttachment.top = 'top';
  16293. }
  16294. }
  16295. if (tAttachment.top === 'middle') {
  16296. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16297. top -= height;
  16298. eAttachment.top = 'bottom';
  16299. } else if (top < bounds[1] && eAttachment.top === 'bottom') {
  16300. top += height;
  16301. eAttachment.top = 'top';
  16302. }
  16303. }
  16304. }
  16305. if (changeAttachX === 'target' || changeAttachX === 'both') {
  16306. if (left < bounds[0] && tAttachment.left === 'left') {
  16307. left += targetWidth;
  16308. tAttachment.left = 'right';
  16309. }
  16310. if (left + width > bounds[2] && tAttachment.left === 'right') {
  16311. left -= targetWidth;
  16312. tAttachment.left = 'left';
  16313. }
  16314. }
  16315. if (changeAttachX === 'together') {
  16316. if (left < bounds[0] && tAttachment.left === 'left') {
  16317. if (eAttachment.left === 'right') {
  16318. left += targetWidth;
  16319. tAttachment.left = 'right';
  16320. left += width;
  16321. eAttachment.left = 'left';
  16322. } else if (eAttachment.left === 'left') {
  16323. left += targetWidth;
  16324. tAttachment.left = 'right';
  16325. left -= width;
  16326. eAttachment.left = 'right';
  16327. }
  16328. } else if (left + width > bounds[2] && tAttachment.left === 'right') {
  16329. if (eAttachment.left === 'left') {
  16330. left -= targetWidth;
  16331. tAttachment.left = 'left';
  16332. left -= width;
  16333. eAttachment.left = 'right';
  16334. } else if (eAttachment.left === 'right') {
  16335. left -= targetWidth;
  16336. tAttachment.left = 'left';
  16337. left += width;
  16338. eAttachment.left = 'left';
  16339. }
  16340. } else if (tAttachment.left === 'center') {
  16341. if (left + width > bounds[2] && eAttachment.left === 'left') {
  16342. left -= width;
  16343. eAttachment.left = 'right';
  16344. } else if (left < bounds[0] && eAttachment.left === 'right') {
  16345. left += width;
  16346. eAttachment.left = 'left';
  16347. }
  16348. }
  16349. }
  16350. if (changeAttachY === 'element' || changeAttachY === 'both') {
  16351. if (top < bounds[1] && eAttachment.top === 'bottom') {
  16352. top += height;
  16353. eAttachment.top = 'top';
  16354. }
  16355. if (top + height > bounds[3] && eAttachment.top === 'top') {
  16356. top -= height;
  16357. eAttachment.top = 'bottom';
  16358. }
  16359. }
  16360. if (changeAttachX === 'element' || changeAttachX === 'both') {
  16361. if (left < bounds[0]) {
  16362. if (eAttachment.left === 'right') {
  16363. left += width;
  16364. eAttachment.left = 'left';
  16365. } else if (eAttachment.left === 'center') {
  16366. left += width / 2;
  16367. eAttachment.left = 'left';
  16368. }
  16369. }
  16370. if (left + width > bounds[2]) {
  16371. if (eAttachment.left === 'left') {
  16372. left -= width;
  16373. eAttachment.left = 'right';
  16374. } else if (eAttachment.left === 'center') {
  16375. left -= width / 2;
  16376. eAttachment.left = 'right';
  16377. }
  16378. }
  16379. }
  16380. if (typeof pin === 'string') {
  16381. pin = pin.split(',').map(function (p) {
  16382. return p.trim();
  16383. });
  16384. } else if (pin === true) {
  16385. pin = ['top', 'left', 'right', 'bottom'];
  16386. }
  16387. pin = pin || [];
  16388. var pinned = [];
  16389. var oob = [];
  16390. if (top < bounds[1]) {
  16391. if (pin.indexOf('top') >= 0) {
  16392. top = bounds[1];
  16393. pinned.push('top');
  16394. } else {
  16395. oob.push('top');
  16396. }
  16397. }
  16398. if (top + height > bounds[3]) {
  16399. if (pin.indexOf('bottom') >= 0) {
  16400. top = bounds[3] - height;
  16401. pinned.push('bottom');
  16402. } else {
  16403. oob.push('bottom');
  16404. }
  16405. }
  16406. if (left < bounds[0]) {
  16407. if (pin.indexOf('left') >= 0) {
  16408. left = bounds[0];
  16409. pinned.push('left');
  16410. } else {
  16411. oob.push('left');
  16412. }
  16413. }
  16414. if (left + width > bounds[2]) {
  16415. if (pin.indexOf('right') >= 0) {
  16416. left = bounds[2] - width;
  16417. pinned.push('right');
  16418. } else {
  16419. oob.push('right');
  16420. }
  16421. }
  16422. if (pinned.length) {
  16423. (function () {
  16424. var pinnedClass = undefined;
  16425. if (typeof _this.options.pinnedClass !== 'undefined') {
  16426. pinnedClass = _this.options.pinnedClass;
  16427. } else {
  16428. pinnedClass = _this.getClass('pinned');
  16429. }
  16430. addClasses.push(pinnedClass);
  16431. pinned.forEach(function (side) {
  16432. addClasses.push(pinnedClass + '-' + side);
  16433. });
  16434. })();
  16435. }
  16436. if (oob.length) {
  16437. (function () {
  16438. var oobClass = undefined;
  16439. if (typeof _this.options.outOfBoundsClass !== 'undefined') {
  16440. oobClass = _this.options.outOfBoundsClass;
  16441. } else {
  16442. oobClass = _this.getClass('out-of-bounds');
  16443. }
  16444. addClasses.push(oobClass);
  16445. oob.forEach(function (side) {
  16446. addClasses.push(oobClass + '-' + side);
  16447. });
  16448. })();
  16449. }
  16450. if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
  16451. eAttachment.left = tAttachment.left = false;
  16452. }
  16453. if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
  16454. eAttachment.top = tAttachment.top = false;
  16455. }
  16456. if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
  16457. _this.updateAttachClasses(eAttachment, tAttachment);
  16458. _this.trigger('update', {
  16459. attachment: eAttachment,
  16460. targetAttachment: tAttachment
  16461. });
  16462. }
  16463. });
  16464. defer(function () {
  16465. if (!(_this.options.addTargetClasses === false)) {
  16466. updateClasses(_this.target, addClasses, allClasses);
  16467. }
  16468. updateClasses(_this.element, addClasses, allClasses);
  16469. });
  16470. return { top: top, left: left };
  16471. }
  16472. });
  16473. /* globals TetherBase */
  16474. 'use strict';
  16475. var _TetherBase$Utils = TetherBase.Utils;
  16476. var getBounds = _TetherBase$Utils.getBounds;
  16477. var updateClasses = _TetherBase$Utils.updateClasses;
  16478. var defer = _TetherBase$Utils.defer;
  16479. TetherBase.modules.push({
  16480. position: function position(_ref) {
  16481. var _this = this;
  16482. var top = _ref.top;
  16483. var left = _ref.left;
  16484. var _cache = this.cache('element-bounds', function () {
  16485. return getBounds(_this.element);
  16486. });
  16487. var height = _cache.height;
  16488. var width = _cache.width;
  16489. var targetPos = this.getTargetBounds();
  16490. var bottom = top + height;
  16491. var right = left + width;
  16492. var abutted = [];
  16493. if (top <= targetPos.bottom && bottom >= targetPos.top) {
  16494. ['left', 'right'].forEach(function (side) {
  16495. var targetPosSide = targetPos[side];
  16496. if (targetPosSide === left || targetPosSide === right) {
  16497. abutted.push(side);
  16498. }
  16499. });
  16500. }
  16501. if (left <= targetPos.right && right >= targetPos.left) {
  16502. ['top', 'bottom'].forEach(function (side) {
  16503. var targetPosSide = targetPos[side];
  16504. if (targetPosSide === top || targetPosSide === bottom) {
  16505. abutted.push(side);
  16506. }
  16507. });
  16508. }
  16509. var allClasses = [];
  16510. var addClasses = [];
  16511. var sides = ['left', 'top', 'right', 'bottom'];
  16512. allClasses.push(this.getClass('abutted'));
  16513. sides.forEach(function (side) {
  16514. allClasses.push(_this.getClass('abutted') + '-' + side);
  16515. });
  16516. if (abutted.length) {
  16517. addClasses.push(this.getClass('abutted'));
  16518. }
  16519. abutted.forEach(function (side) {
  16520. addClasses.push(_this.getClass('abutted') + '-' + side);
  16521. });
  16522. defer(function () {
  16523. if (!(_this.options.addTargetClasses === false)) {
  16524. updateClasses(_this.target, addClasses, allClasses);
  16525. }
  16526. updateClasses(_this.element, addClasses, allClasses);
  16527. });
  16528. return true;
  16529. }
  16530. });
  16531. /* globals TetherBase */
  16532. 'use strict';
  16533. var _slicedToArray = function () {
  16534. function sliceIterator(arr, i) {
  16535. var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
  16536. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  16537. _arr.push(_s.value);if (i && _arr.length === i) break;
  16538. }
  16539. } catch (err) {
  16540. _d = true;_e = err;
  16541. } finally {
  16542. try {
  16543. if (!_n && _i['return']) _i['return']();
  16544. } finally {
  16545. if (_d) throw _e;
  16546. }
  16547. }return _arr;
  16548. }return function (arr, i) {
  16549. if (Array.isArray(arr)) {
  16550. return arr;
  16551. } else if (Symbol.iterator in Object(arr)) {
  16552. return sliceIterator(arr, i);
  16553. } else {
  16554. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  16555. }
  16556. };
  16557. }();
  16558. TetherBase.modules.push({
  16559. position: function position(_ref) {
  16560. var top = _ref.top;
  16561. var left = _ref.left;
  16562. if (!this.options.shift) {
  16563. return;
  16564. }
  16565. var shift = this.options.shift;
  16566. if (typeof this.options.shift === 'function') {
  16567. shift = this.options.shift.call(this, { top: top, left: left });
  16568. }
  16569. var shiftTop = undefined,
  16570. shiftLeft = undefined;
  16571. if (typeof shift === 'string') {
  16572. shift = shift.split(' ');
  16573. shift[1] = shift[1] || shift[0];
  16574. var _shift = shift;
  16575. var _shift2 = _slicedToArray(_shift, 2);
  16576. shiftTop = _shift2[0];
  16577. shiftLeft = _shift2[1];
  16578. shiftTop = parseFloat(shiftTop, 10);
  16579. shiftLeft = parseFloat(shiftLeft, 10);
  16580. } else {
  16581. shiftTop = shift.top;
  16582. shiftLeft = shift.left;
  16583. }
  16584. top += shiftTop;
  16585. left += shiftLeft;
  16586. return { top: top, left: left };
  16587. }
  16588. });
  16589. return Tether;
  16590. });
  16591. /***/ }),
  16592. /* 35 */
  16593. /***/ (function(module, exports, __webpack_require__) {
  16594. "use strict";
  16595. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  16596. /*
  16597. * Toastr
  16598. * Copyright 2012-2015
  16599. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  16600. * All Rights Reserved.
  16601. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  16602. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  16603. *
  16604. * ARIA Support: Greta Krafsig
  16605. *
  16606. * Project: https://github.com/CodeSeven/toastr
  16607. */
  16608. /* global define */
  16609. (function (define) {
  16610. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1)], __WEBPACK_AMD_DEFINE_RESULT__ = function ($) {
  16611. return function () {
  16612. var $container;
  16613. var listener;
  16614. var toastId = 0;
  16615. var toastType = {
  16616. error: 'error',
  16617. info: 'info',
  16618. success: 'success',
  16619. warning: 'warning'
  16620. };
  16621. var toastr = {
  16622. clear: clear,
  16623. remove: remove,
  16624. error: error,
  16625. getContainer: getContainer,
  16626. info: info,
  16627. options: {},
  16628. subscribe: subscribe,
  16629. success: success,
  16630. version: '2.1.3',
  16631. warning: warning
  16632. };
  16633. var previousToast;
  16634. return toastr;
  16635. ////////////////
  16636. function error(message, title, optionsOverride) {
  16637. return notify({
  16638. type: toastType.error,
  16639. iconClass: getOptions().iconClasses.error,
  16640. message: message,
  16641. optionsOverride: optionsOverride,
  16642. title: title
  16643. });
  16644. }
  16645. function getContainer(options, create) {
  16646. if (!options) {
  16647. options = getOptions();
  16648. }
  16649. $container = $('#' + options.containerId);
  16650. if ($container.length) {
  16651. return $container;
  16652. }
  16653. if (create) {
  16654. $container = createContainer(options);
  16655. }
  16656. return $container;
  16657. }
  16658. function info(message, title, optionsOverride) {
  16659. return notify({
  16660. type: toastType.info,
  16661. iconClass: getOptions().iconClasses.info,
  16662. message: message,
  16663. optionsOverride: optionsOverride,
  16664. title: title
  16665. });
  16666. }
  16667. function subscribe(callback) {
  16668. listener = callback;
  16669. }
  16670. function success(message, title, optionsOverride) {
  16671. return notify({
  16672. type: toastType.success,
  16673. iconClass: getOptions().iconClasses.success,
  16674. message: message,
  16675. optionsOverride: optionsOverride,
  16676. title: title
  16677. });
  16678. }
  16679. function warning(message, title, optionsOverride) {
  16680. return notify({
  16681. type: toastType.warning,
  16682. iconClass: getOptions().iconClasses.warning,
  16683. message: message,
  16684. optionsOverride: optionsOverride,
  16685. title: title
  16686. });
  16687. }
  16688. function clear($toastElement, clearOptions) {
  16689. var options = getOptions();
  16690. if (!$container) {
  16691. getContainer(options);
  16692. }
  16693. if (!clearToast($toastElement, options, clearOptions)) {
  16694. clearContainer(options);
  16695. }
  16696. }
  16697. function remove($toastElement) {
  16698. var options = getOptions();
  16699. if (!$container) {
  16700. getContainer(options);
  16701. }
  16702. if ($toastElement && $(':focus', $toastElement).length === 0) {
  16703. removeToast($toastElement);
  16704. return;
  16705. }
  16706. if ($container.children().length) {
  16707. $container.remove();
  16708. }
  16709. }
  16710. // internal functions
  16711. function clearContainer(options) {
  16712. var toastsToClear = $container.children();
  16713. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  16714. clearToast($(toastsToClear[i]), options);
  16715. }
  16716. }
  16717. function clearToast($toastElement, options, clearOptions) {
  16718. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  16719. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  16720. $toastElement[options.hideMethod]({
  16721. duration: options.hideDuration,
  16722. easing: options.hideEasing,
  16723. complete: function complete() {
  16724. removeToast($toastElement);
  16725. }
  16726. });
  16727. return true;
  16728. }
  16729. return false;
  16730. }
  16731. function createContainer(options) {
  16732. $container = $('<div/>').attr('id', options.containerId).addClass(options.positionClass);
  16733. $container.appendTo($(options.target));
  16734. return $container;
  16735. }
  16736. function getDefaults() {
  16737. return {
  16738. tapToDismiss: true,
  16739. toastClass: 'toast',
  16740. containerId: 'toast-container',
  16741. debug: false,
  16742. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  16743. showDuration: 300,
  16744. showEasing: 'swing', //swing and linear are built into jQuery
  16745. onShown: undefined,
  16746. hideMethod: 'fadeOut',
  16747. hideDuration: 1000,
  16748. hideEasing: 'swing',
  16749. onHidden: undefined,
  16750. closeMethod: false,
  16751. closeDuration: false,
  16752. closeEasing: false,
  16753. closeOnHover: true,
  16754. extendedTimeOut: 1000,
  16755. iconClasses: {
  16756. error: 'toast-error',
  16757. info: 'toast-info',
  16758. success: 'toast-success',
  16759. warning: 'toast-warning'
  16760. },
  16761. iconClass: 'toast-info',
  16762. positionClass: 'toast-top-right',
  16763. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  16764. titleClass: 'toast-title',
  16765. messageClass: 'toast-message',
  16766. escapeHtml: false,
  16767. target: 'body',
  16768. closeHtml: '<button type="button">&times;</button>',
  16769. closeClass: 'toast-close-button',
  16770. newestOnTop: true,
  16771. preventDuplicates: false,
  16772. progressBar: false,
  16773. progressClass: 'toast-progress',
  16774. rtl: false
  16775. };
  16776. }
  16777. function publish(args) {
  16778. if (!listener) {
  16779. return;
  16780. }
  16781. listener(args);
  16782. }
  16783. function notify(map) {
  16784. var options = getOptions();
  16785. var iconClass = map.iconClass || options.iconClass;
  16786. if (typeof map.optionsOverride !== 'undefined') {
  16787. options = $.extend(options, map.optionsOverride);
  16788. iconClass = map.optionsOverride.iconClass || iconClass;
  16789. }
  16790. if (shouldExit(options, map)) {
  16791. return;
  16792. }
  16793. toastId++;
  16794. $container = getContainer(options, true);
  16795. var intervalId = null;
  16796. var $toastElement = $('<div/>');
  16797. var $titleElement = $('<div/>');
  16798. var $messageElement = $('<div/>');
  16799. var $progressElement = $('<div/>');
  16800. var $closeElement = $(options.closeHtml);
  16801. var progressBar = {
  16802. intervalId: null,
  16803. hideEta: null,
  16804. maxHideTime: null
  16805. };
  16806. var response = {
  16807. toastId: toastId,
  16808. state: 'visible',
  16809. startTime: new Date(),
  16810. options: options,
  16811. map: map
  16812. };
  16813. personalizeToast();
  16814. displayToast();
  16815. handleEvents();
  16816. publish(response);
  16817. if (options.debug && console) {
  16818. console.log(response);
  16819. }
  16820. return $toastElement;
  16821. function escapeHtml(source) {
  16822. if (source == null) {
  16823. source = '';
  16824. }
  16825. return source.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  16826. }
  16827. function personalizeToast() {
  16828. setIcon();
  16829. setTitle();
  16830. setMessage();
  16831. setCloseButton();
  16832. setProgressBar();
  16833. setRTL();
  16834. setSequence();
  16835. setAria();
  16836. }
  16837. function setAria() {
  16838. var ariaValue = '';
  16839. switch (map.iconClass) {
  16840. case 'toast-success':
  16841. case 'toast-info':
  16842. ariaValue = 'polite';
  16843. break;
  16844. default:
  16845. ariaValue = 'assertive';
  16846. }
  16847. $toastElement.attr('aria-live', ariaValue);
  16848. }
  16849. function handleEvents() {
  16850. if (options.closeOnHover) {
  16851. $toastElement.hover(stickAround, delayedHideToast);
  16852. }
  16853. if (!options.onclick && options.tapToDismiss) {
  16854. $toastElement.click(hideToast);
  16855. }
  16856. if (options.closeButton && $closeElement) {
  16857. $closeElement.click(function (event) {
  16858. if (event.stopPropagation) {
  16859. event.stopPropagation();
  16860. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  16861. event.cancelBubble = true;
  16862. }
  16863. if (options.onCloseClick) {
  16864. options.onCloseClick(event);
  16865. }
  16866. hideToast(true);
  16867. });
  16868. }
  16869. if (options.onclick) {
  16870. $toastElement.click(function (event) {
  16871. options.onclick(event);
  16872. hideToast();
  16873. });
  16874. }
  16875. }
  16876. function displayToast() {
  16877. $toastElement.hide();
  16878. $toastElement[options.showMethod]({ duration: options.showDuration, easing: options.showEasing, complete: options.onShown });
  16879. if (options.timeOut > 0) {
  16880. intervalId = setTimeout(hideToast, options.timeOut);
  16881. progressBar.maxHideTime = parseFloat(options.timeOut);
  16882. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16883. if (options.progressBar) {
  16884. progressBar.intervalId = setInterval(updateProgress, 10);
  16885. }
  16886. }
  16887. }
  16888. function setIcon() {
  16889. if (map.iconClass) {
  16890. $toastElement.addClass(options.toastClass).addClass(iconClass).addClass('mg-toast');
  16891. }
  16892. }
  16893. function setSequence() {
  16894. if (options.newestOnTop) {
  16895. $container.prepend($toastElement);
  16896. } else {
  16897. $container.append($toastElement);
  16898. }
  16899. }
  16900. function setTitle() {
  16901. if (map.title) {
  16902. var suffix = map.title;
  16903. if (options.escapeHtml) {
  16904. suffix = escapeHtml(map.title);
  16905. }
  16906. $titleElement.append(suffix).addClass(options.titleClass);
  16907. $toastElement.append($titleElement);
  16908. }
  16909. }
  16910. function setMessage() {
  16911. if (map.message) {
  16912. var suffix = map.message;
  16913. if (options.escapeHtml) {
  16914. suffix = escapeHtml(map.message);
  16915. }
  16916. $messageElement.append(suffix).addClass(options.messageClass);
  16917. $toastElement.append($messageElement);
  16918. }
  16919. }
  16920. function setCloseButton() {
  16921. if (options.closeButton) {
  16922. $closeElement.addClass(options.closeClass).attr('role', 'button');
  16923. $toastElement.prepend($closeElement);
  16924. }
  16925. }
  16926. function setProgressBar() {
  16927. if (options.progressBar) {
  16928. $progressElement.addClass(options.progressClass);
  16929. $toastElement.prepend($progressElement);
  16930. }
  16931. }
  16932. function setRTL() {
  16933. if (options.rtl) {
  16934. $toastElement.addClass('rtl');
  16935. }
  16936. }
  16937. function shouldExit(options, map) {
  16938. if (options.preventDuplicates) {
  16939. if (map.message === previousToast) {
  16940. return true;
  16941. } else {
  16942. previousToast = map.message;
  16943. }
  16944. }
  16945. return false;
  16946. }
  16947. function hideToast(override) {
  16948. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  16949. var duration = override && options.closeDuration !== false ? options.closeDuration : options.hideDuration;
  16950. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  16951. if ($(':focus', $toastElement).length && !override) {
  16952. return;
  16953. }
  16954. clearTimeout(progressBar.intervalId);
  16955. return $toastElement[method]({
  16956. duration: duration,
  16957. easing: easing,
  16958. complete: function complete() {
  16959. removeToast($toastElement);
  16960. clearTimeout(intervalId);
  16961. if (options.onHidden && response.state !== 'hidden') {
  16962. options.onHidden();
  16963. }
  16964. response.state = 'hidden';
  16965. response.endTime = new Date();
  16966. publish(response);
  16967. }
  16968. });
  16969. }
  16970. function delayedHideToast() {
  16971. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  16972. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  16973. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  16974. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  16975. }
  16976. }
  16977. function stickAround() {
  16978. clearTimeout(intervalId);
  16979. progressBar.hideEta = 0;
  16980. $toastElement.stop(true, true)[options.showMethod]({ duration: options.showDuration, easing: options.showEasing });
  16981. }
  16982. function updateProgress() {
  16983. var percentage = (progressBar.hideEta - new Date().getTime()) / progressBar.maxHideTime * 100;
  16984. $progressElement.width(percentage + '%');
  16985. }
  16986. }
  16987. function getOptions() {
  16988. return $.extend({}, getDefaults(), toastr.options);
  16989. }
  16990. function removeToast($toastElement) {
  16991. if (!$container) {
  16992. $container = getContainer();
  16993. }
  16994. if ($toastElement.is(':visible')) {
  16995. return;
  16996. }
  16997. $toastElement.remove();
  16998. $toastElement = null;
  16999. if ($container.children().length === 0) {
  17000. $container.remove();
  17001. previousToast = undefined;
  17002. }
  17003. }
  17004. }();
  17005. }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17006. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17007. })(__webpack_require__(36));
  17008. /***/ }),
  17009. /* 36 */
  17010. /***/ (function(module, exports) {
  17011. module.exports = function() {
  17012. throw new Error("define cannot be used indirect");
  17013. };
  17014. /***/ })
  17015. /******/ ]);