0
0

swiper-bundle.js 300 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428
  1. /**
  2. * Swiper 6.3.5
  3. * Most modern mobile touch slider and framework with hardware accelerated transitions
  4. * https://swiperjs.com
  5. *
  6. * Copyright 2014-2020 Vladimir Kharlampidi
  7. *
  8. * Released under the MIT License
  9. *
  10. * Released on: October 30, 2020
  11. */
  12. (function (global, factory) {
  13. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  14. typeof define === 'function' && define.amd ? define(factory) :
  15. (global = global || self, global.Swiper = factory());
  16. }(this, (function () { 'use strict';
  17. function _defineProperties(target, props) {
  18. for (var i = 0; i < props.length; i++) {
  19. var descriptor = props[i];
  20. descriptor.enumerable = descriptor.enumerable || false;
  21. descriptor.configurable = true;
  22. if ("value" in descriptor) descriptor.writable = true;
  23. Object.defineProperty(target, descriptor.key, descriptor);
  24. }
  25. }
  26. function _createClass(Constructor, protoProps, staticProps) {
  27. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  28. if (staticProps) _defineProperties(Constructor, staticProps);
  29. return Constructor;
  30. }
  31. function _extends() {
  32. _extends = Object.assign || function (target) {
  33. for (var i = 1; i < arguments.length; i++) {
  34. var source = arguments[i];
  35. for (var key in source) {
  36. if (Object.prototype.hasOwnProperty.call(source, key)) {
  37. target[key] = source[key];
  38. }
  39. }
  40. }
  41. return target;
  42. };
  43. return _extends.apply(this, arguments);
  44. }
  45. /**
  46. * SSR Window 3.0.0-alpha.4
  47. * Better handling for window object in SSR environment
  48. * https://github.com/nolimits4web/ssr-window
  49. *
  50. * Copyright 2020, Vladimir Kharlampidi
  51. *
  52. * Licensed under MIT
  53. *
  54. * Released on: May 20, 2020
  55. */
  56. /* eslint-disable no-param-reassign */
  57. function isObject(obj) {
  58. return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object;
  59. }
  60. function extend(target, src) {
  61. if (target === void 0) {
  62. target = {};
  63. }
  64. if (src === void 0) {
  65. src = {};
  66. }
  67. Object.keys(src).forEach(function (key) {
  68. if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {
  69. extend(target[key], src[key]);
  70. }
  71. });
  72. }
  73. var ssrDocument = {
  74. body: {},
  75. addEventListener: function addEventListener() {},
  76. removeEventListener: function removeEventListener() {},
  77. activeElement: {
  78. blur: function blur() {},
  79. nodeName: ''
  80. },
  81. querySelector: function querySelector() {
  82. return null;
  83. },
  84. querySelectorAll: function querySelectorAll() {
  85. return [];
  86. },
  87. getElementById: function getElementById() {
  88. return null;
  89. },
  90. createEvent: function createEvent() {
  91. return {
  92. initEvent: function initEvent() {}
  93. };
  94. },
  95. createElement: function createElement() {
  96. return {
  97. children: [],
  98. childNodes: [],
  99. style: {},
  100. setAttribute: function setAttribute() {},
  101. getElementsByTagName: function getElementsByTagName() {
  102. return [];
  103. }
  104. };
  105. },
  106. createElementNS: function createElementNS() {
  107. return {};
  108. },
  109. importNode: function importNode() {
  110. return null;
  111. },
  112. location: {
  113. hash: '',
  114. host: '',
  115. hostname: '',
  116. href: '',
  117. origin: '',
  118. pathname: '',
  119. protocol: '',
  120. search: ''
  121. }
  122. };
  123. function getDocument() {
  124. var doc = typeof document !== 'undefined' ? document : {};
  125. extend(doc, ssrDocument);
  126. return doc;
  127. }
  128. var ssrWindow = {
  129. document: ssrDocument,
  130. navigator: {
  131. userAgent: ''
  132. },
  133. location: {
  134. hash: '',
  135. host: '',
  136. hostname: '',
  137. href: '',
  138. origin: '',
  139. pathname: '',
  140. protocol: '',
  141. search: ''
  142. },
  143. history: {
  144. replaceState: function replaceState() {},
  145. pushState: function pushState() {},
  146. go: function go() {},
  147. back: function back() {}
  148. },
  149. CustomEvent: function CustomEvent() {
  150. return this;
  151. },
  152. addEventListener: function addEventListener() {},
  153. removeEventListener: function removeEventListener() {},
  154. getComputedStyle: function getComputedStyle() {
  155. return {
  156. getPropertyValue: function getPropertyValue() {
  157. return '';
  158. }
  159. };
  160. },
  161. Image: function Image() {},
  162. Date: function Date() {},
  163. screen: {},
  164. setTimeout: function setTimeout() {},
  165. clearTimeout: function clearTimeout() {},
  166. matchMedia: function matchMedia() {
  167. return {};
  168. },
  169. requestAnimationFrame: function requestAnimationFrame(callback) {
  170. if (typeof setTimeout === 'undefined') {
  171. callback();
  172. return null;
  173. }
  174. return setTimeout(callback, 0);
  175. },
  176. cancelAnimationFrame: function cancelAnimationFrame(id) {
  177. if (typeof setTimeout === 'undefined') {
  178. return;
  179. }
  180. clearTimeout(id);
  181. }
  182. };
  183. function getWindow() {
  184. var win = typeof window !== 'undefined' ? window : {};
  185. extend(win, ssrWindow);
  186. return win;
  187. }
  188. /**
  189. * Dom7 3.0.0-alpha.7
  190. * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
  191. * https://framework7.io/docs/dom7.html
  192. *
  193. * Copyright 2020, Vladimir Kharlampidi
  194. *
  195. * Licensed under MIT
  196. *
  197. * Released on: July 14, 2020
  198. */
  199. function _inheritsLoose(subClass, superClass) {
  200. subClass.prototype = Object.create(superClass.prototype);
  201. subClass.prototype.constructor = subClass;
  202. subClass.__proto__ = superClass;
  203. }
  204. function _getPrototypeOf(o) {
  205. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  206. return o.__proto__ || Object.getPrototypeOf(o);
  207. };
  208. return _getPrototypeOf(o);
  209. }
  210. function _setPrototypeOf(o, p) {
  211. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  212. o.__proto__ = p;
  213. return o;
  214. };
  215. return _setPrototypeOf(o, p);
  216. }
  217. function _isNativeReflectConstruct() {
  218. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  219. if (Reflect.construct.sham) return false;
  220. if (typeof Proxy === "function") return true;
  221. try {
  222. Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
  223. return true;
  224. } catch (e) {
  225. return false;
  226. }
  227. }
  228. function _construct(Parent, args, Class) {
  229. if (_isNativeReflectConstruct()) {
  230. _construct = Reflect.construct;
  231. } else {
  232. _construct = function _construct(Parent, args, Class) {
  233. var a = [null];
  234. a.push.apply(a, args);
  235. var Constructor = Function.bind.apply(Parent, a);
  236. var instance = new Constructor();
  237. if (Class) _setPrototypeOf(instance, Class.prototype);
  238. return instance;
  239. };
  240. }
  241. return _construct.apply(null, arguments);
  242. }
  243. function _isNativeFunction(fn) {
  244. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  245. }
  246. function _wrapNativeSuper(Class) {
  247. var _cache = typeof Map === "function" ? new Map() : undefined;
  248. _wrapNativeSuper = function _wrapNativeSuper(Class) {
  249. if (Class === null || !_isNativeFunction(Class)) return Class;
  250. if (typeof Class !== "function") {
  251. throw new TypeError("Super expression must either be null or a function");
  252. }
  253. if (typeof _cache !== "undefined") {
  254. if (_cache.has(Class)) return _cache.get(Class);
  255. _cache.set(Class, Wrapper);
  256. }
  257. function Wrapper() {
  258. return _construct(Class, arguments, _getPrototypeOf(this).constructor);
  259. }
  260. Wrapper.prototype = Object.create(Class.prototype, {
  261. constructor: {
  262. value: Wrapper,
  263. enumerable: false,
  264. writable: true,
  265. configurable: true
  266. }
  267. });
  268. return _setPrototypeOf(Wrapper, Class);
  269. };
  270. return _wrapNativeSuper(Class);
  271. }
  272. function _assertThisInitialized(self) {
  273. if (self === void 0) {
  274. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  275. }
  276. return self;
  277. }
  278. /* eslint-disable no-proto */
  279. function makeReactive(obj) {
  280. var proto = obj.__proto__;
  281. Object.defineProperty(obj, '__proto__', {
  282. get: function get() {
  283. return proto;
  284. },
  285. set: function set(value) {
  286. proto.__proto__ = value;
  287. }
  288. });
  289. }
  290. var Dom7 = /*#__PURE__*/function (_Array) {
  291. _inheritsLoose(Dom7, _Array);
  292. function Dom7(items) {
  293. var _this;
  294. _this = _Array.call.apply(_Array, [this].concat(items)) || this;
  295. makeReactive(_assertThisInitialized(_this));
  296. return _this;
  297. }
  298. return Dom7;
  299. }( /*#__PURE__*/_wrapNativeSuper(Array));
  300. function arrayFlat(arr) {
  301. if (arr === void 0) {
  302. arr = [];
  303. }
  304. var res = [];
  305. arr.forEach(function (el) {
  306. if (Array.isArray(el)) {
  307. res.push.apply(res, arrayFlat(el));
  308. } else {
  309. res.push(el);
  310. }
  311. });
  312. return res;
  313. }
  314. function arrayFilter(arr, callback) {
  315. return Array.prototype.filter.call(arr, callback);
  316. }
  317. function arrayUnique(arr) {
  318. var uniqueArray = [];
  319. for (var i = 0; i < arr.length; i += 1) {
  320. if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
  321. }
  322. return uniqueArray;
  323. }
  324. function qsa(selector, context) {
  325. if (typeof selector !== 'string') {
  326. return [selector];
  327. }
  328. var a = [];
  329. var res = context.querySelectorAll(selector);
  330. for (var i = 0; i < res.length; i += 1) {
  331. a.push(res[i]);
  332. }
  333. return a;
  334. }
  335. function $(selector, context) {
  336. var window = getWindow();
  337. var document = getDocument();
  338. var arr = [];
  339. if (!context && selector instanceof Dom7) {
  340. return selector;
  341. }
  342. if (!selector) {
  343. return new Dom7(arr);
  344. }
  345. if (typeof selector === 'string') {
  346. var html = selector.trim();
  347. if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
  348. var toCreate = 'div';
  349. if (html.indexOf('<li') === 0) toCreate = 'ul';
  350. if (html.indexOf('<tr') === 0) toCreate = 'tbody';
  351. if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
  352. if (html.indexOf('<tbody') === 0) toCreate = 'table';
  353. if (html.indexOf('<option') === 0) toCreate = 'select';
  354. var tempParent = document.createElement(toCreate);
  355. tempParent.innerHTML = html;
  356. for (var i = 0; i < tempParent.childNodes.length; i += 1) {
  357. arr.push(tempParent.childNodes[i]);
  358. }
  359. } else {
  360. arr = qsa(selector.trim(), context || document);
  361. } // arr = qsa(selector, document);
  362. } else if (selector.nodeType || selector === window || selector === document) {
  363. arr.push(selector);
  364. } else if (Array.isArray(selector)) {
  365. if (selector instanceof Dom7) return selector;
  366. arr = selector;
  367. }
  368. return new Dom7(arrayUnique(arr));
  369. }
  370. $.fn = Dom7.prototype;
  371. function addClass() {
  372. for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
  373. classes[_key] = arguments[_key];
  374. }
  375. var classNames = arrayFlat(classes.map(function (c) {
  376. return c.split(' ');
  377. }));
  378. this.forEach(function (el) {
  379. var _el$classList;
  380. (_el$classList = el.classList).add.apply(_el$classList, classNames);
  381. });
  382. return this;
  383. }
  384. function removeClass() {
  385. for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  386. classes[_key2] = arguments[_key2];
  387. }
  388. var classNames = arrayFlat(classes.map(function (c) {
  389. return c.split(' ');
  390. }));
  391. this.forEach(function (el) {
  392. var _el$classList2;
  393. (_el$classList2 = el.classList).remove.apply(_el$classList2, classNames);
  394. });
  395. return this;
  396. }
  397. function toggleClass() {
  398. for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  399. classes[_key3] = arguments[_key3];
  400. }
  401. var classNames = arrayFlat(classes.map(function (c) {
  402. return c.split(' ');
  403. }));
  404. this.forEach(function (el) {
  405. classNames.forEach(function (className) {
  406. el.classList.toggle(className);
  407. });
  408. });
  409. }
  410. function hasClass() {
  411. for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  412. classes[_key4] = arguments[_key4];
  413. }
  414. var classNames = arrayFlat(classes.map(function (c) {
  415. return c.split(' ');
  416. }));
  417. return arrayFilter(this, function (el) {
  418. return classNames.filter(function (className) {
  419. return el.classList.contains(className);
  420. }).length > 0;
  421. }).length > 0;
  422. }
  423. function attr(attrs, value) {
  424. if (arguments.length === 1 && typeof attrs === 'string') {
  425. // Get attr
  426. if (this[0]) return this[0].getAttribute(attrs);
  427. return undefined;
  428. } // Set attrs
  429. for (var i = 0; i < this.length; i += 1) {
  430. if (arguments.length === 2) {
  431. // String
  432. this[i].setAttribute(attrs, value);
  433. } else {
  434. // Object
  435. for (var attrName in attrs) {
  436. this[i][attrName] = attrs[attrName];
  437. this[i].setAttribute(attrName, attrs[attrName]);
  438. }
  439. }
  440. }
  441. return this;
  442. }
  443. function removeAttr(attr) {
  444. for (var i = 0; i < this.length; i += 1) {
  445. this[i].removeAttribute(attr);
  446. }
  447. return this;
  448. }
  449. function transform(transform) {
  450. for (var i = 0; i < this.length; i += 1) {
  451. this[i].style.transform = transform;
  452. }
  453. return this;
  454. }
  455. function transition(duration) {
  456. for (var i = 0; i < this.length; i += 1) {
  457. this[i].style.transition = typeof duration !== 'string' ? duration + "ms" : duration;
  458. }
  459. return this;
  460. }
  461. function on() {
  462. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  463. args[_key5] = arguments[_key5];
  464. }
  465. var eventType = args[0],
  466. targetSelector = args[1],
  467. listener = args[2],
  468. capture = args[3];
  469. if (typeof args[1] === 'function') {
  470. eventType = args[0];
  471. listener = args[1];
  472. capture = args[2];
  473. targetSelector = undefined;
  474. }
  475. if (!capture) capture = false;
  476. function handleLiveEvent(e) {
  477. var target = e.target;
  478. if (!target) return;
  479. var eventData = e.target.dom7EventData || [];
  480. if (eventData.indexOf(e) < 0) {
  481. eventData.unshift(e);
  482. }
  483. if ($(target).is(targetSelector)) listener.apply(target, eventData);else {
  484. var _parents = $(target).parents(); // eslint-disable-line
  485. for (var k = 0; k < _parents.length; k += 1) {
  486. if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);
  487. }
  488. }
  489. }
  490. function handleEvent(e) {
  491. var eventData = e && e.target ? e.target.dom7EventData || [] : [];
  492. if (eventData.indexOf(e) < 0) {
  493. eventData.unshift(e);
  494. }
  495. listener.apply(this, eventData);
  496. }
  497. var events = eventType.split(' ');
  498. var j;
  499. for (var i = 0; i < this.length; i += 1) {
  500. var el = this[i];
  501. if (!targetSelector) {
  502. for (j = 0; j < events.length; j += 1) {
  503. var event = events[j];
  504. if (!el.dom7Listeners) el.dom7Listeners = {};
  505. if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
  506. el.dom7Listeners[event].push({
  507. listener: listener,
  508. proxyListener: handleEvent
  509. });
  510. el.addEventListener(event, handleEvent, capture);
  511. }
  512. } else {
  513. // Live events
  514. for (j = 0; j < events.length; j += 1) {
  515. var _event = events[j];
  516. if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
  517. if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];
  518. el.dom7LiveListeners[_event].push({
  519. listener: listener,
  520. proxyListener: handleLiveEvent
  521. });
  522. el.addEventListener(_event, handleLiveEvent, capture);
  523. }
  524. }
  525. }
  526. return this;
  527. }
  528. function off() {
  529. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  530. args[_key6] = arguments[_key6];
  531. }
  532. var eventType = args[0],
  533. targetSelector = args[1],
  534. listener = args[2],
  535. capture = args[3];
  536. if (typeof args[1] === 'function') {
  537. eventType = args[0];
  538. listener = args[1];
  539. capture = args[2];
  540. targetSelector = undefined;
  541. }
  542. if (!capture) capture = false;
  543. var events = eventType.split(' ');
  544. for (var i = 0; i < events.length; i += 1) {
  545. var event = events[i];
  546. for (var j = 0; j < this.length; j += 1) {
  547. var el = this[j];
  548. var handlers = void 0;
  549. if (!targetSelector && el.dom7Listeners) {
  550. handlers = el.dom7Listeners[event];
  551. } else if (targetSelector && el.dom7LiveListeners) {
  552. handlers = el.dom7LiveListeners[event];
  553. }
  554. if (handlers && handlers.length) {
  555. for (var k = handlers.length - 1; k >= 0; k -= 1) {
  556. var handler = handlers[k];
  557. if (listener && handler.listener === listener) {
  558. el.removeEventListener(event, handler.proxyListener, capture);
  559. handlers.splice(k, 1);
  560. } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
  561. el.removeEventListener(event, handler.proxyListener, capture);
  562. handlers.splice(k, 1);
  563. } else if (!listener) {
  564. el.removeEventListener(event, handler.proxyListener, capture);
  565. handlers.splice(k, 1);
  566. }
  567. }
  568. }
  569. }
  570. }
  571. return this;
  572. }
  573. function trigger() {
  574. var window = getWindow();
  575. for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
  576. args[_key9] = arguments[_key9];
  577. }
  578. var events = args[0].split(' ');
  579. var eventData = args[1];
  580. for (var i = 0; i < events.length; i += 1) {
  581. var event = events[i];
  582. for (var j = 0; j < this.length; j += 1) {
  583. var el = this[j];
  584. if (window.CustomEvent) {
  585. var evt = new window.CustomEvent(event, {
  586. detail: eventData,
  587. bubbles: true,
  588. cancelable: true
  589. });
  590. el.dom7EventData = args.filter(function (data, dataIndex) {
  591. return dataIndex > 0;
  592. });
  593. el.dispatchEvent(evt);
  594. el.dom7EventData = [];
  595. delete el.dom7EventData;
  596. }
  597. }
  598. }
  599. return this;
  600. }
  601. function transitionEnd(callback) {
  602. var dom = this;
  603. function fireCallBack(e) {
  604. if (e.target !== this) return;
  605. callback.call(this, e);
  606. dom.off('transitionend', fireCallBack);
  607. }
  608. if (callback) {
  609. dom.on('transitionend', fireCallBack);
  610. }
  611. return this;
  612. }
  613. function outerWidth(includeMargins) {
  614. if (this.length > 0) {
  615. if (includeMargins) {
  616. var _styles = this.styles();
  617. return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));
  618. }
  619. return this[0].offsetWidth;
  620. }
  621. return null;
  622. }
  623. function outerHeight(includeMargins) {
  624. if (this.length > 0) {
  625. if (includeMargins) {
  626. var _styles2 = this.styles();
  627. return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));
  628. }
  629. return this[0].offsetHeight;
  630. }
  631. return null;
  632. }
  633. function offset() {
  634. if (this.length > 0) {
  635. var window = getWindow();
  636. var document = getDocument();
  637. var el = this[0];
  638. var box = el.getBoundingClientRect();
  639. var body = document.body;
  640. var clientTop = el.clientTop || body.clientTop || 0;
  641. var clientLeft = el.clientLeft || body.clientLeft || 0;
  642. var scrollTop = el === window ? window.scrollY : el.scrollTop;
  643. var scrollLeft = el === window ? window.scrollX : el.scrollLeft;
  644. return {
  645. top: box.top + scrollTop - clientTop,
  646. left: box.left + scrollLeft - clientLeft
  647. };
  648. }
  649. return null;
  650. }
  651. function styles() {
  652. var window = getWindow();
  653. if (this[0]) return window.getComputedStyle(this[0], null);
  654. return {};
  655. }
  656. function css(props, value) {
  657. var window = getWindow();
  658. var i;
  659. if (arguments.length === 1) {
  660. if (typeof props === 'string') {
  661. // .css('width')
  662. if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
  663. } else {
  664. // .css({ width: '100px' })
  665. for (i = 0; i < this.length; i += 1) {
  666. for (var _prop in props) {
  667. this[i].style[_prop] = props[_prop];
  668. }
  669. }
  670. return this;
  671. }
  672. }
  673. if (arguments.length === 2 && typeof props === 'string') {
  674. // .css('width', '100px')
  675. for (i = 0; i < this.length; i += 1) {
  676. this[i].style[props] = value;
  677. }
  678. return this;
  679. }
  680. return this;
  681. }
  682. function each(callback) {
  683. if (!callback) return this;
  684. this.forEach(function (el, index) {
  685. callback.apply(el, [el, index]);
  686. });
  687. return this;
  688. }
  689. function filter(callback) {
  690. var result = arrayFilter(this, callback);
  691. return $(result);
  692. }
  693. function html(html) {
  694. if (typeof html === 'undefined') {
  695. return this[0] ? this[0].innerHTML : null;
  696. }
  697. for (var i = 0; i < this.length; i += 1) {
  698. this[i].innerHTML = html;
  699. }
  700. return this;
  701. }
  702. function text(text) {
  703. if (typeof text === 'undefined') {
  704. return this[0] ? this[0].textContent.trim() : null;
  705. }
  706. for (var i = 0; i < this.length; i += 1) {
  707. this[i].textContent = text;
  708. }
  709. return this;
  710. }
  711. function is(selector) {
  712. var window = getWindow();
  713. var document = getDocument();
  714. var el = this[0];
  715. var compareWith;
  716. var i;
  717. if (!el || typeof selector === 'undefined') return false;
  718. if (typeof selector === 'string') {
  719. if (el.matches) return el.matches(selector);
  720. if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
  721. if (el.msMatchesSelector) return el.msMatchesSelector(selector);
  722. compareWith = $(selector);
  723. for (i = 0; i < compareWith.length; i += 1) {
  724. if (compareWith[i] === el) return true;
  725. }
  726. return false;
  727. }
  728. if (selector === document) {
  729. return el === document;
  730. }
  731. if (selector === window) {
  732. return el === window;
  733. }
  734. if (selector.nodeType || selector instanceof Dom7) {
  735. compareWith = selector.nodeType ? [selector] : selector;
  736. for (i = 0; i < compareWith.length; i += 1) {
  737. if (compareWith[i] === el) return true;
  738. }
  739. return false;
  740. }
  741. return false;
  742. }
  743. function index() {
  744. var child = this[0];
  745. var i;
  746. if (child) {
  747. i = 0; // eslint-disable-next-line
  748. while ((child = child.previousSibling) !== null) {
  749. if (child.nodeType === 1) i += 1;
  750. }
  751. return i;
  752. }
  753. return undefined;
  754. }
  755. function eq(index) {
  756. if (typeof index === 'undefined') return this;
  757. var length = this.length;
  758. if (index > length - 1) {
  759. return $([]);
  760. }
  761. if (index < 0) {
  762. var returnIndex = length + index;
  763. if (returnIndex < 0) return $([]);
  764. return $([this[returnIndex]]);
  765. }
  766. return $([this[index]]);
  767. }
  768. function append() {
  769. var newChild;
  770. var document = getDocument();
  771. for (var k = 0; k < arguments.length; k += 1) {
  772. newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];
  773. for (var i = 0; i < this.length; i += 1) {
  774. if (typeof newChild === 'string') {
  775. var tempDiv = document.createElement('div');
  776. tempDiv.innerHTML = newChild;
  777. while (tempDiv.firstChild) {
  778. this[i].appendChild(tempDiv.firstChild);
  779. }
  780. } else if (newChild instanceof Dom7) {
  781. for (var j = 0; j < newChild.length; j += 1) {
  782. this[i].appendChild(newChild[j]);
  783. }
  784. } else {
  785. this[i].appendChild(newChild);
  786. }
  787. }
  788. }
  789. return this;
  790. }
  791. function prepend(newChild) {
  792. var document = getDocument();
  793. var i;
  794. var j;
  795. for (i = 0; i < this.length; i += 1) {
  796. if (typeof newChild === 'string') {
  797. var tempDiv = document.createElement('div');
  798. tempDiv.innerHTML = newChild;
  799. for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
  800. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  801. }
  802. } else if (newChild instanceof Dom7) {
  803. for (j = 0; j < newChild.length; j += 1) {
  804. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  805. }
  806. } else {
  807. this[i].insertBefore(newChild, this[i].childNodes[0]);
  808. }
  809. }
  810. return this;
  811. }
  812. function next(selector) {
  813. if (this.length > 0) {
  814. if (selector) {
  815. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
  816. return $([this[0].nextElementSibling]);
  817. }
  818. return $([]);
  819. }
  820. if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
  821. return $([]);
  822. }
  823. return $([]);
  824. }
  825. function nextAll(selector) {
  826. var nextEls = [];
  827. var el = this[0];
  828. if (!el) return $([]);
  829. while (el.nextElementSibling) {
  830. var _next = el.nextElementSibling; // eslint-disable-line
  831. if (selector) {
  832. if ($(_next).is(selector)) nextEls.push(_next);
  833. } else nextEls.push(_next);
  834. el = _next;
  835. }
  836. return $(nextEls);
  837. }
  838. function prev(selector) {
  839. if (this.length > 0) {
  840. var el = this[0];
  841. if (selector) {
  842. if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
  843. return $([el.previousElementSibling]);
  844. }
  845. return $([]);
  846. }
  847. if (el.previousElementSibling) return $([el.previousElementSibling]);
  848. return $([]);
  849. }
  850. return $([]);
  851. }
  852. function prevAll(selector) {
  853. var prevEls = [];
  854. var el = this[0];
  855. if (!el) return $([]);
  856. while (el.previousElementSibling) {
  857. var _prev = el.previousElementSibling; // eslint-disable-line
  858. if (selector) {
  859. if ($(_prev).is(selector)) prevEls.push(_prev);
  860. } else prevEls.push(_prev);
  861. el = _prev;
  862. }
  863. return $(prevEls);
  864. }
  865. function parent(selector) {
  866. var parents = []; // eslint-disable-line
  867. for (var i = 0; i < this.length; i += 1) {
  868. if (this[i].parentNode !== null) {
  869. if (selector) {
  870. if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
  871. } else {
  872. parents.push(this[i].parentNode);
  873. }
  874. }
  875. }
  876. return $(parents);
  877. }
  878. function parents(selector) {
  879. var parents = []; // eslint-disable-line
  880. for (var i = 0; i < this.length; i += 1) {
  881. var _parent = this[i].parentNode; // eslint-disable-line
  882. while (_parent) {
  883. if (selector) {
  884. if ($(_parent).is(selector)) parents.push(_parent);
  885. } else {
  886. parents.push(_parent);
  887. }
  888. _parent = _parent.parentNode;
  889. }
  890. }
  891. return $(parents);
  892. }
  893. function closest(selector) {
  894. var closest = this; // eslint-disable-line
  895. if (typeof selector === 'undefined') {
  896. return $([]);
  897. }
  898. if (!closest.is(selector)) {
  899. closest = closest.parents(selector).eq(0);
  900. }
  901. return closest;
  902. }
  903. function find(selector) {
  904. var foundElements = [];
  905. for (var i = 0; i < this.length; i += 1) {
  906. var found = this[i].querySelectorAll(selector);
  907. for (var j = 0; j < found.length; j += 1) {
  908. foundElements.push(found[j]);
  909. }
  910. }
  911. return $(foundElements);
  912. }
  913. function children(selector) {
  914. var children = []; // eslint-disable-line
  915. for (var i = 0; i < this.length; i += 1) {
  916. var childNodes = this[i].children;
  917. for (var j = 0; j < childNodes.length; j += 1) {
  918. if (!selector || $(childNodes[j]).is(selector)) {
  919. children.push(childNodes[j]);
  920. }
  921. }
  922. }
  923. return $(children);
  924. }
  925. function remove() {
  926. for (var i = 0; i < this.length; i += 1) {
  927. if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
  928. }
  929. return this;
  930. }
  931. var Methods = {
  932. addClass: addClass,
  933. removeClass: removeClass,
  934. hasClass: hasClass,
  935. toggleClass: toggleClass,
  936. attr: attr,
  937. removeAttr: removeAttr,
  938. transform: transform,
  939. transition: transition,
  940. on: on,
  941. off: off,
  942. trigger: trigger,
  943. transitionEnd: transitionEnd,
  944. outerWidth: outerWidth,
  945. outerHeight: outerHeight,
  946. styles: styles,
  947. offset: offset,
  948. css: css,
  949. each: each,
  950. html: html,
  951. text: text,
  952. is: is,
  953. index: index,
  954. eq: eq,
  955. append: append,
  956. prepend: prepend,
  957. next: next,
  958. nextAll: nextAll,
  959. prev: prev,
  960. prevAll: prevAll,
  961. parent: parent,
  962. parents: parents,
  963. closest: closest,
  964. find: find,
  965. children: children,
  966. filter: filter,
  967. remove: remove
  968. };
  969. Object.keys(Methods).forEach(function (methodName) {
  970. $.fn[methodName] = Methods[methodName];
  971. });
  972. function deleteProps(obj) {
  973. var object = obj;
  974. Object.keys(object).forEach(function (key) {
  975. try {
  976. object[key] = null;
  977. } catch (e) {// no getter for object
  978. }
  979. try {
  980. delete object[key];
  981. } catch (e) {// something got wrong
  982. }
  983. });
  984. }
  985. function nextTick(callback, delay) {
  986. if (delay === void 0) {
  987. delay = 0;
  988. }
  989. return setTimeout(callback, delay);
  990. }
  991. function now() {
  992. return Date.now();
  993. }
  994. function getTranslate(el, axis) {
  995. if (axis === void 0) {
  996. axis = 'x';
  997. }
  998. var window = getWindow();
  999. var matrix;
  1000. var curTransform;
  1001. var transformMatrix;
  1002. var curStyle = window.getComputedStyle(el, null);
  1003. if (window.WebKitCSSMatrix) {
  1004. curTransform = curStyle.transform || curStyle.webkitTransform;
  1005. if (curTransform.split(',').length > 6) {
  1006. curTransform = curTransform.split(', ').map(function (a) {
  1007. return a.replace(',', '.');
  1008. }).join(', ');
  1009. } // Some old versions of Webkit choke when 'none' is passed; pass
  1010. // empty string instead in this case
  1011. transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
  1012. } else {
  1013. transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
  1014. matrix = transformMatrix.toString().split(',');
  1015. }
  1016. if (axis === 'x') {
  1017. // Latest Chrome and webkits Fix
  1018. if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix
  1019. else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers
  1020. else curTransform = parseFloat(matrix[4]);
  1021. }
  1022. if (axis === 'y') {
  1023. // Latest Chrome and webkits Fix
  1024. if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix
  1025. else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers
  1026. else curTransform = parseFloat(matrix[5]);
  1027. }
  1028. return curTransform || 0;
  1029. }
  1030. function isObject$1(o) {
  1031. return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object;
  1032. }
  1033. function extend$1() {
  1034. var to = Object(arguments.length <= 0 ? undefined : arguments[0]);
  1035. for (var i = 1; i < arguments.length; i += 1) {
  1036. var nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
  1037. if (nextSource !== undefined && nextSource !== null) {
  1038. var keysArray = Object.keys(Object(nextSource));
  1039. for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
  1040. var nextKey = keysArray[nextIndex];
  1041. var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
  1042. if (desc !== undefined && desc.enumerable) {
  1043. if (isObject$1(to[nextKey]) && isObject$1(nextSource[nextKey])) {
  1044. extend$1(to[nextKey], nextSource[nextKey]);
  1045. } else if (!isObject$1(to[nextKey]) && isObject$1(nextSource[nextKey])) {
  1046. to[nextKey] = {};
  1047. extend$1(to[nextKey], nextSource[nextKey]);
  1048. } else {
  1049. to[nextKey] = nextSource[nextKey];
  1050. }
  1051. }
  1052. }
  1053. }
  1054. }
  1055. return to;
  1056. }
  1057. function bindModuleMethods(instance, obj) {
  1058. Object.keys(obj).forEach(function (key) {
  1059. if (isObject$1(obj[key])) {
  1060. Object.keys(obj[key]).forEach(function (subKey) {
  1061. if (typeof obj[key][subKey] === 'function') {
  1062. obj[key][subKey] = obj[key][subKey].bind(instance);
  1063. }
  1064. });
  1065. }
  1066. instance[key] = obj[key];
  1067. });
  1068. }
  1069. var support;
  1070. function calcSupport() {
  1071. var window = getWindow();
  1072. var document = getDocument();
  1073. return {
  1074. touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch),
  1075. pointerEvents: !!window.PointerEvent && 'maxTouchPoints' in window.navigator && window.navigator.maxTouchPoints >= 0,
  1076. observer: function checkObserver() {
  1077. return 'MutationObserver' in window || 'WebkitMutationObserver' in window;
  1078. }(),
  1079. passiveListener: function checkPassiveListener() {
  1080. var supportsPassive = false;
  1081. try {
  1082. var opts = Object.defineProperty({}, 'passive', {
  1083. // eslint-disable-next-line
  1084. get: function get() {
  1085. supportsPassive = true;
  1086. }
  1087. });
  1088. window.addEventListener('testPassiveListener', null, opts);
  1089. } catch (e) {// No support
  1090. }
  1091. return supportsPassive;
  1092. }(),
  1093. gestures: function checkGestures() {
  1094. return 'ongesturestart' in window;
  1095. }()
  1096. };
  1097. }
  1098. function getSupport() {
  1099. if (!support) {
  1100. support = calcSupport();
  1101. }
  1102. return support;
  1103. }
  1104. var device;
  1105. function calcDevice(_temp) {
  1106. var _ref = _temp === void 0 ? {} : _temp,
  1107. userAgent = _ref.userAgent;
  1108. var support = getSupport();
  1109. var window = getWindow();
  1110. var platform = window.navigator.platform;
  1111. var ua = userAgent || window.navigator.userAgent;
  1112. var device = {
  1113. ios: false,
  1114. android: false
  1115. };
  1116. var screenWidth = window.screen.width;
  1117. var screenHeight = window.screen.height;
  1118. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
  1119. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  1120. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  1121. var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
  1122. var windows = platform === 'Win32';
  1123. var macos = platform === 'MacIntel'; // iPadOs 13 fix
  1124. var iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
  1125. if (!ipad && macos && support.touch && iPadScreens.indexOf(screenWidth + "x" + screenHeight) >= 0) {
  1126. ipad = ua.match(/(Version)\/([\d.]+)/);
  1127. if (!ipad) ipad = [0, 1, '13_0_0'];
  1128. macos = false;
  1129. } // Android
  1130. if (android && !windows) {
  1131. device.os = 'android';
  1132. device.android = true;
  1133. }
  1134. if (ipad || iphone || ipod) {
  1135. device.os = 'ios';
  1136. device.ios = true;
  1137. } // Export object
  1138. return device;
  1139. }
  1140. function getDevice(overrides) {
  1141. if (overrides === void 0) {
  1142. overrides = {};
  1143. }
  1144. if (!device) {
  1145. device = calcDevice(overrides);
  1146. }
  1147. return device;
  1148. }
  1149. var browser;
  1150. function calcBrowser() {
  1151. var window = getWindow();
  1152. function isSafari() {
  1153. var ua = window.navigator.userAgent.toLowerCase();
  1154. return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
  1155. }
  1156. return {
  1157. isEdge: !!window.navigator.userAgent.match(/Edge/g),
  1158. isSafari: isSafari(),
  1159. isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
  1160. };
  1161. }
  1162. function getBrowser() {
  1163. if (!browser) {
  1164. browser = calcBrowser();
  1165. }
  1166. return browser;
  1167. }
  1168. var Resize = {
  1169. name: 'resize',
  1170. create: function create() {
  1171. var swiper = this;
  1172. extend$1(swiper, {
  1173. resize: {
  1174. resizeHandler: function resizeHandler() {
  1175. if (!swiper || swiper.destroyed || !swiper.initialized) return;
  1176. swiper.emit('beforeResize');
  1177. swiper.emit('resize');
  1178. },
  1179. orientationChangeHandler: function orientationChangeHandler() {
  1180. if (!swiper || swiper.destroyed || !swiper.initialized) return;
  1181. swiper.emit('orientationchange');
  1182. }
  1183. }
  1184. });
  1185. },
  1186. on: {
  1187. init: function init(swiper) {
  1188. var window = getWindow(); // Emit resize
  1189. window.addEventListener('resize', swiper.resize.resizeHandler); // Emit orientationchange
  1190. window.addEventListener('orientationchange', swiper.resize.orientationChangeHandler);
  1191. },
  1192. destroy: function destroy(swiper) {
  1193. var window = getWindow();
  1194. window.removeEventListener('resize', swiper.resize.resizeHandler);
  1195. window.removeEventListener('orientationchange', swiper.resize.orientationChangeHandler);
  1196. }
  1197. }
  1198. };
  1199. var Observer = {
  1200. attach: function attach(target, options) {
  1201. if (options === void 0) {
  1202. options = {};
  1203. }
  1204. var window = getWindow();
  1205. var swiper = this;
  1206. var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
  1207. var observer = new ObserverFunc(function (mutations) {
  1208. // The observerUpdate event should only be triggered
  1209. // once despite the number of mutations. Additional
  1210. // triggers are redundant and are very costly
  1211. if (mutations.length === 1) {
  1212. swiper.emit('observerUpdate', mutations[0]);
  1213. return;
  1214. }
  1215. var observerUpdate = function observerUpdate() {
  1216. swiper.emit('observerUpdate', mutations[0]);
  1217. };
  1218. if (window.requestAnimationFrame) {
  1219. window.requestAnimationFrame(observerUpdate);
  1220. } else {
  1221. window.setTimeout(observerUpdate, 0);
  1222. }
  1223. });
  1224. observer.observe(target, {
  1225. attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
  1226. childList: typeof options.childList === 'undefined' ? true : options.childList,
  1227. characterData: typeof options.characterData === 'undefined' ? true : options.characterData
  1228. });
  1229. swiper.observer.observers.push(observer);
  1230. },
  1231. init: function init() {
  1232. var swiper = this;
  1233. if (!swiper.support.observer || !swiper.params.observer) return;
  1234. if (swiper.params.observeParents) {
  1235. var containerParents = swiper.$el.parents();
  1236. for (var i = 0; i < containerParents.length; i += 1) {
  1237. swiper.observer.attach(containerParents[i]);
  1238. }
  1239. } // Observe container
  1240. swiper.observer.attach(swiper.$el[0], {
  1241. childList: swiper.params.observeSlideChildren
  1242. }); // Observe wrapper
  1243. swiper.observer.attach(swiper.$wrapperEl[0], {
  1244. attributes: false
  1245. });
  1246. },
  1247. destroy: function destroy() {
  1248. var swiper = this;
  1249. swiper.observer.observers.forEach(function (observer) {
  1250. observer.disconnect();
  1251. });
  1252. swiper.observer.observers = [];
  1253. }
  1254. };
  1255. var Observer$1 = {
  1256. name: 'observer',
  1257. params: {
  1258. observer: false,
  1259. observeParents: false,
  1260. observeSlideChildren: false
  1261. },
  1262. create: function create() {
  1263. var swiper = this;
  1264. bindModuleMethods(swiper, {
  1265. observer: _extends(_extends({}, Observer), {}, {
  1266. observers: []
  1267. })
  1268. });
  1269. },
  1270. on: {
  1271. init: function init(swiper) {
  1272. swiper.observer.init();
  1273. },
  1274. destroy: function destroy(swiper) {
  1275. swiper.observer.destroy();
  1276. }
  1277. }
  1278. };
  1279. var modular = {
  1280. useParams: function useParams(instanceParams) {
  1281. var instance = this;
  1282. if (!instance.modules) return;
  1283. Object.keys(instance.modules).forEach(function (moduleName) {
  1284. var module = instance.modules[moduleName]; // Extend params
  1285. if (module.params) {
  1286. extend$1(instanceParams, module.params);
  1287. }
  1288. });
  1289. },
  1290. useModules: function useModules(modulesParams) {
  1291. if (modulesParams === void 0) {
  1292. modulesParams = {};
  1293. }
  1294. var instance = this;
  1295. if (!instance.modules) return;
  1296. Object.keys(instance.modules).forEach(function (moduleName) {
  1297. var module = instance.modules[moduleName];
  1298. var moduleParams = modulesParams[moduleName] || {}; // Add event listeners
  1299. if (module.on && instance.on) {
  1300. Object.keys(module.on).forEach(function (moduleEventName) {
  1301. instance.on(moduleEventName, module.on[moduleEventName]);
  1302. });
  1303. } // Module create callback
  1304. if (module.create) {
  1305. module.create.bind(instance)(moduleParams);
  1306. }
  1307. });
  1308. }
  1309. };
  1310. /* eslint-disable no-underscore-dangle */
  1311. var eventsEmitter = {
  1312. on: function on(events, handler, priority) {
  1313. var self = this;
  1314. if (typeof handler !== 'function') return self;
  1315. var method = priority ? 'unshift' : 'push';
  1316. events.split(' ').forEach(function (event) {
  1317. if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
  1318. self.eventsListeners[event][method](handler);
  1319. });
  1320. return self;
  1321. },
  1322. once: function once(events, handler, priority) {
  1323. var self = this;
  1324. if (typeof handler !== 'function') return self;
  1325. function onceHandler() {
  1326. self.off(events, onceHandler);
  1327. if (onceHandler.__emitterProxy) {
  1328. delete onceHandler.__emitterProxy;
  1329. }
  1330. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  1331. args[_key] = arguments[_key];
  1332. }
  1333. handler.apply(self, args);
  1334. }
  1335. onceHandler.__emitterProxy = handler;
  1336. return self.on(events, onceHandler, priority);
  1337. },
  1338. onAny: function onAny(handler, priority) {
  1339. var self = this;
  1340. if (typeof handler !== 'function') return self;
  1341. var method = priority ? 'unshift' : 'push';
  1342. if (self.eventsAnyListeners.indexOf(handler) < 0) {
  1343. self.eventsAnyListeners[method](handler);
  1344. }
  1345. return self;
  1346. },
  1347. offAny: function offAny(handler) {
  1348. var self = this;
  1349. if (!self.eventsAnyListeners) return self;
  1350. var index = self.eventsAnyListeners.indexOf(handler);
  1351. if (index >= 0) {
  1352. self.eventsAnyListeners.splice(index, 1);
  1353. }
  1354. return self;
  1355. },
  1356. off: function off(events, handler) {
  1357. var self = this;
  1358. if (!self.eventsListeners) return self;
  1359. events.split(' ').forEach(function (event) {
  1360. if (typeof handler === 'undefined') {
  1361. self.eventsListeners[event] = [];
  1362. } else if (self.eventsListeners[event]) {
  1363. self.eventsListeners[event].forEach(function (eventHandler, index) {
  1364. if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
  1365. self.eventsListeners[event].splice(index, 1);
  1366. }
  1367. });
  1368. }
  1369. });
  1370. return self;
  1371. },
  1372. emit: function emit() {
  1373. var self = this;
  1374. if (!self.eventsListeners) return self;
  1375. var events;
  1376. var data;
  1377. var context;
  1378. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  1379. args[_key2] = arguments[_key2];
  1380. }
  1381. if (typeof args[0] === 'string' || Array.isArray(args[0])) {
  1382. events = args[0];
  1383. data = args.slice(1, args.length);
  1384. context = self;
  1385. } else {
  1386. events = args[0].events;
  1387. data = args[0].data;
  1388. context = args[0].context || self;
  1389. }
  1390. data.unshift(context);
  1391. var eventsArray = Array.isArray(events) ? events : events.split(' ');
  1392. eventsArray.forEach(function (event) {
  1393. if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
  1394. self.eventsAnyListeners.forEach(function (eventHandler) {
  1395. eventHandler.apply(context, [event].concat(data));
  1396. });
  1397. }
  1398. if (self.eventsListeners && self.eventsListeners[event]) {
  1399. var handlers = [];
  1400. self.eventsListeners[event].forEach(function (eventHandler) {
  1401. handlers.push(eventHandler);
  1402. });
  1403. handlers.forEach(function (eventHandler) {
  1404. eventHandler.apply(context, data);
  1405. });
  1406. }
  1407. });
  1408. return self;
  1409. }
  1410. };
  1411. function updateSize() {
  1412. var swiper = this;
  1413. var width;
  1414. var height;
  1415. var $el = swiper.$el;
  1416. if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
  1417. width = swiper.params.width;
  1418. } else {
  1419. width = $el[0].clientWidth;
  1420. }
  1421. if (typeof swiper.params.height !== 'undefined' && swiper.params.width !== null) {
  1422. height = swiper.params.height;
  1423. } else {
  1424. height = $el[0].clientHeight;
  1425. }
  1426. if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
  1427. return;
  1428. } // Subtract paddings
  1429. width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10);
  1430. height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10);
  1431. if (Number.isNaN(width)) width = 0;
  1432. if (Number.isNaN(height)) height = 0;
  1433. extend$1(swiper, {
  1434. width: width,
  1435. height: height,
  1436. size: swiper.isHorizontal() ? width : height
  1437. });
  1438. }
  1439. function updateSlides() {
  1440. var swiper = this;
  1441. var window = getWindow();
  1442. var params = swiper.params;
  1443. var $wrapperEl = swiper.$wrapperEl,
  1444. swiperSize = swiper.size,
  1445. rtl = swiper.rtlTranslate,
  1446. wrongRTL = swiper.wrongRTL;
  1447. var isVirtual = swiper.virtual && params.virtual.enabled;
  1448. var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
  1449. var slides = $wrapperEl.children("." + swiper.params.slideClass);
  1450. var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
  1451. var snapGrid = [];
  1452. var slidesGrid = [];
  1453. var slidesSizesGrid = [];
  1454. function slidesForMargin(slideEl, slideIndex) {
  1455. if (!params.cssMode) return true;
  1456. if (slideIndex === slides.length - 1) {
  1457. return false;
  1458. }
  1459. return true;
  1460. }
  1461. var offsetBefore = params.slidesOffsetBefore;
  1462. if (typeof offsetBefore === 'function') {
  1463. offsetBefore = params.slidesOffsetBefore.call(swiper);
  1464. }
  1465. var offsetAfter = params.slidesOffsetAfter;
  1466. if (typeof offsetAfter === 'function') {
  1467. offsetAfter = params.slidesOffsetAfter.call(swiper);
  1468. }
  1469. var previousSnapGridLength = swiper.snapGrid.length;
  1470. var previousSlidesGridLength = swiper.snapGrid.length;
  1471. var spaceBetween = params.spaceBetween;
  1472. var slidePosition = -offsetBefore;
  1473. var prevSlideSize = 0;
  1474. var index = 0;
  1475. if (typeof swiperSize === 'undefined') {
  1476. return;
  1477. }
  1478. if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
  1479. spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
  1480. }
  1481. swiper.virtualSize = -spaceBetween; // reset margins
  1482. if (rtl) slides.css({
  1483. marginLeft: '',
  1484. marginTop: ''
  1485. });else slides.css({
  1486. marginRight: '',
  1487. marginBottom: ''
  1488. });
  1489. var slidesNumberEvenToRows;
  1490. if (params.slidesPerColumn > 1) {
  1491. if (Math.floor(slidesLength / params.slidesPerColumn) === slidesLength / swiper.params.slidesPerColumn) {
  1492. slidesNumberEvenToRows = slidesLength;
  1493. } else {
  1494. slidesNumberEvenToRows = Math.ceil(slidesLength / params.slidesPerColumn) * params.slidesPerColumn;
  1495. }
  1496. if (params.slidesPerView !== 'auto' && params.slidesPerColumnFill === 'row') {
  1497. slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, params.slidesPerView * params.slidesPerColumn);
  1498. }
  1499. } // Calc slides
  1500. var slideSize;
  1501. var slidesPerColumn = params.slidesPerColumn;
  1502. var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
  1503. var numFullColumns = Math.floor(slidesLength / params.slidesPerColumn);
  1504. for (var i = 0; i < slidesLength; i += 1) {
  1505. slideSize = 0;
  1506. var slide = slides.eq(i);
  1507. if (params.slidesPerColumn > 1) {
  1508. // Set slides order
  1509. var newSlideOrderIndex = void 0;
  1510. var column = void 0;
  1511. var row = void 0;
  1512. if (params.slidesPerColumnFill === 'row' && params.slidesPerGroup > 1) {
  1513. var groupIndex = Math.floor(i / (params.slidesPerGroup * params.slidesPerColumn));
  1514. var slideIndexInGroup = i - params.slidesPerColumn * params.slidesPerGroup * groupIndex;
  1515. var columnsInGroup = groupIndex === 0 ? params.slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * slidesPerColumn * params.slidesPerGroup) / slidesPerColumn), params.slidesPerGroup);
  1516. row = Math.floor(slideIndexInGroup / columnsInGroup);
  1517. column = slideIndexInGroup - row * columnsInGroup + groupIndex * params.slidesPerGroup;
  1518. newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
  1519. slide.css({
  1520. '-webkit-box-ordinal-group': newSlideOrderIndex,
  1521. '-moz-box-ordinal-group': newSlideOrderIndex,
  1522. '-ms-flex-order': newSlideOrderIndex,
  1523. '-webkit-order': newSlideOrderIndex,
  1524. order: newSlideOrderIndex
  1525. });
  1526. } else if (params.slidesPerColumnFill === 'column') {
  1527. column = Math.floor(i / slidesPerColumn);
  1528. row = i - column * slidesPerColumn;
  1529. if (column > numFullColumns || column === numFullColumns && row === slidesPerColumn - 1) {
  1530. row += 1;
  1531. if (row >= slidesPerColumn) {
  1532. row = 0;
  1533. column += 1;
  1534. }
  1535. }
  1536. } else {
  1537. row = Math.floor(i / slidesPerRow);
  1538. column = i - row * slidesPerRow;
  1539. }
  1540. slide.css("margin-" + (swiper.isHorizontal() ? 'top' : 'left'), row !== 0 && params.spaceBetween && params.spaceBetween + "px");
  1541. }
  1542. if (slide.css('display') === 'none') continue; // eslint-disable-line
  1543. if (params.slidesPerView === 'auto') {
  1544. var slideStyles = window.getComputedStyle(slide[0], null);
  1545. var currentTransform = slide[0].style.transform;
  1546. var currentWebKitTransform = slide[0].style.webkitTransform;
  1547. if (currentTransform) {
  1548. slide[0].style.transform = 'none';
  1549. }
  1550. if (currentWebKitTransform) {
  1551. slide[0].style.webkitTransform = 'none';
  1552. }
  1553. if (params.roundLengths) {
  1554. slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
  1555. } else {
  1556. // eslint-disable-next-line
  1557. if (swiper.isHorizontal()) {
  1558. var width = parseFloat(slideStyles.getPropertyValue('width') || 0);
  1559. var paddingLeft = parseFloat(slideStyles.getPropertyValue('padding-left') || 0);
  1560. var paddingRight = parseFloat(slideStyles.getPropertyValue('padding-right') || 0);
  1561. var marginLeft = parseFloat(slideStyles.getPropertyValue('margin-left') || 0);
  1562. var marginRight = parseFloat(slideStyles.getPropertyValue('margin-right') || 0);
  1563. var boxSizing = slideStyles.getPropertyValue('box-sizing');
  1564. if (boxSizing && boxSizing === 'border-box') {
  1565. slideSize = width + marginLeft + marginRight;
  1566. } else {
  1567. var _slide$ = slide[0],
  1568. clientWidth = _slide$.clientWidth,
  1569. offsetWidth = _slide$.offsetWidth;
  1570. slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
  1571. }
  1572. } else {
  1573. var height = parseFloat(slideStyles.getPropertyValue('height') || 0);
  1574. var paddingTop = parseFloat(slideStyles.getPropertyValue('padding-top') || 0);
  1575. var paddingBottom = parseFloat(slideStyles.getPropertyValue('padding-bottom') || 0);
  1576. var marginTop = parseFloat(slideStyles.getPropertyValue('margin-top') || 0);
  1577. var marginBottom = parseFloat(slideStyles.getPropertyValue('margin-bottom') || 0);
  1578. var _boxSizing = slideStyles.getPropertyValue('box-sizing');
  1579. if (_boxSizing && _boxSizing === 'border-box') {
  1580. slideSize = height + marginTop + marginBottom;
  1581. } else {
  1582. var _slide$2 = slide[0],
  1583. clientHeight = _slide$2.clientHeight,
  1584. offsetHeight = _slide$2.offsetHeight;
  1585. slideSize = height + paddingTop + paddingBottom + marginTop + marginBottom + (offsetHeight - clientHeight);
  1586. }
  1587. }
  1588. }
  1589. if (currentTransform) {
  1590. slide[0].style.transform = currentTransform;
  1591. }
  1592. if (currentWebKitTransform) {
  1593. slide[0].style.webkitTransform = currentWebKitTransform;
  1594. }
  1595. if (params.roundLengths) slideSize = Math.floor(slideSize);
  1596. } else {
  1597. slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
  1598. if (params.roundLengths) slideSize = Math.floor(slideSize);
  1599. if (slides[i]) {
  1600. if (swiper.isHorizontal()) {
  1601. slides[i].style.width = slideSize + "px";
  1602. } else {
  1603. slides[i].style.height = slideSize + "px";
  1604. }
  1605. }
  1606. }
  1607. if (slides[i]) {
  1608. slides[i].swiperSlideSize = slideSize;
  1609. }
  1610. slidesSizesGrid.push(slideSize);
  1611. if (params.centeredSlides) {
  1612. slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
  1613. if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
  1614. if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
  1615. if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
  1616. if (params.roundLengths) slidePosition = Math.floor(slidePosition);
  1617. if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
  1618. slidesGrid.push(slidePosition);
  1619. } else {
  1620. if (params.roundLengths) slidePosition = Math.floor(slidePosition);
  1621. if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
  1622. slidesGrid.push(slidePosition);
  1623. slidePosition = slidePosition + slideSize + spaceBetween;
  1624. }
  1625. swiper.virtualSize += slideSize + spaceBetween;
  1626. prevSlideSize = slideSize;
  1627. index += 1;
  1628. }
  1629. swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
  1630. var newSlidesGrid;
  1631. if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
  1632. $wrapperEl.css({
  1633. width: swiper.virtualSize + params.spaceBetween + "px"
  1634. });
  1635. }
  1636. if (params.setWrapperSize) {
  1637. if (swiper.isHorizontal()) $wrapperEl.css({
  1638. width: swiper.virtualSize + params.spaceBetween + "px"
  1639. });else $wrapperEl.css({
  1640. height: swiper.virtualSize + params.spaceBetween + "px"
  1641. });
  1642. }
  1643. if (params.slidesPerColumn > 1) {
  1644. swiper.virtualSize = (slideSize + params.spaceBetween) * slidesNumberEvenToRows;
  1645. swiper.virtualSize = Math.ceil(swiper.virtualSize / params.slidesPerColumn) - params.spaceBetween;
  1646. if (swiper.isHorizontal()) $wrapperEl.css({
  1647. width: swiper.virtualSize + params.spaceBetween + "px"
  1648. });else $wrapperEl.css({
  1649. height: swiper.virtualSize + params.spaceBetween + "px"
  1650. });
  1651. if (params.centeredSlides) {
  1652. newSlidesGrid = [];
  1653. for (var _i = 0; _i < snapGrid.length; _i += 1) {
  1654. var slidesGridItem = snapGrid[_i];
  1655. if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
  1656. if (snapGrid[_i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);
  1657. }
  1658. snapGrid = newSlidesGrid;
  1659. }
  1660. } // Remove last grid elements depending on width
  1661. if (!params.centeredSlides) {
  1662. newSlidesGrid = [];
  1663. for (var _i2 = 0; _i2 < snapGrid.length; _i2 += 1) {
  1664. var _slidesGridItem = snapGrid[_i2];
  1665. if (params.roundLengths) _slidesGridItem = Math.floor(_slidesGridItem);
  1666. if (snapGrid[_i2] <= swiper.virtualSize - swiperSize) {
  1667. newSlidesGrid.push(_slidesGridItem);
  1668. }
  1669. }
  1670. snapGrid = newSlidesGrid;
  1671. if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
  1672. snapGrid.push(swiper.virtualSize - swiperSize);
  1673. }
  1674. }
  1675. if (snapGrid.length === 0) snapGrid = [0];
  1676. if (params.spaceBetween !== 0) {
  1677. if (swiper.isHorizontal()) {
  1678. if (rtl) slides.filter(slidesForMargin).css({
  1679. marginLeft: spaceBetween + "px"
  1680. });else slides.filter(slidesForMargin).css({
  1681. marginRight: spaceBetween + "px"
  1682. });
  1683. } else slides.filter(slidesForMargin).css({
  1684. marginBottom: spaceBetween + "px"
  1685. });
  1686. }
  1687. if (params.centeredSlides && params.centeredSlidesBounds) {
  1688. var allSlidesSize = 0;
  1689. slidesSizesGrid.forEach(function (slideSizeValue) {
  1690. allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
  1691. });
  1692. allSlidesSize -= params.spaceBetween;
  1693. var maxSnap = allSlidesSize - swiperSize;
  1694. snapGrid = snapGrid.map(function (snap) {
  1695. if (snap < 0) return -offsetBefore;
  1696. if (snap > maxSnap) return maxSnap + offsetAfter;
  1697. return snap;
  1698. });
  1699. }
  1700. if (params.centerInsufficientSlides) {
  1701. var _allSlidesSize = 0;
  1702. slidesSizesGrid.forEach(function (slideSizeValue) {
  1703. _allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
  1704. });
  1705. _allSlidesSize -= params.spaceBetween;
  1706. if (_allSlidesSize < swiperSize) {
  1707. var allSlidesOffset = (swiperSize - _allSlidesSize) / 2;
  1708. snapGrid.forEach(function (snap, snapIndex) {
  1709. snapGrid[snapIndex] = snap - allSlidesOffset;
  1710. });
  1711. slidesGrid.forEach(function (snap, snapIndex) {
  1712. slidesGrid[snapIndex] = snap + allSlidesOffset;
  1713. });
  1714. }
  1715. }
  1716. extend$1(swiper, {
  1717. slides: slides,
  1718. snapGrid: snapGrid,
  1719. slidesGrid: slidesGrid,
  1720. slidesSizesGrid: slidesSizesGrid
  1721. });
  1722. if (slidesLength !== previousSlidesLength) {
  1723. swiper.emit('slidesLengthChange');
  1724. }
  1725. if (snapGrid.length !== previousSnapGridLength) {
  1726. if (swiper.params.watchOverflow) swiper.checkOverflow();
  1727. swiper.emit('snapGridLengthChange');
  1728. }
  1729. if (slidesGrid.length !== previousSlidesGridLength) {
  1730. swiper.emit('slidesGridLengthChange');
  1731. }
  1732. if (params.watchSlidesProgress || params.watchSlidesVisibility) {
  1733. swiper.updateSlidesOffset();
  1734. }
  1735. }
  1736. function updateAutoHeight(speed) {
  1737. var swiper = this;
  1738. var activeSlides = [];
  1739. var newHeight = 0;
  1740. var i;
  1741. if (typeof speed === 'number') {
  1742. swiper.setTransition(speed);
  1743. } else if (speed === true) {
  1744. swiper.setTransition(swiper.params.speed);
  1745. } // Find slides currently in view
  1746. if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
  1747. if (swiper.params.centeredSlides) {
  1748. swiper.visibleSlides.each(function (slide) {
  1749. activeSlides.push(slide);
  1750. });
  1751. } else {
  1752. for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
  1753. var index = swiper.activeIndex + i;
  1754. if (index > swiper.slides.length) break;
  1755. activeSlides.push(swiper.slides.eq(index)[0]);
  1756. }
  1757. }
  1758. } else {
  1759. activeSlides.push(swiper.slides.eq(swiper.activeIndex)[0]);
  1760. } // Find new height from highest slide in view
  1761. for (i = 0; i < activeSlides.length; i += 1) {
  1762. if (typeof activeSlides[i] !== 'undefined') {
  1763. var height = activeSlides[i].offsetHeight;
  1764. newHeight = height > newHeight ? height : newHeight;
  1765. }
  1766. } // Update Height
  1767. if (newHeight) swiper.$wrapperEl.css('height', newHeight + "px");
  1768. }
  1769. function updateSlidesOffset() {
  1770. var swiper = this;
  1771. var slides = swiper.slides;
  1772. for (var i = 0; i < slides.length; i += 1) {
  1773. slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;
  1774. }
  1775. }
  1776. function updateSlidesProgress(translate) {
  1777. if (translate === void 0) {
  1778. translate = this && this.translate || 0;
  1779. }
  1780. var swiper = this;
  1781. var params = swiper.params;
  1782. var slides = swiper.slides,
  1783. rtl = swiper.rtlTranslate;
  1784. if (slides.length === 0) return;
  1785. if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
  1786. var offsetCenter = -translate;
  1787. if (rtl) offsetCenter = translate; // Visible Slides
  1788. slides.removeClass(params.slideVisibleClass);
  1789. swiper.visibleSlidesIndexes = [];
  1790. swiper.visibleSlides = [];
  1791. for (var i = 0; i < slides.length; i += 1) {
  1792. var slide = slides[i];
  1793. var slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + params.spaceBetween);
  1794. if (params.watchSlidesVisibility || params.centeredSlides && params.autoHeight) {
  1795. var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
  1796. var slideAfter = slideBefore + swiper.slidesSizesGrid[i];
  1797. var isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
  1798. if (isVisible) {
  1799. swiper.visibleSlides.push(slide);
  1800. swiper.visibleSlidesIndexes.push(i);
  1801. slides.eq(i).addClass(params.slideVisibleClass);
  1802. }
  1803. }
  1804. slide.progress = rtl ? -slideProgress : slideProgress;
  1805. }
  1806. swiper.visibleSlides = $(swiper.visibleSlides);
  1807. }
  1808. function updateProgress(translate) {
  1809. var swiper = this;
  1810. if (typeof translate === 'undefined') {
  1811. var multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line
  1812. translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
  1813. }
  1814. var params = swiper.params;
  1815. var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
  1816. var progress = swiper.progress,
  1817. isBeginning = swiper.isBeginning,
  1818. isEnd = swiper.isEnd;
  1819. var wasBeginning = isBeginning;
  1820. var wasEnd = isEnd;
  1821. if (translatesDiff === 0) {
  1822. progress = 0;
  1823. isBeginning = true;
  1824. isEnd = true;
  1825. } else {
  1826. progress = (translate - swiper.minTranslate()) / translatesDiff;
  1827. isBeginning = progress <= 0;
  1828. isEnd = progress >= 1;
  1829. }
  1830. extend$1(swiper, {
  1831. progress: progress,
  1832. isBeginning: isBeginning,
  1833. isEnd: isEnd
  1834. });
  1835. if (params.watchSlidesProgress || params.watchSlidesVisibility || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
  1836. if (isBeginning && !wasBeginning) {
  1837. swiper.emit('reachBeginning toEdge');
  1838. }
  1839. if (isEnd && !wasEnd) {
  1840. swiper.emit('reachEnd toEdge');
  1841. }
  1842. if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
  1843. swiper.emit('fromEdge');
  1844. }
  1845. swiper.emit('progress', progress);
  1846. }
  1847. function updateSlidesClasses() {
  1848. var swiper = this;
  1849. var slides = swiper.slides,
  1850. params = swiper.params,
  1851. $wrapperEl = swiper.$wrapperEl,
  1852. activeIndex = swiper.activeIndex,
  1853. realIndex = swiper.realIndex;
  1854. var isVirtual = swiper.virtual && params.virtual.enabled;
  1855. slides.removeClass(params.slideActiveClass + " " + params.slideNextClass + " " + params.slidePrevClass + " " + params.slideDuplicateActiveClass + " " + params.slideDuplicateNextClass + " " + params.slideDuplicatePrevClass);
  1856. var activeSlide;
  1857. if (isVirtual) {
  1858. activeSlide = swiper.$wrapperEl.find("." + params.slideClass + "[data-swiper-slide-index=\"" + activeIndex + "\"]");
  1859. } else {
  1860. activeSlide = slides.eq(activeIndex);
  1861. } // Active classes
  1862. activeSlide.addClass(params.slideActiveClass);
  1863. if (params.loop) {
  1864. // Duplicate to all looped slides
  1865. if (activeSlide.hasClass(params.slideDuplicateClass)) {
  1866. $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + realIndex + "\"]").addClass(params.slideDuplicateActiveClass);
  1867. } else {
  1868. $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + realIndex + "\"]").addClass(params.slideDuplicateActiveClass);
  1869. }
  1870. } // Next Slide
  1871. var nextSlide = activeSlide.nextAll("." + params.slideClass).eq(0).addClass(params.slideNextClass);
  1872. if (params.loop && nextSlide.length === 0) {
  1873. nextSlide = slides.eq(0);
  1874. nextSlide.addClass(params.slideNextClass);
  1875. } // Prev Slide
  1876. var prevSlide = activeSlide.prevAll("." + params.slideClass).eq(0).addClass(params.slidePrevClass);
  1877. if (params.loop && prevSlide.length === 0) {
  1878. prevSlide = slides.eq(-1);
  1879. prevSlide.addClass(params.slidePrevClass);
  1880. }
  1881. if (params.loop) {
  1882. // Duplicate to all looped slides
  1883. if (nextSlide.hasClass(params.slideDuplicateClass)) {
  1884. $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + nextSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicateNextClass);
  1885. } else {
  1886. $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + nextSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicateNextClass);
  1887. }
  1888. if (prevSlide.hasClass(params.slideDuplicateClass)) {
  1889. $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + prevSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicatePrevClass);
  1890. } else {
  1891. $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + prevSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicatePrevClass);
  1892. }
  1893. }
  1894. swiper.emitSlidesClasses();
  1895. }
  1896. function updateActiveIndex(newActiveIndex) {
  1897. var swiper = this;
  1898. var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
  1899. var slidesGrid = swiper.slidesGrid,
  1900. snapGrid = swiper.snapGrid,
  1901. params = swiper.params,
  1902. previousIndex = swiper.activeIndex,
  1903. previousRealIndex = swiper.realIndex,
  1904. previousSnapIndex = swiper.snapIndex;
  1905. var activeIndex = newActiveIndex;
  1906. var snapIndex;
  1907. if (typeof activeIndex === 'undefined') {
  1908. for (var i = 0; i < slidesGrid.length; i += 1) {
  1909. if (typeof slidesGrid[i + 1] !== 'undefined') {
  1910. if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
  1911. activeIndex = i;
  1912. } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
  1913. activeIndex = i + 1;
  1914. }
  1915. } else if (translate >= slidesGrid[i]) {
  1916. activeIndex = i;
  1917. }
  1918. } // Normalize slideIndex
  1919. if (params.normalizeSlideIndex) {
  1920. if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
  1921. }
  1922. }
  1923. if (snapGrid.indexOf(translate) >= 0) {
  1924. snapIndex = snapGrid.indexOf(translate);
  1925. } else {
  1926. var skip = Math.min(params.slidesPerGroupSkip, activeIndex);
  1927. snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
  1928. }
  1929. if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
  1930. if (activeIndex === previousIndex) {
  1931. if (snapIndex !== previousSnapIndex) {
  1932. swiper.snapIndex = snapIndex;
  1933. swiper.emit('snapIndexChange');
  1934. }
  1935. return;
  1936. } // Get real index
  1937. var realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);
  1938. extend$1(swiper, {
  1939. snapIndex: snapIndex,
  1940. realIndex: realIndex,
  1941. previousIndex: previousIndex,
  1942. activeIndex: activeIndex
  1943. });
  1944. swiper.emit('activeIndexChange');
  1945. swiper.emit('snapIndexChange');
  1946. if (previousRealIndex !== realIndex) {
  1947. swiper.emit('realIndexChange');
  1948. }
  1949. if (swiper.initialized || swiper.params.runCallbacksOnInit) {
  1950. swiper.emit('slideChange');
  1951. }
  1952. }
  1953. function updateClickedSlide(e) {
  1954. var swiper = this;
  1955. var params = swiper.params;
  1956. var slide = $(e.target).closest("." + params.slideClass)[0];
  1957. var slideFound = false;
  1958. if (slide) {
  1959. for (var i = 0; i < swiper.slides.length; i += 1) {
  1960. if (swiper.slides[i] === slide) slideFound = true;
  1961. }
  1962. }
  1963. if (slide && slideFound) {
  1964. swiper.clickedSlide = slide;
  1965. if (swiper.virtual && swiper.params.virtual.enabled) {
  1966. swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10);
  1967. } else {
  1968. swiper.clickedIndex = $(slide).index();
  1969. }
  1970. } else {
  1971. swiper.clickedSlide = undefined;
  1972. swiper.clickedIndex = undefined;
  1973. return;
  1974. }
  1975. if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
  1976. swiper.slideToClickedSlide();
  1977. }
  1978. }
  1979. var update = {
  1980. updateSize: updateSize,
  1981. updateSlides: updateSlides,
  1982. updateAutoHeight: updateAutoHeight,
  1983. updateSlidesOffset: updateSlidesOffset,
  1984. updateSlidesProgress: updateSlidesProgress,
  1985. updateProgress: updateProgress,
  1986. updateSlidesClasses: updateSlidesClasses,
  1987. updateActiveIndex: updateActiveIndex,
  1988. updateClickedSlide: updateClickedSlide
  1989. };
  1990. function getSwiperTranslate(axis) {
  1991. if (axis === void 0) {
  1992. axis = this.isHorizontal() ? 'x' : 'y';
  1993. }
  1994. var swiper = this;
  1995. var params = swiper.params,
  1996. rtl = swiper.rtlTranslate,
  1997. translate = swiper.translate,
  1998. $wrapperEl = swiper.$wrapperEl;
  1999. if (params.virtualTranslate) {
  2000. return rtl ? -translate : translate;
  2001. }
  2002. if (params.cssMode) {
  2003. return translate;
  2004. }
  2005. var currentTranslate = getTranslate($wrapperEl[0], axis);
  2006. if (rtl) currentTranslate = -currentTranslate;
  2007. return currentTranslate || 0;
  2008. }
  2009. function setTranslate(translate, byController) {
  2010. var swiper = this;
  2011. var rtl = swiper.rtlTranslate,
  2012. params = swiper.params,
  2013. $wrapperEl = swiper.$wrapperEl,
  2014. wrapperEl = swiper.wrapperEl,
  2015. progress = swiper.progress;
  2016. var x = 0;
  2017. var y = 0;
  2018. var z = 0;
  2019. if (swiper.isHorizontal()) {
  2020. x = rtl ? -translate : translate;
  2021. } else {
  2022. y = translate;
  2023. }
  2024. if (params.roundLengths) {
  2025. x = Math.floor(x);
  2026. y = Math.floor(y);
  2027. }
  2028. if (params.cssMode) {
  2029. wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
  2030. } else if (!params.virtualTranslate) {
  2031. $wrapperEl.transform("translate3d(" + x + "px, " + y + "px, " + z + "px)");
  2032. }
  2033. swiper.previousTranslate = swiper.translate;
  2034. swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress
  2035. var newProgress;
  2036. var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
  2037. if (translatesDiff === 0) {
  2038. newProgress = 0;
  2039. } else {
  2040. newProgress = (translate - swiper.minTranslate()) / translatesDiff;
  2041. }
  2042. if (newProgress !== progress) {
  2043. swiper.updateProgress(translate);
  2044. }
  2045. swiper.emit('setTranslate', swiper.translate, byController);
  2046. }
  2047. function minTranslate() {
  2048. return -this.snapGrid[0];
  2049. }
  2050. function maxTranslate() {
  2051. return -this.snapGrid[this.snapGrid.length - 1];
  2052. }
  2053. function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
  2054. if (translate === void 0) {
  2055. translate = 0;
  2056. }
  2057. if (speed === void 0) {
  2058. speed = this.params.speed;
  2059. }
  2060. if (runCallbacks === void 0) {
  2061. runCallbacks = true;
  2062. }
  2063. if (translateBounds === void 0) {
  2064. translateBounds = true;
  2065. }
  2066. var swiper = this;
  2067. var params = swiper.params,
  2068. wrapperEl = swiper.wrapperEl;
  2069. if (swiper.animating && params.preventInteractionOnTransition) {
  2070. return false;
  2071. }
  2072. var minTranslate = swiper.minTranslate();
  2073. var maxTranslate = swiper.maxTranslate();
  2074. var newTranslate;
  2075. if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress
  2076. swiper.updateProgress(newTranslate);
  2077. if (params.cssMode) {
  2078. var isH = swiper.isHorizontal();
  2079. if (speed === 0) {
  2080. wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
  2081. } else {
  2082. // eslint-disable-next-line
  2083. if (wrapperEl.scrollTo) {
  2084. var _wrapperEl$scrollTo;
  2085. wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _wrapperEl$scrollTo[isH ? 'left' : 'top'] = -newTranslate, _wrapperEl$scrollTo.behavior = 'smooth', _wrapperEl$scrollTo));
  2086. } else {
  2087. wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
  2088. }
  2089. }
  2090. return true;
  2091. }
  2092. if (speed === 0) {
  2093. swiper.setTransition(0);
  2094. swiper.setTranslate(newTranslate);
  2095. if (runCallbacks) {
  2096. swiper.emit('beforeTransitionStart', speed, internal);
  2097. swiper.emit('transitionEnd');
  2098. }
  2099. } else {
  2100. swiper.setTransition(speed);
  2101. swiper.setTranslate(newTranslate);
  2102. if (runCallbacks) {
  2103. swiper.emit('beforeTransitionStart', speed, internal);
  2104. swiper.emit('transitionStart');
  2105. }
  2106. if (!swiper.animating) {
  2107. swiper.animating = true;
  2108. if (!swiper.onTranslateToWrapperTransitionEnd) {
  2109. swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
  2110. if (!swiper || swiper.destroyed) return;
  2111. if (e.target !== this) return;
  2112. swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
  2113. swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
  2114. swiper.onTranslateToWrapperTransitionEnd = null;
  2115. delete swiper.onTranslateToWrapperTransitionEnd;
  2116. if (runCallbacks) {
  2117. swiper.emit('transitionEnd');
  2118. }
  2119. };
  2120. }
  2121. swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
  2122. swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
  2123. }
  2124. }
  2125. return true;
  2126. }
  2127. var translate = {
  2128. getTranslate: getSwiperTranslate,
  2129. setTranslate: setTranslate,
  2130. minTranslate: minTranslate,
  2131. maxTranslate: maxTranslate,
  2132. translateTo: translateTo
  2133. };
  2134. function setTransition(duration, byController) {
  2135. var swiper = this;
  2136. if (!swiper.params.cssMode) {
  2137. swiper.$wrapperEl.transition(duration);
  2138. }
  2139. swiper.emit('setTransition', duration, byController);
  2140. }
  2141. function transitionStart(runCallbacks, direction) {
  2142. if (runCallbacks === void 0) {
  2143. runCallbacks = true;
  2144. }
  2145. var swiper = this;
  2146. var activeIndex = swiper.activeIndex,
  2147. params = swiper.params,
  2148. previousIndex = swiper.previousIndex;
  2149. if (params.cssMode) return;
  2150. if (params.autoHeight) {
  2151. swiper.updateAutoHeight();
  2152. }
  2153. var dir = direction;
  2154. if (!dir) {
  2155. if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
  2156. }
  2157. swiper.emit('transitionStart');
  2158. if (runCallbacks && activeIndex !== previousIndex) {
  2159. if (dir === 'reset') {
  2160. swiper.emit('slideResetTransitionStart');
  2161. return;
  2162. }
  2163. swiper.emit('slideChangeTransitionStart');
  2164. if (dir === 'next') {
  2165. swiper.emit('slideNextTransitionStart');
  2166. } else {
  2167. swiper.emit('slidePrevTransitionStart');
  2168. }
  2169. }
  2170. }
  2171. function transitionEnd$1(runCallbacks, direction) {
  2172. if (runCallbacks === void 0) {
  2173. runCallbacks = true;
  2174. }
  2175. var swiper = this;
  2176. var activeIndex = swiper.activeIndex,
  2177. previousIndex = swiper.previousIndex,
  2178. params = swiper.params;
  2179. swiper.animating = false;
  2180. if (params.cssMode) return;
  2181. swiper.setTransition(0);
  2182. var dir = direction;
  2183. if (!dir) {
  2184. if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
  2185. }
  2186. swiper.emit('transitionEnd');
  2187. if (runCallbacks && activeIndex !== previousIndex) {
  2188. if (dir === 'reset') {
  2189. swiper.emit('slideResetTransitionEnd');
  2190. return;
  2191. }
  2192. swiper.emit('slideChangeTransitionEnd');
  2193. if (dir === 'next') {
  2194. swiper.emit('slideNextTransitionEnd');
  2195. } else {
  2196. swiper.emit('slidePrevTransitionEnd');
  2197. }
  2198. }
  2199. }
  2200. var transition$1 = {
  2201. setTransition: setTransition,
  2202. transitionStart: transitionStart,
  2203. transitionEnd: transitionEnd$1
  2204. };
  2205. function slideTo(index, speed, runCallbacks, internal) {
  2206. if (index === void 0) {
  2207. index = 0;
  2208. }
  2209. if (speed === void 0) {
  2210. speed = this.params.speed;
  2211. }
  2212. if (runCallbacks === void 0) {
  2213. runCallbacks = true;
  2214. }
  2215. if (typeof index !== 'number' && typeof index !== 'string') {
  2216. throw new Error("The 'index' argument cannot have type other than 'number' or 'string'. [" + typeof index + "] given.");
  2217. }
  2218. if (typeof index === 'string') {
  2219. /**
  2220. * The `index` argument converted from `string` to `number`.
  2221. * @type {number}
  2222. */
  2223. var indexAsNumber = parseInt(index, 10);
  2224. /**
  2225. * Determines whether the `index` argument is a valid `number`
  2226. * after being converted from the `string` type.
  2227. * @type {boolean}
  2228. */
  2229. var isValidNumber = isFinite(indexAsNumber);
  2230. if (!isValidNumber) {
  2231. throw new Error("The passed-in 'index' (string) couldn't be converted to 'number'. [" + index + "] given.");
  2232. } // Knowing that the converted `index` is a valid number,
  2233. // we can update the original argument's value.
  2234. index = indexAsNumber;
  2235. }
  2236. var swiper = this;
  2237. var slideIndex = index;
  2238. if (slideIndex < 0) slideIndex = 0;
  2239. var params = swiper.params,
  2240. snapGrid = swiper.snapGrid,
  2241. slidesGrid = swiper.slidesGrid,
  2242. previousIndex = swiper.previousIndex,
  2243. activeIndex = swiper.activeIndex,
  2244. rtl = swiper.rtlTranslate,
  2245. wrapperEl = swiper.wrapperEl;
  2246. if (swiper.animating && params.preventInteractionOnTransition) {
  2247. return false;
  2248. }
  2249. var skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
  2250. var snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
  2251. if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
  2252. if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) {
  2253. swiper.emit('beforeSlideChangeStart');
  2254. }
  2255. var translate = -snapGrid[snapIndex]; // Update progress
  2256. swiper.updateProgress(translate); // Normalize slideIndex
  2257. if (params.normalizeSlideIndex) {
  2258. for (var i = 0; i < slidesGrid.length; i += 1) {
  2259. if (-Math.floor(translate * 100) >= Math.floor(slidesGrid[i] * 100)) {
  2260. slideIndex = i;
  2261. }
  2262. }
  2263. } // Directions locks
  2264. if (swiper.initialized && slideIndex !== activeIndex) {
  2265. if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
  2266. return false;
  2267. }
  2268. if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
  2269. if ((activeIndex || 0) !== slideIndex) return false;
  2270. }
  2271. }
  2272. var direction;
  2273. if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index
  2274. if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
  2275. swiper.updateActiveIndex(slideIndex); // Update Height
  2276. if (params.autoHeight) {
  2277. swiper.updateAutoHeight();
  2278. }
  2279. swiper.updateSlidesClasses();
  2280. if (params.effect !== 'slide') {
  2281. swiper.setTranslate(translate);
  2282. }
  2283. if (direction !== 'reset') {
  2284. swiper.transitionStart(runCallbacks, direction);
  2285. swiper.transitionEnd(runCallbacks, direction);
  2286. }
  2287. return false;
  2288. }
  2289. if (params.cssMode) {
  2290. var isH = swiper.isHorizontal();
  2291. var t = -translate;
  2292. if (rtl) {
  2293. t = wrapperEl.scrollWidth - wrapperEl.offsetWidth - t;
  2294. }
  2295. if (speed === 0) {
  2296. wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
  2297. } else {
  2298. // eslint-disable-next-line
  2299. if (wrapperEl.scrollTo) {
  2300. var _wrapperEl$scrollTo;
  2301. wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _wrapperEl$scrollTo[isH ? 'left' : 'top'] = t, _wrapperEl$scrollTo.behavior = 'smooth', _wrapperEl$scrollTo));
  2302. } else {
  2303. wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
  2304. }
  2305. }
  2306. return true;
  2307. }
  2308. if (speed === 0) {
  2309. swiper.setTransition(0);
  2310. swiper.setTranslate(translate);
  2311. swiper.updateActiveIndex(slideIndex);
  2312. swiper.updateSlidesClasses();
  2313. swiper.emit('beforeTransitionStart', speed, internal);
  2314. swiper.transitionStart(runCallbacks, direction);
  2315. swiper.transitionEnd(runCallbacks, direction);
  2316. } else {
  2317. swiper.setTransition(speed);
  2318. swiper.setTranslate(translate);
  2319. swiper.updateActiveIndex(slideIndex);
  2320. swiper.updateSlidesClasses();
  2321. swiper.emit('beforeTransitionStart', speed, internal);
  2322. swiper.transitionStart(runCallbacks, direction);
  2323. if (!swiper.animating) {
  2324. swiper.animating = true;
  2325. if (!swiper.onSlideToWrapperTransitionEnd) {
  2326. swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
  2327. if (!swiper || swiper.destroyed) return;
  2328. if (e.target !== this) return;
  2329. swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
  2330. swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
  2331. swiper.onSlideToWrapperTransitionEnd = null;
  2332. delete swiper.onSlideToWrapperTransitionEnd;
  2333. swiper.transitionEnd(runCallbacks, direction);
  2334. };
  2335. }
  2336. swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
  2337. swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
  2338. }
  2339. }
  2340. return true;
  2341. }
  2342. function slideToLoop(index, speed, runCallbacks, internal) {
  2343. if (index === void 0) {
  2344. index = 0;
  2345. }
  2346. if (speed === void 0) {
  2347. speed = this.params.speed;
  2348. }
  2349. if (runCallbacks === void 0) {
  2350. runCallbacks = true;
  2351. }
  2352. var swiper = this;
  2353. var newIndex = index;
  2354. if (swiper.params.loop) {
  2355. newIndex += swiper.loopedSlides;
  2356. }
  2357. return swiper.slideTo(newIndex, speed, runCallbacks, internal);
  2358. }
  2359. /* eslint no-unused-vars: "off" */
  2360. function slideNext(speed, runCallbacks, internal) {
  2361. if (speed === void 0) {
  2362. speed = this.params.speed;
  2363. }
  2364. if (runCallbacks === void 0) {
  2365. runCallbacks = true;
  2366. }
  2367. var swiper = this;
  2368. var params = swiper.params,
  2369. animating = swiper.animating;
  2370. var increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup;
  2371. if (params.loop) {
  2372. if (animating && params.loopPreventsSlide) return false;
  2373. swiper.loopFix(); // eslint-disable-next-line
  2374. swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
  2375. }
  2376. return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
  2377. }
  2378. /* eslint no-unused-vars: "off" */
  2379. function slidePrev(speed, runCallbacks, internal) {
  2380. if (speed === void 0) {
  2381. speed = this.params.speed;
  2382. }
  2383. if (runCallbacks === void 0) {
  2384. runCallbacks = true;
  2385. }
  2386. var swiper = this;
  2387. var params = swiper.params,
  2388. animating = swiper.animating,
  2389. snapGrid = swiper.snapGrid,
  2390. slidesGrid = swiper.slidesGrid,
  2391. rtlTranslate = swiper.rtlTranslate;
  2392. if (params.loop) {
  2393. if (animating && params.loopPreventsSlide) return false;
  2394. swiper.loopFix(); // eslint-disable-next-line
  2395. swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
  2396. }
  2397. var translate = rtlTranslate ? swiper.translate : -swiper.translate;
  2398. function normalize(val) {
  2399. if (val < 0) return -Math.floor(Math.abs(val));
  2400. return Math.floor(val);
  2401. }
  2402. var normalizedTranslate = normalize(translate);
  2403. var normalizedSnapGrid = snapGrid.map(function (val) {
  2404. return normalize(val);
  2405. });
  2406. var currentSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate)];
  2407. var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
  2408. if (typeof prevSnap === 'undefined' && params.cssMode) {
  2409. snapGrid.forEach(function (snap) {
  2410. if (!prevSnap && normalizedTranslate >= snap) prevSnap = snap;
  2411. });
  2412. }
  2413. var prevIndex;
  2414. if (typeof prevSnap !== 'undefined') {
  2415. prevIndex = slidesGrid.indexOf(prevSnap);
  2416. if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
  2417. }
  2418. return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
  2419. }
  2420. /* eslint no-unused-vars: "off" */
  2421. function slideReset(speed, runCallbacks, internal) {
  2422. if (speed === void 0) {
  2423. speed = this.params.speed;
  2424. }
  2425. if (runCallbacks === void 0) {
  2426. runCallbacks = true;
  2427. }
  2428. var swiper = this;
  2429. return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
  2430. }
  2431. /* eslint no-unused-vars: "off" */
  2432. function slideToClosest(speed, runCallbacks, internal, threshold) {
  2433. if (speed === void 0) {
  2434. speed = this.params.speed;
  2435. }
  2436. if (runCallbacks === void 0) {
  2437. runCallbacks = true;
  2438. }
  2439. if (threshold === void 0) {
  2440. threshold = 0.5;
  2441. }
  2442. var swiper = this;
  2443. var index = swiper.activeIndex;
  2444. var skip = Math.min(swiper.params.slidesPerGroupSkip, index);
  2445. var snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
  2446. var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
  2447. if (translate >= swiper.snapGrid[snapIndex]) {
  2448. // The current translate is on or after the current snap index, so the choice
  2449. // is between the current index and the one after it.
  2450. var currentSnap = swiper.snapGrid[snapIndex];
  2451. var nextSnap = swiper.snapGrid[snapIndex + 1];
  2452. if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
  2453. index += swiper.params.slidesPerGroup;
  2454. }
  2455. } else {
  2456. // The current translate is before the current snap index, so the choice
  2457. // is between the current index and the one before it.
  2458. var prevSnap = swiper.snapGrid[snapIndex - 1];
  2459. var _currentSnap = swiper.snapGrid[snapIndex];
  2460. if (translate - prevSnap <= (_currentSnap - prevSnap) * threshold) {
  2461. index -= swiper.params.slidesPerGroup;
  2462. }
  2463. }
  2464. index = Math.max(index, 0);
  2465. index = Math.min(index, swiper.slidesGrid.length - 1);
  2466. return swiper.slideTo(index, speed, runCallbacks, internal);
  2467. }
  2468. function slideToClickedSlide() {
  2469. var swiper = this;
  2470. var params = swiper.params,
  2471. $wrapperEl = swiper.$wrapperEl;
  2472. var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
  2473. var slideToIndex = swiper.clickedIndex;
  2474. var realIndex;
  2475. if (params.loop) {
  2476. if (swiper.animating) return;
  2477. realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);
  2478. if (params.centeredSlides) {
  2479. if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
  2480. swiper.loopFix();
  2481. slideToIndex = $wrapperEl.children("." + params.slideClass + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + params.slideDuplicateClass + ")").eq(0).index();
  2482. nextTick(function () {
  2483. swiper.slideTo(slideToIndex);
  2484. });
  2485. } else {
  2486. swiper.slideTo(slideToIndex);
  2487. }
  2488. } else if (slideToIndex > swiper.slides.length - slidesPerView) {
  2489. swiper.loopFix();
  2490. slideToIndex = $wrapperEl.children("." + params.slideClass + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + params.slideDuplicateClass + ")").eq(0).index();
  2491. nextTick(function () {
  2492. swiper.slideTo(slideToIndex);
  2493. });
  2494. } else {
  2495. swiper.slideTo(slideToIndex);
  2496. }
  2497. } else {
  2498. swiper.slideTo(slideToIndex);
  2499. }
  2500. }
  2501. var slide = {
  2502. slideTo: slideTo,
  2503. slideToLoop: slideToLoop,
  2504. slideNext: slideNext,
  2505. slidePrev: slidePrev,
  2506. slideReset: slideReset,
  2507. slideToClosest: slideToClosest,
  2508. slideToClickedSlide: slideToClickedSlide
  2509. };
  2510. function loopCreate() {
  2511. var swiper = this;
  2512. var document = getDocument();
  2513. var params = swiper.params,
  2514. $wrapperEl = swiper.$wrapperEl; // Remove duplicated slides
  2515. $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass).remove();
  2516. var slides = $wrapperEl.children("." + params.slideClass);
  2517. if (params.loopFillGroupWithBlank) {
  2518. var blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;
  2519. if (blankSlidesNum !== params.slidesPerGroup) {
  2520. for (var i = 0; i < blankSlidesNum; i += 1) {
  2521. var blankNode = $(document.createElement('div')).addClass(params.slideClass + " " + params.slideBlankClass);
  2522. $wrapperEl.append(blankNode);
  2523. }
  2524. slides = $wrapperEl.children("." + params.slideClass);
  2525. }
  2526. }
  2527. if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;
  2528. swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));
  2529. swiper.loopedSlides += params.loopAdditionalSlides;
  2530. if (swiper.loopedSlides > slides.length) {
  2531. swiper.loopedSlides = slides.length;
  2532. }
  2533. var prependSlides = [];
  2534. var appendSlides = [];
  2535. slides.each(function (el, index) {
  2536. var slide = $(el);
  2537. if (index < swiper.loopedSlides) {
  2538. appendSlides.push(el);
  2539. }
  2540. if (index < slides.length && index >= slides.length - swiper.loopedSlides) {
  2541. prependSlides.push(el);
  2542. }
  2543. slide.attr('data-swiper-slide-index', index);
  2544. });
  2545. for (var _i = 0; _i < appendSlides.length; _i += 1) {
  2546. $wrapperEl.append($(appendSlides[_i].cloneNode(true)).addClass(params.slideDuplicateClass));
  2547. }
  2548. for (var _i2 = prependSlides.length - 1; _i2 >= 0; _i2 -= 1) {
  2549. $wrapperEl.prepend($(prependSlides[_i2].cloneNode(true)).addClass(params.slideDuplicateClass));
  2550. }
  2551. }
  2552. function loopFix() {
  2553. var swiper = this;
  2554. swiper.emit('beforeLoopFix');
  2555. var activeIndex = swiper.activeIndex,
  2556. slides = swiper.slides,
  2557. loopedSlides = swiper.loopedSlides,
  2558. allowSlidePrev = swiper.allowSlidePrev,
  2559. allowSlideNext = swiper.allowSlideNext,
  2560. snapGrid = swiper.snapGrid,
  2561. rtl = swiper.rtlTranslate;
  2562. var newIndex;
  2563. swiper.allowSlidePrev = true;
  2564. swiper.allowSlideNext = true;
  2565. var snapTranslate = -snapGrid[activeIndex];
  2566. var diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding
  2567. if (activeIndex < loopedSlides) {
  2568. newIndex = slides.length - loopedSlides * 3 + activeIndex;
  2569. newIndex += loopedSlides;
  2570. var slideChanged = swiper.slideTo(newIndex, 0, false, true);
  2571. if (slideChanged && diff !== 0) {
  2572. swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
  2573. }
  2574. } else if (activeIndex >= slides.length - loopedSlides) {
  2575. // Fix For Positive Oversliding
  2576. newIndex = -slides.length + activeIndex + loopedSlides;
  2577. newIndex += loopedSlides;
  2578. var _slideChanged = swiper.slideTo(newIndex, 0, false, true);
  2579. if (_slideChanged && diff !== 0) {
  2580. swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
  2581. }
  2582. }
  2583. swiper.allowSlidePrev = allowSlidePrev;
  2584. swiper.allowSlideNext = allowSlideNext;
  2585. swiper.emit('loopFix');
  2586. }
  2587. function loopDestroy() {
  2588. var swiper = this;
  2589. var $wrapperEl = swiper.$wrapperEl,
  2590. params = swiper.params,
  2591. slides = swiper.slides;
  2592. $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + ",." + params.slideClass + "." + params.slideBlankClass).remove();
  2593. slides.removeAttr('data-swiper-slide-index');
  2594. }
  2595. var loop = {
  2596. loopCreate: loopCreate,
  2597. loopFix: loopFix,
  2598. loopDestroy: loopDestroy
  2599. };
  2600. function setGrabCursor(moving) {
  2601. var swiper = this;
  2602. if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
  2603. var el = swiper.el;
  2604. el.style.cursor = 'move';
  2605. el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
  2606. el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
  2607. el.style.cursor = moving ? 'grabbing' : 'grab';
  2608. }
  2609. function unsetGrabCursor() {
  2610. var swiper = this;
  2611. if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
  2612. return;
  2613. }
  2614. swiper.el.style.cursor = '';
  2615. }
  2616. var grabCursor = {
  2617. setGrabCursor: setGrabCursor,
  2618. unsetGrabCursor: unsetGrabCursor
  2619. };
  2620. function appendSlide(slides) {
  2621. var swiper = this;
  2622. var $wrapperEl = swiper.$wrapperEl,
  2623. params = swiper.params;
  2624. if (params.loop) {
  2625. swiper.loopDestroy();
  2626. }
  2627. if (typeof slides === 'object' && 'length' in slides) {
  2628. for (var i = 0; i < slides.length; i += 1) {
  2629. if (slides[i]) $wrapperEl.append(slides[i]);
  2630. }
  2631. } else {
  2632. $wrapperEl.append(slides);
  2633. }
  2634. if (params.loop) {
  2635. swiper.loopCreate();
  2636. }
  2637. if (!(params.observer && swiper.support.observer)) {
  2638. swiper.update();
  2639. }
  2640. }
  2641. function prependSlide(slides) {
  2642. var swiper = this;
  2643. var params = swiper.params,
  2644. $wrapperEl = swiper.$wrapperEl,
  2645. activeIndex = swiper.activeIndex;
  2646. if (params.loop) {
  2647. swiper.loopDestroy();
  2648. }
  2649. var newActiveIndex = activeIndex + 1;
  2650. if (typeof slides === 'object' && 'length' in slides) {
  2651. for (var i = 0; i < slides.length; i += 1) {
  2652. if (slides[i]) $wrapperEl.prepend(slides[i]);
  2653. }
  2654. newActiveIndex = activeIndex + slides.length;
  2655. } else {
  2656. $wrapperEl.prepend(slides);
  2657. }
  2658. if (params.loop) {
  2659. swiper.loopCreate();
  2660. }
  2661. if (!(params.observer && swiper.support.observer)) {
  2662. swiper.update();
  2663. }
  2664. swiper.slideTo(newActiveIndex, 0, false);
  2665. }
  2666. function addSlide(index, slides) {
  2667. var swiper = this;
  2668. var $wrapperEl = swiper.$wrapperEl,
  2669. params = swiper.params,
  2670. activeIndex = swiper.activeIndex;
  2671. var activeIndexBuffer = activeIndex;
  2672. if (params.loop) {
  2673. activeIndexBuffer -= swiper.loopedSlides;
  2674. swiper.loopDestroy();
  2675. swiper.slides = $wrapperEl.children("." + params.slideClass);
  2676. }
  2677. var baseLength = swiper.slides.length;
  2678. if (index <= 0) {
  2679. swiper.prependSlide(slides);
  2680. return;
  2681. }
  2682. if (index >= baseLength) {
  2683. swiper.appendSlide(slides);
  2684. return;
  2685. }
  2686. var newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer;
  2687. var slidesBuffer = [];
  2688. for (var i = baseLength - 1; i >= index; i -= 1) {
  2689. var currentSlide = swiper.slides.eq(i);
  2690. currentSlide.remove();
  2691. slidesBuffer.unshift(currentSlide);
  2692. }
  2693. if (typeof slides === 'object' && 'length' in slides) {
  2694. for (var _i = 0; _i < slides.length; _i += 1) {
  2695. if (slides[_i]) $wrapperEl.append(slides[_i]);
  2696. }
  2697. newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer;
  2698. } else {
  2699. $wrapperEl.append(slides);
  2700. }
  2701. for (var _i2 = 0; _i2 < slidesBuffer.length; _i2 += 1) {
  2702. $wrapperEl.append(slidesBuffer[_i2]);
  2703. }
  2704. if (params.loop) {
  2705. swiper.loopCreate();
  2706. }
  2707. if (!(params.observer && swiper.support.observer)) {
  2708. swiper.update();
  2709. }
  2710. if (params.loop) {
  2711. swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
  2712. } else {
  2713. swiper.slideTo(newActiveIndex, 0, false);
  2714. }
  2715. }
  2716. function removeSlide(slidesIndexes) {
  2717. var swiper = this;
  2718. var params = swiper.params,
  2719. $wrapperEl = swiper.$wrapperEl,
  2720. activeIndex = swiper.activeIndex;
  2721. var activeIndexBuffer = activeIndex;
  2722. if (params.loop) {
  2723. activeIndexBuffer -= swiper.loopedSlides;
  2724. swiper.loopDestroy();
  2725. swiper.slides = $wrapperEl.children("." + params.slideClass);
  2726. }
  2727. var newActiveIndex = activeIndexBuffer;
  2728. var indexToRemove;
  2729. if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) {
  2730. for (var i = 0; i < slidesIndexes.length; i += 1) {
  2731. indexToRemove = slidesIndexes[i];
  2732. if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();
  2733. if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
  2734. }
  2735. newActiveIndex = Math.max(newActiveIndex, 0);
  2736. } else {
  2737. indexToRemove = slidesIndexes;
  2738. if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();
  2739. if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
  2740. newActiveIndex = Math.max(newActiveIndex, 0);
  2741. }
  2742. if (params.loop) {
  2743. swiper.loopCreate();
  2744. }
  2745. if (!(params.observer && swiper.support.observer)) {
  2746. swiper.update();
  2747. }
  2748. if (params.loop) {
  2749. swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
  2750. } else {
  2751. swiper.slideTo(newActiveIndex, 0, false);
  2752. }
  2753. }
  2754. function removeAllSlides() {
  2755. var swiper = this;
  2756. var slidesIndexes = [];
  2757. for (var i = 0; i < swiper.slides.length; i += 1) {
  2758. slidesIndexes.push(i);
  2759. }
  2760. swiper.removeSlide(slidesIndexes);
  2761. }
  2762. var manipulation = {
  2763. appendSlide: appendSlide,
  2764. prependSlide: prependSlide,
  2765. addSlide: addSlide,
  2766. removeSlide: removeSlide,
  2767. removeAllSlides: removeAllSlides
  2768. };
  2769. function onTouchStart(event) {
  2770. var swiper = this;
  2771. var document = getDocument();
  2772. var window = getWindow();
  2773. var data = swiper.touchEventsData;
  2774. var params = swiper.params,
  2775. touches = swiper.touches;
  2776. if (swiper.animating && params.preventInteractionOnTransition) {
  2777. return;
  2778. }
  2779. var e = event;
  2780. if (e.originalEvent) e = e.originalEvent;
  2781. var $targetEl = $(e.target);
  2782. if (params.touchEventsTarget === 'wrapper') {
  2783. if (!$targetEl.closest(swiper.wrapperEl).length) return;
  2784. }
  2785. data.isTouchEvent = e.type === 'touchstart';
  2786. if (!data.isTouchEvent && 'which' in e && e.which === 3) return;
  2787. if (!data.isTouchEvent && 'button' in e && e.button > 0) return;
  2788. if (data.isTouched && data.isMoved) return; // change target el for shadow root componenet
  2789. var swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
  2790. if (swipingClassHasValue && e.target && e.target.shadowRoot && event.path && event.path[0]) {
  2791. $targetEl = $(event.path[0]);
  2792. }
  2793. if (params.noSwiping && $targetEl.closest(params.noSwipingSelector ? params.noSwipingSelector : "." + params.noSwipingClass)[0]) {
  2794. swiper.allowClick = true;
  2795. return;
  2796. }
  2797. if (params.swipeHandler) {
  2798. if (!$targetEl.closest(params.swipeHandler)[0]) return;
  2799. }
  2800. touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  2801. touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  2802. var startX = touches.currentX;
  2803. var startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
  2804. var edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
  2805. var edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
  2806. if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.screen.width - edgeSwipeThreshold)) {
  2807. return;
  2808. }
  2809. extend$1(data, {
  2810. isTouched: true,
  2811. isMoved: false,
  2812. allowTouchCallbacks: true,
  2813. isScrolling: undefined,
  2814. startMoving: undefined
  2815. });
  2816. touches.startX = startX;
  2817. touches.startY = startY;
  2818. data.touchStartTime = now();
  2819. swiper.allowClick = true;
  2820. swiper.updateSize();
  2821. swiper.swipeDirection = undefined;
  2822. if (params.threshold > 0) data.allowThresholdMove = false;
  2823. if (e.type !== 'touchstart') {
  2824. var preventDefault = true;
  2825. if ($targetEl.is(data.formElements)) preventDefault = false;
  2826. if (document.activeElement && $(document.activeElement).is(data.formElements) && document.activeElement !== $targetEl[0]) {
  2827. document.activeElement.blur();
  2828. }
  2829. var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
  2830. if (params.touchStartForcePreventDefault || shouldPreventDefault) {
  2831. e.preventDefault();
  2832. }
  2833. }
  2834. swiper.emit('touchStart', e);
  2835. }
  2836. function onTouchMove(event) {
  2837. var document = getDocument();
  2838. var swiper = this;
  2839. var data = swiper.touchEventsData;
  2840. var params = swiper.params,
  2841. touches = swiper.touches,
  2842. rtl = swiper.rtlTranslate;
  2843. var e = event;
  2844. if (e.originalEvent) e = e.originalEvent;
  2845. if (!data.isTouched) {
  2846. if (data.startMoving && data.isScrolling) {
  2847. swiper.emit('touchMoveOpposite', e);
  2848. }
  2849. return;
  2850. }
  2851. if (data.isTouchEvent && e.type !== 'touchmove') return;
  2852. var targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);
  2853. var pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;
  2854. var pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;
  2855. if (e.preventedByNestedSwiper) {
  2856. touches.startX = pageX;
  2857. touches.startY = pageY;
  2858. return;
  2859. }
  2860. if (!swiper.allowTouchMove) {
  2861. // isMoved = true;
  2862. swiper.allowClick = false;
  2863. if (data.isTouched) {
  2864. extend$1(touches, {
  2865. startX: pageX,
  2866. startY: pageY,
  2867. currentX: pageX,
  2868. currentY: pageY
  2869. });
  2870. data.touchStartTime = now();
  2871. }
  2872. return;
  2873. }
  2874. if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
  2875. if (swiper.isVertical()) {
  2876. // Vertical
  2877. if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
  2878. data.isTouched = false;
  2879. data.isMoved = false;
  2880. return;
  2881. }
  2882. } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
  2883. return;
  2884. }
  2885. }
  2886. if (data.isTouchEvent && document.activeElement) {
  2887. if (e.target === document.activeElement && $(e.target).is(data.formElements)) {
  2888. data.isMoved = true;
  2889. swiper.allowClick = false;
  2890. return;
  2891. }
  2892. }
  2893. if (data.allowTouchCallbacks) {
  2894. swiper.emit('touchMove', e);
  2895. }
  2896. if (e.targetTouches && e.targetTouches.length > 1) return;
  2897. touches.currentX = pageX;
  2898. touches.currentY = pageY;
  2899. var diffX = touches.currentX - touches.startX;
  2900. var diffY = touches.currentY - touches.startY;
  2901. if (swiper.params.threshold && Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2)) < swiper.params.threshold) return;
  2902. if (typeof data.isScrolling === 'undefined') {
  2903. var touchAngle;
  2904. if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
  2905. data.isScrolling = false;
  2906. } else {
  2907. // eslint-disable-next-line
  2908. if (diffX * diffX + diffY * diffY >= 25) {
  2909. touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
  2910. data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
  2911. }
  2912. }
  2913. }
  2914. if (data.isScrolling) {
  2915. swiper.emit('touchMoveOpposite', e);
  2916. }
  2917. if (typeof data.startMoving === 'undefined') {
  2918. if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
  2919. data.startMoving = true;
  2920. }
  2921. }
  2922. if (data.isScrolling) {
  2923. data.isTouched = false;
  2924. return;
  2925. }
  2926. if (!data.startMoving) {
  2927. return;
  2928. }
  2929. swiper.allowClick = false;
  2930. if (!params.cssMode && e.cancelable) {
  2931. e.preventDefault();
  2932. }
  2933. if (params.touchMoveStopPropagation && !params.nested) {
  2934. e.stopPropagation();
  2935. }
  2936. if (!data.isMoved) {
  2937. if (params.loop) {
  2938. swiper.loopFix();
  2939. }
  2940. data.startTranslate = swiper.getTranslate();
  2941. swiper.setTransition(0);
  2942. if (swiper.animating) {
  2943. swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
  2944. }
  2945. data.allowMomentumBounce = false; // Grab Cursor
  2946. if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
  2947. swiper.setGrabCursor(true);
  2948. }
  2949. swiper.emit('sliderFirstMove', e);
  2950. }
  2951. swiper.emit('sliderMove', e);
  2952. data.isMoved = true;
  2953. var diff = swiper.isHorizontal() ? diffX : diffY;
  2954. touches.diff = diff;
  2955. diff *= params.touchRatio;
  2956. if (rtl) diff = -diff;
  2957. swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
  2958. data.currentTranslate = diff + data.startTranslate;
  2959. var disableParentSwiper = true;
  2960. var resistanceRatio = params.resistanceRatio;
  2961. if (params.touchReleaseOnEdges) {
  2962. resistanceRatio = 0;
  2963. }
  2964. if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {
  2965. disableParentSwiper = false;
  2966. if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + Math.pow(-swiper.minTranslate() + data.startTranslate + diff, resistanceRatio);
  2967. } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
  2968. disableParentSwiper = false;
  2969. if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - Math.pow(swiper.maxTranslate() - data.startTranslate - diff, resistanceRatio);
  2970. }
  2971. if (disableParentSwiper) {
  2972. e.preventedByNestedSwiper = true;
  2973. } // Directions locks
  2974. if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
  2975. data.currentTranslate = data.startTranslate;
  2976. }
  2977. if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
  2978. data.currentTranslate = data.startTranslate;
  2979. } // Threshold
  2980. if (params.threshold > 0) {
  2981. if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
  2982. if (!data.allowThresholdMove) {
  2983. data.allowThresholdMove = true;
  2984. touches.startX = touches.currentX;
  2985. touches.startY = touches.currentY;
  2986. data.currentTranslate = data.startTranslate;
  2987. touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
  2988. return;
  2989. }
  2990. } else {
  2991. data.currentTranslate = data.startTranslate;
  2992. return;
  2993. }
  2994. }
  2995. if (!params.followFinger || params.cssMode) return; // Update active index in free mode
  2996. if (params.freeMode || params.watchSlidesProgress || params.watchSlidesVisibility) {
  2997. swiper.updateActiveIndex();
  2998. swiper.updateSlidesClasses();
  2999. }
  3000. if (params.freeMode) {
  3001. // Velocity
  3002. if (data.velocities.length === 0) {
  3003. data.velocities.push({
  3004. position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
  3005. time: data.touchStartTime
  3006. });
  3007. }
  3008. data.velocities.push({
  3009. position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
  3010. time: now()
  3011. });
  3012. } // Update progress
  3013. swiper.updateProgress(data.currentTranslate); // Update translate
  3014. swiper.setTranslate(data.currentTranslate);
  3015. }
  3016. function onTouchEnd(event) {
  3017. var swiper = this;
  3018. var data = swiper.touchEventsData;
  3019. var params = swiper.params,
  3020. touches = swiper.touches,
  3021. rtl = swiper.rtlTranslate,
  3022. $wrapperEl = swiper.$wrapperEl,
  3023. slidesGrid = swiper.slidesGrid,
  3024. snapGrid = swiper.snapGrid;
  3025. var e = event;
  3026. if (e.originalEvent) e = e.originalEvent;
  3027. if (data.allowTouchCallbacks) {
  3028. swiper.emit('touchEnd', e);
  3029. }
  3030. data.allowTouchCallbacks = false;
  3031. if (!data.isTouched) {
  3032. if (data.isMoved && params.grabCursor) {
  3033. swiper.setGrabCursor(false);
  3034. }
  3035. data.isMoved = false;
  3036. data.startMoving = false;
  3037. return;
  3038. } // Return Grab Cursor
  3039. if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
  3040. swiper.setGrabCursor(false);
  3041. } // Time diff
  3042. var touchEndTime = now();
  3043. var timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click
  3044. if (swiper.allowClick) {
  3045. swiper.updateClickedSlide(e);
  3046. swiper.emit('tap click', e);
  3047. if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
  3048. swiper.emit('doubleTap doubleClick', e);
  3049. }
  3050. }
  3051. data.lastClickTime = now();
  3052. nextTick(function () {
  3053. if (!swiper.destroyed) swiper.allowClick = true;
  3054. });
  3055. if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
  3056. data.isTouched = false;
  3057. data.isMoved = false;
  3058. data.startMoving = false;
  3059. return;
  3060. }
  3061. data.isTouched = false;
  3062. data.isMoved = false;
  3063. data.startMoving = false;
  3064. var currentPos;
  3065. if (params.followFinger) {
  3066. currentPos = rtl ? swiper.translate : -swiper.translate;
  3067. } else {
  3068. currentPos = -data.currentTranslate;
  3069. }
  3070. if (params.cssMode) {
  3071. return;
  3072. }
  3073. if (params.freeMode) {
  3074. if (currentPos < -swiper.minTranslate()) {
  3075. swiper.slideTo(swiper.activeIndex);
  3076. return;
  3077. }
  3078. if (currentPos > -swiper.maxTranslate()) {
  3079. if (swiper.slides.length < snapGrid.length) {
  3080. swiper.slideTo(snapGrid.length - 1);
  3081. } else {
  3082. swiper.slideTo(swiper.slides.length - 1);
  3083. }
  3084. return;
  3085. }
  3086. if (params.freeModeMomentum) {
  3087. if (data.velocities.length > 1) {
  3088. var lastMoveEvent = data.velocities.pop();
  3089. var velocityEvent = data.velocities.pop();
  3090. var distance = lastMoveEvent.position - velocityEvent.position;
  3091. var time = lastMoveEvent.time - velocityEvent.time;
  3092. swiper.velocity = distance / time;
  3093. swiper.velocity /= 2;
  3094. if (Math.abs(swiper.velocity) < params.freeModeMinimumVelocity) {
  3095. swiper.velocity = 0;
  3096. } // this implies that the user stopped moving a finger then released.
  3097. // There would be no events with distance zero, so the last event is stale.
  3098. if (time > 150 || now() - lastMoveEvent.time > 300) {
  3099. swiper.velocity = 0;
  3100. }
  3101. } else {
  3102. swiper.velocity = 0;
  3103. }
  3104. swiper.velocity *= params.freeModeMomentumVelocityRatio;
  3105. data.velocities.length = 0;
  3106. var momentumDuration = 1000 * params.freeModeMomentumRatio;
  3107. var momentumDistance = swiper.velocity * momentumDuration;
  3108. var newPosition = swiper.translate + momentumDistance;
  3109. if (rtl) newPosition = -newPosition;
  3110. var doBounce = false;
  3111. var afterBouncePosition;
  3112. var bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeModeMomentumBounceRatio;
  3113. var needsLoopFix;
  3114. if (newPosition < swiper.maxTranslate()) {
  3115. if (params.freeModeMomentumBounce) {
  3116. if (newPosition + swiper.maxTranslate() < -bounceAmount) {
  3117. newPosition = swiper.maxTranslate() - bounceAmount;
  3118. }
  3119. afterBouncePosition = swiper.maxTranslate();
  3120. doBounce = true;
  3121. data.allowMomentumBounce = true;
  3122. } else {
  3123. newPosition = swiper.maxTranslate();
  3124. }
  3125. if (params.loop && params.centeredSlides) needsLoopFix = true;
  3126. } else if (newPosition > swiper.minTranslate()) {
  3127. if (params.freeModeMomentumBounce) {
  3128. if (newPosition - swiper.minTranslate() > bounceAmount) {
  3129. newPosition = swiper.minTranslate() + bounceAmount;
  3130. }
  3131. afterBouncePosition = swiper.minTranslate();
  3132. doBounce = true;
  3133. data.allowMomentumBounce = true;
  3134. } else {
  3135. newPosition = swiper.minTranslate();
  3136. }
  3137. if (params.loop && params.centeredSlides) needsLoopFix = true;
  3138. } else if (params.freeModeSticky) {
  3139. var nextSlide;
  3140. for (var j = 0; j < snapGrid.length; j += 1) {
  3141. if (snapGrid[j] > -newPosition) {
  3142. nextSlide = j;
  3143. break;
  3144. }
  3145. }
  3146. if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
  3147. newPosition = snapGrid[nextSlide];
  3148. } else {
  3149. newPosition = snapGrid[nextSlide - 1];
  3150. }
  3151. newPosition = -newPosition;
  3152. }
  3153. if (needsLoopFix) {
  3154. swiper.once('transitionEnd', function () {
  3155. swiper.loopFix();
  3156. });
  3157. } // Fix duration
  3158. if (swiper.velocity !== 0) {
  3159. if (rtl) {
  3160. momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
  3161. } else {
  3162. momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
  3163. }
  3164. if (params.freeModeSticky) {
  3165. // If freeModeSticky is active and the user ends a swipe with a slow-velocity
  3166. // event, then durations can be 20+ seconds to slide one (or zero!) slides.
  3167. // It's easy to see this when simulating touch with mouse events. To fix this,
  3168. // limit single-slide swipes to the default slide duration. This also has the
  3169. // nice side effect of matching slide speed if the user stopped moving before
  3170. // lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
  3171. // For faster swipes, also apply limits (albeit higher ones).
  3172. var moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
  3173. var currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
  3174. if (moveDistance < currentSlideSize) {
  3175. momentumDuration = params.speed;
  3176. } else if (moveDistance < 2 * currentSlideSize) {
  3177. momentumDuration = params.speed * 1.5;
  3178. } else {
  3179. momentumDuration = params.speed * 2.5;
  3180. }
  3181. }
  3182. } else if (params.freeModeSticky) {
  3183. swiper.slideToClosest();
  3184. return;
  3185. }
  3186. if (params.freeModeMomentumBounce && doBounce) {
  3187. swiper.updateProgress(afterBouncePosition);
  3188. swiper.setTransition(momentumDuration);
  3189. swiper.setTranslate(newPosition);
  3190. swiper.transitionStart(true, swiper.swipeDirection);
  3191. swiper.animating = true;
  3192. $wrapperEl.transitionEnd(function () {
  3193. if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
  3194. swiper.emit('momentumBounce');
  3195. swiper.setTransition(params.speed);
  3196. setTimeout(function () {
  3197. swiper.setTranslate(afterBouncePosition);
  3198. $wrapperEl.transitionEnd(function () {
  3199. if (!swiper || swiper.destroyed) return;
  3200. swiper.transitionEnd();
  3201. });
  3202. }, 0);
  3203. });
  3204. } else if (swiper.velocity) {
  3205. swiper.updateProgress(newPosition);
  3206. swiper.setTransition(momentumDuration);
  3207. swiper.setTranslate(newPosition);
  3208. swiper.transitionStart(true, swiper.swipeDirection);
  3209. if (!swiper.animating) {
  3210. swiper.animating = true;
  3211. $wrapperEl.transitionEnd(function () {
  3212. if (!swiper || swiper.destroyed) return;
  3213. swiper.transitionEnd();
  3214. });
  3215. }
  3216. } else {
  3217. swiper.updateProgress(newPosition);
  3218. }
  3219. swiper.updateActiveIndex();
  3220. swiper.updateSlidesClasses();
  3221. } else if (params.freeModeSticky) {
  3222. swiper.slideToClosest();
  3223. return;
  3224. }
  3225. if (!params.freeModeMomentum || timeDiff >= params.longSwipesMs) {
  3226. swiper.updateProgress();
  3227. swiper.updateActiveIndex();
  3228. swiper.updateSlidesClasses();
  3229. }
  3230. return;
  3231. } // Find current slide
  3232. var stopIndex = 0;
  3233. var groupSize = swiper.slidesSizesGrid[0];
  3234. for (var i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
  3235. var _increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
  3236. if (typeof slidesGrid[i + _increment] !== 'undefined') {
  3237. if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + _increment]) {
  3238. stopIndex = i;
  3239. groupSize = slidesGrid[i + _increment] - slidesGrid[i];
  3240. }
  3241. } else if (currentPos >= slidesGrid[i]) {
  3242. stopIndex = i;
  3243. groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
  3244. }
  3245. } // Find current slide size
  3246. var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
  3247. var increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
  3248. if (timeDiff > params.longSwipesMs) {
  3249. // Long touches
  3250. if (!params.longSwipes) {
  3251. swiper.slideTo(swiper.activeIndex);
  3252. return;
  3253. }
  3254. if (swiper.swipeDirection === 'next') {
  3255. if (ratio >= params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);
  3256. }
  3257. if (swiper.swipeDirection === 'prev') {
  3258. if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);
  3259. }
  3260. } else {
  3261. // Short swipes
  3262. if (!params.shortSwipes) {
  3263. swiper.slideTo(swiper.activeIndex);
  3264. return;
  3265. }
  3266. var isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
  3267. if (!isNavButtonTarget) {
  3268. if (swiper.swipeDirection === 'next') {
  3269. swiper.slideTo(stopIndex + increment);
  3270. }
  3271. if (swiper.swipeDirection === 'prev') {
  3272. swiper.slideTo(stopIndex);
  3273. }
  3274. } else if (e.target === swiper.navigation.nextEl) {
  3275. swiper.slideTo(stopIndex + increment);
  3276. } else {
  3277. swiper.slideTo(stopIndex);
  3278. }
  3279. }
  3280. }
  3281. function onResize() {
  3282. var swiper = this;
  3283. var params = swiper.params,
  3284. el = swiper.el;
  3285. if (el && el.offsetWidth === 0) return; // Breakpoints
  3286. if (params.breakpoints) {
  3287. swiper.setBreakpoint();
  3288. } // Save locks
  3289. var allowSlideNext = swiper.allowSlideNext,
  3290. allowSlidePrev = swiper.allowSlidePrev,
  3291. snapGrid = swiper.snapGrid; // Disable locks on resize
  3292. swiper.allowSlideNext = true;
  3293. swiper.allowSlidePrev = true;
  3294. swiper.updateSize();
  3295. swiper.updateSlides();
  3296. swiper.updateSlidesClasses();
  3297. if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
  3298. swiper.slideTo(swiper.slides.length - 1, 0, false, true);
  3299. } else {
  3300. swiper.slideTo(swiper.activeIndex, 0, false, true);
  3301. }
  3302. if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
  3303. swiper.autoplay.run();
  3304. } // Return locks after resize
  3305. swiper.allowSlidePrev = allowSlidePrev;
  3306. swiper.allowSlideNext = allowSlideNext;
  3307. if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
  3308. swiper.checkOverflow();
  3309. }
  3310. }
  3311. function onClick(e) {
  3312. var swiper = this;
  3313. if (!swiper.allowClick) {
  3314. if (swiper.params.preventClicks) e.preventDefault();
  3315. if (swiper.params.preventClicksPropagation && swiper.animating) {
  3316. e.stopPropagation();
  3317. e.stopImmediatePropagation();
  3318. }
  3319. }
  3320. }
  3321. function onScroll() {
  3322. var swiper = this;
  3323. var wrapperEl = swiper.wrapperEl,
  3324. rtlTranslate = swiper.rtlTranslate;
  3325. swiper.previousTranslate = swiper.translate;
  3326. if (swiper.isHorizontal()) {
  3327. if (rtlTranslate) {
  3328. swiper.translate = wrapperEl.scrollWidth - wrapperEl.offsetWidth - wrapperEl.scrollLeft;
  3329. } else {
  3330. swiper.translate = -wrapperEl.scrollLeft;
  3331. }
  3332. } else {
  3333. swiper.translate = -wrapperEl.scrollTop;
  3334. } // eslint-disable-next-line
  3335. if (swiper.translate === -0) swiper.translate = 0;
  3336. swiper.updateActiveIndex();
  3337. swiper.updateSlidesClasses();
  3338. var newProgress;
  3339. var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
  3340. if (translatesDiff === 0) {
  3341. newProgress = 0;
  3342. } else {
  3343. newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
  3344. }
  3345. if (newProgress !== swiper.progress) {
  3346. swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
  3347. }
  3348. swiper.emit('setTranslate', swiper.translate, false);
  3349. }
  3350. var dummyEventAttached = false;
  3351. function dummyEventListener() {}
  3352. function attachEvents() {
  3353. var swiper = this;
  3354. var document = getDocument();
  3355. var params = swiper.params,
  3356. touchEvents = swiper.touchEvents,
  3357. el = swiper.el,
  3358. wrapperEl = swiper.wrapperEl,
  3359. device = swiper.device,
  3360. support = swiper.support;
  3361. swiper.onTouchStart = onTouchStart.bind(swiper);
  3362. swiper.onTouchMove = onTouchMove.bind(swiper);
  3363. swiper.onTouchEnd = onTouchEnd.bind(swiper);
  3364. if (params.cssMode) {
  3365. swiper.onScroll = onScroll.bind(swiper);
  3366. }
  3367. swiper.onClick = onClick.bind(swiper);
  3368. var capture = !!params.nested; // Touch Events
  3369. if (!support.touch && support.pointerEvents) {
  3370. el.addEventListener(touchEvents.start, swiper.onTouchStart, false);
  3371. document.addEventListener(touchEvents.move, swiper.onTouchMove, capture);
  3372. document.addEventListener(touchEvents.end, swiper.onTouchEnd, false);
  3373. } else {
  3374. if (support.touch) {
  3375. var passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {
  3376. passive: true,
  3377. capture: false
  3378. } : false;
  3379. el.addEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);
  3380. el.addEventListener(touchEvents.move, swiper.onTouchMove, support.passiveListener ? {
  3381. passive: false,
  3382. capture: capture
  3383. } : capture);
  3384. el.addEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);
  3385. if (touchEvents.cancel) {
  3386. el.addEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener);
  3387. }
  3388. if (!dummyEventAttached) {
  3389. document.addEventListener('touchstart', dummyEventListener);
  3390. dummyEventAttached = true;
  3391. }
  3392. }
  3393. if (params.simulateTouch && !device.ios && !device.android || params.simulateTouch && !support.touch && device.ios) {
  3394. el.addEventListener('mousedown', swiper.onTouchStart, false);
  3395. document.addEventListener('mousemove', swiper.onTouchMove, capture);
  3396. document.addEventListener('mouseup', swiper.onTouchEnd, false);
  3397. }
  3398. } // Prevent Links Clicks
  3399. if (params.preventClicks || params.preventClicksPropagation) {
  3400. el.addEventListener('click', swiper.onClick, true);
  3401. }
  3402. if (params.cssMode) {
  3403. wrapperEl.addEventListener('scroll', swiper.onScroll);
  3404. } // Resize handler
  3405. if (params.updateOnWindowResize) {
  3406. swiper.on(device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
  3407. } else {
  3408. swiper.on('observerUpdate', onResize, true);
  3409. }
  3410. }
  3411. function detachEvents() {
  3412. var swiper = this;
  3413. var document = getDocument();
  3414. var params = swiper.params,
  3415. touchEvents = swiper.touchEvents,
  3416. el = swiper.el,
  3417. wrapperEl = swiper.wrapperEl,
  3418. device = swiper.device,
  3419. support = swiper.support;
  3420. var capture = !!params.nested; // Touch Events
  3421. if (!support.touch && support.pointerEvents) {
  3422. el.removeEventListener(touchEvents.start, swiper.onTouchStart, false);
  3423. document.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);
  3424. document.removeEventListener(touchEvents.end, swiper.onTouchEnd, false);
  3425. } else {
  3426. if (support.touch) {
  3427. var passiveListener = touchEvents.start === 'onTouchStart' && support.passiveListener && params.passiveListeners ? {
  3428. passive: true,
  3429. capture: false
  3430. } : false;
  3431. el.removeEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);
  3432. el.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);
  3433. el.removeEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);
  3434. if (touchEvents.cancel) {
  3435. el.removeEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener);
  3436. }
  3437. }
  3438. if (params.simulateTouch && !device.ios && !device.android || params.simulateTouch && !support.touch && device.ios) {
  3439. el.removeEventListener('mousedown', swiper.onTouchStart, false);
  3440. document.removeEventListener('mousemove', swiper.onTouchMove, capture);
  3441. document.removeEventListener('mouseup', swiper.onTouchEnd, false);
  3442. }
  3443. } // Prevent Links Clicks
  3444. if (params.preventClicks || params.preventClicksPropagation) {
  3445. el.removeEventListener('click', swiper.onClick, true);
  3446. }
  3447. if (params.cssMode) {
  3448. wrapperEl.removeEventListener('scroll', swiper.onScroll);
  3449. } // Resize handler
  3450. swiper.off(device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize);
  3451. }
  3452. var events = {
  3453. attachEvents: attachEvents,
  3454. detachEvents: detachEvents
  3455. };
  3456. function setBreakpoint() {
  3457. var swiper = this;
  3458. var activeIndex = swiper.activeIndex,
  3459. initialized = swiper.initialized,
  3460. _swiper$loopedSlides = swiper.loopedSlides,
  3461. loopedSlides = _swiper$loopedSlides === void 0 ? 0 : _swiper$loopedSlides,
  3462. params = swiper.params,
  3463. $el = swiper.$el;
  3464. var breakpoints = params.breakpoints;
  3465. if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters
  3466. var breakpoint = swiper.getBreakpoint(breakpoints);
  3467. if (breakpoint && swiper.currentBreakpoint !== breakpoint) {
  3468. var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
  3469. if (breakpointOnlyParams) {
  3470. ['slidesPerView', 'spaceBetween', 'slidesPerGroup', 'slidesPerGroupSkip', 'slidesPerColumn'].forEach(function (param) {
  3471. var paramValue = breakpointOnlyParams[param];
  3472. if (typeof paramValue === 'undefined') return;
  3473. if (param === 'slidesPerView' && (paramValue === 'AUTO' || paramValue === 'auto')) {
  3474. breakpointOnlyParams[param] = 'auto';
  3475. } else if (param === 'slidesPerView') {
  3476. breakpointOnlyParams[param] = parseFloat(paramValue);
  3477. } else {
  3478. breakpointOnlyParams[param] = parseInt(paramValue, 10);
  3479. }
  3480. });
  3481. }
  3482. var breakpointParams = breakpointOnlyParams || swiper.originalParams;
  3483. var wasMultiRow = params.slidesPerColumn > 1;
  3484. var isMultiRow = breakpointParams.slidesPerColumn > 1;
  3485. if (wasMultiRow && !isMultiRow) {
  3486. $el.removeClass(params.containerModifierClass + "multirow " + params.containerModifierClass + "multirow-column");
  3487. swiper.emitContainerClasses();
  3488. } else if (!wasMultiRow && isMultiRow) {
  3489. $el.addClass(params.containerModifierClass + "multirow");
  3490. if (breakpointParams.slidesPerColumnFill === 'column') {
  3491. $el.addClass(params.containerModifierClass + "multirow-column");
  3492. }
  3493. swiper.emitContainerClasses();
  3494. }
  3495. var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
  3496. var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
  3497. if (directionChanged && initialized) {
  3498. swiper.changeDirection();
  3499. }
  3500. extend$1(swiper.params, breakpointParams);
  3501. extend$1(swiper, {
  3502. allowTouchMove: swiper.params.allowTouchMove,
  3503. allowSlideNext: swiper.params.allowSlideNext,
  3504. allowSlidePrev: swiper.params.allowSlidePrev
  3505. });
  3506. swiper.currentBreakpoint = breakpoint;
  3507. swiper.emit('_beforeBreakpoint', breakpointParams);
  3508. if (needsReLoop && initialized) {
  3509. swiper.loopDestroy();
  3510. swiper.loopCreate();
  3511. swiper.updateSlides();
  3512. swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);
  3513. }
  3514. swiper.emit('breakpoint', breakpointParams);
  3515. }
  3516. }
  3517. function getBreakpoints(breakpoints) {
  3518. var window = getWindow(); // Get breakpoint for window width
  3519. if (!breakpoints) return undefined;
  3520. var breakpoint = false;
  3521. var points = Object.keys(breakpoints).map(function (point) {
  3522. if (typeof point === 'string' && point.indexOf('@') === 0) {
  3523. var minRatio = parseFloat(point.substr(1));
  3524. var value = window.innerHeight * minRatio;
  3525. return {
  3526. value: value,
  3527. point: point
  3528. };
  3529. }
  3530. return {
  3531. value: point,
  3532. point: point
  3533. };
  3534. });
  3535. points.sort(function (a, b) {
  3536. return parseInt(a.value, 10) - parseInt(b.value, 10);
  3537. });
  3538. for (var i = 0; i < points.length; i += 1) {
  3539. var _points$i = points[i],
  3540. point = _points$i.point,
  3541. value = _points$i.value;
  3542. if (value <= window.innerWidth) {
  3543. breakpoint = point;
  3544. }
  3545. }
  3546. return breakpoint || 'max';
  3547. }
  3548. var breakpoints = {
  3549. setBreakpoint: setBreakpoint,
  3550. getBreakpoint: getBreakpoints
  3551. };
  3552. function addClasses() {
  3553. var swiper = this;
  3554. var classNames = swiper.classNames,
  3555. params = swiper.params,
  3556. rtl = swiper.rtl,
  3557. $el = swiper.$el,
  3558. device = swiper.device;
  3559. var suffixes = [];
  3560. suffixes.push('initialized');
  3561. suffixes.push(params.direction);
  3562. if (params.freeMode) {
  3563. suffixes.push('free-mode');
  3564. }
  3565. if (params.autoHeight) {
  3566. suffixes.push('autoheight');
  3567. }
  3568. if (rtl) {
  3569. suffixes.push('rtl');
  3570. }
  3571. if (params.slidesPerColumn > 1) {
  3572. suffixes.push('multirow');
  3573. if (params.slidesPerColumnFill === 'column') {
  3574. suffixes.push('multirow-column');
  3575. }
  3576. }
  3577. if (device.android) {
  3578. suffixes.push('android');
  3579. }
  3580. if (device.ios) {
  3581. suffixes.push('ios');
  3582. }
  3583. if (params.cssMode) {
  3584. suffixes.push('css-mode');
  3585. }
  3586. suffixes.forEach(function (suffix) {
  3587. classNames.push(params.containerModifierClass + suffix);
  3588. });
  3589. $el.addClass(classNames.join(' '));
  3590. swiper.emitContainerClasses();
  3591. }
  3592. function removeClasses() {
  3593. var swiper = this;
  3594. var $el = swiper.$el,
  3595. classNames = swiper.classNames;
  3596. $el.removeClass(classNames.join(' '));
  3597. swiper.emitContainerClasses();
  3598. }
  3599. var classes = {
  3600. addClasses: addClasses,
  3601. removeClasses: removeClasses
  3602. };
  3603. function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
  3604. var window = getWindow();
  3605. var image;
  3606. function onReady() {
  3607. if (callback) callback();
  3608. }
  3609. var isPicture = $(imageEl).parent('picture')[0];
  3610. if (!isPicture && (!imageEl.complete || !checkForComplete)) {
  3611. if (src) {
  3612. image = new window.Image();
  3613. image.onload = onReady;
  3614. image.onerror = onReady;
  3615. if (sizes) {
  3616. image.sizes = sizes;
  3617. }
  3618. if (srcset) {
  3619. image.srcset = srcset;
  3620. }
  3621. if (src) {
  3622. image.src = src;
  3623. }
  3624. } else {
  3625. onReady();
  3626. }
  3627. } else {
  3628. // image already loaded...
  3629. onReady();
  3630. }
  3631. }
  3632. function preloadImages() {
  3633. var swiper = this;
  3634. swiper.imagesToLoad = swiper.$el.find('img');
  3635. function onReady() {
  3636. if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;
  3637. if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;
  3638. if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
  3639. if (swiper.params.updateOnImagesReady) swiper.update();
  3640. swiper.emit('imagesReady');
  3641. }
  3642. }
  3643. for (var i = 0; i < swiper.imagesToLoad.length; i += 1) {
  3644. var imageEl = swiper.imagesToLoad[i];
  3645. swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);
  3646. }
  3647. }
  3648. var images = {
  3649. loadImage: loadImage,
  3650. preloadImages: preloadImages
  3651. };
  3652. function checkOverflow() {
  3653. var swiper = this;
  3654. var params = swiper.params;
  3655. var wasLocked = swiper.isLocked;
  3656. var lastSlidePosition = swiper.slides.length > 0 && params.slidesOffsetBefore + params.spaceBetween * (swiper.slides.length - 1) + swiper.slides[0].offsetWidth * swiper.slides.length;
  3657. if (params.slidesOffsetBefore && params.slidesOffsetAfter && lastSlidePosition) {
  3658. swiper.isLocked = lastSlidePosition <= swiper.size;
  3659. } else {
  3660. swiper.isLocked = swiper.snapGrid.length === 1;
  3661. }
  3662. swiper.allowSlideNext = !swiper.isLocked;
  3663. swiper.allowSlidePrev = !swiper.isLocked; // events
  3664. if (wasLocked !== swiper.isLocked) swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
  3665. if (wasLocked && wasLocked !== swiper.isLocked) {
  3666. swiper.isEnd = false;
  3667. if (swiper.navigation) swiper.navigation.update();
  3668. }
  3669. }
  3670. var checkOverflow$1 = {
  3671. checkOverflow: checkOverflow
  3672. };
  3673. var defaults = {
  3674. init: true,
  3675. direction: 'horizontal',
  3676. touchEventsTarget: 'container',
  3677. initialSlide: 0,
  3678. speed: 300,
  3679. cssMode: false,
  3680. updateOnWindowResize: true,
  3681. nested: false,
  3682. // Overrides
  3683. width: null,
  3684. height: null,
  3685. //
  3686. preventInteractionOnTransition: false,
  3687. // ssr
  3688. userAgent: null,
  3689. url: null,
  3690. // To support iOS's swipe-to-go-back gesture (when being used in-app).
  3691. edgeSwipeDetection: false,
  3692. edgeSwipeThreshold: 20,
  3693. // Free mode
  3694. freeMode: false,
  3695. freeModeMomentum: true,
  3696. freeModeMomentumRatio: 1,
  3697. freeModeMomentumBounce: true,
  3698. freeModeMomentumBounceRatio: 1,
  3699. freeModeMomentumVelocityRatio: 1,
  3700. freeModeSticky: false,
  3701. freeModeMinimumVelocity: 0.02,
  3702. // Autoheight
  3703. autoHeight: false,
  3704. // Set wrapper width
  3705. setWrapperSize: false,
  3706. // Virtual Translate
  3707. virtualTranslate: false,
  3708. // Effects
  3709. effect: 'slide',
  3710. // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
  3711. // Breakpoints
  3712. breakpoints: undefined,
  3713. // Slides grid
  3714. spaceBetween: 0,
  3715. slidesPerView: 1,
  3716. slidesPerColumn: 1,
  3717. slidesPerColumnFill: 'column',
  3718. slidesPerGroup: 1,
  3719. slidesPerGroupSkip: 0,
  3720. centeredSlides: false,
  3721. centeredSlidesBounds: false,
  3722. slidesOffsetBefore: 0,
  3723. // in px
  3724. slidesOffsetAfter: 0,
  3725. // in px
  3726. normalizeSlideIndex: true,
  3727. centerInsufficientSlides: false,
  3728. // Disable swiper and hide navigation when container not overflow
  3729. watchOverflow: false,
  3730. // Round length
  3731. roundLengths: false,
  3732. // Touches
  3733. touchRatio: 1,
  3734. touchAngle: 45,
  3735. simulateTouch: true,
  3736. shortSwipes: true,
  3737. longSwipes: true,
  3738. longSwipesRatio: 0.5,
  3739. longSwipesMs: 300,
  3740. followFinger: true,
  3741. allowTouchMove: true,
  3742. threshold: 0,
  3743. touchMoveStopPropagation: false,
  3744. touchStartPreventDefault: true,
  3745. touchStartForcePreventDefault: false,
  3746. touchReleaseOnEdges: false,
  3747. // Unique Navigation Elements
  3748. uniqueNavElements: true,
  3749. // Resistance
  3750. resistance: true,
  3751. resistanceRatio: 0.85,
  3752. // Progress
  3753. watchSlidesProgress: false,
  3754. watchSlidesVisibility: false,
  3755. // Cursor
  3756. grabCursor: false,
  3757. // Clicks
  3758. preventClicks: true,
  3759. preventClicksPropagation: true,
  3760. slideToClickedSlide: false,
  3761. // Images
  3762. preloadImages: true,
  3763. updateOnImagesReady: true,
  3764. // loop
  3765. loop: false,
  3766. loopAdditionalSlides: 0,
  3767. loopedSlides: null,
  3768. loopFillGroupWithBlank: false,
  3769. loopPreventsSlide: true,
  3770. // Swiping/no swiping
  3771. allowSlidePrev: true,
  3772. allowSlideNext: true,
  3773. swipeHandler: null,
  3774. // '.swipe-handler',
  3775. noSwiping: true,
  3776. noSwipingClass: 'swiper-no-swiping',
  3777. noSwipingSelector: null,
  3778. // Passive Listeners
  3779. passiveListeners: true,
  3780. // NS
  3781. containerModifierClass: 'swiper-container-',
  3782. // NEW
  3783. slideClass: 'swiper-slide',
  3784. slideBlankClass: 'swiper-slide-invisible-blank',
  3785. slideActiveClass: 'swiper-slide-active',
  3786. slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
  3787. slideVisibleClass: 'swiper-slide-visible',
  3788. slideDuplicateClass: 'swiper-slide-duplicate',
  3789. slideNextClass: 'swiper-slide-next',
  3790. slideDuplicateNextClass: 'swiper-slide-duplicate-next',
  3791. slidePrevClass: 'swiper-slide-prev',
  3792. slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
  3793. wrapperClass: 'swiper-wrapper',
  3794. // Callbacks
  3795. runCallbacksOnInit: true,
  3796. // Internals
  3797. _emitClasses: false
  3798. };
  3799. var prototypes = {
  3800. modular: modular,
  3801. eventsEmitter: eventsEmitter,
  3802. update: update,
  3803. translate: translate,
  3804. transition: transition$1,
  3805. slide: slide,
  3806. loop: loop,
  3807. grabCursor: grabCursor,
  3808. manipulation: manipulation,
  3809. events: events,
  3810. breakpoints: breakpoints,
  3811. checkOverflow: checkOverflow$1,
  3812. classes: classes,
  3813. images: images
  3814. };
  3815. var extendedDefaults = {};
  3816. var Swiper = /*#__PURE__*/function () {
  3817. function Swiper() {
  3818. var el;
  3819. var params;
  3820. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  3821. args[_key] = arguments[_key];
  3822. }
  3823. if (args.length === 1 && args[0].constructor && args[0].constructor === Object) {
  3824. params = args[0];
  3825. } else {
  3826. el = args[0];
  3827. params = args[1];
  3828. }
  3829. if (!params) params = {};
  3830. params = extend$1({}, params);
  3831. if (el && !params.el) params.el = el; // Swiper Instance
  3832. var swiper = this;
  3833. swiper.support = getSupport();
  3834. swiper.device = getDevice({
  3835. userAgent: params.userAgent
  3836. });
  3837. swiper.browser = getBrowser();
  3838. swiper.eventsListeners = {};
  3839. swiper.eventsAnyListeners = [];
  3840. if (typeof swiper.modules === 'undefined') {
  3841. swiper.modules = {};
  3842. }
  3843. Object.keys(swiper.modules).forEach(function (moduleName) {
  3844. var module = swiper.modules[moduleName];
  3845. if (module.params) {
  3846. var moduleParamName = Object.keys(module.params)[0];
  3847. var moduleParams = module.params[moduleParamName];
  3848. if (typeof moduleParams !== 'object' || moduleParams === null) return;
  3849. if (!(moduleParamName in params && 'enabled' in moduleParams)) return;
  3850. if (params[moduleParamName] === true) {
  3851. params[moduleParamName] = {
  3852. enabled: true
  3853. };
  3854. }
  3855. if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
  3856. params[moduleParamName].enabled = true;
  3857. }
  3858. if (!params[moduleParamName]) params[moduleParamName] = {
  3859. enabled: false
  3860. };
  3861. }
  3862. }); // Extend defaults with modules params
  3863. var swiperParams = extend$1({}, defaults);
  3864. swiper.useParams(swiperParams); // Extend defaults with passed params
  3865. swiper.params = extend$1({}, swiperParams, extendedDefaults, params);
  3866. swiper.originalParams = extend$1({}, swiper.params);
  3867. swiper.passedParams = extend$1({}, params); // add event listeners
  3868. if (swiper.params && swiper.params.on) {
  3869. Object.keys(swiper.params.on).forEach(function (eventName) {
  3870. swiper.on(eventName, swiper.params.on[eventName]);
  3871. });
  3872. }
  3873. if (swiper.params && swiper.params.onAny) {
  3874. swiper.onAny(swiper.params.onAny);
  3875. } // Save Dom lib
  3876. swiper.$ = $; // Find el
  3877. var $el = $(swiper.params.el);
  3878. el = $el[0];
  3879. if (!el) {
  3880. return undefined;
  3881. }
  3882. if ($el.length > 1) {
  3883. var swipers = [];
  3884. $el.each(function (containerEl) {
  3885. var newParams = extend$1({}, params, {
  3886. el: containerEl
  3887. });
  3888. swipers.push(new Swiper(newParams));
  3889. });
  3890. return swipers;
  3891. }
  3892. el.swiper = swiper; // Find Wrapper
  3893. var $wrapperEl;
  3894. if (el && el.shadowRoot && el.shadowRoot.querySelector) {
  3895. $wrapperEl = $(el.shadowRoot.querySelector("." + swiper.params.wrapperClass)); // Children needs to return slot items
  3896. $wrapperEl.children = function (options) {
  3897. return $el.children(options);
  3898. };
  3899. } else {
  3900. $wrapperEl = $el.children("." + swiper.params.wrapperClass);
  3901. } // Extend Swiper
  3902. extend$1(swiper, {
  3903. $el: $el,
  3904. el: el,
  3905. $wrapperEl: $wrapperEl,
  3906. wrapperEl: $wrapperEl[0],
  3907. // Classes
  3908. classNames: [],
  3909. // Slides
  3910. slides: $(),
  3911. slidesGrid: [],
  3912. snapGrid: [],
  3913. slidesSizesGrid: [],
  3914. // isDirection
  3915. isHorizontal: function isHorizontal() {
  3916. return swiper.params.direction === 'horizontal';
  3917. },
  3918. isVertical: function isVertical() {
  3919. return swiper.params.direction === 'vertical';
  3920. },
  3921. // RTL
  3922. rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl',
  3923. rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
  3924. wrongRTL: $wrapperEl.css('display') === '-webkit-box',
  3925. // Indexes
  3926. activeIndex: 0,
  3927. realIndex: 0,
  3928. //
  3929. isBeginning: true,
  3930. isEnd: false,
  3931. // Props
  3932. translate: 0,
  3933. previousTranslate: 0,
  3934. progress: 0,
  3935. velocity: 0,
  3936. animating: false,
  3937. // Locks
  3938. allowSlideNext: swiper.params.allowSlideNext,
  3939. allowSlidePrev: swiper.params.allowSlidePrev,
  3940. // Touch Events
  3941. touchEvents: function touchEvents() {
  3942. var touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
  3943. var desktop = ['mousedown', 'mousemove', 'mouseup'];
  3944. if (swiper.support.pointerEvents) {
  3945. desktop = ['pointerdown', 'pointermove', 'pointerup'];
  3946. }
  3947. swiper.touchEventsTouch = {
  3948. start: touch[0],
  3949. move: touch[1],
  3950. end: touch[2],
  3951. cancel: touch[3]
  3952. };
  3953. swiper.touchEventsDesktop = {
  3954. start: desktop[0],
  3955. move: desktop[1],
  3956. end: desktop[2]
  3957. };
  3958. return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;
  3959. }(),
  3960. touchEventsData: {
  3961. isTouched: undefined,
  3962. isMoved: undefined,
  3963. allowTouchCallbacks: undefined,
  3964. touchStartTime: undefined,
  3965. isScrolling: undefined,
  3966. currentTranslate: undefined,
  3967. startTranslate: undefined,
  3968. allowThresholdMove: undefined,
  3969. // Form elements to match
  3970. formElements: 'input, select, option, textarea, button, video, label',
  3971. // Last click time
  3972. lastClickTime: now(),
  3973. clickTimeout: undefined,
  3974. // Velocities
  3975. velocities: [],
  3976. allowMomentumBounce: undefined,
  3977. isTouchEvent: undefined,
  3978. startMoving: undefined
  3979. },
  3980. // Clicks
  3981. allowClick: true,
  3982. // Touches
  3983. allowTouchMove: swiper.params.allowTouchMove,
  3984. touches: {
  3985. startX: 0,
  3986. startY: 0,
  3987. currentX: 0,
  3988. currentY: 0,
  3989. diff: 0
  3990. },
  3991. // Images
  3992. imagesToLoad: [],
  3993. imagesLoaded: 0
  3994. }); // Install Modules
  3995. swiper.useModules();
  3996. swiper.emit('_swiper'); // Init
  3997. if (swiper.params.init) {
  3998. swiper.init();
  3999. } // Return app instance
  4000. return swiper;
  4001. }
  4002. var _proto = Swiper.prototype;
  4003. _proto.emitContainerClasses = function emitContainerClasses() {
  4004. var swiper = this;
  4005. if (!swiper.params._emitClasses || !swiper.el) return;
  4006. var classes = swiper.el.className.split(' ').filter(function (className) {
  4007. return className.indexOf('swiper-container') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
  4008. });
  4009. swiper.emit('_containerClasses', classes.join(' '));
  4010. };
  4011. _proto.getSlideClasses = function getSlideClasses(slideEl) {
  4012. var swiper = this;
  4013. return slideEl.className.split(' ').filter(function (className) {
  4014. return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
  4015. }).join(' ');
  4016. };
  4017. _proto.emitSlidesClasses = function emitSlidesClasses() {
  4018. var swiper = this;
  4019. if (!swiper.params._emitClasses || !swiper.el) return;
  4020. swiper.slides.each(function (slideEl) {
  4021. var classNames = swiper.getSlideClasses(slideEl);
  4022. swiper.emit('_slideClass', slideEl, classNames);
  4023. });
  4024. };
  4025. _proto.slidesPerViewDynamic = function slidesPerViewDynamic() {
  4026. var swiper = this;
  4027. var params = swiper.params,
  4028. slides = swiper.slides,
  4029. slidesGrid = swiper.slidesGrid,
  4030. swiperSize = swiper.size,
  4031. activeIndex = swiper.activeIndex;
  4032. var spv = 1;
  4033. if (params.centeredSlides) {
  4034. var slideSize = slides[activeIndex].swiperSlideSize;
  4035. var breakLoop;
  4036. for (var i = activeIndex + 1; i < slides.length; i += 1) {
  4037. if (slides[i] && !breakLoop) {
  4038. slideSize += slides[i].swiperSlideSize;
  4039. spv += 1;
  4040. if (slideSize > swiperSize) breakLoop = true;
  4041. }
  4042. }
  4043. for (var _i = activeIndex - 1; _i >= 0; _i -= 1) {
  4044. if (slides[_i] && !breakLoop) {
  4045. slideSize += slides[_i].swiperSlideSize;
  4046. spv += 1;
  4047. if (slideSize > swiperSize) breakLoop = true;
  4048. }
  4049. }
  4050. } else {
  4051. for (var _i2 = activeIndex + 1; _i2 < slides.length; _i2 += 1) {
  4052. if (slidesGrid[_i2] - slidesGrid[activeIndex] < swiperSize) {
  4053. spv += 1;
  4054. }
  4055. }
  4056. }
  4057. return spv;
  4058. };
  4059. _proto.update = function update() {
  4060. var swiper = this;
  4061. if (!swiper || swiper.destroyed) return;
  4062. var snapGrid = swiper.snapGrid,
  4063. params = swiper.params; // Breakpoints
  4064. if (params.breakpoints) {
  4065. swiper.setBreakpoint();
  4066. }
  4067. swiper.updateSize();
  4068. swiper.updateSlides();
  4069. swiper.updateProgress();
  4070. swiper.updateSlidesClasses();
  4071. function setTranslate() {
  4072. var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
  4073. var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
  4074. swiper.setTranslate(newTranslate);
  4075. swiper.updateActiveIndex();
  4076. swiper.updateSlidesClasses();
  4077. }
  4078. var translated;
  4079. if (swiper.params.freeMode) {
  4080. setTranslate();
  4081. if (swiper.params.autoHeight) {
  4082. swiper.updateAutoHeight();
  4083. }
  4084. } else {
  4085. if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
  4086. translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
  4087. } else {
  4088. translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
  4089. }
  4090. if (!translated) {
  4091. setTranslate();
  4092. }
  4093. }
  4094. if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
  4095. swiper.checkOverflow();
  4096. }
  4097. swiper.emit('update');
  4098. };
  4099. _proto.changeDirection = function changeDirection(newDirection, needUpdate) {
  4100. if (needUpdate === void 0) {
  4101. needUpdate = true;
  4102. }
  4103. var swiper = this;
  4104. var currentDirection = swiper.params.direction;
  4105. if (!newDirection) {
  4106. // eslint-disable-next-line
  4107. newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
  4108. }
  4109. if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
  4110. return swiper;
  4111. }
  4112. swiper.$el.removeClass("" + swiper.params.containerModifierClass + currentDirection).addClass("" + swiper.params.containerModifierClass + newDirection);
  4113. swiper.emitContainerClasses();
  4114. swiper.params.direction = newDirection;
  4115. swiper.slides.each(function (slideEl) {
  4116. if (newDirection === 'vertical') {
  4117. slideEl.style.width = '';
  4118. } else {
  4119. slideEl.style.height = '';
  4120. }
  4121. });
  4122. swiper.emit('changeDirection');
  4123. if (needUpdate) swiper.update();
  4124. return swiper;
  4125. };
  4126. _proto.init = function init() {
  4127. var swiper = this;
  4128. if (swiper.initialized) return;
  4129. swiper.emit('beforeInit'); // Set breakpoint
  4130. if (swiper.params.breakpoints) {
  4131. swiper.setBreakpoint();
  4132. } // Add Classes
  4133. swiper.addClasses(); // Create loop
  4134. if (swiper.params.loop) {
  4135. swiper.loopCreate();
  4136. } // Update size
  4137. swiper.updateSize(); // Update slides
  4138. swiper.updateSlides();
  4139. if (swiper.params.watchOverflow) {
  4140. swiper.checkOverflow();
  4141. } // Set Grab Cursor
  4142. if (swiper.params.grabCursor) {
  4143. swiper.setGrabCursor();
  4144. }
  4145. if (swiper.params.preloadImages) {
  4146. swiper.preloadImages();
  4147. } // Slide To Initial Slide
  4148. if (swiper.params.loop) {
  4149. swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit);
  4150. } else {
  4151. swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit);
  4152. } // Attach events
  4153. swiper.attachEvents(); // Init Flag
  4154. swiper.initialized = true; // Emit
  4155. swiper.emit('init');
  4156. swiper.emit('afterInit');
  4157. };
  4158. _proto.destroy = function destroy(deleteInstance, cleanStyles) {
  4159. if (deleteInstance === void 0) {
  4160. deleteInstance = true;
  4161. }
  4162. if (cleanStyles === void 0) {
  4163. cleanStyles = true;
  4164. }
  4165. var swiper = this;
  4166. var params = swiper.params,
  4167. $el = swiper.$el,
  4168. $wrapperEl = swiper.$wrapperEl,
  4169. slides = swiper.slides;
  4170. if (typeof swiper.params === 'undefined' || swiper.destroyed) {
  4171. return null;
  4172. }
  4173. swiper.emit('beforeDestroy'); // Init Flag
  4174. swiper.initialized = false; // Detach events
  4175. swiper.detachEvents(); // Destroy loop
  4176. if (params.loop) {
  4177. swiper.loopDestroy();
  4178. } // Cleanup styles
  4179. if (cleanStyles) {
  4180. swiper.removeClasses();
  4181. $el.removeAttr('style');
  4182. $wrapperEl.removeAttr('style');
  4183. if (slides && slides.length) {
  4184. slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index');
  4185. }
  4186. }
  4187. swiper.emit('destroy'); // Detach emitter events
  4188. Object.keys(swiper.eventsListeners).forEach(function (eventName) {
  4189. swiper.off(eventName);
  4190. });
  4191. if (deleteInstance !== false) {
  4192. swiper.$el[0].swiper = null;
  4193. deleteProps(swiper);
  4194. }
  4195. swiper.destroyed = true;
  4196. return null;
  4197. };
  4198. Swiper.extendDefaults = function extendDefaults(newDefaults) {
  4199. extend$1(extendedDefaults, newDefaults);
  4200. };
  4201. Swiper.installModule = function installModule(module) {
  4202. if (!Swiper.prototype.modules) Swiper.prototype.modules = {};
  4203. var name = module.name || Object.keys(Swiper.prototype.modules).length + "_" + now();
  4204. Swiper.prototype.modules[name] = module;
  4205. };
  4206. Swiper.use = function use(module) {
  4207. if (Array.isArray(module)) {
  4208. module.forEach(function (m) {
  4209. return Swiper.installModule(m);
  4210. });
  4211. return Swiper;
  4212. }
  4213. Swiper.installModule(module);
  4214. return Swiper;
  4215. };
  4216. _createClass(Swiper, null, [{
  4217. key: "extendedDefaults",
  4218. get: function get() {
  4219. return extendedDefaults;
  4220. }
  4221. }, {
  4222. key: "defaults",
  4223. get: function get() {
  4224. return defaults;
  4225. }
  4226. }]);
  4227. return Swiper;
  4228. }();
  4229. Object.keys(prototypes).forEach(function (prototypeGroup) {
  4230. Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) {
  4231. Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
  4232. });
  4233. });
  4234. Swiper.use([Resize, Observer$1]);
  4235. var Virtual = {
  4236. update: function update(force) {
  4237. var swiper = this;
  4238. var _swiper$params = swiper.params,
  4239. slidesPerView = _swiper$params.slidesPerView,
  4240. slidesPerGroup = _swiper$params.slidesPerGroup,
  4241. centeredSlides = _swiper$params.centeredSlides;
  4242. var _swiper$params$virtua = swiper.params.virtual,
  4243. addSlidesBefore = _swiper$params$virtua.addSlidesBefore,
  4244. addSlidesAfter = _swiper$params$virtua.addSlidesAfter;
  4245. var _swiper$virtual = swiper.virtual,
  4246. previousFrom = _swiper$virtual.from,
  4247. previousTo = _swiper$virtual.to,
  4248. slides = _swiper$virtual.slides,
  4249. previousSlidesGrid = _swiper$virtual.slidesGrid,
  4250. renderSlide = _swiper$virtual.renderSlide,
  4251. previousOffset = _swiper$virtual.offset;
  4252. swiper.updateActiveIndex();
  4253. var activeIndex = swiper.activeIndex || 0;
  4254. var offsetProp;
  4255. if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top';
  4256. var slidesAfter;
  4257. var slidesBefore;
  4258. if (centeredSlides) {
  4259. slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter;
  4260. slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore;
  4261. } else {
  4262. slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter;
  4263. slidesBefore = slidesPerGroup + addSlidesBefore;
  4264. }
  4265. var from = Math.max((activeIndex || 0) - slidesBefore, 0);
  4266. var to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1);
  4267. var offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0);
  4268. extend$1(swiper.virtual, {
  4269. from: from,
  4270. to: to,
  4271. offset: offset,
  4272. slidesGrid: swiper.slidesGrid
  4273. });
  4274. function onRendered() {
  4275. swiper.updateSlides();
  4276. swiper.updateProgress();
  4277. swiper.updateSlidesClasses();
  4278. if (swiper.lazy && swiper.params.lazy.enabled) {
  4279. swiper.lazy.load();
  4280. }
  4281. }
  4282. if (previousFrom === from && previousTo === to && !force) {
  4283. if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) {
  4284. swiper.slides.css(offsetProp, offset + "px");
  4285. }
  4286. swiper.updateProgress();
  4287. return;
  4288. }
  4289. if (swiper.params.virtual.renderExternal) {
  4290. swiper.params.virtual.renderExternal.call(swiper, {
  4291. offset: offset,
  4292. from: from,
  4293. to: to,
  4294. slides: function getSlides() {
  4295. var slidesToRender = [];
  4296. for (var i = from; i <= to; i += 1) {
  4297. slidesToRender.push(slides[i]);
  4298. }
  4299. return slidesToRender;
  4300. }()
  4301. });
  4302. if (swiper.params.virtual.renderExternalUpdate) {
  4303. onRendered();
  4304. }
  4305. return;
  4306. }
  4307. var prependIndexes = [];
  4308. var appendIndexes = [];
  4309. if (force) {
  4310. swiper.$wrapperEl.find("." + swiper.params.slideClass).remove();
  4311. } else {
  4312. for (var i = previousFrom; i <= previousTo; i += 1) {
  4313. if (i < from || i > to) {
  4314. swiper.$wrapperEl.find("." + swiper.params.slideClass + "[data-swiper-slide-index=\"" + i + "\"]").remove();
  4315. }
  4316. }
  4317. }
  4318. for (var _i = 0; _i < slides.length; _i += 1) {
  4319. if (_i >= from && _i <= to) {
  4320. if (typeof previousTo === 'undefined' || force) {
  4321. appendIndexes.push(_i);
  4322. } else {
  4323. if (_i > previousTo) appendIndexes.push(_i);
  4324. if (_i < previousFrom) prependIndexes.push(_i);
  4325. }
  4326. }
  4327. }
  4328. appendIndexes.forEach(function (index) {
  4329. swiper.$wrapperEl.append(renderSlide(slides[index], index));
  4330. });
  4331. prependIndexes.sort(function (a, b) {
  4332. return b - a;
  4333. }).forEach(function (index) {
  4334. swiper.$wrapperEl.prepend(renderSlide(slides[index], index));
  4335. });
  4336. swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, offset + "px");
  4337. onRendered();
  4338. },
  4339. renderSlide: function renderSlide(slide, index) {
  4340. var swiper = this;
  4341. var params = swiper.params.virtual;
  4342. if (params.cache && swiper.virtual.cache[index]) {
  4343. return swiper.virtual.cache[index];
  4344. }
  4345. var $slideEl = params.renderSlide ? $(params.renderSlide.call(swiper, slide, index)) : $("<div class=\"" + swiper.params.slideClass + "\" data-swiper-slide-index=\"" + index + "\">" + slide + "</div>");
  4346. if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index);
  4347. if (params.cache) swiper.virtual.cache[index] = $slideEl;
  4348. return $slideEl;
  4349. },
  4350. appendSlide: function appendSlide(slides) {
  4351. var swiper = this;
  4352. if (typeof slides === 'object' && 'length' in slides) {
  4353. for (var i = 0; i < slides.length; i += 1) {
  4354. if (slides[i]) swiper.virtual.slides.push(slides[i]);
  4355. }
  4356. } else {
  4357. swiper.virtual.slides.push(slides);
  4358. }
  4359. swiper.virtual.update(true);
  4360. },
  4361. prependSlide: function prependSlide(slides) {
  4362. var swiper = this;
  4363. var activeIndex = swiper.activeIndex;
  4364. var newActiveIndex = activeIndex + 1;
  4365. var numberOfNewSlides = 1;
  4366. if (Array.isArray(slides)) {
  4367. for (var i = 0; i < slides.length; i += 1) {
  4368. if (slides[i]) swiper.virtual.slides.unshift(slides[i]);
  4369. }
  4370. newActiveIndex = activeIndex + slides.length;
  4371. numberOfNewSlides = slides.length;
  4372. } else {
  4373. swiper.virtual.slides.unshift(slides);
  4374. }
  4375. if (swiper.params.virtual.cache) {
  4376. var cache = swiper.virtual.cache;
  4377. var newCache = {};
  4378. Object.keys(cache).forEach(function (cachedIndex) {
  4379. var $cachedEl = cache[cachedIndex];
  4380. var cachedElIndex = $cachedEl.attr('data-swiper-slide-index');
  4381. if (cachedElIndex) {
  4382. $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + 1);
  4383. }
  4384. newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl;
  4385. });
  4386. swiper.virtual.cache = newCache;
  4387. }
  4388. swiper.virtual.update(true);
  4389. swiper.slideTo(newActiveIndex, 0);
  4390. },
  4391. removeSlide: function removeSlide(slidesIndexes) {
  4392. var swiper = this;
  4393. if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return;
  4394. var activeIndex = swiper.activeIndex;
  4395. if (Array.isArray(slidesIndexes)) {
  4396. for (var i = slidesIndexes.length - 1; i >= 0; i -= 1) {
  4397. swiper.virtual.slides.splice(slidesIndexes[i], 1);
  4398. if (swiper.params.virtual.cache) {
  4399. delete swiper.virtual.cache[slidesIndexes[i]];
  4400. }
  4401. if (slidesIndexes[i] < activeIndex) activeIndex -= 1;
  4402. activeIndex = Math.max(activeIndex, 0);
  4403. }
  4404. } else {
  4405. swiper.virtual.slides.splice(slidesIndexes, 1);
  4406. if (swiper.params.virtual.cache) {
  4407. delete swiper.virtual.cache[slidesIndexes];
  4408. }
  4409. if (slidesIndexes < activeIndex) activeIndex -= 1;
  4410. activeIndex = Math.max(activeIndex, 0);
  4411. }
  4412. swiper.virtual.update(true);
  4413. swiper.slideTo(activeIndex, 0);
  4414. },
  4415. removeAllSlides: function removeAllSlides() {
  4416. var swiper = this;
  4417. swiper.virtual.slides = [];
  4418. if (swiper.params.virtual.cache) {
  4419. swiper.virtual.cache = {};
  4420. }
  4421. swiper.virtual.update(true);
  4422. swiper.slideTo(0, 0);
  4423. }
  4424. };
  4425. var Virtual$1 = {
  4426. name: 'virtual',
  4427. params: {
  4428. virtual: {
  4429. enabled: false,
  4430. slides: [],
  4431. cache: true,
  4432. renderSlide: null,
  4433. renderExternal: null,
  4434. renderExternalUpdate: true,
  4435. addSlidesBefore: 0,
  4436. addSlidesAfter: 0
  4437. }
  4438. },
  4439. create: function create() {
  4440. var swiper = this;
  4441. bindModuleMethods(swiper, {
  4442. virtual: _extends(_extends({}, Virtual), {}, {
  4443. slides: swiper.params.virtual.slides,
  4444. cache: {}
  4445. })
  4446. });
  4447. },
  4448. on: {
  4449. beforeInit: function beforeInit(swiper) {
  4450. if (!swiper.params.virtual.enabled) return;
  4451. swiper.classNames.push(swiper.params.containerModifierClass + "virtual");
  4452. var overwriteParams = {
  4453. watchSlidesProgress: true
  4454. };
  4455. extend$1(swiper.params, overwriteParams);
  4456. extend$1(swiper.originalParams, overwriteParams);
  4457. if (!swiper.params.initialSlide) {
  4458. swiper.virtual.update();
  4459. }
  4460. },
  4461. setTranslate: function setTranslate(swiper) {
  4462. if (!swiper.params.virtual.enabled) return;
  4463. swiper.virtual.update();
  4464. }
  4465. }
  4466. };
  4467. var Keyboard = {
  4468. handle: function handle(event) {
  4469. var swiper = this;
  4470. var window = getWindow();
  4471. var document = getDocument();
  4472. var rtl = swiper.rtlTranslate;
  4473. var e = event;
  4474. if (e.originalEvent) e = e.originalEvent; // jquery fix
  4475. var kc = e.keyCode || e.charCode;
  4476. var pageUpDown = swiper.params.keyboard.pageUpDown;
  4477. var isPageUp = pageUpDown && kc === 33;
  4478. var isPageDown = pageUpDown && kc === 34;
  4479. var isArrowLeft = kc === 37;
  4480. var isArrowRight = kc === 39;
  4481. var isArrowUp = kc === 38;
  4482. var isArrowDown = kc === 40; // Directions locks
  4483. if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) {
  4484. return false;
  4485. }
  4486. if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) {
  4487. return false;
  4488. }
  4489. if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
  4490. return undefined;
  4491. }
  4492. if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
  4493. return undefined;
  4494. }
  4495. if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {
  4496. var inView = false; // Check that swiper should be inside of visible area of window
  4497. if (swiper.$el.parents("." + swiper.params.slideClass).length > 0 && swiper.$el.parents("." + swiper.params.slideActiveClass).length === 0) {
  4498. return undefined;
  4499. }
  4500. var windowWidth = window.innerWidth;
  4501. var windowHeight = window.innerHeight;
  4502. var swiperOffset = swiper.$el.offset();
  4503. if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft;
  4504. var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiper.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiper.height], [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height]];
  4505. for (var i = 0; i < swiperCoord.length; i += 1) {
  4506. var point = swiperCoord[i];
  4507. if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) {
  4508. inView = true;
  4509. }
  4510. }
  4511. if (!inView) return undefined;
  4512. }
  4513. if (swiper.isHorizontal()) {
  4514. if (isPageUp || isPageDown || isArrowLeft || isArrowRight) {
  4515. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  4516. }
  4517. if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext();
  4518. if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev();
  4519. } else {
  4520. if (isPageUp || isPageDown || isArrowUp || isArrowDown) {
  4521. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  4522. }
  4523. if (isPageDown || isArrowDown) swiper.slideNext();
  4524. if (isPageUp || isArrowUp) swiper.slidePrev();
  4525. }
  4526. swiper.emit('keyPress', kc);
  4527. return undefined;
  4528. },
  4529. enable: function enable() {
  4530. var swiper = this;
  4531. var document = getDocument();
  4532. if (swiper.keyboard.enabled) return;
  4533. $(document).on('keydown', swiper.keyboard.handle);
  4534. swiper.keyboard.enabled = true;
  4535. },
  4536. disable: function disable() {
  4537. var swiper = this;
  4538. var document = getDocument();
  4539. if (!swiper.keyboard.enabled) return;
  4540. $(document).off('keydown', swiper.keyboard.handle);
  4541. swiper.keyboard.enabled = false;
  4542. }
  4543. };
  4544. var Keyboard$1 = {
  4545. name: 'keyboard',
  4546. params: {
  4547. keyboard: {
  4548. enabled: false,
  4549. onlyInViewport: true,
  4550. pageUpDown: true
  4551. }
  4552. },
  4553. create: function create() {
  4554. var swiper = this;
  4555. bindModuleMethods(swiper, {
  4556. keyboard: _extends({
  4557. enabled: false
  4558. }, Keyboard)
  4559. });
  4560. },
  4561. on: {
  4562. init: function init(swiper) {
  4563. if (swiper.params.keyboard.enabled) {
  4564. swiper.keyboard.enable();
  4565. }
  4566. },
  4567. destroy: function destroy(swiper) {
  4568. if (swiper.keyboard.enabled) {
  4569. swiper.keyboard.disable();
  4570. }
  4571. }
  4572. }
  4573. };
  4574. function isEventSupported() {
  4575. var document = getDocument();
  4576. var eventName = 'onwheel';
  4577. var isSupported = (eventName in document);
  4578. if (!isSupported) {
  4579. var element = document.createElement('div');
  4580. element.setAttribute(eventName, 'return;');
  4581. isSupported = typeof element[eventName] === 'function';
  4582. }
  4583. if (!isSupported && document.implementation && document.implementation.hasFeature && // always returns true in newer browsers as per the standard.
  4584. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  4585. document.implementation.hasFeature('', '') !== true) {
  4586. // This is the only way to test support for the `wheel` event in IE9+.
  4587. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  4588. }
  4589. return isSupported;
  4590. }
  4591. var Mousewheel = {
  4592. lastScrollTime: now(),
  4593. lastEventBeforeSnap: undefined,
  4594. recentWheelEvents: [],
  4595. event: function event() {
  4596. var window = getWindow();
  4597. if (window.navigator.userAgent.indexOf('firefox') > -1) return 'DOMMouseScroll';
  4598. return isEventSupported() ? 'wheel' : 'mousewheel';
  4599. },
  4600. normalize: function normalize(e) {
  4601. // Reasonable defaults
  4602. var PIXEL_STEP = 10;
  4603. var LINE_HEIGHT = 40;
  4604. var PAGE_HEIGHT = 800;
  4605. var sX = 0;
  4606. var sY = 0; // spinX, spinY
  4607. var pX = 0;
  4608. var pY = 0; // pixelX, pixelY
  4609. // Legacy
  4610. if ('detail' in e) {
  4611. sY = e.detail;
  4612. }
  4613. if ('wheelDelta' in e) {
  4614. sY = -e.wheelDelta / 120;
  4615. }
  4616. if ('wheelDeltaY' in e) {
  4617. sY = -e.wheelDeltaY / 120;
  4618. }
  4619. if ('wheelDeltaX' in e) {
  4620. sX = -e.wheelDeltaX / 120;
  4621. } // side scrolling on FF with DOMMouseScroll
  4622. if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) {
  4623. sX = sY;
  4624. sY = 0;
  4625. }
  4626. pX = sX * PIXEL_STEP;
  4627. pY = sY * PIXEL_STEP;
  4628. if ('deltaY' in e) {
  4629. pY = e.deltaY;
  4630. }
  4631. if ('deltaX' in e) {
  4632. pX = e.deltaX;
  4633. }
  4634. if (e.shiftKey && !pX) {
  4635. // if user scrolls with shift he wants horizontal scroll
  4636. pX = pY;
  4637. pY = 0;
  4638. }
  4639. if ((pX || pY) && e.deltaMode) {
  4640. if (e.deltaMode === 1) {
  4641. // delta in LINE units
  4642. pX *= LINE_HEIGHT;
  4643. pY *= LINE_HEIGHT;
  4644. } else {
  4645. // delta in PAGE units
  4646. pX *= PAGE_HEIGHT;
  4647. pY *= PAGE_HEIGHT;
  4648. }
  4649. } // Fall-back if spin cannot be determined
  4650. if (pX && !sX) {
  4651. sX = pX < 1 ? -1 : 1;
  4652. }
  4653. if (pY && !sY) {
  4654. sY = pY < 1 ? -1 : 1;
  4655. }
  4656. return {
  4657. spinX: sX,
  4658. spinY: sY,
  4659. pixelX: pX,
  4660. pixelY: pY
  4661. };
  4662. },
  4663. handleMouseEnter: function handleMouseEnter() {
  4664. var swiper = this;
  4665. swiper.mouseEntered = true;
  4666. },
  4667. handleMouseLeave: function handleMouseLeave() {
  4668. var swiper = this;
  4669. swiper.mouseEntered = false;
  4670. },
  4671. handle: function handle(event) {
  4672. var e = event;
  4673. var swiper = this;
  4674. var params = swiper.params.mousewheel;
  4675. if (swiper.params.cssMode) {
  4676. e.preventDefault();
  4677. }
  4678. var target = swiper.$el;
  4679. if (swiper.params.mousewheel.eventsTarget !== 'container') {
  4680. target = $(swiper.params.mousewheel.eventsTarget);
  4681. }
  4682. if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true;
  4683. if (e.originalEvent) e = e.originalEvent; // jquery fix
  4684. var delta = 0;
  4685. var rtlFactor = swiper.rtlTranslate ? -1 : 1;
  4686. var data = Mousewheel.normalize(e);
  4687. if (params.forceToAxis) {
  4688. if (swiper.isHorizontal()) {
  4689. if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true;
  4690. } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true;
  4691. } else {
  4692. delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;
  4693. }
  4694. if (delta === 0) return true;
  4695. if (params.invert) delta = -delta;
  4696. if (!swiper.params.freeMode) {
  4697. // Register the new event in a variable which stores the relevant data
  4698. var newEvent = {
  4699. time: now(),
  4700. delta: Math.abs(delta),
  4701. direction: Math.sign(delta),
  4702. raw: event
  4703. }; // Keep the most recent events
  4704. var recentWheelEvents = swiper.mousewheel.recentWheelEvents;
  4705. if (recentWheelEvents.length >= 2) {
  4706. recentWheelEvents.shift(); // only store the last N events
  4707. }
  4708. var prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;
  4709. recentWheelEvents.push(newEvent); // If there is at least one previous recorded event:
  4710. // If direction has changed or
  4711. // if the scroll is quicker than the previous one:
  4712. // Animate the slider.
  4713. // Else (this is the first time the wheel is moved):
  4714. // Animate the slider.
  4715. if (prevEvent) {
  4716. if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) {
  4717. swiper.mousewheel.animateSlider(newEvent);
  4718. }
  4719. } else {
  4720. swiper.mousewheel.animateSlider(newEvent);
  4721. } // If it's time to release the scroll:
  4722. // Return now so you don't hit the preventDefault.
  4723. if (swiper.mousewheel.releaseScroll(newEvent)) {
  4724. return true;
  4725. }
  4726. } else {
  4727. // Freemode or scrollContainer:
  4728. // If we recently snapped after a momentum scroll, then ignore wheel events
  4729. // to give time for the deceleration to finish. Stop ignoring after 500 msecs
  4730. // or if it's a new scroll (larger delta or inverse sign as last event before
  4731. // an end-of-momentum snap).
  4732. var _newEvent = {
  4733. time: now(),
  4734. delta: Math.abs(delta),
  4735. direction: Math.sign(delta)
  4736. };
  4737. var lastEventBeforeSnap = swiper.mousewheel.lastEventBeforeSnap;
  4738. var ignoreWheelEvents = lastEventBeforeSnap && _newEvent.time < lastEventBeforeSnap.time + 500 && _newEvent.delta <= lastEventBeforeSnap.delta && _newEvent.direction === lastEventBeforeSnap.direction;
  4739. if (!ignoreWheelEvents) {
  4740. swiper.mousewheel.lastEventBeforeSnap = undefined;
  4741. if (swiper.params.loop) {
  4742. swiper.loopFix();
  4743. }
  4744. var position = swiper.getTranslate() + delta * params.sensitivity;
  4745. var wasBeginning = swiper.isBeginning;
  4746. var wasEnd = swiper.isEnd;
  4747. if (position >= swiper.minTranslate()) position = swiper.minTranslate();
  4748. if (position <= swiper.maxTranslate()) position = swiper.maxTranslate();
  4749. swiper.setTransition(0);
  4750. swiper.setTranslate(position);
  4751. swiper.updateProgress();
  4752. swiper.updateActiveIndex();
  4753. swiper.updateSlidesClasses();
  4754. if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) {
  4755. swiper.updateSlidesClasses();
  4756. }
  4757. if (swiper.params.freeModeSticky) {
  4758. // When wheel scrolling starts with sticky (aka snap) enabled, then detect
  4759. // the end of a momentum scroll by storing recent (N=15?) wheel events.
  4760. // 1. do all N events have decreasing or same (absolute value) delta?
  4761. // 2. did all N events arrive in the last M (M=500?) msecs?
  4762. // 3. does the earliest event have an (absolute value) delta that's
  4763. // at least P (P=1?) larger than the most recent event's delta?
  4764. // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels?
  4765. // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration.
  4766. // Snap immediately and ignore remaining wheel events in this scroll.
  4767. // See comment above for "remaining wheel events in this scroll" determination.
  4768. // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event.
  4769. clearTimeout(swiper.mousewheel.timeout);
  4770. swiper.mousewheel.timeout = undefined;
  4771. var _recentWheelEvents = swiper.mousewheel.recentWheelEvents;
  4772. if (_recentWheelEvents.length >= 15) {
  4773. _recentWheelEvents.shift(); // only store the last N events
  4774. }
  4775. var _prevEvent = _recentWheelEvents.length ? _recentWheelEvents[_recentWheelEvents.length - 1] : undefined;
  4776. var firstEvent = _recentWheelEvents[0];
  4777. _recentWheelEvents.push(_newEvent);
  4778. if (_prevEvent && (_newEvent.delta > _prevEvent.delta || _newEvent.direction !== _prevEvent.direction)) {
  4779. // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log.
  4780. _recentWheelEvents.splice(0);
  4781. } else if (_recentWheelEvents.length >= 15 && _newEvent.time - firstEvent.time < 500 && firstEvent.delta - _newEvent.delta >= 1 && _newEvent.delta <= 6) {
  4782. // We're at the end of the deceleration of a momentum scroll, so there's no need
  4783. // to wait for more events. Snap ASAP on the next tick.
  4784. // Also, because there's some remaining momentum we'll bias the snap in the
  4785. // direction of the ongoing scroll because it's better UX for the scroll to snap
  4786. // in the same direction as the scroll instead of reversing to snap. Therefore,
  4787. // if it's already scrolled more than 20% in the current direction, keep going.
  4788. var snapToThreshold = delta > 0 ? 0.8 : 0.2;
  4789. swiper.mousewheel.lastEventBeforeSnap = _newEvent;
  4790. _recentWheelEvents.splice(0);
  4791. swiper.mousewheel.timeout = nextTick(function () {
  4792. swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
  4793. }, 0); // no delay; move on next tick
  4794. }
  4795. if (!swiper.mousewheel.timeout) {
  4796. // if we get here, then we haven't detected the end of a momentum scroll, so
  4797. // we'll consider a scroll "complete" when there haven't been any wheel events
  4798. // for 500ms.
  4799. swiper.mousewheel.timeout = nextTick(function () {
  4800. var snapToThreshold = 0.5;
  4801. swiper.mousewheel.lastEventBeforeSnap = _newEvent;
  4802. _recentWheelEvents.splice(0);
  4803. swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
  4804. }, 500);
  4805. }
  4806. } // Emit event
  4807. if (!ignoreWheelEvents) swiper.emit('scroll', e); // Stop autoplay
  4808. if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions
  4809. if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true;
  4810. }
  4811. }
  4812. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  4813. return false;
  4814. },
  4815. animateSlider: function animateSlider(newEvent) {
  4816. var swiper = this;
  4817. var window = getWindow();
  4818. if (this.params.mousewheel.thresholdDelta && newEvent.delta < this.params.mousewheel.thresholdDelta) {
  4819. // Prevent if delta of wheel scroll delta is below configured threshold
  4820. return false;
  4821. }
  4822. if (this.params.mousewheel.thresholdTime && now() - swiper.mousewheel.lastScrollTime < this.params.mousewheel.thresholdTime) {
  4823. // Prevent if time between scrolls is below configured threshold
  4824. return false;
  4825. } // If the movement is NOT big enough and
  4826. // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider):
  4827. // Don't go any further (avoid insignificant scroll movement).
  4828. if (newEvent.delta >= 6 && now() - swiper.mousewheel.lastScrollTime < 60) {
  4829. // Return false as a default
  4830. return true;
  4831. } // If user is scrolling towards the end:
  4832. // If the slider hasn't hit the latest slide or
  4833. // if the slider is a loop and
  4834. // if the slider isn't moving right now:
  4835. // Go to next slide and
  4836. // emit a scroll event.
  4837. // Else (the user is scrolling towards the beginning) and
  4838. // if the slider hasn't hit the first slide or
  4839. // if the slider is a loop and
  4840. // if the slider isn't moving right now:
  4841. // Go to prev slide and
  4842. // emit a scroll event.
  4843. if (newEvent.direction < 0) {
  4844. if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) {
  4845. swiper.slideNext();
  4846. swiper.emit('scroll', newEvent.raw);
  4847. }
  4848. } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) {
  4849. swiper.slidePrev();
  4850. swiper.emit('scroll', newEvent.raw);
  4851. } // If you got here is because an animation has been triggered so store the current time
  4852. swiper.mousewheel.lastScrollTime = new window.Date().getTime(); // Return false as a default
  4853. return false;
  4854. },
  4855. releaseScroll: function releaseScroll(newEvent) {
  4856. var swiper = this;
  4857. var params = swiper.params.mousewheel;
  4858. if (newEvent.direction < 0) {
  4859. if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) {
  4860. // Return true to animate scroll on edges
  4861. return true;
  4862. }
  4863. } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) {
  4864. // Return true to animate scroll on edges
  4865. return true;
  4866. }
  4867. return false;
  4868. },
  4869. enable: function enable() {
  4870. var swiper = this;
  4871. var event = Mousewheel.event();
  4872. if (swiper.params.cssMode) {
  4873. swiper.wrapperEl.removeEventListener(event, swiper.mousewheel.handle);
  4874. return true;
  4875. }
  4876. if (!event) return false;
  4877. if (swiper.mousewheel.enabled) return false;
  4878. var target = swiper.$el;
  4879. if (swiper.params.mousewheel.eventsTarget !== 'container') {
  4880. target = $(swiper.params.mousewheel.eventsTarget);
  4881. }
  4882. target.on('mouseenter', swiper.mousewheel.handleMouseEnter);
  4883. target.on('mouseleave', swiper.mousewheel.handleMouseLeave);
  4884. target.on(event, swiper.mousewheel.handle);
  4885. swiper.mousewheel.enabled = true;
  4886. return true;
  4887. },
  4888. disable: function disable() {
  4889. var swiper = this;
  4890. var event = Mousewheel.event();
  4891. if (swiper.params.cssMode) {
  4892. swiper.wrapperEl.addEventListener(event, swiper.mousewheel.handle);
  4893. return true;
  4894. }
  4895. if (!event) return false;
  4896. if (!swiper.mousewheel.enabled) return false;
  4897. var target = swiper.$el;
  4898. if (swiper.params.mousewheel.eventsTarget !== 'container') {
  4899. target = $(swiper.params.mousewheel.eventsTarget);
  4900. }
  4901. target.off(event, swiper.mousewheel.handle);
  4902. swiper.mousewheel.enabled = false;
  4903. return true;
  4904. }
  4905. };
  4906. var Mousewheel$1 = {
  4907. name: 'mousewheel',
  4908. params: {
  4909. mousewheel: {
  4910. enabled: false,
  4911. releaseOnEdges: false,
  4912. invert: false,
  4913. forceToAxis: false,
  4914. sensitivity: 1,
  4915. eventsTarget: 'container',
  4916. thresholdDelta: null,
  4917. thresholdTime: null
  4918. }
  4919. },
  4920. create: function create() {
  4921. var swiper = this;
  4922. bindModuleMethods(swiper, {
  4923. mousewheel: {
  4924. enabled: false,
  4925. lastScrollTime: now(),
  4926. lastEventBeforeSnap: undefined,
  4927. recentWheelEvents: [],
  4928. enable: Mousewheel.enable,
  4929. disable: Mousewheel.disable,
  4930. handle: Mousewheel.handle,
  4931. handleMouseEnter: Mousewheel.handleMouseEnter,
  4932. handleMouseLeave: Mousewheel.handleMouseLeave,
  4933. animateSlider: Mousewheel.animateSlider,
  4934. releaseScroll: Mousewheel.releaseScroll
  4935. }
  4936. });
  4937. },
  4938. on: {
  4939. init: function init(swiper) {
  4940. if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) {
  4941. swiper.mousewheel.disable();
  4942. }
  4943. if (swiper.params.mousewheel.enabled) swiper.mousewheel.enable();
  4944. },
  4945. destroy: function destroy(swiper) {
  4946. if (swiper.params.cssMode) {
  4947. swiper.mousewheel.enable();
  4948. }
  4949. if (swiper.mousewheel.enabled) swiper.mousewheel.disable();
  4950. }
  4951. }
  4952. };
  4953. var Navigation = {
  4954. update: function update() {
  4955. // Update Navigation Buttons
  4956. var swiper = this;
  4957. var params = swiper.params.navigation;
  4958. if (swiper.params.loop) return;
  4959. var _swiper$navigation = swiper.navigation,
  4960. $nextEl = _swiper$navigation.$nextEl,
  4961. $prevEl = _swiper$navigation.$prevEl;
  4962. if ($prevEl && $prevEl.length > 0) {
  4963. if (swiper.isBeginning) {
  4964. $prevEl.addClass(params.disabledClass);
  4965. } else {
  4966. $prevEl.removeClass(params.disabledClass);
  4967. }
  4968. $prevEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
  4969. }
  4970. if ($nextEl && $nextEl.length > 0) {
  4971. if (swiper.isEnd) {
  4972. $nextEl.addClass(params.disabledClass);
  4973. } else {
  4974. $nextEl.removeClass(params.disabledClass);
  4975. }
  4976. $nextEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
  4977. }
  4978. },
  4979. onPrevClick: function onPrevClick(e) {
  4980. var swiper = this;
  4981. e.preventDefault();
  4982. if (swiper.isBeginning && !swiper.params.loop) return;
  4983. swiper.slidePrev();
  4984. },
  4985. onNextClick: function onNextClick(e) {
  4986. var swiper = this;
  4987. e.preventDefault();
  4988. if (swiper.isEnd && !swiper.params.loop) return;
  4989. swiper.slideNext();
  4990. },
  4991. init: function init() {
  4992. var swiper = this;
  4993. var params = swiper.params.navigation;
  4994. if (!(params.nextEl || params.prevEl)) return;
  4995. var $nextEl;
  4996. var $prevEl;
  4997. if (params.nextEl) {
  4998. $nextEl = $(params.nextEl);
  4999. if (swiper.params.uniqueNavElements && typeof params.nextEl === 'string' && $nextEl.length > 1 && swiper.$el.find(params.nextEl).length === 1) {
  5000. $nextEl = swiper.$el.find(params.nextEl);
  5001. }
  5002. }
  5003. if (params.prevEl) {
  5004. $prevEl = $(params.prevEl);
  5005. if (swiper.params.uniqueNavElements && typeof params.prevEl === 'string' && $prevEl.length > 1 && swiper.$el.find(params.prevEl).length === 1) {
  5006. $prevEl = swiper.$el.find(params.prevEl);
  5007. }
  5008. }
  5009. if ($nextEl && $nextEl.length > 0) {
  5010. $nextEl.on('click', swiper.navigation.onNextClick);
  5011. }
  5012. if ($prevEl && $prevEl.length > 0) {
  5013. $prevEl.on('click', swiper.navigation.onPrevClick);
  5014. }
  5015. extend$1(swiper.navigation, {
  5016. $nextEl: $nextEl,
  5017. nextEl: $nextEl && $nextEl[0],
  5018. $prevEl: $prevEl,
  5019. prevEl: $prevEl && $prevEl[0]
  5020. });
  5021. },
  5022. destroy: function destroy() {
  5023. var swiper = this;
  5024. var _swiper$navigation2 = swiper.navigation,
  5025. $nextEl = _swiper$navigation2.$nextEl,
  5026. $prevEl = _swiper$navigation2.$prevEl;
  5027. if ($nextEl && $nextEl.length) {
  5028. $nextEl.off('click', swiper.navigation.onNextClick);
  5029. $nextEl.removeClass(swiper.params.navigation.disabledClass);
  5030. }
  5031. if ($prevEl && $prevEl.length) {
  5032. $prevEl.off('click', swiper.navigation.onPrevClick);
  5033. $prevEl.removeClass(swiper.params.navigation.disabledClass);
  5034. }
  5035. }
  5036. };
  5037. var Navigation$1 = {
  5038. name: 'navigation',
  5039. params: {
  5040. navigation: {
  5041. nextEl: null,
  5042. prevEl: null,
  5043. hideOnClick: false,
  5044. disabledClass: 'swiper-button-disabled',
  5045. hiddenClass: 'swiper-button-hidden',
  5046. lockClass: 'swiper-button-lock'
  5047. }
  5048. },
  5049. create: function create() {
  5050. var swiper = this;
  5051. bindModuleMethods(swiper, {
  5052. navigation: _extends({}, Navigation)
  5053. });
  5054. },
  5055. on: {
  5056. init: function init(swiper) {
  5057. swiper.navigation.init();
  5058. swiper.navigation.update();
  5059. },
  5060. toEdge: function toEdge(swiper) {
  5061. swiper.navigation.update();
  5062. },
  5063. fromEdge: function fromEdge(swiper) {
  5064. swiper.navigation.update();
  5065. },
  5066. destroy: function destroy(swiper) {
  5067. swiper.navigation.destroy();
  5068. },
  5069. click: function click(swiper, e) {
  5070. var _swiper$navigation3 = swiper.navigation,
  5071. $nextEl = _swiper$navigation3.$nextEl,
  5072. $prevEl = _swiper$navigation3.$prevEl;
  5073. if (swiper.params.navigation.hideOnClick && !$(e.target).is($prevEl) && !$(e.target).is($nextEl)) {
  5074. var isHidden;
  5075. if ($nextEl) {
  5076. isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);
  5077. } else if ($prevEl) {
  5078. isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);
  5079. }
  5080. if (isHidden === true) {
  5081. swiper.emit('navigationShow');
  5082. } else {
  5083. swiper.emit('navigationHide');
  5084. }
  5085. if ($nextEl) {
  5086. $nextEl.toggleClass(swiper.params.navigation.hiddenClass);
  5087. }
  5088. if ($prevEl) {
  5089. $prevEl.toggleClass(swiper.params.navigation.hiddenClass);
  5090. }
  5091. }
  5092. }
  5093. }
  5094. };
  5095. var Pagination = {
  5096. update: function update() {
  5097. // Render || Update Pagination bullets/items
  5098. var swiper = this;
  5099. var rtl = swiper.rtl;
  5100. var params = swiper.params.pagination;
  5101. if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
  5102. var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
  5103. var $el = swiper.pagination.$el; // Current/Total
  5104. var current;
  5105. var total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
  5106. if (swiper.params.loop) {
  5107. current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup);
  5108. if (current > slidesLength - 1 - swiper.loopedSlides * 2) {
  5109. current -= slidesLength - swiper.loopedSlides * 2;
  5110. }
  5111. if (current > total - 1) current -= total;
  5112. if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current;
  5113. } else if (typeof swiper.snapIndex !== 'undefined') {
  5114. current = swiper.snapIndex;
  5115. } else {
  5116. current = swiper.activeIndex || 0;
  5117. } // Types
  5118. if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
  5119. var bullets = swiper.pagination.bullets;
  5120. var firstIndex;
  5121. var lastIndex;
  5122. var midIndex;
  5123. if (params.dynamicBullets) {
  5124. swiper.pagination.bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true);
  5125. $el.css(swiper.isHorizontal() ? 'width' : 'height', swiper.pagination.bulletSize * (params.dynamicMainBullets + 4) + "px");
  5126. if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) {
  5127. swiper.pagination.dynamicBulletIndex += current - swiper.previousIndex;
  5128. if (swiper.pagination.dynamicBulletIndex > params.dynamicMainBullets - 1) {
  5129. swiper.pagination.dynamicBulletIndex = params.dynamicMainBullets - 1;
  5130. } else if (swiper.pagination.dynamicBulletIndex < 0) {
  5131. swiper.pagination.dynamicBulletIndex = 0;
  5132. }
  5133. }
  5134. firstIndex = current - swiper.pagination.dynamicBulletIndex;
  5135. lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
  5136. midIndex = (lastIndex + firstIndex) / 2;
  5137. }
  5138. bullets.removeClass(params.bulletActiveClass + " " + params.bulletActiveClass + "-next " + params.bulletActiveClass + "-next-next " + params.bulletActiveClass + "-prev " + params.bulletActiveClass + "-prev-prev " + params.bulletActiveClass + "-main");
  5139. if ($el.length > 1) {
  5140. bullets.each(function (bullet) {
  5141. var $bullet = $(bullet);
  5142. var bulletIndex = $bullet.index();
  5143. if (bulletIndex === current) {
  5144. $bullet.addClass(params.bulletActiveClass);
  5145. }
  5146. if (params.dynamicBullets) {
  5147. if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
  5148. $bullet.addClass(params.bulletActiveClass + "-main");
  5149. }
  5150. if (bulletIndex === firstIndex) {
  5151. $bullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
  5152. }
  5153. if (bulletIndex === lastIndex) {
  5154. $bullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
  5155. }
  5156. }
  5157. });
  5158. } else {
  5159. var $bullet = bullets.eq(current);
  5160. var bulletIndex = $bullet.index();
  5161. $bullet.addClass(params.bulletActiveClass);
  5162. if (params.dynamicBullets) {
  5163. var $firstDisplayedBullet = bullets.eq(firstIndex);
  5164. var $lastDisplayedBullet = bullets.eq(lastIndex);
  5165. for (var i = firstIndex; i <= lastIndex; i += 1) {
  5166. bullets.eq(i).addClass(params.bulletActiveClass + "-main");
  5167. }
  5168. if (swiper.params.loop) {
  5169. if (bulletIndex >= bullets.length - params.dynamicMainBullets) {
  5170. for (var _i = params.dynamicMainBullets; _i >= 0; _i -= 1) {
  5171. bullets.eq(bullets.length - _i).addClass(params.bulletActiveClass + "-main");
  5172. }
  5173. bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(params.bulletActiveClass + "-prev");
  5174. } else {
  5175. $firstDisplayedBullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
  5176. $lastDisplayedBullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
  5177. }
  5178. } else {
  5179. $firstDisplayedBullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
  5180. $lastDisplayedBullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
  5181. }
  5182. }
  5183. }
  5184. if (params.dynamicBullets) {
  5185. var dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
  5186. var bulletsOffset = (swiper.pagination.bulletSize * dynamicBulletsLength - swiper.pagination.bulletSize) / 2 - midIndex * swiper.pagination.bulletSize;
  5187. var offsetProp = rtl ? 'right' : 'left';
  5188. bullets.css(swiper.isHorizontal() ? offsetProp : 'top', bulletsOffset + "px");
  5189. }
  5190. }
  5191. if (params.type === 'fraction') {
  5192. $el.find("." + params.currentClass).text(params.formatFractionCurrent(current + 1));
  5193. $el.find("." + params.totalClass).text(params.formatFractionTotal(total));
  5194. }
  5195. if (params.type === 'progressbar') {
  5196. var progressbarDirection;
  5197. if (params.progressbarOpposite) {
  5198. progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
  5199. } else {
  5200. progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
  5201. }
  5202. var scale = (current + 1) / total;
  5203. var scaleX = 1;
  5204. var scaleY = 1;
  5205. if (progressbarDirection === 'horizontal') {
  5206. scaleX = scale;
  5207. } else {
  5208. scaleY = scale;
  5209. }
  5210. $el.find("." + params.progressbarFillClass).transform("translate3d(0,0,0) scaleX(" + scaleX + ") scaleY(" + scaleY + ")").transition(swiper.params.speed);
  5211. }
  5212. if (params.type === 'custom' && params.renderCustom) {
  5213. $el.html(params.renderCustom(swiper, current + 1, total));
  5214. swiper.emit('paginationRender', $el[0]);
  5215. } else {
  5216. swiper.emit('paginationUpdate', $el[0]);
  5217. }
  5218. $el[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
  5219. },
  5220. render: function render() {
  5221. // Render Container
  5222. var swiper = this;
  5223. var params = swiper.params.pagination;
  5224. if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
  5225. var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
  5226. var $el = swiper.pagination.$el;
  5227. var paginationHTML = '';
  5228. if (params.type === 'bullets') {
  5229. var numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
  5230. for (var i = 0; i < numberOfBullets; i += 1) {
  5231. if (params.renderBullet) {
  5232. paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
  5233. } else {
  5234. paginationHTML += "<" + params.bulletElement + " class=\"" + params.bulletClass + "\"></" + params.bulletElement + ">";
  5235. }
  5236. }
  5237. $el.html(paginationHTML);
  5238. swiper.pagination.bullets = $el.find("." + params.bulletClass);
  5239. }
  5240. if (params.type === 'fraction') {
  5241. if (params.renderFraction) {
  5242. paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
  5243. } else {
  5244. paginationHTML = "<span class=\"" + params.currentClass + "\"></span>" + ' / ' + ("<span class=\"" + params.totalClass + "\"></span>");
  5245. }
  5246. $el.html(paginationHTML);
  5247. }
  5248. if (params.type === 'progressbar') {
  5249. if (params.renderProgressbar) {
  5250. paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
  5251. } else {
  5252. paginationHTML = "<span class=\"" + params.progressbarFillClass + "\"></span>";
  5253. }
  5254. $el.html(paginationHTML);
  5255. }
  5256. if (params.type !== 'custom') {
  5257. swiper.emit('paginationRender', swiper.pagination.$el[0]);
  5258. }
  5259. },
  5260. init: function init() {
  5261. var swiper = this;
  5262. var params = swiper.params.pagination;
  5263. if (!params.el) return;
  5264. var $el = $(params.el);
  5265. if ($el.length === 0) return;
  5266. if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) {
  5267. $el = swiper.$el.find(params.el);
  5268. }
  5269. if (params.type === 'bullets' && params.clickable) {
  5270. $el.addClass(params.clickableClass);
  5271. }
  5272. $el.addClass(params.modifierClass + params.type);
  5273. if (params.type === 'bullets' && params.dynamicBullets) {
  5274. $el.addClass("" + params.modifierClass + params.type + "-dynamic");
  5275. swiper.pagination.dynamicBulletIndex = 0;
  5276. if (params.dynamicMainBullets < 1) {
  5277. params.dynamicMainBullets = 1;
  5278. }
  5279. }
  5280. if (params.type === 'progressbar' && params.progressbarOpposite) {
  5281. $el.addClass(params.progressbarOppositeClass);
  5282. }
  5283. if (params.clickable) {
  5284. $el.on('click', "." + params.bulletClass, function onClick(e) {
  5285. e.preventDefault();
  5286. var index = $(this).index() * swiper.params.slidesPerGroup;
  5287. if (swiper.params.loop) index += swiper.loopedSlides;
  5288. swiper.slideTo(index);
  5289. });
  5290. }
  5291. extend$1(swiper.pagination, {
  5292. $el: $el,
  5293. el: $el[0]
  5294. });
  5295. },
  5296. destroy: function destroy() {
  5297. var swiper = this;
  5298. var params = swiper.params.pagination;
  5299. if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
  5300. var $el = swiper.pagination.$el;
  5301. $el.removeClass(params.hiddenClass);
  5302. $el.removeClass(params.modifierClass + params.type);
  5303. if (swiper.pagination.bullets) swiper.pagination.bullets.removeClass(params.bulletActiveClass);
  5304. if (params.clickable) {
  5305. $el.off('click', "." + params.bulletClass);
  5306. }
  5307. }
  5308. };
  5309. var Pagination$1 = {
  5310. name: 'pagination',
  5311. params: {
  5312. pagination: {
  5313. el: null,
  5314. bulletElement: 'span',
  5315. clickable: false,
  5316. hideOnClick: false,
  5317. renderBullet: null,
  5318. renderProgressbar: null,
  5319. renderFraction: null,
  5320. renderCustom: null,
  5321. progressbarOpposite: false,
  5322. type: 'bullets',
  5323. // 'bullets' or 'progressbar' or 'fraction' or 'custom'
  5324. dynamicBullets: false,
  5325. dynamicMainBullets: 1,
  5326. formatFractionCurrent: function formatFractionCurrent(number) {
  5327. return number;
  5328. },
  5329. formatFractionTotal: function formatFractionTotal(number) {
  5330. return number;
  5331. },
  5332. bulletClass: 'swiper-pagination-bullet',
  5333. bulletActiveClass: 'swiper-pagination-bullet-active',
  5334. modifierClass: 'swiper-pagination-',
  5335. // NEW
  5336. currentClass: 'swiper-pagination-current',
  5337. totalClass: 'swiper-pagination-total',
  5338. hiddenClass: 'swiper-pagination-hidden',
  5339. progressbarFillClass: 'swiper-pagination-progressbar-fill',
  5340. progressbarOppositeClass: 'swiper-pagination-progressbar-opposite',
  5341. clickableClass: 'swiper-pagination-clickable',
  5342. // NEW
  5343. lockClass: 'swiper-pagination-lock'
  5344. }
  5345. },
  5346. create: function create() {
  5347. var swiper = this;
  5348. bindModuleMethods(swiper, {
  5349. pagination: _extends({
  5350. dynamicBulletIndex: 0
  5351. }, Pagination)
  5352. });
  5353. },
  5354. on: {
  5355. init: function init(swiper) {
  5356. swiper.pagination.init();
  5357. swiper.pagination.render();
  5358. swiper.pagination.update();
  5359. },
  5360. activeIndexChange: function activeIndexChange(swiper) {
  5361. if (swiper.params.loop) {
  5362. swiper.pagination.update();
  5363. } else if (typeof swiper.snapIndex === 'undefined') {
  5364. swiper.pagination.update();
  5365. }
  5366. },
  5367. snapIndexChange: function snapIndexChange(swiper) {
  5368. if (!swiper.params.loop) {
  5369. swiper.pagination.update();
  5370. }
  5371. },
  5372. slidesLengthChange: function slidesLengthChange(swiper) {
  5373. if (swiper.params.loop) {
  5374. swiper.pagination.render();
  5375. swiper.pagination.update();
  5376. }
  5377. },
  5378. snapGridLengthChange: function snapGridLengthChange(swiper) {
  5379. if (!swiper.params.loop) {
  5380. swiper.pagination.render();
  5381. swiper.pagination.update();
  5382. }
  5383. },
  5384. destroy: function destroy(swiper) {
  5385. swiper.pagination.destroy();
  5386. },
  5387. click: function click(swiper, e) {
  5388. if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && swiper.pagination.$el.length > 0 && !$(e.target).hasClass(swiper.params.pagination.bulletClass)) {
  5389. var isHidden = swiper.pagination.$el.hasClass(swiper.params.pagination.hiddenClass);
  5390. if (isHidden === true) {
  5391. swiper.emit('paginationShow');
  5392. } else {
  5393. swiper.emit('paginationHide');
  5394. }
  5395. swiper.pagination.$el.toggleClass(swiper.params.pagination.hiddenClass);
  5396. }
  5397. }
  5398. }
  5399. };
  5400. var Scrollbar = {
  5401. setTranslate: function setTranslate() {
  5402. var swiper = this;
  5403. if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
  5404. var scrollbar = swiper.scrollbar,
  5405. rtl = swiper.rtlTranslate,
  5406. progress = swiper.progress;
  5407. var dragSize = scrollbar.dragSize,
  5408. trackSize = scrollbar.trackSize,
  5409. $dragEl = scrollbar.$dragEl,
  5410. $el = scrollbar.$el;
  5411. var params = swiper.params.scrollbar;
  5412. var newSize = dragSize;
  5413. var newPos = (trackSize - dragSize) * progress;
  5414. if (rtl) {
  5415. newPos = -newPos;
  5416. if (newPos > 0) {
  5417. newSize = dragSize - newPos;
  5418. newPos = 0;
  5419. } else if (-newPos + dragSize > trackSize) {
  5420. newSize = trackSize + newPos;
  5421. }
  5422. } else if (newPos < 0) {
  5423. newSize = dragSize + newPos;
  5424. newPos = 0;
  5425. } else if (newPos + dragSize > trackSize) {
  5426. newSize = trackSize - newPos;
  5427. }
  5428. if (swiper.isHorizontal()) {
  5429. $dragEl.transform("translate3d(" + newPos + "px, 0, 0)");
  5430. $dragEl[0].style.width = newSize + "px";
  5431. } else {
  5432. $dragEl.transform("translate3d(0px, " + newPos + "px, 0)");
  5433. $dragEl[0].style.height = newSize + "px";
  5434. }
  5435. if (params.hide) {
  5436. clearTimeout(swiper.scrollbar.timeout);
  5437. $el[0].style.opacity = 1;
  5438. swiper.scrollbar.timeout = setTimeout(function () {
  5439. $el[0].style.opacity = 0;
  5440. $el.transition(400);
  5441. }, 1000);
  5442. }
  5443. },
  5444. setTransition: function setTransition(duration) {
  5445. var swiper = this;
  5446. if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
  5447. swiper.scrollbar.$dragEl.transition(duration);
  5448. },
  5449. updateSize: function updateSize() {
  5450. var swiper = this;
  5451. if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
  5452. var scrollbar = swiper.scrollbar;
  5453. var $dragEl = scrollbar.$dragEl,
  5454. $el = scrollbar.$el;
  5455. $dragEl[0].style.width = '';
  5456. $dragEl[0].style.height = '';
  5457. var trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight;
  5458. var divider = swiper.size / swiper.virtualSize;
  5459. var moveDivider = divider * (trackSize / swiper.size);
  5460. var dragSize;
  5461. if (swiper.params.scrollbar.dragSize === 'auto') {
  5462. dragSize = trackSize * divider;
  5463. } else {
  5464. dragSize = parseInt(swiper.params.scrollbar.dragSize, 10);
  5465. }
  5466. if (swiper.isHorizontal()) {
  5467. $dragEl[0].style.width = dragSize + "px";
  5468. } else {
  5469. $dragEl[0].style.height = dragSize + "px";
  5470. }
  5471. if (divider >= 1) {
  5472. $el[0].style.display = 'none';
  5473. } else {
  5474. $el[0].style.display = '';
  5475. }
  5476. if (swiper.params.scrollbar.hide) {
  5477. $el[0].style.opacity = 0;
  5478. }
  5479. extend$1(scrollbar, {
  5480. trackSize: trackSize,
  5481. divider: divider,
  5482. moveDivider: moveDivider,
  5483. dragSize: dragSize
  5484. });
  5485. scrollbar.$el[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass);
  5486. },
  5487. getPointerPosition: function getPointerPosition(e) {
  5488. var swiper = this;
  5489. if (swiper.isHorizontal()) {
  5490. return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX;
  5491. }
  5492. return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY;
  5493. },
  5494. setDragPosition: function setDragPosition(e) {
  5495. var swiper = this;
  5496. var scrollbar = swiper.scrollbar,
  5497. rtl = swiper.rtlTranslate;
  5498. var $el = scrollbar.$el,
  5499. dragSize = scrollbar.dragSize,
  5500. trackSize = scrollbar.trackSize,
  5501. dragStartPos = scrollbar.dragStartPos;
  5502. var positionRatio;
  5503. positionRatio = (scrollbar.getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize);
  5504. positionRatio = Math.max(Math.min(positionRatio, 1), 0);
  5505. if (rtl) {
  5506. positionRatio = 1 - positionRatio;
  5507. }
  5508. var position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio;
  5509. swiper.updateProgress(position);
  5510. swiper.setTranslate(position);
  5511. swiper.updateActiveIndex();
  5512. swiper.updateSlidesClasses();
  5513. },
  5514. onDragStart: function onDragStart(e) {
  5515. var swiper = this;
  5516. var params = swiper.params.scrollbar;
  5517. var scrollbar = swiper.scrollbar,
  5518. $wrapperEl = swiper.$wrapperEl;
  5519. var $el = scrollbar.$el,
  5520. $dragEl = scrollbar.$dragEl;
  5521. swiper.scrollbar.isTouched = true;
  5522. swiper.scrollbar.dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? scrollbar.getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null;
  5523. e.preventDefault();
  5524. e.stopPropagation();
  5525. $wrapperEl.transition(100);
  5526. $dragEl.transition(100);
  5527. scrollbar.setDragPosition(e);
  5528. clearTimeout(swiper.scrollbar.dragTimeout);
  5529. $el.transition(0);
  5530. if (params.hide) {
  5531. $el.css('opacity', 1);
  5532. }
  5533. if (swiper.params.cssMode) {
  5534. swiper.$wrapperEl.css('scroll-snap-type', 'none');
  5535. }
  5536. swiper.emit('scrollbarDragStart', e);
  5537. },
  5538. onDragMove: function onDragMove(e) {
  5539. var swiper = this;
  5540. var scrollbar = swiper.scrollbar,
  5541. $wrapperEl = swiper.$wrapperEl;
  5542. var $el = scrollbar.$el,
  5543. $dragEl = scrollbar.$dragEl;
  5544. if (!swiper.scrollbar.isTouched) return;
  5545. if (e.preventDefault) e.preventDefault();else e.returnValue = false;
  5546. scrollbar.setDragPosition(e);
  5547. $wrapperEl.transition(0);
  5548. $el.transition(0);
  5549. $dragEl.transition(0);
  5550. swiper.emit('scrollbarDragMove', e);
  5551. },
  5552. onDragEnd: function onDragEnd(e) {
  5553. var swiper = this;
  5554. var params = swiper.params.scrollbar;
  5555. var scrollbar = swiper.scrollbar,
  5556. $wrapperEl = swiper.$wrapperEl;
  5557. var $el = scrollbar.$el;
  5558. if (!swiper.scrollbar.isTouched) return;
  5559. swiper.scrollbar.isTouched = false;
  5560. if (swiper.params.cssMode) {
  5561. swiper.$wrapperEl.css('scroll-snap-type', '');
  5562. $wrapperEl.transition('');
  5563. }
  5564. if (params.hide) {
  5565. clearTimeout(swiper.scrollbar.dragTimeout);
  5566. swiper.scrollbar.dragTimeout = nextTick(function () {
  5567. $el.css('opacity', 0);
  5568. $el.transition(400);
  5569. }, 1000);
  5570. }
  5571. swiper.emit('scrollbarDragEnd', e);
  5572. if (params.snapOnRelease) {
  5573. swiper.slideToClosest();
  5574. }
  5575. },
  5576. enableDraggable: function enableDraggable() {
  5577. var swiper = this;
  5578. if (!swiper.params.scrollbar.el) return;
  5579. var document = getDocument();
  5580. var scrollbar = swiper.scrollbar,
  5581. touchEventsTouch = swiper.touchEventsTouch,
  5582. touchEventsDesktop = swiper.touchEventsDesktop,
  5583. params = swiper.params,
  5584. support = swiper.support;
  5585. var $el = scrollbar.$el;
  5586. var target = $el[0];
  5587. var activeListener = support.passiveListener && params.passiveListeners ? {
  5588. passive: false,
  5589. capture: false
  5590. } : false;
  5591. var passiveListener = support.passiveListener && params.passiveListeners ? {
  5592. passive: true,
  5593. capture: false
  5594. } : false;
  5595. if (!support.touch) {
  5596. target.addEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener);
  5597. document.addEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener);
  5598. document.addEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener);
  5599. } else {
  5600. target.addEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener);
  5601. target.addEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener);
  5602. target.addEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener);
  5603. }
  5604. },
  5605. disableDraggable: function disableDraggable() {
  5606. var swiper = this;
  5607. if (!swiper.params.scrollbar.el) return;
  5608. var document = getDocument();
  5609. var scrollbar = swiper.scrollbar,
  5610. touchEventsTouch = swiper.touchEventsTouch,
  5611. touchEventsDesktop = swiper.touchEventsDesktop,
  5612. params = swiper.params,
  5613. support = swiper.support;
  5614. var $el = scrollbar.$el;
  5615. var target = $el[0];
  5616. var activeListener = support.passiveListener && params.passiveListeners ? {
  5617. passive: false,
  5618. capture: false
  5619. } : false;
  5620. var passiveListener = support.passiveListener && params.passiveListeners ? {
  5621. passive: true,
  5622. capture: false
  5623. } : false;
  5624. if (!support.touch) {
  5625. target.removeEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener);
  5626. document.removeEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener);
  5627. document.removeEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener);
  5628. } else {
  5629. target.removeEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener);
  5630. target.removeEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener);
  5631. target.removeEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener);
  5632. }
  5633. },
  5634. init: function init() {
  5635. var swiper = this;
  5636. if (!swiper.params.scrollbar.el) return;
  5637. var scrollbar = swiper.scrollbar,
  5638. $swiperEl = swiper.$el;
  5639. var params = swiper.params.scrollbar;
  5640. var $el = $(params.el);
  5641. if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) {
  5642. $el = $swiperEl.find(params.el);
  5643. }
  5644. var $dragEl = $el.find("." + swiper.params.scrollbar.dragClass);
  5645. if ($dragEl.length === 0) {
  5646. $dragEl = $("<div class=\"" + swiper.params.scrollbar.dragClass + "\"></div>");
  5647. $el.append($dragEl);
  5648. }
  5649. extend$1(scrollbar, {
  5650. $el: $el,
  5651. el: $el[0],
  5652. $dragEl: $dragEl,
  5653. dragEl: $dragEl[0]
  5654. });
  5655. if (params.draggable) {
  5656. scrollbar.enableDraggable();
  5657. }
  5658. },
  5659. destroy: function destroy() {
  5660. var swiper = this;
  5661. swiper.scrollbar.disableDraggable();
  5662. }
  5663. };
  5664. var Scrollbar$1 = {
  5665. name: 'scrollbar',
  5666. params: {
  5667. scrollbar: {
  5668. el: null,
  5669. dragSize: 'auto',
  5670. hide: false,
  5671. draggable: false,
  5672. snapOnRelease: true,
  5673. lockClass: 'swiper-scrollbar-lock',
  5674. dragClass: 'swiper-scrollbar-drag'
  5675. }
  5676. },
  5677. create: function create() {
  5678. var swiper = this;
  5679. bindModuleMethods(swiper, {
  5680. scrollbar: _extends({
  5681. isTouched: false,
  5682. timeout: null,
  5683. dragTimeout: null
  5684. }, Scrollbar)
  5685. });
  5686. },
  5687. on: {
  5688. init: function init(swiper) {
  5689. swiper.scrollbar.init();
  5690. swiper.scrollbar.updateSize();
  5691. swiper.scrollbar.setTranslate();
  5692. },
  5693. update: function update(swiper) {
  5694. swiper.scrollbar.updateSize();
  5695. },
  5696. resize: function resize(swiper) {
  5697. swiper.scrollbar.updateSize();
  5698. },
  5699. observerUpdate: function observerUpdate(swiper) {
  5700. swiper.scrollbar.updateSize();
  5701. },
  5702. setTranslate: function setTranslate(swiper) {
  5703. swiper.scrollbar.setTranslate();
  5704. },
  5705. setTransition: function setTransition(swiper, duration) {
  5706. swiper.scrollbar.setTransition(duration);
  5707. },
  5708. destroy: function destroy(swiper) {
  5709. swiper.scrollbar.destroy();
  5710. }
  5711. }
  5712. };
  5713. var Parallax = {
  5714. setTransform: function setTransform(el, progress) {
  5715. var swiper = this;
  5716. var rtl = swiper.rtl;
  5717. var $el = $(el);
  5718. var rtlFactor = rtl ? -1 : 1;
  5719. var p = $el.attr('data-swiper-parallax') || '0';
  5720. var x = $el.attr('data-swiper-parallax-x');
  5721. var y = $el.attr('data-swiper-parallax-y');
  5722. var scale = $el.attr('data-swiper-parallax-scale');
  5723. var opacity = $el.attr('data-swiper-parallax-opacity');
  5724. if (x || y) {
  5725. x = x || '0';
  5726. y = y || '0';
  5727. } else if (swiper.isHorizontal()) {
  5728. x = p;
  5729. y = '0';
  5730. } else {
  5731. y = p;
  5732. x = '0';
  5733. }
  5734. if (x.indexOf('%') >= 0) {
  5735. x = parseInt(x, 10) * progress * rtlFactor + "%";
  5736. } else {
  5737. x = x * progress * rtlFactor + "px";
  5738. }
  5739. if (y.indexOf('%') >= 0) {
  5740. y = parseInt(y, 10) * progress + "%";
  5741. } else {
  5742. y = y * progress + "px";
  5743. }
  5744. if (typeof opacity !== 'undefined' && opacity !== null) {
  5745. var currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress));
  5746. $el[0].style.opacity = currentOpacity;
  5747. }
  5748. if (typeof scale === 'undefined' || scale === null) {
  5749. $el.transform("translate3d(" + x + ", " + y + ", 0px)");
  5750. } else {
  5751. var currentScale = scale - (scale - 1) * (1 - Math.abs(progress));
  5752. $el.transform("translate3d(" + x + ", " + y + ", 0px) scale(" + currentScale + ")");
  5753. }
  5754. },
  5755. setTranslate: function setTranslate() {
  5756. var swiper = this;
  5757. var $el = swiper.$el,
  5758. slides = swiper.slides,
  5759. progress = swiper.progress,
  5760. snapGrid = swiper.snapGrid;
  5761. $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (el) {
  5762. swiper.parallax.setTransform(el, progress);
  5763. });
  5764. slides.each(function (slideEl, slideIndex) {
  5765. var slideProgress = slideEl.progress;
  5766. if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') {
  5767. slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1);
  5768. }
  5769. slideProgress = Math.min(Math.max(slideProgress, -1), 1);
  5770. $(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (el) {
  5771. swiper.parallax.setTransform(el, slideProgress);
  5772. });
  5773. });
  5774. },
  5775. setTransition: function setTransition(duration) {
  5776. if (duration === void 0) {
  5777. duration = this.params.speed;
  5778. }
  5779. var swiper = this;
  5780. var $el = swiper.$el;
  5781. $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (parallaxEl) {
  5782. var $parallaxEl = $(parallaxEl);
  5783. var parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration;
  5784. if (duration === 0) parallaxDuration = 0;
  5785. $parallaxEl.transition(parallaxDuration);
  5786. });
  5787. }
  5788. };
  5789. var Parallax$1 = {
  5790. name: 'parallax',
  5791. params: {
  5792. parallax: {
  5793. enabled: false
  5794. }
  5795. },
  5796. create: function create() {
  5797. var swiper = this;
  5798. bindModuleMethods(swiper, {
  5799. parallax: _extends({}, Parallax)
  5800. });
  5801. },
  5802. on: {
  5803. beforeInit: function beforeInit(swiper) {
  5804. if (!swiper.params.parallax.enabled) return;
  5805. swiper.params.watchSlidesProgress = true;
  5806. swiper.originalParams.watchSlidesProgress = true;
  5807. },
  5808. init: function init(swiper) {
  5809. if (!swiper.params.parallax.enabled) return;
  5810. swiper.parallax.setTranslate();
  5811. },
  5812. setTranslate: function setTranslate(swiper) {
  5813. if (!swiper.params.parallax.enabled) return;
  5814. swiper.parallax.setTranslate();
  5815. },
  5816. setTransition: function setTransition(swiper, duration) {
  5817. if (!swiper.params.parallax.enabled) return;
  5818. swiper.parallax.setTransition(duration);
  5819. }
  5820. }
  5821. };
  5822. var Zoom = {
  5823. // Calc Scale From Multi-touches
  5824. getDistanceBetweenTouches: function getDistanceBetweenTouches(e) {
  5825. if (e.targetTouches.length < 2) return 1;
  5826. var x1 = e.targetTouches[0].pageX;
  5827. var y1 = e.targetTouches[0].pageY;
  5828. var x2 = e.targetTouches[1].pageX;
  5829. var y2 = e.targetTouches[1].pageY;
  5830. var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  5831. return distance;
  5832. },
  5833. // Events
  5834. onGestureStart: function onGestureStart(e) {
  5835. var swiper = this;
  5836. var support = swiper.support;
  5837. var params = swiper.params.zoom;
  5838. var zoom = swiper.zoom;
  5839. var gesture = zoom.gesture;
  5840. zoom.fakeGestureTouched = false;
  5841. zoom.fakeGestureMoved = false;
  5842. if (!support.gestures) {
  5843. if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) {
  5844. return;
  5845. }
  5846. zoom.fakeGestureTouched = true;
  5847. gesture.scaleStart = Zoom.getDistanceBetweenTouches(e);
  5848. }
  5849. if (!gesture.$slideEl || !gesture.$slideEl.length) {
  5850. gesture.$slideEl = $(e.target).closest("." + swiper.params.slideClass);
  5851. if (gesture.$slideEl.length === 0) gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
  5852. gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
  5853. gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
  5854. gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
  5855. if (gesture.$imageWrapEl.length === 0) {
  5856. gesture.$imageEl = undefined;
  5857. return;
  5858. }
  5859. }
  5860. if (gesture.$imageEl) {
  5861. gesture.$imageEl.transition(0);
  5862. }
  5863. swiper.zoom.isScaling = true;
  5864. },
  5865. onGestureChange: function onGestureChange(e) {
  5866. var swiper = this;
  5867. var support = swiper.support;
  5868. var params = swiper.params.zoom;
  5869. var zoom = swiper.zoom;
  5870. var gesture = zoom.gesture;
  5871. if (!support.gestures) {
  5872. if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) {
  5873. return;
  5874. }
  5875. zoom.fakeGestureMoved = true;
  5876. gesture.scaleMove = Zoom.getDistanceBetweenTouches(e);
  5877. }
  5878. if (!gesture.$imageEl || gesture.$imageEl.length === 0) {
  5879. if (e.type === 'gesturechange') zoom.onGestureStart(e);
  5880. return;
  5881. }
  5882. if (support.gestures) {
  5883. zoom.scale = e.scale * zoom.currentScale;
  5884. } else {
  5885. zoom.scale = gesture.scaleMove / gesture.scaleStart * zoom.currentScale;
  5886. }
  5887. if (zoom.scale > gesture.maxRatio) {
  5888. zoom.scale = gesture.maxRatio - 1 + Math.pow(zoom.scale - gesture.maxRatio + 1, 0.5);
  5889. }
  5890. if (zoom.scale < params.minRatio) {
  5891. zoom.scale = params.minRatio + 1 - Math.pow(params.minRatio - zoom.scale + 1, 0.5);
  5892. }
  5893. gesture.$imageEl.transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
  5894. },
  5895. onGestureEnd: function onGestureEnd(e) {
  5896. var swiper = this;
  5897. var device = swiper.device;
  5898. var support = swiper.support;
  5899. var params = swiper.params.zoom;
  5900. var zoom = swiper.zoom;
  5901. var gesture = zoom.gesture;
  5902. if (!support.gestures) {
  5903. if (!zoom.fakeGestureTouched || !zoom.fakeGestureMoved) {
  5904. return;
  5905. }
  5906. if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2 && !device.android) {
  5907. return;
  5908. }
  5909. zoom.fakeGestureTouched = false;
  5910. zoom.fakeGestureMoved = false;
  5911. }
  5912. if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
  5913. zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio);
  5914. gesture.$imageEl.transition(swiper.params.speed).transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
  5915. zoom.currentScale = zoom.scale;
  5916. zoom.isScaling = false;
  5917. if (zoom.scale === 1) gesture.$slideEl = undefined;
  5918. },
  5919. onTouchStart: function onTouchStart(e) {
  5920. var swiper = this;
  5921. var device = swiper.device;
  5922. var zoom = swiper.zoom;
  5923. var gesture = zoom.gesture,
  5924. image = zoom.image;
  5925. if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
  5926. if (image.isTouched) return;
  5927. if (device.android && e.cancelable) e.preventDefault();
  5928. image.isTouched = true;
  5929. image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
  5930. image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
  5931. },
  5932. onTouchMove: function onTouchMove(e) {
  5933. var swiper = this;
  5934. var zoom = swiper.zoom;
  5935. var gesture = zoom.gesture,
  5936. image = zoom.image,
  5937. velocity = zoom.velocity;
  5938. if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
  5939. swiper.allowClick = false;
  5940. if (!image.isTouched || !gesture.$slideEl) return;
  5941. if (!image.isMoved) {
  5942. image.width = gesture.$imageEl[0].offsetWidth;
  5943. image.height = gesture.$imageEl[0].offsetHeight;
  5944. image.startX = getTranslate(gesture.$imageWrapEl[0], 'x') || 0;
  5945. image.startY = getTranslate(gesture.$imageWrapEl[0], 'y') || 0;
  5946. gesture.slideWidth = gesture.$slideEl[0].offsetWidth;
  5947. gesture.slideHeight = gesture.$slideEl[0].offsetHeight;
  5948. gesture.$imageWrapEl.transition(0);
  5949. if (swiper.rtl) {
  5950. image.startX = -image.startX;
  5951. image.startY = -image.startY;
  5952. }
  5953. } // Define if we need image drag
  5954. var scaledWidth = image.width * zoom.scale;
  5955. var scaledHeight = image.height * zoom.scale;
  5956. if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return;
  5957. image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
  5958. image.maxX = -image.minX;
  5959. image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
  5960. image.maxY = -image.minY;
  5961. image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
  5962. image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
  5963. if (!image.isMoved && !zoom.isScaling) {
  5964. if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) {
  5965. image.isTouched = false;
  5966. return;
  5967. }
  5968. if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) {
  5969. image.isTouched = false;
  5970. return;
  5971. }
  5972. }
  5973. if (e.cancelable) {
  5974. e.preventDefault();
  5975. }
  5976. e.stopPropagation();
  5977. image.isMoved = true;
  5978. image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX;
  5979. image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY;
  5980. if (image.currentX < image.minX) {
  5981. image.currentX = image.minX + 1 - Math.pow(image.minX - image.currentX + 1, 0.8);
  5982. }
  5983. if (image.currentX > image.maxX) {
  5984. image.currentX = image.maxX - 1 + Math.pow(image.currentX - image.maxX + 1, 0.8);
  5985. }
  5986. if (image.currentY < image.minY) {
  5987. image.currentY = image.minY + 1 - Math.pow(image.minY - image.currentY + 1, 0.8);
  5988. }
  5989. if (image.currentY > image.maxY) {
  5990. image.currentY = image.maxY - 1 + Math.pow(image.currentY - image.maxY + 1, 0.8);
  5991. } // Velocity
  5992. if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x;
  5993. if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y;
  5994. if (!velocity.prevTime) velocity.prevTime = Date.now();
  5995. velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2;
  5996. velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2;
  5997. if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0;
  5998. if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0;
  5999. velocity.prevPositionX = image.touchesCurrent.x;
  6000. velocity.prevPositionY = image.touchesCurrent.y;
  6001. velocity.prevTime = Date.now();
  6002. gesture.$imageWrapEl.transform("translate3d(" + image.currentX + "px, " + image.currentY + "px,0)");
  6003. },
  6004. onTouchEnd: function onTouchEnd() {
  6005. var swiper = this;
  6006. var zoom = swiper.zoom;
  6007. var gesture = zoom.gesture,
  6008. image = zoom.image,
  6009. velocity = zoom.velocity;
  6010. if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
  6011. if (!image.isTouched || !image.isMoved) {
  6012. image.isTouched = false;
  6013. image.isMoved = false;
  6014. return;
  6015. }
  6016. image.isTouched = false;
  6017. image.isMoved = false;
  6018. var momentumDurationX = 300;
  6019. var momentumDurationY = 300;
  6020. var momentumDistanceX = velocity.x * momentumDurationX;
  6021. var newPositionX = image.currentX + momentumDistanceX;
  6022. var momentumDistanceY = velocity.y * momentumDurationY;
  6023. var newPositionY = image.currentY + momentumDistanceY; // Fix duration
  6024. if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x);
  6025. if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y);
  6026. var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
  6027. image.currentX = newPositionX;
  6028. image.currentY = newPositionY; // Define if we need image drag
  6029. var scaledWidth = image.width * zoom.scale;
  6030. var scaledHeight = image.height * zoom.scale;
  6031. image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
  6032. image.maxX = -image.minX;
  6033. image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
  6034. image.maxY = -image.minY;
  6035. image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX);
  6036. image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY);
  6037. gesture.$imageWrapEl.transition(momentumDuration).transform("translate3d(" + image.currentX + "px, " + image.currentY + "px,0)");
  6038. },
  6039. onTransitionEnd: function onTransitionEnd() {
  6040. var swiper = this;
  6041. var zoom = swiper.zoom;
  6042. var gesture = zoom.gesture;
  6043. if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) {
  6044. if (gesture.$imageEl) {
  6045. gesture.$imageEl.transform('translate3d(0,0,0) scale(1)');
  6046. }
  6047. if (gesture.$imageWrapEl) {
  6048. gesture.$imageWrapEl.transform('translate3d(0,0,0)');
  6049. }
  6050. zoom.scale = 1;
  6051. zoom.currentScale = 1;
  6052. gesture.$slideEl = undefined;
  6053. gesture.$imageEl = undefined;
  6054. gesture.$imageWrapEl = undefined;
  6055. }
  6056. },
  6057. // Toggle Zoom
  6058. toggle: function toggle(e) {
  6059. var swiper = this;
  6060. var zoom = swiper.zoom;
  6061. if (zoom.scale && zoom.scale !== 1) {
  6062. // Zoom Out
  6063. zoom.out();
  6064. } else {
  6065. // Zoom In
  6066. zoom.in(e);
  6067. }
  6068. },
  6069. in: function _in(e) {
  6070. var swiper = this;
  6071. var zoom = swiper.zoom;
  6072. var params = swiper.params.zoom;
  6073. var gesture = zoom.gesture,
  6074. image = zoom.image;
  6075. if (!gesture.$slideEl) {
  6076. if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
  6077. gesture.$slideEl = swiper.$wrapperEl.children("." + swiper.params.slideActiveClass);
  6078. } else {
  6079. gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
  6080. }
  6081. gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
  6082. gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
  6083. }
  6084. if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
  6085. gesture.$slideEl.addClass("" + params.zoomedSlideClass);
  6086. var touchX;
  6087. var touchY;
  6088. var offsetX;
  6089. var offsetY;
  6090. var diffX;
  6091. var diffY;
  6092. var translateX;
  6093. var translateY;
  6094. var imageWidth;
  6095. var imageHeight;
  6096. var scaledWidth;
  6097. var scaledHeight;
  6098. var translateMinX;
  6099. var translateMinY;
  6100. var translateMaxX;
  6101. var translateMaxY;
  6102. var slideWidth;
  6103. var slideHeight;
  6104. if (typeof image.touchesStart.x === 'undefined' && e) {
  6105. touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;
  6106. touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;
  6107. } else {
  6108. touchX = image.touchesStart.x;
  6109. touchY = image.touchesStart.y;
  6110. }
  6111. zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
  6112. zoom.currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
  6113. if (e) {
  6114. slideWidth = gesture.$slideEl[0].offsetWidth;
  6115. slideHeight = gesture.$slideEl[0].offsetHeight;
  6116. offsetX = gesture.$slideEl.offset().left;
  6117. offsetY = gesture.$slideEl.offset().top;
  6118. diffX = offsetX + slideWidth / 2 - touchX;
  6119. diffY = offsetY + slideHeight / 2 - touchY;
  6120. imageWidth = gesture.$imageEl[0].offsetWidth;
  6121. imageHeight = gesture.$imageEl[0].offsetHeight;
  6122. scaledWidth = imageWidth * zoom.scale;
  6123. scaledHeight = imageHeight * zoom.scale;
  6124. translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);
  6125. translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);
  6126. translateMaxX = -translateMinX;
  6127. translateMaxY = -translateMinY;
  6128. translateX = diffX * zoom.scale;
  6129. translateY = diffY * zoom.scale;
  6130. if (translateX < translateMinX) {
  6131. translateX = translateMinX;
  6132. }
  6133. if (translateX > translateMaxX) {
  6134. translateX = translateMaxX;
  6135. }
  6136. if (translateY < translateMinY) {
  6137. translateY = translateMinY;
  6138. }
  6139. if (translateY > translateMaxY) {
  6140. translateY = translateMaxY;
  6141. }
  6142. } else {
  6143. translateX = 0;
  6144. translateY = 0;
  6145. }
  6146. gesture.$imageWrapEl.transition(300).transform("translate3d(" + translateX + "px, " + translateY + "px,0)");
  6147. gesture.$imageEl.transition(300).transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
  6148. },
  6149. out: function out() {
  6150. var swiper = this;
  6151. var zoom = swiper.zoom;
  6152. var params = swiper.params.zoom;
  6153. var gesture = zoom.gesture;
  6154. if (!gesture.$slideEl) {
  6155. if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
  6156. gesture.$slideEl = swiper.$wrapperEl.children("." + swiper.params.slideActiveClass);
  6157. } else {
  6158. gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
  6159. }
  6160. gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
  6161. gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
  6162. }
  6163. if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
  6164. zoom.scale = 1;
  6165. zoom.currentScale = 1;
  6166. gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)');
  6167. gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)');
  6168. gesture.$slideEl.removeClass("" + params.zoomedSlideClass);
  6169. gesture.$slideEl = undefined;
  6170. },
  6171. toggleGestures: function toggleGestures(method) {
  6172. var swiper = this;
  6173. var zoom = swiper.zoom;
  6174. var selector = zoom.slideSelector,
  6175. passive = zoom.passiveListener;
  6176. swiper.$wrapperEl[method]('gesturestart', selector, zoom.onGestureStart, passive);
  6177. swiper.$wrapperEl[method]('gesturechange', selector, zoom.onGestureChange, passive);
  6178. swiper.$wrapperEl[method]('gestureend', selector, zoom.onGestureEnd, passive);
  6179. },
  6180. enableGestures: function enableGestures() {
  6181. if (this.zoom.gesturesEnabled) return;
  6182. this.zoom.gesturesEnabled = true;
  6183. this.zoom.toggleGestures('on');
  6184. },
  6185. disableGestures: function disableGestures() {
  6186. if (!this.zoom.gesturesEnabled) return;
  6187. this.zoom.gesturesEnabled = false;
  6188. this.zoom.toggleGestures('off');
  6189. },
  6190. // Attach/Detach Events
  6191. enable: function enable() {
  6192. var swiper = this;
  6193. var support = swiper.support;
  6194. var zoom = swiper.zoom;
  6195. if (zoom.enabled) return;
  6196. zoom.enabled = true;
  6197. var passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? {
  6198. passive: true,
  6199. capture: false
  6200. } : false;
  6201. var activeListenerWithCapture = support.passiveListener ? {
  6202. passive: false,
  6203. capture: true
  6204. } : true;
  6205. var slideSelector = "." + swiper.params.slideClass;
  6206. swiper.zoom.passiveListener = passiveListener;
  6207. swiper.zoom.slideSelector = slideSelector; // Scale image
  6208. if (support.gestures) {
  6209. swiper.$wrapperEl.on(swiper.touchEvents.start, swiper.zoom.enableGestures, passiveListener);
  6210. swiper.$wrapperEl.on(swiper.touchEvents.end, swiper.zoom.disableGestures, passiveListener);
  6211. } else if (swiper.touchEvents.start === 'touchstart') {
  6212. swiper.$wrapperEl.on(swiper.touchEvents.start, slideSelector, zoom.onGestureStart, passiveListener);
  6213. swiper.$wrapperEl.on(swiper.touchEvents.move, slideSelector, zoom.onGestureChange, activeListenerWithCapture);
  6214. swiper.$wrapperEl.on(swiper.touchEvents.end, slideSelector, zoom.onGestureEnd, passiveListener);
  6215. if (swiper.touchEvents.cancel) {
  6216. swiper.$wrapperEl.on(swiper.touchEvents.cancel, slideSelector, zoom.onGestureEnd, passiveListener);
  6217. }
  6218. } // Move image
  6219. swiper.$wrapperEl.on(swiper.touchEvents.move, "." + swiper.params.zoom.containerClass, zoom.onTouchMove, activeListenerWithCapture);
  6220. },
  6221. disable: function disable() {
  6222. var swiper = this;
  6223. var zoom = swiper.zoom;
  6224. if (!zoom.enabled) return;
  6225. var support = swiper.support;
  6226. swiper.zoom.enabled = false;
  6227. var passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? {
  6228. passive: true,
  6229. capture: false
  6230. } : false;
  6231. var activeListenerWithCapture = support.passiveListener ? {
  6232. passive: false,
  6233. capture: true
  6234. } : true;
  6235. var slideSelector = "." + swiper.params.slideClass; // Scale image
  6236. if (support.gestures) {
  6237. swiper.$wrapperEl.off(swiper.touchEvents.start, swiper.zoom.enableGestures, passiveListener);
  6238. swiper.$wrapperEl.off(swiper.touchEvents.end, swiper.zoom.disableGestures, passiveListener);
  6239. } else if (swiper.touchEvents.start === 'touchstart') {
  6240. swiper.$wrapperEl.off(swiper.touchEvents.start, slideSelector, zoom.onGestureStart, passiveListener);
  6241. swiper.$wrapperEl.off(swiper.touchEvents.move, slideSelector, zoom.onGestureChange, activeListenerWithCapture);
  6242. swiper.$wrapperEl.off(swiper.touchEvents.end, slideSelector, zoom.onGestureEnd, passiveListener);
  6243. if (swiper.touchEvents.cancel) {
  6244. swiper.$wrapperEl.off(swiper.touchEvents.cancel, slideSelector, zoom.onGestureEnd, passiveListener);
  6245. }
  6246. } // Move image
  6247. swiper.$wrapperEl.off(swiper.touchEvents.move, "." + swiper.params.zoom.containerClass, zoom.onTouchMove, activeListenerWithCapture);
  6248. }
  6249. };
  6250. var Zoom$1 = {
  6251. name: 'zoom',
  6252. params: {
  6253. zoom: {
  6254. enabled: false,
  6255. maxRatio: 3,
  6256. minRatio: 1,
  6257. toggle: true,
  6258. containerClass: 'swiper-zoom-container',
  6259. zoomedSlideClass: 'swiper-slide-zoomed'
  6260. }
  6261. },
  6262. create: function create() {
  6263. var swiper = this;
  6264. bindModuleMethods(swiper, {
  6265. zoom: _extends({
  6266. enabled: false,
  6267. scale: 1,
  6268. currentScale: 1,
  6269. isScaling: false,
  6270. gesture: {
  6271. $slideEl: undefined,
  6272. slideWidth: undefined,
  6273. slideHeight: undefined,
  6274. $imageEl: undefined,
  6275. $imageWrapEl: undefined,
  6276. maxRatio: 3
  6277. },
  6278. image: {
  6279. isTouched: undefined,
  6280. isMoved: undefined,
  6281. currentX: undefined,
  6282. currentY: undefined,
  6283. minX: undefined,
  6284. minY: undefined,
  6285. maxX: undefined,
  6286. maxY: undefined,
  6287. width: undefined,
  6288. height: undefined,
  6289. startX: undefined,
  6290. startY: undefined,
  6291. touchesStart: {},
  6292. touchesCurrent: {}
  6293. },
  6294. velocity: {
  6295. x: undefined,
  6296. y: undefined,
  6297. prevPositionX: undefined,
  6298. prevPositionY: undefined,
  6299. prevTime: undefined
  6300. }
  6301. }, Zoom)
  6302. });
  6303. var scale = 1;
  6304. Object.defineProperty(swiper.zoom, 'scale', {
  6305. get: function get() {
  6306. return scale;
  6307. },
  6308. set: function set(value) {
  6309. if (scale !== value) {
  6310. var imageEl = swiper.zoom.gesture.$imageEl ? swiper.zoom.gesture.$imageEl[0] : undefined;
  6311. var slideEl = swiper.zoom.gesture.$slideEl ? swiper.zoom.gesture.$slideEl[0] : undefined;
  6312. swiper.emit('zoomChange', value, imageEl, slideEl);
  6313. }
  6314. scale = value;
  6315. }
  6316. });
  6317. },
  6318. on: {
  6319. init: function init(swiper) {
  6320. if (swiper.params.zoom.enabled) {
  6321. swiper.zoom.enable();
  6322. }
  6323. },
  6324. destroy: function destroy(swiper) {
  6325. swiper.zoom.disable();
  6326. },
  6327. touchStart: function touchStart(swiper, e) {
  6328. if (!swiper.zoom.enabled) return;
  6329. swiper.zoom.onTouchStart(e);
  6330. },
  6331. touchEnd: function touchEnd(swiper, e) {
  6332. if (!swiper.zoom.enabled) return;
  6333. swiper.zoom.onTouchEnd(e);
  6334. },
  6335. doubleTap: function doubleTap(swiper, e) {
  6336. if (swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {
  6337. swiper.zoom.toggle(e);
  6338. }
  6339. },
  6340. transitionEnd: function transitionEnd(swiper) {
  6341. if (swiper.zoom.enabled && swiper.params.zoom.enabled) {
  6342. swiper.zoom.onTransitionEnd();
  6343. }
  6344. },
  6345. slideChange: function slideChange(swiper) {
  6346. if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) {
  6347. swiper.zoom.onTransitionEnd();
  6348. }
  6349. }
  6350. }
  6351. };
  6352. var Lazy = {
  6353. loadInSlide: function loadInSlide(index, loadInDuplicate) {
  6354. if (loadInDuplicate === void 0) {
  6355. loadInDuplicate = true;
  6356. }
  6357. var swiper = this;
  6358. var params = swiper.params.lazy;
  6359. if (typeof index === 'undefined') return;
  6360. if (swiper.slides.length === 0) return;
  6361. var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
  6362. var $slideEl = isVirtual ? swiper.$wrapperEl.children("." + swiper.params.slideClass + "[data-swiper-slide-index=\"" + index + "\"]") : swiper.slides.eq(index);
  6363. var $images = $slideEl.find("." + params.elementClass + ":not(." + params.loadedClass + "):not(." + params.loadingClass + ")");
  6364. if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) {
  6365. $images.push($slideEl[0]);
  6366. }
  6367. if ($images.length === 0) return;
  6368. $images.each(function (imageEl) {
  6369. var $imageEl = $(imageEl);
  6370. $imageEl.addClass(params.loadingClass);
  6371. var background = $imageEl.attr('data-background');
  6372. var src = $imageEl.attr('data-src');
  6373. var srcset = $imageEl.attr('data-srcset');
  6374. var sizes = $imageEl.attr('data-sizes');
  6375. var $pictureEl = $imageEl.parent('picture');
  6376. swiper.loadImage($imageEl[0], src || background, srcset, sizes, false, function () {
  6377. if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper && !swiper.params || swiper.destroyed) return;
  6378. if (background) {
  6379. $imageEl.css('background-image', "url(\"" + background + "\")");
  6380. $imageEl.removeAttr('data-background');
  6381. } else {
  6382. if (srcset) {
  6383. $imageEl.attr('srcset', srcset);
  6384. $imageEl.removeAttr('data-srcset');
  6385. }
  6386. if (sizes) {
  6387. $imageEl.attr('sizes', sizes);
  6388. $imageEl.removeAttr('data-sizes');
  6389. }
  6390. if ($pictureEl.length) {
  6391. $pictureEl.children('source').each(function (sourceEl) {
  6392. var $source = $(sourceEl);
  6393. if ($source.attr('data-srcset')) {
  6394. $source.attr('srcset', $source.attr('data-srcset'));
  6395. $source.removeAttr('data-srcset');
  6396. }
  6397. });
  6398. }
  6399. if (src) {
  6400. $imageEl.attr('src', src);
  6401. $imageEl.removeAttr('data-src');
  6402. }
  6403. }
  6404. $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass);
  6405. $slideEl.find("." + params.preloaderClass).remove();
  6406. if (swiper.params.loop && loadInDuplicate) {
  6407. var slideOriginalIndex = $slideEl.attr('data-swiper-slide-index');
  6408. if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) {
  6409. var originalSlide = swiper.$wrapperEl.children("[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]:not(." + swiper.params.slideDuplicateClass + ")");
  6410. swiper.lazy.loadInSlide(originalSlide.index(), false);
  6411. } else {
  6412. var duplicatedSlide = swiper.$wrapperEl.children("." + swiper.params.slideDuplicateClass + "[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]");
  6413. swiper.lazy.loadInSlide(duplicatedSlide.index(), false);
  6414. }
  6415. }
  6416. swiper.emit('lazyImageReady', $slideEl[0], $imageEl[0]);
  6417. if (swiper.params.autoHeight) {
  6418. swiper.updateAutoHeight();
  6419. }
  6420. });
  6421. swiper.emit('lazyImageLoad', $slideEl[0], $imageEl[0]);
  6422. });
  6423. },
  6424. load: function load() {
  6425. var swiper = this;
  6426. var $wrapperEl = swiper.$wrapperEl,
  6427. swiperParams = swiper.params,
  6428. slides = swiper.slides,
  6429. activeIndex = swiper.activeIndex;
  6430. var isVirtual = swiper.virtual && swiperParams.virtual.enabled;
  6431. var params = swiperParams.lazy;
  6432. var slidesPerView = swiperParams.slidesPerView;
  6433. if (slidesPerView === 'auto') {
  6434. slidesPerView = 0;
  6435. }
  6436. function slideExist(index) {
  6437. if (isVirtual) {
  6438. if ($wrapperEl.children("." + swiperParams.slideClass + "[data-swiper-slide-index=\"" + index + "\"]").length) {
  6439. return true;
  6440. }
  6441. } else if (slides[index]) return true;
  6442. return false;
  6443. }
  6444. function slideIndex(slideEl) {
  6445. if (isVirtual) {
  6446. return $(slideEl).attr('data-swiper-slide-index');
  6447. }
  6448. return $(slideEl).index();
  6449. }
  6450. if (!swiper.lazy.initialImageLoaded) swiper.lazy.initialImageLoaded = true;
  6451. if (swiper.params.watchSlidesVisibility) {
  6452. $wrapperEl.children("." + swiperParams.slideVisibleClass).each(function (slideEl) {
  6453. var index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index();
  6454. swiper.lazy.loadInSlide(index);
  6455. });
  6456. } else if (slidesPerView > 1) {
  6457. for (var i = activeIndex; i < activeIndex + slidesPerView; i += 1) {
  6458. if (slideExist(i)) swiper.lazy.loadInSlide(i);
  6459. }
  6460. } else {
  6461. swiper.lazy.loadInSlide(activeIndex);
  6462. }
  6463. if (params.loadPrevNext) {
  6464. if (slidesPerView > 1 || params.loadPrevNextAmount && params.loadPrevNextAmount > 1) {
  6465. var amount = params.loadPrevNextAmount;
  6466. var spv = slidesPerView;
  6467. var maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length);
  6468. var minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); // Next Slides
  6469. for (var _i = activeIndex + slidesPerView; _i < maxIndex; _i += 1) {
  6470. if (slideExist(_i)) swiper.lazy.loadInSlide(_i);
  6471. } // Prev Slides
  6472. for (var _i2 = minIndex; _i2 < activeIndex; _i2 += 1) {
  6473. if (slideExist(_i2)) swiper.lazy.loadInSlide(_i2);
  6474. }
  6475. } else {
  6476. var nextSlide = $wrapperEl.children("." + swiperParams.slideNextClass);
  6477. if (nextSlide.length > 0) swiper.lazy.loadInSlide(slideIndex(nextSlide));
  6478. var prevSlide = $wrapperEl.children("." + swiperParams.slidePrevClass);
  6479. if (prevSlide.length > 0) swiper.lazy.loadInSlide(slideIndex(prevSlide));
  6480. }
  6481. }
  6482. }
  6483. };
  6484. var Lazy$1 = {
  6485. name: 'lazy',
  6486. params: {
  6487. lazy: {
  6488. enabled: false,
  6489. loadPrevNext: false,
  6490. loadPrevNextAmount: 1,
  6491. loadOnTransitionStart: false,
  6492. elementClass: 'swiper-lazy',
  6493. loadingClass: 'swiper-lazy-loading',
  6494. loadedClass: 'swiper-lazy-loaded',
  6495. preloaderClass: 'swiper-lazy-preloader'
  6496. }
  6497. },
  6498. create: function create() {
  6499. var swiper = this;
  6500. bindModuleMethods(swiper, {
  6501. lazy: _extends({
  6502. initialImageLoaded: false
  6503. }, Lazy)
  6504. });
  6505. },
  6506. on: {
  6507. beforeInit: function beforeInit(swiper) {
  6508. if (swiper.params.lazy.enabled && swiper.params.preloadImages) {
  6509. swiper.params.preloadImages = false;
  6510. }
  6511. },
  6512. init: function init(swiper) {
  6513. if (swiper.params.lazy.enabled && !swiper.params.loop && swiper.params.initialSlide === 0) {
  6514. swiper.lazy.load();
  6515. }
  6516. },
  6517. scroll: function scroll(swiper) {
  6518. if (swiper.params.freeMode && !swiper.params.freeModeSticky) {
  6519. swiper.lazy.load();
  6520. }
  6521. },
  6522. resize: function resize(swiper) {
  6523. if (swiper.params.lazy.enabled) {
  6524. swiper.lazy.load();
  6525. }
  6526. },
  6527. scrollbarDragMove: function scrollbarDragMove(swiper) {
  6528. if (swiper.params.lazy.enabled) {
  6529. swiper.lazy.load();
  6530. }
  6531. },
  6532. transitionStart: function transitionStart(swiper) {
  6533. if (swiper.params.lazy.enabled) {
  6534. if (swiper.params.lazy.loadOnTransitionStart || !swiper.params.lazy.loadOnTransitionStart && !swiper.lazy.initialImageLoaded) {
  6535. swiper.lazy.load();
  6536. }
  6537. }
  6538. },
  6539. transitionEnd: function transitionEnd(swiper) {
  6540. if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) {
  6541. swiper.lazy.load();
  6542. }
  6543. },
  6544. slideChange: function slideChange(swiper) {
  6545. if (swiper.params.lazy.enabled && swiper.params.cssMode) {
  6546. swiper.lazy.load();
  6547. }
  6548. }
  6549. }
  6550. };
  6551. var Controller = {
  6552. LinearSpline: function LinearSpline(x, y) {
  6553. var binarySearch = function search() {
  6554. var maxIndex;
  6555. var minIndex;
  6556. var guess;
  6557. return function (array, val) {
  6558. minIndex = -1;
  6559. maxIndex = array.length;
  6560. while (maxIndex - minIndex > 1) {
  6561. guess = maxIndex + minIndex >> 1;
  6562. if (array[guess] <= val) {
  6563. minIndex = guess;
  6564. } else {
  6565. maxIndex = guess;
  6566. }
  6567. }
  6568. return maxIndex;
  6569. };
  6570. }();
  6571. this.x = x;
  6572. this.y = y;
  6573. this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value:
  6574. // (x1,y1) is the known point before given value,
  6575. // (x3,y3) is the known point after given value.
  6576. var i1;
  6577. var i3;
  6578. this.interpolate = function interpolate(x2) {
  6579. if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2):
  6580. i3 = binarySearch(this.x, x2);
  6581. i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already:
  6582. // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
  6583. return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
  6584. };
  6585. return this;
  6586. },
  6587. // xxx: for now i will just save one spline function to to
  6588. getInterpolateFunction: function getInterpolateFunction(c) {
  6589. var swiper = this;
  6590. if (!swiper.controller.spline) {
  6591. swiper.controller.spline = swiper.params.loop ? new Controller.LinearSpline(swiper.slidesGrid, c.slidesGrid) : new Controller.LinearSpline(swiper.snapGrid, c.snapGrid);
  6592. }
  6593. },
  6594. setTranslate: function setTranslate(_setTranslate, byController) {
  6595. var swiper = this;
  6596. var controlled = swiper.controller.control;
  6597. var multiplier;
  6598. var controlledTranslate;
  6599. var Swiper = swiper.constructor;
  6600. function setControlledTranslate(c) {
  6601. // this will create an Interpolate function based on the snapGrids
  6602. // x is the Grid of the scrolled scroller and y will be the controlled scroller
  6603. // it makes sense to create this only once and recall it for the interpolation
  6604. // the function does a lot of value caching for performance
  6605. var translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate;
  6606. if (swiper.params.controller.by === 'slide') {
  6607. swiper.controller.getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
  6608. // but it did not work out
  6609. controlledTranslate = -swiper.controller.spline.interpolate(-translate);
  6610. }
  6611. if (!controlledTranslate || swiper.params.controller.by === 'container') {
  6612. multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
  6613. controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();
  6614. }
  6615. if (swiper.params.controller.inverse) {
  6616. controlledTranslate = c.maxTranslate() - controlledTranslate;
  6617. }
  6618. c.updateProgress(controlledTranslate);
  6619. c.setTranslate(controlledTranslate, swiper);
  6620. c.updateActiveIndex();
  6621. c.updateSlidesClasses();
  6622. }
  6623. if (Array.isArray(controlled)) {
  6624. for (var i = 0; i < controlled.length; i += 1) {
  6625. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  6626. setControlledTranslate(controlled[i]);
  6627. }
  6628. }
  6629. } else if (controlled instanceof Swiper && byController !== controlled) {
  6630. setControlledTranslate(controlled);
  6631. }
  6632. },
  6633. setTransition: function setTransition(duration, byController) {
  6634. var swiper = this;
  6635. var Swiper = swiper.constructor;
  6636. var controlled = swiper.controller.control;
  6637. var i;
  6638. function setControlledTransition(c) {
  6639. c.setTransition(duration, swiper);
  6640. if (duration !== 0) {
  6641. c.transitionStart();
  6642. if (c.params.autoHeight) {
  6643. nextTick(function () {
  6644. c.updateAutoHeight();
  6645. });
  6646. }
  6647. c.$wrapperEl.transitionEnd(function () {
  6648. if (!controlled) return;
  6649. if (c.params.loop && swiper.params.controller.by === 'slide') {
  6650. c.loopFix();
  6651. }
  6652. c.transitionEnd();
  6653. });
  6654. }
  6655. }
  6656. if (Array.isArray(controlled)) {
  6657. for (i = 0; i < controlled.length; i += 1) {
  6658. if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
  6659. setControlledTransition(controlled[i]);
  6660. }
  6661. }
  6662. } else if (controlled instanceof Swiper && byController !== controlled) {
  6663. setControlledTransition(controlled);
  6664. }
  6665. }
  6666. };
  6667. var Controller$1 = {
  6668. name: 'controller',
  6669. params: {
  6670. controller: {
  6671. control: undefined,
  6672. inverse: false,
  6673. by: 'slide' // or 'container'
  6674. }
  6675. },
  6676. create: function create() {
  6677. var swiper = this;
  6678. bindModuleMethods(swiper, {
  6679. controller: _extends({
  6680. control: swiper.params.controller.control
  6681. }, Controller)
  6682. });
  6683. },
  6684. on: {
  6685. update: function update(swiper) {
  6686. if (!swiper.controller.control) return;
  6687. if (swiper.controller.spline) {
  6688. swiper.controller.spline = undefined;
  6689. delete swiper.controller.spline;
  6690. }
  6691. },
  6692. resize: function resize(swiper) {
  6693. if (!swiper.controller.control) return;
  6694. if (swiper.controller.spline) {
  6695. swiper.controller.spline = undefined;
  6696. delete swiper.controller.spline;
  6697. }
  6698. },
  6699. observerUpdate: function observerUpdate(swiper) {
  6700. if (!swiper.controller.control) return;
  6701. if (swiper.controller.spline) {
  6702. swiper.controller.spline = undefined;
  6703. delete swiper.controller.spline;
  6704. }
  6705. },
  6706. setTranslate: function setTranslate(swiper, translate, byController) {
  6707. if (!swiper.controller.control) return;
  6708. swiper.controller.setTranslate(translate, byController);
  6709. },
  6710. setTransition: function setTransition(swiper, duration, byController) {
  6711. if (!swiper.controller.control) return;
  6712. swiper.controller.setTransition(duration, byController);
  6713. }
  6714. }
  6715. };
  6716. var A11y = {
  6717. getRandomNumber: function getRandomNumber(size) {
  6718. if (size === void 0) {
  6719. size = 16;
  6720. }
  6721. var randomChar = function randomChar() {
  6722. return Math.round(16 * Math.random()).toString(16);
  6723. };
  6724. return 'x'.repeat(size).replace(/x/g, randomChar);
  6725. },
  6726. makeElFocusable: function makeElFocusable($el) {
  6727. $el.attr('tabIndex', '0');
  6728. return $el;
  6729. },
  6730. makeElNotFocusable: function makeElNotFocusable($el) {
  6731. $el.attr('tabIndex', '-1');
  6732. return $el;
  6733. },
  6734. addElRole: function addElRole($el, role) {
  6735. $el.attr('role', role);
  6736. return $el;
  6737. },
  6738. addElRoleDescription: function addElRoleDescription($el, description) {
  6739. $el.attr('aria-role-description', description);
  6740. return $el;
  6741. },
  6742. addElControls: function addElControls($el, controls) {
  6743. $el.attr('aria-controls', controls);
  6744. return $el;
  6745. },
  6746. addElLabel: function addElLabel($el, label) {
  6747. $el.attr('aria-label', label);
  6748. return $el;
  6749. },
  6750. addElId: function addElId($el, id) {
  6751. $el.attr('id', id);
  6752. return $el;
  6753. },
  6754. addElLive: function addElLive($el, live) {
  6755. $el.attr('aria-live', live);
  6756. return $el;
  6757. },
  6758. disableEl: function disableEl($el) {
  6759. $el.attr('aria-disabled', true);
  6760. return $el;
  6761. },
  6762. enableEl: function enableEl($el) {
  6763. $el.attr('aria-disabled', false);
  6764. return $el;
  6765. },
  6766. onEnterKey: function onEnterKey(e) {
  6767. var swiper = this;
  6768. var params = swiper.params.a11y;
  6769. if (e.keyCode !== 13) return;
  6770. var $targetEl = $(e.target);
  6771. if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) {
  6772. if (!(swiper.isEnd && !swiper.params.loop)) {
  6773. swiper.slideNext();
  6774. }
  6775. if (swiper.isEnd) {
  6776. swiper.a11y.notify(params.lastSlideMessage);
  6777. } else {
  6778. swiper.a11y.notify(params.nextSlideMessage);
  6779. }
  6780. }
  6781. if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) {
  6782. if (!(swiper.isBeginning && !swiper.params.loop)) {
  6783. swiper.slidePrev();
  6784. }
  6785. if (swiper.isBeginning) {
  6786. swiper.a11y.notify(params.firstSlideMessage);
  6787. } else {
  6788. swiper.a11y.notify(params.prevSlideMessage);
  6789. }
  6790. }
  6791. if (swiper.pagination && $targetEl.is("." + swiper.params.pagination.bulletClass)) {
  6792. $targetEl[0].click();
  6793. }
  6794. },
  6795. notify: function notify(message) {
  6796. var swiper = this;
  6797. var notification = swiper.a11y.liveRegion;
  6798. if (notification.length === 0) return;
  6799. notification.html('');
  6800. notification.html(message);
  6801. },
  6802. updateNavigation: function updateNavigation() {
  6803. var swiper = this;
  6804. if (swiper.params.loop || !swiper.navigation) return;
  6805. var _swiper$navigation = swiper.navigation,
  6806. $nextEl = _swiper$navigation.$nextEl,
  6807. $prevEl = _swiper$navigation.$prevEl;
  6808. if ($prevEl && $prevEl.length > 0) {
  6809. if (swiper.isBeginning) {
  6810. swiper.a11y.disableEl($prevEl);
  6811. swiper.a11y.makeElNotFocusable($prevEl);
  6812. } else {
  6813. swiper.a11y.enableEl($prevEl);
  6814. swiper.a11y.makeElFocusable($prevEl);
  6815. }
  6816. }
  6817. if ($nextEl && $nextEl.length > 0) {
  6818. if (swiper.isEnd) {
  6819. swiper.a11y.disableEl($nextEl);
  6820. swiper.a11y.makeElNotFocusable($nextEl);
  6821. } else {
  6822. swiper.a11y.enableEl($nextEl);
  6823. swiper.a11y.makeElFocusable($nextEl);
  6824. }
  6825. }
  6826. },
  6827. updatePagination: function updatePagination() {
  6828. var swiper = this;
  6829. var params = swiper.params.a11y;
  6830. if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
  6831. swiper.pagination.bullets.each(function (bulletEl) {
  6832. var $bulletEl = $(bulletEl);
  6833. swiper.a11y.makeElFocusable($bulletEl);
  6834. if (!swiper.params.pagination.renderBullet) {
  6835. swiper.a11y.addElRole($bulletEl, 'button');
  6836. swiper.a11y.addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1));
  6837. }
  6838. });
  6839. }
  6840. },
  6841. init: function init() {
  6842. var swiper = this;
  6843. var params = swiper.params.a11y;
  6844. swiper.$el.append(swiper.a11y.liveRegion); // Container
  6845. var $containerEl = swiper.$el;
  6846. if (params.containerRoleDescriptionMessage) {
  6847. swiper.a11y.addElRoleDescription($containerEl, params.containerRoleDescriptionMessage);
  6848. }
  6849. if (params.containerMessage) {
  6850. swiper.a11y.addElLabel($containerEl, params.containerMessage);
  6851. } // Wrapper
  6852. var $wrapperEl = swiper.$wrapperEl;
  6853. var wrapperId = $wrapperEl.attr('id') || "swiper-wrapper-" + swiper.a11y.getRandomNumber(16);
  6854. var live;
  6855. swiper.a11y.addElId($wrapperEl, wrapperId);
  6856. if (swiper.params.autoplay && swiper.params.autoplay.enabled) {
  6857. live = 'off';
  6858. } else {
  6859. live = 'polite';
  6860. }
  6861. swiper.a11y.addElLive($wrapperEl, live); // Slide
  6862. if (params.itemRoleDescriptionMessage) {
  6863. swiper.a11y.addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage);
  6864. }
  6865. swiper.a11y.addElRole($(swiper.slides), 'group');
  6866. swiper.slides.each(function (slideEl) {
  6867. var $slideEl = $(slideEl);
  6868. swiper.a11y.addElLabel($slideEl, $slideEl.index() + 1 + " / " + swiper.slides.length);
  6869. }); // Navigation
  6870. var $nextEl;
  6871. var $prevEl;
  6872. if (swiper.navigation && swiper.navigation.$nextEl) {
  6873. $nextEl = swiper.navigation.$nextEl;
  6874. }
  6875. if (swiper.navigation && swiper.navigation.$prevEl) {
  6876. $prevEl = swiper.navigation.$prevEl;
  6877. }
  6878. if ($nextEl && $nextEl.length) {
  6879. swiper.a11y.makeElFocusable($nextEl);
  6880. if ($nextEl[0].tagName !== 'BUTTON') {
  6881. swiper.a11y.addElRole($nextEl, 'button');
  6882. $nextEl.on('keydown', swiper.a11y.onEnterKey);
  6883. }
  6884. swiper.a11y.addElLabel($nextEl, params.nextSlideMessage);
  6885. swiper.a11y.addElControls($nextEl, wrapperId);
  6886. }
  6887. if ($prevEl && $prevEl.length) {
  6888. swiper.a11y.makeElFocusable($prevEl);
  6889. if ($prevEl[0].tagName !== 'BUTTON') {
  6890. swiper.a11y.addElRole($prevEl, 'button');
  6891. $prevEl.on('keydown', swiper.a11y.onEnterKey);
  6892. }
  6893. swiper.a11y.addElLabel($prevEl, params.prevSlideMessage);
  6894. swiper.a11y.addElControls($prevEl, wrapperId);
  6895. } // Pagination
  6896. if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
  6897. swiper.pagination.$el.on('keydown', "." + swiper.params.pagination.bulletClass, swiper.a11y.onEnterKey);
  6898. }
  6899. },
  6900. destroy: function destroy() {
  6901. var swiper = this;
  6902. if (swiper.a11y.liveRegion && swiper.a11y.liveRegion.length > 0) swiper.a11y.liveRegion.remove();
  6903. var $nextEl;
  6904. var $prevEl;
  6905. if (swiper.navigation && swiper.navigation.$nextEl) {
  6906. $nextEl = swiper.navigation.$nextEl;
  6907. }
  6908. if (swiper.navigation && swiper.navigation.$prevEl) {
  6909. $prevEl = swiper.navigation.$prevEl;
  6910. }
  6911. if ($nextEl) {
  6912. $nextEl.off('keydown', swiper.a11y.onEnterKey);
  6913. }
  6914. if ($prevEl) {
  6915. $prevEl.off('keydown', swiper.a11y.onEnterKey);
  6916. } // Pagination
  6917. if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
  6918. swiper.pagination.$el.off('keydown', "." + swiper.params.pagination.bulletClass, swiper.a11y.onEnterKey);
  6919. }
  6920. }
  6921. };
  6922. var A11y$1 = {
  6923. name: 'a11y',
  6924. params: {
  6925. a11y: {
  6926. enabled: true,
  6927. notificationClass: 'swiper-notification',
  6928. prevSlideMessage: 'Previous slide',
  6929. nextSlideMessage: 'Next slide',
  6930. firstSlideMessage: 'This is the first slide',
  6931. lastSlideMessage: 'This is the last slide',
  6932. paginationBulletMessage: 'Go to slide {{index}}',
  6933. containerMessage: null,
  6934. containerRoleDescriptionMessage: null,
  6935. itemRoleDescriptionMessage: null
  6936. }
  6937. },
  6938. create: function create() {
  6939. var swiper = this;
  6940. bindModuleMethods(swiper, {
  6941. a11y: _extends(_extends({}, A11y), {}, {
  6942. liveRegion: $("<span class=\"" + swiper.params.a11y.notificationClass + "\" aria-live=\"assertive\" aria-atomic=\"true\"></span>")
  6943. })
  6944. });
  6945. },
  6946. on: {
  6947. afterInit: function afterInit(swiper) {
  6948. if (!swiper.params.a11y.enabled) return;
  6949. swiper.a11y.init();
  6950. swiper.a11y.updateNavigation();
  6951. },
  6952. toEdge: function toEdge(swiper) {
  6953. if (!swiper.params.a11y.enabled) return;
  6954. swiper.a11y.updateNavigation();
  6955. },
  6956. fromEdge: function fromEdge(swiper) {
  6957. if (!swiper.params.a11y.enabled) return;
  6958. swiper.a11y.updateNavigation();
  6959. },
  6960. paginationUpdate: function paginationUpdate(swiper) {
  6961. if (!swiper.params.a11y.enabled) return;
  6962. swiper.a11y.updatePagination();
  6963. },
  6964. destroy: function destroy(swiper) {
  6965. if (!swiper.params.a11y.enabled) return;
  6966. swiper.a11y.destroy();
  6967. }
  6968. }
  6969. };
  6970. var History = {
  6971. init: function init() {
  6972. var swiper = this;
  6973. var window = getWindow();
  6974. if (!swiper.params.history) return;
  6975. if (!window.history || !window.history.pushState) {
  6976. swiper.params.history.enabled = false;
  6977. swiper.params.hashNavigation.enabled = true;
  6978. return;
  6979. }
  6980. var history = swiper.history;
  6981. history.initialized = true;
  6982. history.paths = History.getPathValues(swiper.params.url);
  6983. if (!history.paths.key && !history.paths.value) return;
  6984. history.scrollToSlide(0, history.paths.value, swiper.params.runCallbacksOnInit);
  6985. if (!swiper.params.history.replaceState) {
  6986. window.addEventListener('popstate', swiper.history.setHistoryPopState);
  6987. }
  6988. },
  6989. destroy: function destroy() {
  6990. var swiper = this;
  6991. var window = getWindow();
  6992. if (!swiper.params.history.replaceState) {
  6993. window.removeEventListener('popstate', swiper.history.setHistoryPopState);
  6994. }
  6995. },
  6996. setHistoryPopState: function setHistoryPopState() {
  6997. var swiper = this;
  6998. swiper.history.paths = History.getPathValues(swiper.params.url);
  6999. swiper.history.scrollToSlide(swiper.params.speed, swiper.history.paths.value, false);
  7000. },
  7001. getPathValues: function getPathValues(urlOverride) {
  7002. var window = getWindow();
  7003. var location;
  7004. if (urlOverride) {
  7005. location = new URL(urlOverride);
  7006. } else {
  7007. location = window.location;
  7008. }
  7009. var pathArray = location.pathname.slice(1).split('/').filter(function (part) {
  7010. return part !== '';
  7011. });
  7012. var total = pathArray.length;
  7013. var key = pathArray[total - 2];
  7014. var value = pathArray[total - 1];
  7015. return {
  7016. key: key,
  7017. value: value
  7018. };
  7019. },
  7020. setHistory: function setHistory(key, index) {
  7021. var swiper = this;
  7022. var window = getWindow();
  7023. if (!swiper.history.initialized || !swiper.params.history.enabled) return;
  7024. var location;
  7025. if (swiper.params.url) {
  7026. location = new URL(swiper.params.url);
  7027. } else {
  7028. location = window.location;
  7029. }
  7030. var slide = swiper.slides.eq(index);
  7031. var value = History.slugify(slide.attr('data-history'));
  7032. if (!location.pathname.includes(key)) {
  7033. value = key + "/" + value;
  7034. }
  7035. var currentState = window.history.state;
  7036. if (currentState && currentState.value === value) {
  7037. return;
  7038. }
  7039. if (swiper.params.history.replaceState) {
  7040. window.history.replaceState({
  7041. value: value
  7042. }, null, value);
  7043. } else {
  7044. window.history.pushState({
  7045. value: value
  7046. }, null, value);
  7047. }
  7048. },
  7049. slugify: function slugify(text) {
  7050. return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
  7051. },
  7052. scrollToSlide: function scrollToSlide(speed, value, runCallbacks) {
  7053. var swiper = this;
  7054. if (value) {
  7055. for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
  7056. var slide = swiper.slides.eq(i);
  7057. var slideHistory = History.slugify(slide.attr('data-history'));
  7058. if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) {
  7059. var index = slide.index();
  7060. swiper.slideTo(index, speed, runCallbacks);
  7061. }
  7062. }
  7063. } else {
  7064. swiper.slideTo(0, speed, runCallbacks);
  7065. }
  7066. }
  7067. };
  7068. var History$1 = {
  7069. name: 'history',
  7070. params: {
  7071. history: {
  7072. enabled: false,
  7073. replaceState: false,
  7074. key: 'slides'
  7075. }
  7076. },
  7077. create: function create() {
  7078. var swiper = this;
  7079. bindModuleMethods(swiper, {
  7080. history: _extends({}, History)
  7081. });
  7082. },
  7083. on: {
  7084. init: function init(swiper) {
  7085. if (swiper.params.history.enabled) {
  7086. swiper.history.init();
  7087. }
  7088. },
  7089. destroy: function destroy(swiper) {
  7090. if (swiper.params.history.enabled) {
  7091. swiper.history.destroy();
  7092. }
  7093. },
  7094. transitionEnd: function transitionEnd(swiper) {
  7095. if (swiper.history.initialized) {
  7096. swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex);
  7097. }
  7098. },
  7099. slideChange: function slideChange(swiper) {
  7100. if (swiper.history.initialized && swiper.params.cssMode) {
  7101. swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex);
  7102. }
  7103. }
  7104. }
  7105. };
  7106. var HashNavigation = {
  7107. onHashCange: function onHashCange() {
  7108. var swiper = this;
  7109. var document = getDocument();
  7110. swiper.emit('hashChange');
  7111. var newHash = document.location.hash.replace('#', '');
  7112. var activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash');
  7113. if (newHash !== activeSlideHash) {
  7114. var newIndex = swiper.$wrapperEl.children("." + swiper.params.slideClass + "[data-hash=\"" + newHash + "\"]").index();
  7115. if (typeof newIndex === 'undefined') return;
  7116. swiper.slideTo(newIndex);
  7117. }
  7118. },
  7119. setHash: function setHash() {
  7120. var swiper = this;
  7121. var window = getWindow();
  7122. var document = getDocument();
  7123. if (!swiper.hashNavigation.initialized || !swiper.params.hashNavigation.enabled) return;
  7124. if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) {
  7125. window.history.replaceState(null, null, "#" + swiper.slides.eq(swiper.activeIndex).attr('data-hash') || '');
  7126. swiper.emit('hashSet');
  7127. } else {
  7128. var slide = swiper.slides.eq(swiper.activeIndex);
  7129. var hash = slide.attr('data-hash') || slide.attr('data-history');
  7130. document.location.hash = hash || '';
  7131. swiper.emit('hashSet');
  7132. }
  7133. },
  7134. init: function init() {
  7135. var swiper = this;
  7136. var document = getDocument();
  7137. var window = getWindow();
  7138. if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return;
  7139. swiper.hashNavigation.initialized = true;
  7140. var hash = document.location.hash.replace('#', '');
  7141. if (hash) {
  7142. var speed = 0;
  7143. for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
  7144. var slide = swiper.slides.eq(i);
  7145. var slideHash = slide.attr('data-hash') || slide.attr('data-history');
  7146. if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) {
  7147. var index = slide.index();
  7148. swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true);
  7149. }
  7150. }
  7151. }
  7152. if (swiper.params.hashNavigation.watchState) {
  7153. $(window).on('hashchange', swiper.hashNavigation.onHashCange);
  7154. }
  7155. },
  7156. destroy: function destroy() {
  7157. var swiper = this;
  7158. var window = getWindow();
  7159. if (swiper.params.hashNavigation.watchState) {
  7160. $(window).off('hashchange', swiper.hashNavigation.onHashCange);
  7161. }
  7162. }
  7163. };
  7164. var HashNavigation$1 = {
  7165. name: 'hash-navigation',
  7166. params: {
  7167. hashNavigation: {
  7168. enabled: false,
  7169. replaceState: false,
  7170. watchState: false
  7171. }
  7172. },
  7173. create: function create() {
  7174. var swiper = this;
  7175. bindModuleMethods(swiper, {
  7176. hashNavigation: _extends({
  7177. initialized: false
  7178. }, HashNavigation)
  7179. });
  7180. },
  7181. on: {
  7182. init: function init(swiper) {
  7183. if (swiper.params.hashNavigation.enabled) {
  7184. swiper.hashNavigation.init();
  7185. }
  7186. },
  7187. destroy: function destroy(swiper) {
  7188. if (swiper.params.hashNavigation.enabled) {
  7189. swiper.hashNavigation.destroy();
  7190. }
  7191. },
  7192. transitionEnd: function transitionEnd(swiper) {
  7193. if (swiper.hashNavigation.initialized) {
  7194. swiper.hashNavigation.setHash();
  7195. }
  7196. },
  7197. slideChange: function slideChange(swiper) {
  7198. if (swiper.hashNavigation.initialized && swiper.params.cssMode) {
  7199. swiper.hashNavigation.setHash();
  7200. }
  7201. }
  7202. }
  7203. };
  7204. var Autoplay = {
  7205. run: function run() {
  7206. var swiper = this;
  7207. var $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
  7208. var delay = swiper.params.autoplay.delay;
  7209. if ($activeSlideEl.attr('data-swiper-autoplay')) {
  7210. delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
  7211. }
  7212. clearTimeout(swiper.autoplay.timeout);
  7213. swiper.autoplay.timeout = nextTick(function () {
  7214. var autoplayResult;
  7215. if (swiper.params.autoplay.reverseDirection) {
  7216. if (swiper.params.loop) {
  7217. swiper.loopFix();
  7218. autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
  7219. swiper.emit('autoplay');
  7220. } else if (!swiper.isBeginning) {
  7221. autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
  7222. swiper.emit('autoplay');
  7223. } else if (!swiper.params.autoplay.stopOnLastSlide) {
  7224. autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
  7225. swiper.emit('autoplay');
  7226. } else {
  7227. swiper.autoplay.stop();
  7228. }
  7229. } else if (swiper.params.loop) {
  7230. swiper.loopFix();
  7231. autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
  7232. swiper.emit('autoplay');
  7233. } else if (!swiper.isEnd) {
  7234. autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
  7235. swiper.emit('autoplay');
  7236. } else if (!swiper.params.autoplay.stopOnLastSlide) {
  7237. autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
  7238. swiper.emit('autoplay');
  7239. } else {
  7240. swiper.autoplay.stop();
  7241. }
  7242. if (swiper.params.cssMode && swiper.autoplay.running) swiper.autoplay.run();else if (autoplayResult === false) {
  7243. swiper.autoplay.run();
  7244. }
  7245. }, delay);
  7246. },
  7247. start: function start() {
  7248. var swiper = this;
  7249. if (typeof swiper.autoplay.timeout !== 'undefined') return false;
  7250. if (swiper.autoplay.running) return false;
  7251. swiper.autoplay.running = true;
  7252. swiper.emit('autoplayStart');
  7253. swiper.autoplay.run();
  7254. return true;
  7255. },
  7256. stop: function stop() {
  7257. var swiper = this;
  7258. if (!swiper.autoplay.running) return false;
  7259. if (typeof swiper.autoplay.timeout === 'undefined') return false;
  7260. if (swiper.autoplay.timeout) {
  7261. clearTimeout(swiper.autoplay.timeout);
  7262. swiper.autoplay.timeout = undefined;
  7263. }
  7264. swiper.autoplay.running = false;
  7265. swiper.emit('autoplayStop');
  7266. return true;
  7267. },
  7268. pause: function pause(speed) {
  7269. var swiper = this;
  7270. if (!swiper.autoplay.running) return;
  7271. if (swiper.autoplay.paused) return;
  7272. if (swiper.autoplay.timeout) clearTimeout(swiper.autoplay.timeout);
  7273. swiper.autoplay.paused = true;
  7274. if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
  7275. swiper.autoplay.paused = false;
  7276. swiper.autoplay.run();
  7277. } else {
  7278. swiper.$wrapperEl[0].addEventListener('transitionend', swiper.autoplay.onTransitionEnd);
  7279. swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.autoplay.onTransitionEnd);
  7280. }
  7281. },
  7282. onVisibilityChange: function onVisibilityChange() {
  7283. var swiper = this;
  7284. var document = getDocument();
  7285. if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
  7286. swiper.autoplay.pause();
  7287. }
  7288. if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
  7289. swiper.autoplay.run();
  7290. swiper.autoplay.paused = false;
  7291. }
  7292. },
  7293. onTransitionEnd: function onTransitionEnd(e) {
  7294. var swiper = this;
  7295. if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
  7296. if (e.target !== swiper.$wrapperEl[0]) return;
  7297. swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.autoplay.onTransitionEnd);
  7298. swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.autoplay.onTransitionEnd);
  7299. swiper.autoplay.paused = false;
  7300. if (!swiper.autoplay.running) {
  7301. swiper.autoplay.stop();
  7302. } else {
  7303. swiper.autoplay.run();
  7304. }
  7305. }
  7306. };
  7307. var Autoplay$1 = {
  7308. name: 'autoplay',
  7309. params: {
  7310. autoplay: {
  7311. enabled: false,
  7312. delay: 3000,
  7313. waitForTransition: true,
  7314. disableOnInteraction: true,
  7315. stopOnLastSlide: false,
  7316. reverseDirection: false
  7317. }
  7318. },
  7319. create: function create() {
  7320. var swiper = this;
  7321. bindModuleMethods(swiper, {
  7322. autoplay: _extends(_extends({}, Autoplay), {}, {
  7323. running: false,
  7324. paused: false
  7325. })
  7326. });
  7327. },
  7328. on: {
  7329. init: function init(swiper) {
  7330. if (swiper.params.autoplay.enabled) {
  7331. swiper.autoplay.start();
  7332. var document = getDocument();
  7333. document.addEventListener('visibilitychange', swiper.autoplay.onVisibilityChange);
  7334. }
  7335. },
  7336. beforeTransitionStart: function beforeTransitionStart(swiper, speed, internal) {
  7337. if (swiper.autoplay.running) {
  7338. if (internal || !swiper.params.autoplay.disableOnInteraction) {
  7339. swiper.autoplay.pause(speed);
  7340. } else {
  7341. swiper.autoplay.stop();
  7342. }
  7343. }
  7344. },
  7345. sliderFirstMove: function sliderFirstMove(swiper) {
  7346. if (swiper.autoplay.running) {
  7347. if (swiper.params.autoplay.disableOnInteraction) {
  7348. swiper.autoplay.stop();
  7349. } else {
  7350. swiper.autoplay.pause();
  7351. }
  7352. }
  7353. },
  7354. touchEnd: function touchEnd(swiper) {
  7355. if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) {
  7356. swiper.autoplay.run();
  7357. }
  7358. },
  7359. destroy: function destroy(swiper) {
  7360. if (swiper.autoplay.running) {
  7361. swiper.autoplay.stop();
  7362. }
  7363. var document = getDocument();
  7364. document.removeEventListener('visibilitychange', swiper.autoplay.onVisibilityChange);
  7365. }
  7366. }
  7367. };
  7368. var Fade = {
  7369. setTranslate: function setTranslate() {
  7370. var swiper = this;
  7371. var slides = swiper.slides;
  7372. for (var i = 0; i < slides.length; i += 1) {
  7373. var $slideEl = swiper.slides.eq(i);
  7374. var offset = $slideEl[0].swiperSlideOffset;
  7375. var tx = -offset;
  7376. if (!swiper.params.virtualTranslate) tx -= swiper.translate;
  7377. var ty = 0;
  7378. if (!swiper.isHorizontal()) {
  7379. ty = tx;
  7380. tx = 0;
  7381. }
  7382. var slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0);
  7383. $slideEl.css({
  7384. opacity: slideOpacity
  7385. }).transform("translate3d(" + tx + "px, " + ty + "px, 0px)");
  7386. }
  7387. },
  7388. setTransition: function setTransition(duration) {
  7389. var swiper = this;
  7390. var slides = swiper.slides,
  7391. $wrapperEl = swiper.$wrapperEl;
  7392. slides.transition(duration);
  7393. if (swiper.params.virtualTranslate && duration !== 0) {
  7394. var eventTriggered = false;
  7395. slides.transitionEnd(function () {
  7396. if (eventTriggered) return;
  7397. if (!swiper || swiper.destroyed) return;
  7398. eventTriggered = true;
  7399. swiper.animating = false;
  7400. var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
  7401. for (var i = 0; i < triggerEvents.length; i += 1) {
  7402. $wrapperEl.trigger(triggerEvents[i]);
  7403. }
  7404. });
  7405. }
  7406. }
  7407. };
  7408. var EffectFade = {
  7409. name: 'effect-fade',
  7410. params: {
  7411. fadeEffect: {
  7412. crossFade: false
  7413. }
  7414. },
  7415. create: function create() {
  7416. var swiper = this;
  7417. bindModuleMethods(swiper, {
  7418. fadeEffect: _extends({}, Fade)
  7419. });
  7420. },
  7421. on: {
  7422. beforeInit: function beforeInit(swiper) {
  7423. if (swiper.params.effect !== 'fade') return;
  7424. swiper.classNames.push(swiper.params.containerModifierClass + "fade");
  7425. var overwriteParams = {
  7426. slidesPerView: 1,
  7427. slidesPerColumn: 1,
  7428. slidesPerGroup: 1,
  7429. watchSlidesProgress: true,
  7430. spaceBetween: 0,
  7431. virtualTranslate: true
  7432. };
  7433. extend$1(swiper.params, overwriteParams);
  7434. extend$1(swiper.originalParams, overwriteParams);
  7435. },
  7436. setTranslate: function setTranslate(swiper) {
  7437. if (swiper.params.effect !== 'fade') return;
  7438. swiper.fadeEffect.setTranslate();
  7439. },
  7440. setTransition: function setTransition(swiper, duration) {
  7441. if (swiper.params.effect !== 'fade') return;
  7442. swiper.fadeEffect.setTransition(duration);
  7443. }
  7444. }
  7445. };
  7446. var Cube = {
  7447. setTranslate: function setTranslate() {
  7448. var swiper = this;
  7449. var $el = swiper.$el,
  7450. $wrapperEl = swiper.$wrapperEl,
  7451. slides = swiper.slides,
  7452. swiperWidth = swiper.width,
  7453. swiperHeight = swiper.height,
  7454. rtl = swiper.rtlTranslate,
  7455. swiperSize = swiper.size,
  7456. browser = swiper.browser;
  7457. var params = swiper.params.cubeEffect;
  7458. var isHorizontal = swiper.isHorizontal();
  7459. var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
  7460. var wrapperRotate = 0;
  7461. var $cubeShadowEl;
  7462. if (params.shadow) {
  7463. if (isHorizontal) {
  7464. $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow');
  7465. if ($cubeShadowEl.length === 0) {
  7466. $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
  7467. $wrapperEl.append($cubeShadowEl);
  7468. }
  7469. $cubeShadowEl.css({
  7470. height: swiperWidth + "px"
  7471. });
  7472. } else {
  7473. $cubeShadowEl = $el.find('.swiper-cube-shadow');
  7474. if ($cubeShadowEl.length === 0) {
  7475. $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
  7476. $el.append($cubeShadowEl);
  7477. }
  7478. }
  7479. }
  7480. for (var i = 0; i < slides.length; i += 1) {
  7481. var $slideEl = slides.eq(i);
  7482. var slideIndex = i;
  7483. if (isVirtual) {
  7484. slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10);
  7485. }
  7486. var slideAngle = slideIndex * 90;
  7487. var round = Math.floor(slideAngle / 360);
  7488. if (rtl) {
  7489. slideAngle = -slideAngle;
  7490. round = Math.floor(-slideAngle / 360);
  7491. }
  7492. var progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
  7493. var tx = 0;
  7494. var ty = 0;
  7495. var tz = 0;
  7496. if (slideIndex % 4 === 0) {
  7497. tx = -round * 4 * swiperSize;
  7498. tz = 0;
  7499. } else if ((slideIndex - 1) % 4 === 0) {
  7500. tx = 0;
  7501. tz = -round * 4 * swiperSize;
  7502. } else if ((slideIndex - 2) % 4 === 0) {
  7503. tx = swiperSize + round * 4 * swiperSize;
  7504. tz = swiperSize;
  7505. } else if ((slideIndex - 3) % 4 === 0) {
  7506. tx = -swiperSize;
  7507. tz = 3 * swiperSize + swiperSize * 4 * round;
  7508. }
  7509. if (rtl) {
  7510. tx = -tx;
  7511. }
  7512. if (!isHorizontal) {
  7513. ty = tx;
  7514. tx = 0;
  7515. }
  7516. var transform = "rotateX(" + (isHorizontal ? 0 : -slideAngle) + "deg) rotateY(" + (isHorizontal ? slideAngle : 0) + "deg) translate3d(" + tx + "px, " + ty + "px, " + tz + "px)";
  7517. if (progress <= 1 && progress > -1) {
  7518. wrapperRotate = slideIndex * 90 + progress * 90;
  7519. if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90;
  7520. }
  7521. $slideEl.transform(transform);
  7522. if (params.slideShadows) {
  7523. // Set shadows
  7524. var shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
  7525. var shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
  7526. if (shadowBefore.length === 0) {
  7527. shadowBefore = $("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>");
  7528. $slideEl.append(shadowBefore);
  7529. }
  7530. if (shadowAfter.length === 0) {
  7531. shadowAfter = $("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>");
  7532. $slideEl.append(shadowAfter);
  7533. }
  7534. if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
  7535. if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
  7536. }
  7537. }
  7538. $wrapperEl.css({
  7539. '-webkit-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
  7540. '-moz-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
  7541. '-ms-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
  7542. 'transform-origin': "50% 50% -" + swiperSize / 2 + "px"
  7543. });
  7544. if (params.shadow) {
  7545. if (isHorizontal) {
  7546. $cubeShadowEl.transform("translate3d(0px, " + (swiperWidth / 2 + params.shadowOffset) + "px, " + -swiperWidth / 2 + "px) rotateX(90deg) rotateZ(0deg) scale(" + params.shadowScale + ")");
  7547. } else {
  7548. var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
  7549. var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
  7550. var scale1 = params.shadowScale;
  7551. var scale2 = params.shadowScale / multiplier;
  7552. var offset = params.shadowOffset;
  7553. $cubeShadowEl.transform("scale3d(" + scale1 + ", 1, " + scale2 + ") translate3d(0px, " + (swiperHeight / 2 + offset) + "px, " + -swiperHeight / 2 / scale2 + "px) rotateX(-90deg)");
  7554. }
  7555. }
  7556. var zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0;
  7557. $wrapperEl.transform("translate3d(0px,0," + zFactor + "px) rotateX(" + (swiper.isHorizontal() ? 0 : wrapperRotate) + "deg) rotateY(" + (swiper.isHorizontal() ? -wrapperRotate : 0) + "deg)");
  7558. },
  7559. setTransition: function setTransition(duration) {
  7560. var swiper = this;
  7561. var $el = swiper.$el,
  7562. slides = swiper.slides;
  7563. slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  7564. if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {
  7565. $el.find('.swiper-cube-shadow').transition(duration);
  7566. }
  7567. }
  7568. };
  7569. var EffectCube = {
  7570. name: 'effect-cube',
  7571. params: {
  7572. cubeEffect: {
  7573. slideShadows: true,
  7574. shadow: true,
  7575. shadowOffset: 20,
  7576. shadowScale: 0.94
  7577. }
  7578. },
  7579. create: function create() {
  7580. var swiper = this;
  7581. bindModuleMethods(swiper, {
  7582. cubeEffect: _extends({}, Cube)
  7583. });
  7584. },
  7585. on: {
  7586. beforeInit: function beforeInit(swiper) {
  7587. if (swiper.params.effect !== 'cube') return;
  7588. swiper.classNames.push(swiper.params.containerModifierClass + "cube");
  7589. swiper.classNames.push(swiper.params.containerModifierClass + "3d");
  7590. var overwriteParams = {
  7591. slidesPerView: 1,
  7592. slidesPerColumn: 1,
  7593. slidesPerGroup: 1,
  7594. watchSlidesProgress: true,
  7595. resistanceRatio: 0,
  7596. spaceBetween: 0,
  7597. centeredSlides: false,
  7598. virtualTranslate: true
  7599. };
  7600. extend$1(swiper.params, overwriteParams);
  7601. extend$1(swiper.originalParams, overwriteParams);
  7602. },
  7603. setTranslate: function setTranslate(swiper) {
  7604. if (swiper.params.effect !== 'cube') return;
  7605. swiper.cubeEffect.setTranslate();
  7606. },
  7607. setTransition: function setTransition(swiper, duration) {
  7608. if (swiper.params.effect !== 'cube') return;
  7609. swiper.cubeEffect.setTransition(duration);
  7610. }
  7611. }
  7612. };
  7613. var Flip = {
  7614. setTranslate: function setTranslate() {
  7615. var swiper = this;
  7616. var slides = swiper.slides,
  7617. rtl = swiper.rtlTranslate;
  7618. for (var i = 0; i < slides.length; i += 1) {
  7619. var $slideEl = slides.eq(i);
  7620. var progress = $slideEl[0].progress;
  7621. if (swiper.params.flipEffect.limitRotation) {
  7622. progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
  7623. }
  7624. var offset = $slideEl[0].swiperSlideOffset;
  7625. var rotate = -180 * progress;
  7626. var rotateY = rotate;
  7627. var rotateX = 0;
  7628. var tx = -offset;
  7629. var ty = 0;
  7630. if (!swiper.isHorizontal()) {
  7631. ty = tx;
  7632. tx = 0;
  7633. rotateX = -rotateY;
  7634. rotateY = 0;
  7635. } else if (rtl) {
  7636. rotateY = -rotateY;
  7637. }
  7638. $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length;
  7639. if (swiper.params.flipEffect.slideShadows) {
  7640. // Set shadows
  7641. var shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
  7642. var shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
  7643. if (shadowBefore.length === 0) {
  7644. shadowBefore = $("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'left' : 'top') + "\"></div>");
  7645. $slideEl.append(shadowBefore);
  7646. }
  7647. if (shadowAfter.length === 0) {
  7648. shadowAfter = $("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'right' : 'bottom') + "\"></div>");
  7649. $slideEl.append(shadowAfter);
  7650. }
  7651. if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
  7652. if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
  7653. }
  7654. $slideEl.transform("translate3d(" + tx + "px, " + ty + "px, 0px) rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg)");
  7655. }
  7656. },
  7657. setTransition: function setTransition(duration) {
  7658. var swiper = this;
  7659. var slides = swiper.slides,
  7660. activeIndex = swiper.activeIndex,
  7661. $wrapperEl = swiper.$wrapperEl;
  7662. slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  7663. if (swiper.params.virtualTranslate && duration !== 0) {
  7664. var eventTriggered = false; // eslint-disable-next-line
  7665. slides.eq(activeIndex).transitionEnd(function onTransitionEnd() {
  7666. if (eventTriggered) return;
  7667. if (!swiper || swiper.destroyed) return; // if (!$(this).hasClass(swiper.params.slideActiveClass)) return;
  7668. eventTriggered = true;
  7669. swiper.animating = false;
  7670. var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
  7671. for (var i = 0; i < triggerEvents.length; i += 1) {
  7672. $wrapperEl.trigger(triggerEvents[i]);
  7673. }
  7674. });
  7675. }
  7676. }
  7677. };
  7678. var EffectFlip = {
  7679. name: 'effect-flip',
  7680. params: {
  7681. flipEffect: {
  7682. slideShadows: true,
  7683. limitRotation: true
  7684. }
  7685. },
  7686. create: function create() {
  7687. var swiper = this;
  7688. bindModuleMethods(swiper, {
  7689. flipEffect: _extends({}, Flip)
  7690. });
  7691. },
  7692. on: {
  7693. beforeInit: function beforeInit(swiper) {
  7694. if (swiper.params.effect !== 'flip') return;
  7695. swiper.classNames.push(swiper.params.containerModifierClass + "flip");
  7696. swiper.classNames.push(swiper.params.containerModifierClass + "3d");
  7697. var overwriteParams = {
  7698. slidesPerView: 1,
  7699. slidesPerColumn: 1,
  7700. slidesPerGroup: 1,
  7701. watchSlidesProgress: true,
  7702. spaceBetween: 0,
  7703. virtualTranslate: true
  7704. };
  7705. extend$1(swiper.params, overwriteParams);
  7706. extend$1(swiper.originalParams, overwriteParams);
  7707. },
  7708. setTranslate: function setTranslate(swiper) {
  7709. if (swiper.params.effect !== 'flip') return;
  7710. swiper.flipEffect.setTranslate();
  7711. },
  7712. setTransition: function setTransition(swiper, duration) {
  7713. if (swiper.params.effect !== 'flip') return;
  7714. swiper.flipEffect.setTransition(duration);
  7715. }
  7716. }
  7717. };
  7718. var Coverflow = {
  7719. setTranslate: function setTranslate() {
  7720. var swiper = this;
  7721. var swiperWidth = swiper.width,
  7722. swiperHeight = swiper.height,
  7723. slides = swiper.slides,
  7724. slidesSizesGrid = swiper.slidesSizesGrid;
  7725. var params = swiper.params.coverflowEffect;
  7726. var isHorizontal = swiper.isHorizontal();
  7727. var transform = swiper.translate;
  7728. var center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2;
  7729. var rotate = isHorizontal ? params.rotate : -params.rotate;
  7730. var translate = params.depth; // Each slide offset from center
  7731. for (var i = 0, length = slides.length; i < length; i += 1) {
  7732. var $slideEl = slides.eq(i);
  7733. var slideSize = slidesSizesGrid[i];
  7734. var slideOffset = $slideEl[0].swiperSlideOffset;
  7735. var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * params.modifier;
  7736. var rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
  7737. var rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0
  7738. var translateZ = -translate * Math.abs(offsetMultiplier);
  7739. var stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders
  7740. if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) {
  7741. stretch = parseFloat(params.stretch) / 100 * slideSize;
  7742. }
  7743. var translateY = isHorizontal ? 0 : stretch * offsetMultiplier;
  7744. var translateX = isHorizontal ? stretch * offsetMultiplier : 0;
  7745. var scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values
  7746. if (Math.abs(translateX) < 0.001) translateX = 0;
  7747. if (Math.abs(translateY) < 0.001) translateY = 0;
  7748. if (Math.abs(translateZ) < 0.001) translateZ = 0;
  7749. if (Math.abs(rotateY) < 0.001) rotateY = 0;
  7750. if (Math.abs(rotateX) < 0.001) rotateX = 0;
  7751. if (Math.abs(scale) < 0.001) scale = 0;
  7752. var slideTransform = "translate3d(" + translateX + "px," + translateY + "px," + translateZ + "px) rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg) scale(" + scale + ")";
  7753. $slideEl.transform(slideTransform);
  7754. $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
  7755. if (params.slideShadows) {
  7756. // Set shadows
  7757. var $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
  7758. var $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
  7759. if ($shadowBeforeEl.length === 0) {
  7760. $shadowBeforeEl = $("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>");
  7761. $slideEl.append($shadowBeforeEl);
  7762. }
  7763. if ($shadowAfterEl.length === 0) {
  7764. $shadowAfterEl = $("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>");
  7765. $slideEl.append($shadowAfterEl);
  7766. }
  7767. if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
  7768. if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
  7769. }
  7770. }
  7771. },
  7772. setTransition: function setTransition(duration) {
  7773. var swiper = this;
  7774. swiper.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
  7775. }
  7776. };
  7777. var EffectCoverflow = {
  7778. name: 'effect-coverflow',
  7779. params: {
  7780. coverflowEffect: {
  7781. rotate: 50,
  7782. stretch: 0,
  7783. depth: 100,
  7784. scale: 1,
  7785. modifier: 1,
  7786. slideShadows: true
  7787. }
  7788. },
  7789. create: function create() {
  7790. var swiper = this;
  7791. bindModuleMethods(swiper, {
  7792. coverflowEffect: _extends({}, Coverflow)
  7793. });
  7794. },
  7795. on: {
  7796. beforeInit: function beforeInit(swiper) {
  7797. if (swiper.params.effect !== 'coverflow') return;
  7798. swiper.classNames.push(swiper.params.containerModifierClass + "coverflow");
  7799. swiper.classNames.push(swiper.params.containerModifierClass + "3d");
  7800. swiper.params.watchSlidesProgress = true;
  7801. swiper.originalParams.watchSlidesProgress = true;
  7802. },
  7803. setTranslate: function setTranslate(swiper) {
  7804. if (swiper.params.effect !== 'coverflow') return;
  7805. swiper.coverflowEffect.setTranslate();
  7806. },
  7807. setTransition: function setTransition(swiper, duration) {
  7808. if (swiper.params.effect !== 'coverflow') return;
  7809. swiper.coverflowEffect.setTransition(duration);
  7810. }
  7811. }
  7812. };
  7813. var Thumbs = {
  7814. init: function init() {
  7815. var swiper = this;
  7816. var thumbsParams = swiper.params.thumbs;
  7817. if (swiper.thumbs.initialized) return false;
  7818. swiper.thumbs.initialized = true;
  7819. var SwiperClass = swiper.constructor;
  7820. if (thumbsParams.swiper instanceof SwiperClass) {
  7821. swiper.thumbs.swiper = thumbsParams.swiper;
  7822. extend$1(swiper.thumbs.swiper.originalParams, {
  7823. watchSlidesProgress: true,
  7824. slideToClickedSlide: false
  7825. });
  7826. extend$1(swiper.thumbs.swiper.params, {
  7827. watchSlidesProgress: true,
  7828. slideToClickedSlide: false
  7829. });
  7830. } else if (isObject$1(thumbsParams.swiper)) {
  7831. swiper.thumbs.swiper = new SwiperClass(extend$1({}, thumbsParams.swiper, {
  7832. watchSlidesVisibility: true,
  7833. watchSlidesProgress: true,
  7834. slideToClickedSlide: false
  7835. }));
  7836. swiper.thumbs.swiperCreated = true;
  7837. }
  7838. swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass);
  7839. swiper.thumbs.swiper.on('tap', swiper.thumbs.onThumbClick);
  7840. return true;
  7841. },
  7842. onThumbClick: function onThumbClick() {
  7843. var swiper = this;
  7844. var thumbsSwiper = swiper.thumbs.swiper;
  7845. if (!thumbsSwiper) return;
  7846. var clickedIndex = thumbsSwiper.clickedIndex;
  7847. var clickedSlide = thumbsSwiper.clickedSlide;
  7848. if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return;
  7849. if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;
  7850. var slideToIndex;
  7851. if (thumbsSwiper.params.loop) {
  7852. slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10);
  7853. } else {
  7854. slideToIndex = clickedIndex;
  7855. }
  7856. if (swiper.params.loop) {
  7857. var currentIndex = swiper.activeIndex;
  7858. if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) {
  7859. swiper.loopFix(); // eslint-disable-next-line
  7860. swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
  7861. currentIndex = swiper.activeIndex;
  7862. }
  7863. var prevIndex = swiper.slides.eq(currentIndex).prevAll("[data-swiper-slide-index=\"" + slideToIndex + "\"]").eq(0).index();
  7864. var nextIndex = swiper.slides.eq(currentIndex).nextAll("[data-swiper-slide-index=\"" + slideToIndex + "\"]").eq(0).index();
  7865. if (typeof prevIndex === 'undefined') slideToIndex = nextIndex;else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex;else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex;else slideToIndex = prevIndex;
  7866. }
  7867. swiper.slideTo(slideToIndex);
  7868. },
  7869. update: function update(initial) {
  7870. var swiper = this;
  7871. var thumbsSwiper = swiper.thumbs.swiper;
  7872. if (!thumbsSwiper) return;
  7873. var slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView;
  7874. var autoScrollOffset = swiper.params.thumbs.autoScrollOffset;
  7875. var useOffset = autoScrollOffset && !thumbsSwiper.params.loop;
  7876. if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {
  7877. var currentThumbsIndex = thumbsSwiper.activeIndex;
  7878. var newThumbsIndex;
  7879. var direction;
  7880. if (thumbsSwiper.params.loop) {
  7881. if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) {
  7882. thumbsSwiper.loopFix(); // eslint-disable-next-line
  7883. thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft;
  7884. currentThumbsIndex = thumbsSwiper.activeIndex;
  7885. } // Find actual thumbs index to slide to
  7886. var prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll("[data-swiper-slide-index=\"" + swiper.realIndex + "\"]").eq(0).index();
  7887. var nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll("[data-swiper-slide-index=\"" + swiper.realIndex + "\"]").eq(0).index();
  7888. if (typeof prevThumbsIndex === 'undefined') newThumbsIndex = nextThumbsIndex;else if (typeof nextThumbsIndex === 'undefined') newThumbsIndex = prevThumbsIndex;else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) newThumbsIndex = currentThumbsIndex;else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) newThumbsIndex = nextThumbsIndex;else newThumbsIndex = prevThumbsIndex;
  7889. direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';
  7890. } else {
  7891. newThumbsIndex = swiper.realIndex;
  7892. direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';
  7893. }
  7894. if (useOffset) {
  7895. newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;
  7896. }
  7897. if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
  7898. if (thumbsSwiper.params.centeredSlides) {
  7899. if (newThumbsIndex > currentThumbsIndex) {
  7900. newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
  7901. } else {
  7902. newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
  7903. }
  7904. } else if (newThumbsIndex > currentThumbsIndex) {
  7905. newThumbsIndex = newThumbsIndex - slidesPerView + 1;
  7906. }
  7907. thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
  7908. }
  7909. } // Activate thumbs
  7910. var thumbsToActivate = 1;
  7911. var thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
  7912. if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
  7913. thumbsToActivate = swiper.params.slidesPerView;
  7914. }
  7915. if (!swiper.params.thumbs.multipleActiveThumbs) {
  7916. thumbsToActivate = 1;
  7917. }
  7918. thumbsToActivate = Math.floor(thumbsToActivate);
  7919. thumbsSwiper.slides.removeClass(thumbActiveClass);
  7920. if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {
  7921. for (var i = 0; i < thumbsToActivate; i += 1) {
  7922. thumbsSwiper.$wrapperEl.children("[data-swiper-slide-index=\"" + (swiper.realIndex + i) + "\"]").addClass(thumbActiveClass);
  7923. }
  7924. } else {
  7925. for (var _i = 0; _i < thumbsToActivate; _i += 1) {
  7926. thumbsSwiper.slides.eq(swiper.realIndex + _i).addClass(thumbActiveClass);
  7927. }
  7928. }
  7929. }
  7930. };
  7931. var Thumbs$1 = {
  7932. name: 'thumbs',
  7933. params: {
  7934. thumbs: {
  7935. swiper: null,
  7936. multipleActiveThumbs: true,
  7937. autoScrollOffset: 0,
  7938. slideThumbActiveClass: 'swiper-slide-thumb-active',
  7939. thumbsContainerClass: 'swiper-container-thumbs'
  7940. }
  7941. },
  7942. create: function create() {
  7943. var swiper = this;
  7944. bindModuleMethods(swiper, {
  7945. thumbs: _extends({
  7946. swiper: null,
  7947. initialized: false
  7948. }, Thumbs)
  7949. });
  7950. },
  7951. on: {
  7952. beforeInit: function beforeInit(swiper) {
  7953. var thumbs = swiper.params.thumbs;
  7954. if (!thumbs || !thumbs.swiper) return;
  7955. swiper.thumbs.init();
  7956. swiper.thumbs.update(true);
  7957. },
  7958. slideChange: function slideChange(swiper) {
  7959. if (!swiper.thumbs.swiper) return;
  7960. swiper.thumbs.update();
  7961. },
  7962. update: function update(swiper) {
  7963. if (!swiper.thumbs.swiper) return;
  7964. swiper.thumbs.update();
  7965. },
  7966. resize: function resize(swiper) {
  7967. if (!swiper.thumbs.swiper) return;
  7968. swiper.thumbs.update();
  7969. },
  7970. observerUpdate: function observerUpdate(swiper) {
  7971. if (!swiper.thumbs.swiper) return;
  7972. swiper.thumbs.update();
  7973. },
  7974. setTransition: function setTransition(swiper, duration) {
  7975. var thumbsSwiper = swiper.thumbs.swiper;
  7976. if (!thumbsSwiper) return;
  7977. thumbsSwiper.setTransition(duration);
  7978. },
  7979. beforeDestroy: function beforeDestroy(swiper) {
  7980. var thumbsSwiper = swiper.thumbs.swiper;
  7981. if (!thumbsSwiper) return;
  7982. if (swiper.thumbs.swiperCreated && thumbsSwiper) {
  7983. thumbsSwiper.destroy();
  7984. }
  7985. }
  7986. }
  7987. };
  7988. // Swiper Class
  7989. var components = [Virtual$1, Keyboard$1, Mousewheel$1, Navigation$1, Pagination$1, Scrollbar$1, Parallax$1, Zoom$1, Lazy$1, Controller$1, A11y$1, History$1, HashNavigation$1, Autoplay$1, EffectFade, EffectCube, EffectFlip, EffectCoverflow, Thumbs$1];
  7990. Swiper.use(components);
  7991. return Swiper;
  7992. })));
  7993. //# sourceMappingURL=swiper-bundle.js.map