vendors.bundle.js 785 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609
  1. (function() {
  2. var AjaxMonitor, Bar, DocumentMonitor, ElementMonitor, ElementTracker, EventLagMonitor, Evented, Events, NoTargetError, Pace, RequestIntercept, SOURCE_KEYS, Scaler, SocketRequestTracker, XHRRequestTracker, animation, avgAmplitude, bar, cancelAnimation, cancelAnimationFrame, defaultOptions, extend, extendNative, getFromDOM, getIntercept, handlePushState, ignoreStack, init, now, options, requestAnimationFrame, result, runAnimation, scalers, shouldIgnoreURL, shouldTrack, source, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _i, _intercept, _len, _pushState, _ref, _ref1, _replaceState,
  3. __slice = [].slice,
  4. __hasProp = {}.hasOwnProperty,
  5. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  6. __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
  7. defaultOptions = {
  8. catchupTime: 100,
  9. initialRate: .03,
  10. minTime: 250,
  11. ghostTime: 100,
  12. maxProgressPerFrame: 20,
  13. easeFactor: 1.25,
  14. startOnPageLoad: true,
  15. restartOnPushState: true,
  16. restartOnRequestAfter: 500,
  17. target: 'body',
  18. elements: {
  19. checkInterval: 100,
  20. selectors: ['body']
  21. },
  22. eventLag: {
  23. minSamples: 10,
  24. sampleCount: 3,
  25. lagThreshold: 3
  26. },
  27. ajax: {
  28. trackMethods: ['GET'],
  29. trackWebSockets: true,
  30. ignoreURLs: []
  31. }
  32. };
  33. now = function() {
  34. var _ref;
  35. return (_ref = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref : +(new Date);
  36. };
  37. requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
  38. cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
  39. if (requestAnimationFrame == null) {
  40. requestAnimationFrame = function(fn) {
  41. return setTimeout(fn, 50);
  42. };
  43. cancelAnimationFrame = function(id) {
  44. return clearTimeout(id);
  45. };
  46. }
  47. runAnimation = function(fn) {
  48. var last, tick;
  49. last = now();
  50. tick = function() {
  51. var diff;
  52. diff = now() - last;
  53. if (diff >= 33) {
  54. last = now();
  55. return fn(diff, function() {
  56. return requestAnimationFrame(tick);
  57. });
  58. } else {
  59. return setTimeout(tick, 33 - diff);
  60. }
  61. };
  62. return tick();
  63. };
  64. result = function() {
  65. var args, key, obj;
  66. obj = arguments[0], key = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
  67. if (typeof obj[key] === 'function') {
  68. return obj[key].apply(obj, args);
  69. } else {
  70. return obj[key];
  71. }
  72. };
  73. extend = function() {
  74. var key, out, source, sources, val, _i, _len;
  75. out = arguments[0], sources = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  76. for (_i = 0, _len = sources.length; _i < _len; _i++) {
  77. source = sources[_i];
  78. if (source) {
  79. for (key in source) {
  80. if (!__hasProp.call(source, key)) continue;
  81. val = source[key];
  82. if ((out[key] != null) && typeof out[key] === 'object' && (val != null) && typeof val === 'object') {
  83. extend(out[key], val);
  84. } else {
  85. out[key] = val;
  86. }
  87. }
  88. }
  89. }
  90. return out;
  91. };
  92. avgAmplitude = function(arr) {
  93. var count, sum, v, _i, _len;
  94. sum = count = 0;
  95. for (_i = 0, _len = arr.length; _i < _len; _i++) {
  96. v = arr[_i];
  97. sum += Math.abs(v);
  98. count++;
  99. }
  100. return sum / count;
  101. };
  102. getFromDOM = function(key, json) {
  103. var data, e, el;
  104. if (key == null) {
  105. key = 'options';
  106. }
  107. if (json == null) {
  108. json = true;
  109. }
  110. el = document.querySelector("[data-pace-" + key + "]");
  111. if (!el) {
  112. return;
  113. }
  114. data = el.getAttribute("data-pace-" + key);
  115. if (!json) {
  116. return data;
  117. }
  118. try {
  119. return JSON.parse(data);
  120. } catch (_error) {
  121. e = _error;
  122. return typeof console !== "undefined" && console !== null ? console.error("Error parsing inline pace options", e) : void 0;
  123. }
  124. };
  125. Evented = (function() {
  126. function Evented() {}
  127. Evented.prototype.on = function(event, handler, ctx, once) {
  128. var _base;
  129. if (once == null) {
  130. once = false;
  131. }
  132. if (this.bindings == null) {
  133. this.bindings = {};
  134. }
  135. if ((_base = this.bindings)[event] == null) {
  136. _base[event] = [];
  137. }
  138. return this.bindings[event].push({
  139. handler: handler,
  140. ctx: ctx,
  141. once: once
  142. });
  143. };
  144. Evented.prototype.once = function(event, handler, ctx) {
  145. return this.on(event, handler, ctx, true);
  146. };
  147. Evented.prototype.off = function(event, handler) {
  148. var i, _ref, _results;
  149. if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
  150. return;
  151. }
  152. if (handler == null) {
  153. return delete this.bindings[event];
  154. } else {
  155. i = 0;
  156. _results = [];
  157. while (i < this.bindings[event].length) {
  158. if (this.bindings[event][i].handler === handler) {
  159. _results.push(this.bindings[event].splice(i, 1));
  160. } else {
  161. _results.push(i++);
  162. }
  163. }
  164. return _results;
  165. }
  166. };
  167. Evented.prototype.trigger = function() {
  168. var args, ctx, event, handler, i, once, _ref, _ref1, _results;
  169. event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  170. if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
  171. i = 0;
  172. _results = [];
  173. while (i < this.bindings[event].length) {
  174. _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
  175. handler.apply(ctx != null ? ctx : this, args);
  176. if (once) {
  177. _results.push(this.bindings[event].splice(i, 1));
  178. } else {
  179. _results.push(i++);
  180. }
  181. }
  182. return _results;
  183. }
  184. };
  185. return Evented;
  186. })();
  187. Pace = window.Pace || {};
  188. window.Pace = Pace;
  189. extend(Pace, Evented.prototype);
  190. options = Pace.options = extend({}, defaultOptions, window.paceOptions, getFromDOM());
  191. _ref = ['ajax', 'document', 'eventLag', 'elements'];
  192. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  193. source = _ref[_i];
  194. if (options[source] === true) {
  195. options[source] = defaultOptions[source];
  196. }
  197. }
  198. NoTargetError = (function(_super) {
  199. __extends(NoTargetError, _super);
  200. function NoTargetError() {
  201. _ref1 = NoTargetError.__super__.constructor.apply(this, arguments);
  202. return _ref1;
  203. }
  204. return NoTargetError;
  205. })(Error);
  206. Bar = (function() {
  207. function Bar() {
  208. this.progress = 0;
  209. }
  210. Bar.prototype.getElement = function() {
  211. var targetElement;
  212. if (this.el == null) {
  213. targetElement = document.querySelector(options.target);
  214. if (!targetElement) {
  215. throw new NoTargetError;
  216. }
  217. this.el = document.createElement('div');
  218. this.el.className = "pace pace-active";
  219. document.body.className = document.body.className.replace(/pace-done/g, '');
  220. document.body.className += ' pace-running';
  221. this.el.innerHTML = '<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>';
  222. if (targetElement.firstChild != null) {
  223. targetElement.insertBefore(this.el, targetElement.firstChild);
  224. } else {
  225. targetElement.appendChild(this.el);
  226. }
  227. }
  228. return this.el;
  229. };
  230. Bar.prototype.finish = function() {
  231. var el;
  232. el = this.getElement();
  233. el.className = el.className.replace('pace-active', '');
  234. el.className += ' pace-inactive';
  235. document.body.className = document.body.className.replace('pace-running', '');
  236. return document.body.className += ' pace-done';
  237. };
  238. Bar.prototype.update = function(prog) {
  239. this.progress = prog;
  240. return this.render();
  241. };
  242. Bar.prototype.destroy = function() {
  243. try {
  244. this.getElement().parentNode.removeChild(this.getElement());
  245. } catch (_error) {
  246. NoTargetError = _error;
  247. }
  248. return this.el = void 0;
  249. };
  250. Bar.prototype.render = function() {
  251. var el, key, progressStr, transform, _j, _len1, _ref2;
  252. if (document.querySelector(options.target) == null) {
  253. return false;
  254. }
  255. el = this.getElement();
  256. transform = "translate3d(" + this.progress + "%, 0, 0)";
  257. _ref2 = ['webkitTransform', 'msTransform', 'transform'];
  258. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  259. key = _ref2[_j];
  260. el.children[0].style[key] = transform;
  261. }
  262. if (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) {
  263. el.children[0].setAttribute('data-progress-text', "" + (this.progress | 0) + "%");
  264. if (this.progress >= 100) {
  265. progressStr = '99';
  266. } else {
  267. progressStr = this.progress < 10 ? "0" : "";
  268. progressStr += this.progress | 0;
  269. }
  270. el.children[0].setAttribute('data-progress', "" + progressStr);
  271. }
  272. return this.lastRenderedProgress = this.progress;
  273. };
  274. Bar.prototype.done = function() {
  275. return this.progress >= 100;
  276. };
  277. return Bar;
  278. })();
  279. Events = (function() {
  280. function Events() {
  281. this.bindings = {};
  282. }
  283. Events.prototype.trigger = function(name, val) {
  284. var binding, _j, _len1, _ref2, _results;
  285. if (this.bindings[name] != null) {
  286. _ref2 = this.bindings[name];
  287. _results = [];
  288. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  289. binding = _ref2[_j];
  290. _results.push(binding.call(this, val));
  291. }
  292. return _results;
  293. }
  294. };
  295. Events.prototype.on = function(name, fn) {
  296. var _base;
  297. if ((_base = this.bindings)[name] == null) {
  298. _base[name] = [];
  299. }
  300. return this.bindings[name].push(fn);
  301. };
  302. return Events;
  303. })();
  304. _XMLHttpRequest = window.XMLHttpRequest;
  305. _XDomainRequest = window.XDomainRequest;
  306. _WebSocket = window.WebSocket;
  307. extendNative = function(to, from) {
  308. var e, key, _results;
  309. _results = [];
  310. for (key in from.prototype) {
  311. try {
  312. if ((to[key] == null) && typeof from[key] !== 'function') {
  313. if (typeof Object.defineProperty === 'function') {
  314. _results.push(Object.defineProperty(to, key, {
  315. get: function() {
  316. return from.prototype[key];
  317. },
  318. configurable: true,
  319. enumerable: true
  320. }));
  321. } else {
  322. _results.push(to[key] = from.prototype[key]);
  323. }
  324. } else {
  325. _results.push(void 0);
  326. }
  327. } catch (_error) {
  328. e = _error;
  329. }
  330. }
  331. return _results;
  332. };
  333. ignoreStack = [];
  334. Pace.ignore = function() {
  335. var args, fn, ret;
  336. fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  337. ignoreStack.unshift('ignore');
  338. ret = fn.apply(null, args);
  339. ignoreStack.shift();
  340. return ret;
  341. };
  342. Pace.track = function() {
  343. var args, fn, ret;
  344. fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  345. ignoreStack.unshift('track');
  346. ret = fn.apply(null, args);
  347. ignoreStack.shift();
  348. return ret;
  349. };
  350. shouldTrack = function(method) {
  351. var _ref2;
  352. if (method == null) {
  353. method = 'GET';
  354. }
  355. if (ignoreStack[0] === 'track') {
  356. return 'force';
  357. }
  358. if (!ignoreStack.length && options.ajax) {
  359. if (method === 'socket' && options.ajax.trackWebSockets) {
  360. return true;
  361. } else if (_ref2 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref2) >= 0) {
  362. return true;
  363. }
  364. }
  365. return false;
  366. };
  367. RequestIntercept = (function(_super) {
  368. __extends(RequestIntercept, _super);
  369. function RequestIntercept() {
  370. var monitorXHR,
  371. _this = this;
  372. RequestIntercept.__super__.constructor.apply(this, arguments);
  373. monitorXHR = function(req) {
  374. var _open;
  375. _open = req.open;
  376. return req.open = function(type, url, async) {
  377. if (shouldTrack(type)) {
  378. _this.trigger('request', {
  379. type: type,
  380. url: url,
  381. request: req
  382. });
  383. }
  384. return _open.apply(req, arguments);
  385. };
  386. };
  387. window.XMLHttpRequest = function(flags) {
  388. var req;
  389. req = new _XMLHttpRequest(flags);
  390. monitorXHR(req);
  391. return req;
  392. };
  393. try {
  394. extendNative(window.XMLHttpRequest, _XMLHttpRequest);
  395. } catch (_error) {}
  396. if (_XDomainRequest != null) {
  397. window.XDomainRequest = function() {
  398. var req;
  399. req = new _XDomainRequest;
  400. monitorXHR(req);
  401. return req;
  402. };
  403. try {
  404. extendNative(window.XDomainRequest, _XDomainRequest);
  405. } catch (_error) {}
  406. }
  407. if ((_WebSocket != null) && options.ajax.trackWebSockets) {
  408. window.WebSocket = function(url, protocols) {
  409. var req;
  410. if (protocols != null) {
  411. req = new _WebSocket(url, protocols);
  412. } else {
  413. req = new _WebSocket(url);
  414. }
  415. if (shouldTrack('socket')) {
  416. _this.trigger('request', {
  417. type: 'socket',
  418. url: url,
  419. protocols: protocols,
  420. request: req
  421. });
  422. }
  423. return req;
  424. };
  425. try {
  426. extendNative(window.WebSocket, _WebSocket);
  427. } catch (_error) {}
  428. }
  429. }
  430. return RequestIntercept;
  431. })(Events);
  432. _intercept = null;
  433. getIntercept = function() {
  434. if (_intercept == null) {
  435. _intercept = new RequestIntercept;
  436. }
  437. return _intercept;
  438. };
  439. shouldIgnoreURL = function(url) {
  440. var pattern, _j, _len1, _ref2;
  441. _ref2 = options.ajax.ignoreURLs;
  442. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  443. pattern = _ref2[_j];
  444. if (typeof pattern === 'string') {
  445. if (url.indexOf(pattern) !== -1) {
  446. return true;
  447. }
  448. } else {
  449. if (pattern.test(url)) {
  450. return true;
  451. }
  452. }
  453. }
  454. return false;
  455. };
  456. getIntercept().on('request', function(_arg) {
  457. var after, args, request, type, url;
  458. type = _arg.type, request = _arg.request, url = _arg.url;
  459. if (shouldIgnoreURL(url)) {
  460. return;
  461. }
  462. if (!Pace.running && (options.restartOnRequestAfter !== false || shouldTrack(type) === 'force')) {
  463. args = arguments;
  464. after = options.restartOnRequestAfter || 0;
  465. if (typeof after === 'boolean') {
  466. after = 0;
  467. }
  468. return setTimeout(function() {
  469. var stillActive, _j, _len1, _ref2, _ref3, _results;
  470. if (type === 'socket') {
  471. stillActive = request.readyState < 2;
  472. } else {
  473. stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4);
  474. }
  475. if (stillActive) {
  476. Pace.restart();
  477. _ref3 = Pace.sources;
  478. _results = [];
  479. for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
  480. source = _ref3[_j];
  481. if (source instanceof AjaxMonitor) {
  482. source.watch.apply(source, args);
  483. break;
  484. } else {
  485. _results.push(void 0);
  486. }
  487. }
  488. return _results;
  489. }
  490. }, after);
  491. }
  492. });
  493. AjaxMonitor = (function() {
  494. function AjaxMonitor() {
  495. var _this = this;
  496. this.elements = [];
  497. getIntercept().on('request', function() {
  498. return _this.watch.apply(_this, arguments);
  499. });
  500. }
  501. AjaxMonitor.prototype.watch = function(_arg) {
  502. var request, tracker, type, url;
  503. type = _arg.type, request = _arg.request, url = _arg.url;
  504. if (shouldIgnoreURL(url)) {
  505. return;
  506. }
  507. if (type === 'socket') {
  508. tracker = new SocketRequestTracker(request);
  509. } else {
  510. tracker = new XHRRequestTracker(request);
  511. }
  512. return this.elements.push(tracker);
  513. };
  514. return AjaxMonitor;
  515. })();
  516. XHRRequestTracker = (function() {
  517. function XHRRequestTracker(request) {
  518. var event, size, _j, _len1, _onreadystatechange, _ref2,
  519. _this = this;
  520. this.progress = 0;
  521. if (window.ProgressEvent != null) {
  522. size = null;
  523. request.addEventListener('progress', function(evt) {
  524. if (evt.lengthComputable) {
  525. return _this.progress = 100 * evt.loaded / evt.total;
  526. } else {
  527. return _this.progress = _this.progress + (100 - _this.progress) / 2;
  528. }
  529. }, false);
  530. _ref2 = ['load', 'abort', 'timeout', 'error'];
  531. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  532. event = _ref2[_j];
  533. request.addEventListener(event, function() {
  534. return _this.progress = 100;
  535. }, false);
  536. }
  537. } else {
  538. _onreadystatechange = request.onreadystatechange;
  539. request.onreadystatechange = function() {
  540. var _ref3;
  541. if ((_ref3 = request.readyState) === 0 || _ref3 === 4) {
  542. _this.progress = 100;
  543. } else if (request.readyState === 3) {
  544. _this.progress = 50;
  545. }
  546. return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0;
  547. };
  548. }
  549. }
  550. return XHRRequestTracker;
  551. })();
  552. SocketRequestTracker = (function() {
  553. function SocketRequestTracker(request) {
  554. var event, _j, _len1, _ref2,
  555. _this = this;
  556. this.progress = 0;
  557. _ref2 = ['error', 'open'];
  558. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  559. event = _ref2[_j];
  560. request.addEventListener(event, function() {
  561. return _this.progress = 100;
  562. }, false);
  563. }
  564. }
  565. return SocketRequestTracker;
  566. })();
  567. ElementMonitor = (function() {
  568. function ElementMonitor(options) {
  569. var selector, _j, _len1, _ref2;
  570. if (options == null) {
  571. options = {};
  572. }
  573. this.elements = [];
  574. if (options.selectors == null) {
  575. options.selectors = [];
  576. }
  577. _ref2 = options.selectors;
  578. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  579. selector = _ref2[_j];
  580. this.elements.push(new ElementTracker(selector));
  581. }
  582. }
  583. return ElementMonitor;
  584. })();
  585. ElementTracker = (function() {
  586. function ElementTracker(selector) {
  587. this.selector = selector;
  588. this.progress = 0;
  589. this.check();
  590. }
  591. ElementTracker.prototype.check = function() {
  592. var _this = this;
  593. if (document.querySelector(this.selector)) {
  594. return this.done();
  595. } else {
  596. return setTimeout((function() {
  597. return _this.check();
  598. }), options.elements.checkInterval);
  599. }
  600. };
  601. ElementTracker.prototype.done = function() {
  602. return this.progress = 100;
  603. };
  604. return ElementTracker;
  605. })();
  606. DocumentMonitor = (function() {
  607. DocumentMonitor.prototype.states = {
  608. loading: 0,
  609. interactive: 50,
  610. complete: 100
  611. };
  612. function DocumentMonitor() {
  613. var _onreadystatechange, _ref2,
  614. _this = this;
  615. this.progress = (_ref2 = this.states[document.readyState]) != null ? _ref2 : 100;
  616. _onreadystatechange = document.onreadystatechange;
  617. document.onreadystatechange = function() {
  618. if (_this.states[document.readyState] != null) {
  619. _this.progress = _this.states[document.readyState];
  620. }
  621. return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0;
  622. };
  623. }
  624. return DocumentMonitor;
  625. })();
  626. EventLagMonitor = (function() {
  627. function EventLagMonitor() {
  628. var avg, interval, last, points, samples,
  629. _this = this;
  630. this.progress = 0;
  631. avg = 0;
  632. samples = [];
  633. points = 0;
  634. last = now();
  635. interval = setInterval(function() {
  636. var diff;
  637. diff = now() - last - 50;
  638. last = now();
  639. samples.push(diff);
  640. if (samples.length > options.eventLag.sampleCount) {
  641. samples.shift();
  642. }
  643. avg = avgAmplitude(samples);
  644. if (++points >= options.eventLag.minSamples && avg < options.eventLag.lagThreshold) {
  645. _this.progress = 100;
  646. return clearInterval(interval);
  647. } else {
  648. return _this.progress = 100 * (3 / (avg + 3));
  649. }
  650. }, 50);
  651. }
  652. return EventLagMonitor;
  653. })();
  654. Scaler = (function() {
  655. function Scaler(source) {
  656. this.source = source;
  657. this.last = this.sinceLastUpdate = 0;
  658. this.rate = options.initialRate;
  659. this.catchup = 0;
  660. this.progress = this.lastProgress = 0;
  661. if (this.source != null) {
  662. this.progress = result(this.source, 'progress');
  663. }
  664. }
  665. Scaler.prototype.tick = function(frameTime, val) {
  666. var scaling;
  667. if (val == null) {
  668. val = result(this.source, 'progress');
  669. }
  670. if (val >= 100) {
  671. this.done = true;
  672. }
  673. if (val === this.last) {
  674. this.sinceLastUpdate += frameTime;
  675. } else {
  676. if (this.sinceLastUpdate) {
  677. this.rate = (val - this.last) / this.sinceLastUpdate;
  678. }
  679. this.catchup = (val - this.progress) / options.catchupTime;
  680. this.sinceLastUpdate = 0;
  681. this.last = val;
  682. }
  683. if (val > this.progress) {
  684. this.progress += this.catchup * frameTime;
  685. }
  686. scaling = 1 - Math.pow(this.progress / 100, options.easeFactor);
  687. this.progress += scaling * this.rate * frameTime;
  688. this.progress = Math.min(this.lastProgress + options.maxProgressPerFrame, this.progress);
  689. this.progress = Math.max(0, this.progress);
  690. this.progress = Math.min(100, this.progress);
  691. this.lastProgress = this.progress;
  692. return this.progress;
  693. };
  694. return Scaler;
  695. })();
  696. sources = null;
  697. scalers = null;
  698. bar = null;
  699. uniScaler = null;
  700. animation = null;
  701. cancelAnimation = null;
  702. Pace.running = false;
  703. handlePushState = function() {
  704. if (options.restartOnPushState) {
  705. return Pace.restart();
  706. }
  707. };
  708. if (window.history.pushState != null) {
  709. _pushState = window.history.pushState;
  710. window.history.pushState = function() {
  711. handlePushState();
  712. return _pushState.apply(window.history, arguments);
  713. };
  714. }
  715. if (window.history.replaceState != null) {
  716. _replaceState = window.history.replaceState;
  717. window.history.replaceState = function() {
  718. handlePushState();
  719. return _replaceState.apply(window.history, arguments);
  720. };
  721. }
  722. SOURCE_KEYS = {
  723. ajax: AjaxMonitor,
  724. elements: ElementMonitor,
  725. document: DocumentMonitor,
  726. eventLag: EventLagMonitor
  727. };
  728. (init = function() {
  729. var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4;
  730. Pace.sources = sources = [];
  731. _ref2 = ['ajax', 'elements', 'document', 'eventLag'];
  732. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  733. type = _ref2[_j];
  734. if (options[type] !== false) {
  735. sources.push(new SOURCE_KEYS[type](options[type]));
  736. }
  737. }
  738. _ref4 = (_ref3 = options.extraSources) != null ? _ref3 : [];
  739. for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
  740. source = _ref4[_k];
  741. sources.push(new source(options));
  742. }
  743. Pace.bar = bar = new Bar;
  744. scalers = [];
  745. return uniScaler = new Scaler;
  746. })();
  747. Pace.stop = function() {
  748. Pace.trigger('stop');
  749. Pace.running = false;
  750. bar.destroy();
  751. cancelAnimation = true;
  752. if (animation != null) {
  753. if (typeof cancelAnimationFrame === "function") {
  754. cancelAnimationFrame(animation);
  755. }
  756. animation = null;
  757. }
  758. return init();
  759. };
  760. Pace.restart = function() {
  761. Pace.trigger('restart');
  762. Pace.stop();
  763. return Pace.start();
  764. };
  765. Pace.go = function() {
  766. var start;
  767. Pace.running = true;
  768. bar.render();
  769. start = now();
  770. cancelAnimation = false;
  771. return animation = runAnimation(function(frameTime, enqueueNextFrame) {
  772. var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, sum, _j, _k, _len1, _len2, _ref2;
  773. remaining = 100 - bar.progress;
  774. count = sum = 0;
  775. done = true;
  776. for (i = _j = 0, _len1 = sources.length; _j < _len1; i = ++_j) {
  777. source = sources[i];
  778. scalerList = scalers[i] != null ? scalers[i] : scalers[i] = [];
  779. elements = (_ref2 = source.elements) != null ? _ref2 : [source];
  780. for (j = _k = 0, _len2 = elements.length; _k < _len2; j = ++_k) {
  781. element = elements[j];
  782. scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element);
  783. done &= scaler.done;
  784. if (scaler.done) {
  785. continue;
  786. }
  787. count++;
  788. sum += scaler.tick(frameTime);
  789. }
  790. }
  791. avg = sum / count;
  792. bar.update(uniScaler.tick(frameTime, avg));
  793. if (bar.done() || done || cancelAnimation) {
  794. bar.update(100);
  795. Pace.trigger('done');
  796. return setTimeout(function() {
  797. bar.finish();
  798. Pace.running = false;
  799. return Pace.trigger('hide');
  800. }, Math.max(options.ghostTime, Math.max(options.minTime - (now() - start), 0)));
  801. } else {
  802. return enqueueNextFrame();
  803. }
  804. });
  805. };
  806. Pace.start = function(_options) {
  807. extend(options, _options);
  808. Pace.running = true;
  809. try {
  810. bar.render();
  811. } catch (_error) {
  812. NoTargetError = _error;
  813. }
  814. if (!document.querySelector('.pace')) {
  815. return setTimeout(Pace.start, 50);
  816. } else {
  817. Pace.trigger('start');
  818. return Pace.go();
  819. }
  820. };
  821. if (typeof define === 'function' && define.amd) {
  822. define(['pace'], function() {
  823. return Pace;
  824. });
  825. } else if (typeof exports === 'object') {
  826. module.exports = Pace;
  827. } else {
  828. if (options.startOnPageLoad) {
  829. Pace.start();
  830. }
  831. }
  832. }).call(this);
  833. /*!
  834. * jQuery JavaScript Library v3.4.1
  835. * https://jquery.com/
  836. *
  837. * Includes Sizzle.js
  838. * https://sizzlejs.com/
  839. *
  840. * Copyright JS Foundation and other contributors
  841. * Released under the MIT license
  842. * https://jquery.org/license
  843. *
  844. * Date: 2019-05-01T21:04Z
  845. */
  846. ( function( global, factory ) {
  847. "use strict";
  848. if ( typeof module === "object" && typeof module.exports === "object" ) {
  849. // For CommonJS and CommonJS-like environments where a proper `window`
  850. // is present, execute the factory and get jQuery.
  851. // For environments that do not have a `window` with a `document`
  852. // (such as Node.js), expose a factory as module.exports.
  853. // This accentuates the need for the creation of a real `window`.
  854. // e.g. var jQuery = require("jquery")(window);
  855. // See ticket #14549 for more info.
  856. module.exports = global.document ?
  857. factory( global, true ) :
  858. function( w ) {
  859. if ( !w.document ) {
  860. throw new Error( "jQuery requires a window with a document" );
  861. }
  862. return factory( w );
  863. };
  864. } else {
  865. factory( global );
  866. }
  867. // Pass this if window is not defined yet
  868. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  869. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  870. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  871. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  872. // enough that all such attempts are guarded in a try block.
  873. "use strict";
  874. var arr = [];
  875. var document = window.document;
  876. var getProto = Object.getPrototypeOf;
  877. var slice = arr.slice;
  878. var concat = arr.concat;
  879. var push = arr.push;
  880. var indexOf = arr.indexOf;
  881. var class2type = {};
  882. var toString = class2type.toString;
  883. var hasOwn = class2type.hasOwnProperty;
  884. var fnToString = hasOwn.toString;
  885. var ObjectFunctionString = fnToString.call( Object );
  886. var support = {};
  887. var isFunction = function isFunction( obj ) {
  888. // Support: Chrome <=57, Firefox <=52
  889. // In some browsers, typeof returns "function" for HTML <object> elements
  890. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  891. // We don't want to classify *any* DOM node as a function.
  892. return typeof obj === "function" && typeof obj.nodeType !== "number";
  893. };
  894. var isWindow = function isWindow( obj ) {
  895. return obj != null && obj === obj.window;
  896. };
  897. var preservedScriptAttributes = {
  898. type: true,
  899. src: true,
  900. nonce: true,
  901. noModule: true
  902. };
  903. function DOMEval( code, node, doc ) {
  904. doc = doc || document;
  905. var i, val,
  906. script = doc.createElement( "script" );
  907. script.text = code;
  908. if ( node ) {
  909. for ( i in preservedScriptAttributes ) {
  910. // Support: Firefox 64+, Edge 18+
  911. // Some browsers don't support the "nonce" property on scripts.
  912. // On the other hand, just using `getAttribute` is not enough as
  913. // the `nonce` attribute is reset to an empty string whenever it
  914. // becomes browsing-context connected.
  915. // See https://github.com/whatwg/html/issues/2369
  916. // See https://html.spec.whatwg.org/#nonce-attributes
  917. // The `node.getAttribute` check was added for the sake of
  918. // `jQuery.globalEval` so that it can fake a nonce-containing node
  919. // via an object.
  920. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  921. if ( val ) {
  922. script.setAttribute( i, val );
  923. }
  924. }
  925. }
  926. doc.head.appendChild( script ).parentNode.removeChild( script );
  927. }
  928. function toType( obj ) {
  929. if ( obj == null ) {
  930. return obj + "";
  931. }
  932. // Support: Android <=2.3 only (functionish RegExp)
  933. return typeof obj === "object" || typeof obj === "function" ?
  934. class2type[ toString.call( obj ) ] || "object" :
  935. typeof obj;
  936. }
  937. /* global Symbol */
  938. // Defining this global in .eslintrc.json would create a danger of using the global
  939. // unguarded in another place, it seems safer to define global only for this module
  940. var
  941. version = "3.4.1",
  942. // Define a local copy of jQuery
  943. jQuery = function( selector, context ) {
  944. // The jQuery object is actually just the init constructor 'enhanced'
  945. // Need init if jQuery is called (just allow error to be thrown if not included)
  946. return new jQuery.fn.init( selector, context );
  947. },
  948. // Support: Android <=4.0 only
  949. // Make sure we trim BOM and NBSP
  950. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  951. jQuery.fn = jQuery.prototype = {
  952. // The current version of jQuery being used
  953. jquery: version,
  954. constructor: jQuery,
  955. // The default length of a jQuery object is 0
  956. length: 0,
  957. toArray: function() {
  958. return slice.call( this );
  959. },
  960. // Get the Nth element in the matched element set OR
  961. // Get the whole matched element set as a clean array
  962. get: function( num ) {
  963. // Return all the elements in a clean array
  964. if ( num == null ) {
  965. return slice.call( this );
  966. }
  967. // Return just the one element from the set
  968. return num < 0 ? this[ num + this.length ] : this[ num ];
  969. },
  970. // Take an array of elements and push it onto the stack
  971. // (returning the new matched element set)
  972. pushStack: function( elems ) {
  973. // Build a new jQuery matched element set
  974. var ret = jQuery.merge( this.constructor(), elems );
  975. // Add the old object onto the stack (as a reference)
  976. ret.prevObject = this;
  977. // Return the newly-formed element set
  978. return ret;
  979. },
  980. // Execute a callback for every element in the matched set.
  981. each: function( callback ) {
  982. return jQuery.each( this, callback );
  983. },
  984. map: function( callback ) {
  985. return this.pushStack( jQuery.map( this, function( elem, i ) {
  986. return callback.call( elem, i, elem );
  987. } ) );
  988. },
  989. slice: function() {
  990. return this.pushStack( slice.apply( this, arguments ) );
  991. },
  992. first: function() {
  993. return this.eq( 0 );
  994. },
  995. last: function() {
  996. return this.eq( -1 );
  997. },
  998. eq: function( i ) {
  999. var len = this.length,
  1000. j = +i + ( i < 0 ? len : 0 );
  1001. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  1002. },
  1003. end: function() {
  1004. return this.prevObject || this.constructor();
  1005. },
  1006. // For internal use only.
  1007. // Behaves like an Array's method, not like a jQuery method.
  1008. push: push,
  1009. sort: arr.sort,
  1010. splice: arr.splice
  1011. };
  1012. jQuery.extend = jQuery.fn.extend = function() {
  1013. var options, name, src, copy, copyIsArray, clone,
  1014. target = arguments[ 0 ] || {},
  1015. i = 1,
  1016. length = arguments.length,
  1017. deep = false;
  1018. // Handle a deep copy situation
  1019. if ( typeof target === "boolean" ) {
  1020. deep = target;
  1021. // Skip the boolean and the target
  1022. target = arguments[ i ] || {};
  1023. i++;
  1024. }
  1025. // Handle case when target is a string or something (possible in deep copy)
  1026. if ( typeof target !== "object" && !isFunction( target ) ) {
  1027. target = {};
  1028. }
  1029. // Extend jQuery itself if only one argument is passed
  1030. if ( i === length ) {
  1031. target = this;
  1032. i--;
  1033. }
  1034. for ( ; i < length; i++ ) {
  1035. // Only deal with non-null/undefined values
  1036. if ( ( options = arguments[ i ] ) != null ) {
  1037. // Extend the base object
  1038. for ( name in options ) {
  1039. copy = options[ name ];
  1040. // Prevent Object.prototype pollution
  1041. // Prevent never-ending loop
  1042. if ( name === "__proto__" || target === copy ) {
  1043. continue;
  1044. }
  1045. // Recurse if we're merging plain objects or arrays
  1046. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  1047. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  1048. src = target[ name ];
  1049. // Ensure proper type for the source value
  1050. if ( copyIsArray && !Array.isArray( src ) ) {
  1051. clone = [];
  1052. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  1053. clone = {};
  1054. } else {
  1055. clone = src;
  1056. }
  1057. copyIsArray = false;
  1058. // Never move original objects, clone them
  1059. target[ name ] = jQuery.extend( deep, clone, copy );
  1060. // Don't bring in undefined values
  1061. } else if ( copy !== undefined ) {
  1062. target[ name ] = copy;
  1063. }
  1064. }
  1065. }
  1066. }
  1067. // Return the modified object
  1068. return target;
  1069. };
  1070. jQuery.extend( {
  1071. // Unique for each copy of jQuery on the page
  1072. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  1073. // Assume jQuery is ready without the ready module
  1074. isReady: true,
  1075. error: function( msg ) {
  1076. throw new Error( msg );
  1077. },
  1078. noop: function() {},
  1079. isPlainObject: function( obj ) {
  1080. var proto, Ctor;
  1081. // Detect obvious negatives
  1082. // Use toString instead of jQuery.type to catch host objects
  1083. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  1084. return false;
  1085. }
  1086. proto = getProto( obj );
  1087. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  1088. if ( !proto ) {
  1089. return true;
  1090. }
  1091. // Objects with prototype are plain iff they were constructed by a global Object function
  1092. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  1093. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  1094. },
  1095. isEmptyObject: function( obj ) {
  1096. var name;
  1097. for ( name in obj ) {
  1098. return false;
  1099. }
  1100. return true;
  1101. },
  1102. // Evaluates a script in a global context
  1103. globalEval: function( code, options ) {
  1104. DOMEval( code, { nonce: options && options.nonce } );
  1105. },
  1106. each: function( obj, callback ) {
  1107. var length, i = 0;
  1108. if ( isArrayLike( obj ) ) {
  1109. length = obj.length;
  1110. for ( ; i < length; i++ ) {
  1111. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1112. break;
  1113. }
  1114. }
  1115. } else {
  1116. for ( i in obj ) {
  1117. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1118. break;
  1119. }
  1120. }
  1121. }
  1122. return obj;
  1123. },
  1124. // Support: Android <=4.0 only
  1125. trim: function( text ) {
  1126. return text == null ?
  1127. "" :
  1128. ( text + "" ).replace( rtrim, "" );
  1129. },
  1130. // results is for internal usage only
  1131. makeArray: function( arr, results ) {
  1132. var ret = results || [];
  1133. if ( arr != null ) {
  1134. if ( isArrayLike( Object( arr ) ) ) {
  1135. jQuery.merge( ret,
  1136. typeof arr === "string" ?
  1137. [ arr ] : arr
  1138. );
  1139. } else {
  1140. push.call( ret, arr );
  1141. }
  1142. }
  1143. return ret;
  1144. },
  1145. inArray: function( elem, arr, i ) {
  1146. return arr == null ? -1 : indexOf.call( arr, elem, i );
  1147. },
  1148. // Support: Android <=4.0 only, PhantomJS 1 only
  1149. // push.apply(_, arraylike) throws on ancient WebKit
  1150. merge: function( first, second ) {
  1151. var len = +second.length,
  1152. j = 0,
  1153. i = first.length;
  1154. for ( ; j < len; j++ ) {
  1155. first[ i++ ] = second[ j ];
  1156. }
  1157. first.length = i;
  1158. return first;
  1159. },
  1160. grep: function( elems, callback, invert ) {
  1161. var callbackInverse,
  1162. matches = [],
  1163. i = 0,
  1164. length = elems.length,
  1165. callbackExpect = !invert;
  1166. // Go through the array, only saving the items
  1167. // that pass the validator function
  1168. for ( ; i < length; i++ ) {
  1169. callbackInverse = !callback( elems[ i ], i );
  1170. if ( callbackInverse !== callbackExpect ) {
  1171. matches.push( elems[ i ] );
  1172. }
  1173. }
  1174. return matches;
  1175. },
  1176. // arg is for internal usage only
  1177. map: function( elems, callback, arg ) {
  1178. var length, value,
  1179. i = 0,
  1180. ret = [];
  1181. // Go through the array, translating each of the items to their new values
  1182. if ( isArrayLike( elems ) ) {
  1183. length = elems.length;
  1184. for ( ; i < length; i++ ) {
  1185. value = callback( elems[ i ], i, arg );
  1186. if ( value != null ) {
  1187. ret.push( value );
  1188. }
  1189. }
  1190. // Go through every key on the object,
  1191. } else {
  1192. for ( i in elems ) {
  1193. value = callback( elems[ i ], i, arg );
  1194. if ( value != null ) {
  1195. ret.push( value );
  1196. }
  1197. }
  1198. }
  1199. // Flatten any nested arrays
  1200. return concat.apply( [], ret );
  1201. },
  1202. // A global GUID counter for objects
  1203. guid: 1,
  1204. // jQuery.support is not used in Core but other projects attach their
  1205. // properties to it so it needs to exist.
  1206. support: support
  1207. } );
  1208. if ( typeof Symbol === "function" ) {
  1209. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  1210. }
  1211. // Populate the class2type map
  1212. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  1213. function( i, name ) {
  1214. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  1215. } );
  1216. function isArrayLike( obj ) {
  1217. // Support: real iOS 8.2 only (not reproducible in simulator)
  1218. // `in` check used to prevent JIT error (gh-2145)
  1219. // hasOwn isn't used here due to false negatives
  1220. // regarding Nodelist length in IE
  1221. var length = !!obj && "length" in obj && obj.length,
  1222. type = toType( obj );
  1223. if ( isFunction( obj ) || isWindow( obj ) ) {
  1224. return false;
  1225. }
  1226. return type === "array" || length === 0 ||
  1227. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  1228. }
  1229. var Sizzle =
  1230. /*!
  1231. * Sizzle CSS Selector Engine v2.3.4
  1232. * https://sizzlejs.com/
  1233. *
  1234. * Copyright JS Foundation and other contributors
  1235. * Released under the MIT license
  1236. * https://js.foundation/
  1237. *
  1238. * Date: 2019-04-08
  1239. */
  1240. (function( window ) {
  1241. var i,
  1242. support,
  1243. Expr,
  1244. getText,
  1245. isXML,
  1246. tokenize,
  1247. compile,
  1248. select,
  1249. outermostContext,
  1250. sortInput,
  1251. hasDuplicate,
  1252. // Local document vars
  1253. setDocument,
  1254. document,
  1255. docElem,
  1256. documentIsHTML,
  1257. rbuggyQSA,
  1258. rbuggyMatches,
  1259. matches,
  1260. contains,
  1261. // Instance-specific data
  1262. expando = "sizzle" + 1 * new Date(),
  1263. preferredDoc = window.document,
  1264. dirruns = 0,
  1265. done = 0,
  1266. classCache = createCache(),
  1267. tokenCache = createCache(),
  1268. compilerCache = createCache(),
  1269. nonnativeSelectorCache = createCache(),
  1270. sortOrder = function( a, b ) {
  1271. if ( a === b ) {
  1272. hasDuplicate = true;
  1273. }
  1274. return 0;
  1275. },
  1276. // Instance methods
  1277. hasOwn = ({}).hasOwnProperty,
  1278. arr = [],
  1279. pop = arr.pop,
  1280. push_native = arr.push,
  1281. push = arr.push,
  1282. slice = arr.slice,
  1283. // Use a stripped-down indexOf as it's faster than native
  1284. // https://jsperf.com/thor-indexof-vs-for/5
  1285. indexOf = function( list, elem ) {
  1286. var i = 0,
  1287. len = list.length;
  1288. for ( ; i < len; i++ ) {
  1289. if ( list[i] === elem ) {
  1290. return i;
  1291. }
  1292. }
  1293. return -1;
  1294. },
  1295. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  1296. // Regular expressions
  1297. // http://www.w3.org/TR/css3-selectors/#whitespace
  1298. whitespace = "[\\x20\\t\\r\\n\\f]",
  1299. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  1300. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  1301. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  1302. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  1303. // Operator (capture 2)
  1304. "*([*^$|!~]?=)" + whitespace +
  1305. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  1306. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  1307. "*\\]",
  1308. pseudos = ":(" + identifier + ")(?:\\((" +
  1309. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  1310. // 1. quoted (capture 3; capture 4 or capture 5)
  1311. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  1312. // 2. simple (capture 6)
  1313. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  1314. // 3. anything else (capture 2)
  1315. ".*" +
  1316. ")\\)|)",
  1317. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  1318. rwhitespace = new RegExp( whitespace + "+", "g" ),
  1319. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  1320. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  1321. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  1322. rdescend = new RegExp( whitespace + "|>" ),
  1323. rpseudo = new RegExp( pseudos ),
  1324. ridentifier = new RegExp( "^" + identifier + "$" ),
  1325. matchExpr = {
  1326. "ID": new RegExp( "^#(" + identifier + ")" ),
  1327. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  1328. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  1329. "ATTR": new RegExp( "^" + attributes ),
  1330. "PSEUDO": new RegExp( "^" + pseudos ),
  1331. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  1332. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  1333. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  1334. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  1335. // For use in libraries implementing .is()
  1336. // We use this for POS matching in `select`
  1337. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  1338. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  1339. },
  1340. rhtml = /HTML$/i,
  1341. rinputs = /^(?:input|select|textarea|button)$/i,
  1342. rheader = /^h\d$/i,
  1343. rnative = /^[^{]+\{\s*\[native \w/,
  1344. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  1345. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  1346. rsibling = /[+~]/,
  1347. // CSS escapes
  1348. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  1349. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  1350. funescape = function( _, escaped, escapedWhitespace ) {
  1351. var high = "0x" + escaped - 0x10000;
  1352. // NaN means non-codepoint
  1353. // Support: Firefox<24
  1354. // Workaround erroneous numeric interpretation of +"0x"
  1355. return high !== high || escapedWhitespace ?
  1356. escaped :
  1357. high < 0 ?
  1358. // BMP codepoint
  1359. String.fromCharCode( high + 0x10000 ) :
  1360. // Supplemental Plane codepoint (surrogate pair)
  1361. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  1362. },
  1363. // CSS string/identifier serialization
  1364. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  1365. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  1366. fcssescape = function( ch, asCodePoint ) {
  1367. if ( asCodePoint ) {
  1368. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  1369. if ( ch === "\0" ) {
  1370. return "\uFFFD";
  1371. }
  1372. // Control characters and (dependent upon position) numbers get escaped as code points
  1373. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  1374. }
  1375. // Other potentially-special ASCII characters get backslash-escaped
  1376. return "\\" + ch;
  1377. },
  1378. // Used for iframes
  1379. // See setDocument()
  1380. // Removing the function wrapper causes a "Permission Denied"
  1381. // error in IE
  1382. unloadHandler = function() {
  1383. setDocument();
  1384. },
  1385. inDisabledFieldset = addCombinator(
  1386. function( elem ) {
  1387. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  1388. },
  1389. { dir: "parentNode", next: "legend" }
  1390. );
  1391. // Optimize for push.apply( _, NodeList )
  1392. try {
  1393. push.apply(
  1394. (arr = slice.call( preferredDoc.childNodes )),
  1395. preferredDoc.childNodes
  1396. );
  1397. // Support: Android<4.0
  1398. // Detect silently failing push.apply
  1399. arr[ preferredDoc.childNodes.length ].nodeType;
  1400. } catch ( e ) {
  1401. push = { apply: arr.length ?
  1402. // Leverage slice if possible
  1403. function( target, els ) {
  1404. push_native.apply( target, slice.call(els) );
  1405. } :
  1406. // Support: IE<9
  1407. // Otherwise append directly
  1408. function( target, els ) {
  1409. var j = target.length,
  1410. i = 0;
  1411. // Can't trust NodeList.length
  1412. while ( (target[j++] = els[i++]) ) {}
  1413. target.length = j - 1;
  1414. }
  1415. };
  1416. }
  1417. function Sizzle( selector, context, results, seed ) {
  1418. var m, i, elem, nid, match, groups, newSelector,
  1419. newContext = context && context.ownerDocument,
  1420. // nodeType defaults to 9, since context defaults to document
  1421. nodeType = context ? context.nodeType : 9;
  1422. results = results || [];
  1423. // Return early from calls with invalid selector or context
  1424. if ( typeof selector !== "string" || !selector ||
  1425. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  1426. return results;
  1427. }
  1428. // Try to shortcut find operations (as opposed to filters) in HTML documents
  1429. if ( !seed ) {
  1430. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  1431. setDocument( context );
  1432. }
  1433. context = context || document;
  1434. if ( documentIsHTML ) {
  1435. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  1436. // (excepting DocumentFragment context, where the methods don't exist)
  1437. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  1438. // ID selector
  1439. if ( (m = match[1]) ) {
  1440. // Document context
  1441. if ( nodeType === 9 ) {
  1442. if ( (elem = context.getElementById( m )) ) {
  1443. // Support: IE, Opera, Webkit
  1444. // TODO: identify versions
  1445. // getElementById can match elements by name instead of ID
  1446. if ( elem.id === m ) {
  1447. results.push( elem );
  1448. return results;
  1449. }
  1450. } else {
  1451. return results;
  1452. }
  1453. // Element context
  1454. } else {
  1455. // Support: IE, Opera, Webkit
  1456. // TODO: identify versions
  1457. // getElementById can match elements by name instead of ID
  1458. if ( newContext && (elem = newContext.getElementById( m )) &&
  1459. contains( context, elem ) &&
  1460. elem.id === m ) {
  1461. results.push( elem );
  1462. return results;
  1463. }
  1464. }
  1465. // Type selector
  1466. } else if ( match[2] ) {
  1467. push.apply( results, context.getElementsByTagName( selector ) );
  1468. return results;
  1469. // Class selector
  1470. } else if ( (m = match[3]) && support.getElementsByClassName &&
  1471. context.getElementsByClassName ) {
  1472. push.apply( results, context.getElementsByClassName( m ) );
  1473. return results;
  1474. }
  1475. }
  1476. // Take advantage of querySelectorAll
  1477. if ( support.qsa &&
  1478. !nonnativeSelectorCache[ selector + " " ] &&
  1479. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  1480. // Support: IE 8 only
  1481. // Exclude object elements
  1482. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  1483. newSelector = selector;
  1484. newContext = context;
  1485. // qSA considers elements outside a scoping root when evaluating child or
  1486. // descendant combinators, which is not what we want.
  1487. // In such cases, we work around the behavior by prefixing every selector in the
  1488. // list with an ID selector referencing the scope context.
  1489. // Thanks to Andrew Dupont for this technique.
  1490. if ( nodeType === 1 && rdescend.test( selector ) ) {
  1491. // Capture the context ID, setting it first if necessary
  1492. if ( (nid = context.getAttribute( "id" )) ) {
  1493. nid = nid.replace( rcssescape, fcssescape );
  1494. } else {
  1495. context.setAttribute( "id", (nid = expando) );
  1496. }
  1497. // Prefix every selector in the list
  1498. groups = tokenize( selector );
  1499. i = groups.length;
  1500. while ( i-- ) {
  1501. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  1502. }
  1503. newSelector = groups.join( "," );
  1504. // Expand context for sibling selectors
  1505. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  1506. context;
  1507. }
  1508. try {
  1509. push.apply( results,
  1510. newContext.querySelectorAll( newSelector )
  1511. );
  1512. return results;
  1513. } catch ( qsaError ) {
  1514. nonnativeSelectorCache( selector, true );
  1515. } finally {
  1516. if ( nid === expando ) {
  1517. context.removeAttribute( "id" );
  1518. }
  1519. }
  1520. }
  1521. }
  1522. }
  1523. // All others
  1524. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  1525. }
  1526. /**
  1527. * Create key-value caches of limited size
  1528. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  1529. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1530. * deleting the oldest entry
  1531. */
  1532. function createCache() {
  1533. var keys = [];
  1534. function cache( key, value ) {
  1535. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  1536. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1537. // Only keep the most recent entries
  1538. delete cache[ keys.shift() ];
  1539. }
  1540. return (cache[ key + " " ] = value);
  1541. }
  1542. return cache;
  1543. }
  1544. /**
  1545. * Mark a function for special use by Sizzle
  1546. * @param {Function} fn The function to mark
  1547. */
  1548. function markFunction( fn ) {
  1549. fn[ expando ] = true;
  1550. return fn;
  1551. }
  1552. /**
  1553. * Support testing using an element
  1554. * @param {Function} fn Passed the created element and returns a boolean result
  1555. */
  1556. function assert( fn ) {
  1557. var el = document.createElement("fieldset");
  1558. try {
  1559. return !!fn( el );
  1560. } catch (e) {
  1561. return false;
  1562. } finally {
  1563. // Remove from its parent by default
  1564. if ( el.parentNode ) {
  1565. el.parentNode.removeChild( el );
  1566. }
  1567. // release memory in IE
  1568. el = null;
  1569. }
  1570. }
  1571. /**
  1572. * Adds the same handler for all of the specified attrs
  1573. * @param {String} attrs Pipe-separated list of attributes
  1574. * @param {Function} handler The method that will be applied
  1575. */
  1576. function addHandle( attrs, handler ) {
  1577. var arr = attrs.split("|"),
  1578. i = arr.length;
  1579. while ( i-- ) {
  1580. Expr.attrHandle[ arr[i] ] = handler;
  1581. }
  1582. }
  1583. /**
  1584. * Checks document order of two siblings
  1585. * @param {Element} a
  1586. * @param {Element} b
  1587. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  1588. */
  1589. function siblingCheck( a, b ) {
  1590. var cur = b && a,
  1591. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  1592. a.sourceIndex - b.sourceIndex;
  1593. // Use IE sourceIndex if available on both nodes
  1594. if ( diff ) {
  1595. return diff;
  1596. }
  1597. // Check if b follows a
  1598. if ( cur ) {
  1599. while ( (cur = cur.nextSibling) ) {
  1600. if ( cur === b ) {
  1601. return -1;
  1602. }
  1603. }
  1604. }
  1605. return a ? 1 : -1;
  1606. }
  1607. /**
  1608. * Returns a function to use in pseudos for input types
  1609. * @param {String} type
  1610. */
  1611. function createInputPseudo( type ) {
  1612. return function( elem ) {
  1613. var name = elem.nodeName.toLowerCase();
  1614. return name === "input" && elem.type === type;
  1615. };
  1616. }
  1617. /**
  1618. * Returns a function to use in pseudos for buttons
  1619. * @param {String} type
  1620. */
  1621. function createButtonPseudo( type ) {
  1622. return function( elem ) {
  1623. var name = elem.nodeName.toLowerCase();
  1624. return (name === "input" || name === "button") && elem.type === type;
  1625. };
  1626. }
  1627. /**
  1628. * Returns a function to use in pseudos for :enabled/:disabled
  1629. * @param {Boolean} disabled true for :disabled; false for :enabled
  1630. */
  1631. function createDisabledPseudo( disabled ) {
  1632. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  1633. return function( elem ) {
  1634. // Only certain elements can match :enabled or :disabled
  1635. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  1636. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  1637. if ( "form" in elem ) {
  1638. // Check for inherited disabledness on relevant non-disabled elements:
  1639. // * listed form-associated elements in a disabled fieldset
  1640. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  1641. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  1642. // * option elements in a disabled optgroup
  1643. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  1644. // All such elements have a "form" property.
  1645. if ( elem.parentNode && elem.disabled === false ) {
  1646. // Option elements defer to a parent optgroup if present
  1647. if ( "label" in elem ) {
  1648. if ( "label" in elem.parentNode ) {
  1649. return elem.parentNode.disabled === disabled;
  1650. } else {
  1651. return elem.disabled === disabled;
  1652. }
  1653. }
  1654. // Support: IE 6 - 11
  1655. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  1656. return elem.isDisabled === disabled ||
  1657. // Where there is no isDisabled, check manually
  1658. /* jshint -W018 */
  1659. elem.isDisabled !== !disabled &&
  1660. inDisabledFieldset( elem ) === disabled;
  1661. }
  1662. return elem.disabled === disabled;
  1663. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  1664. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  1665. // even exist on them, let alone have a boolean value.
  1666. } else if ( "label" in elem ) {
  1667. return elem.disabled === disabled;
  1668. }
  1669. // Remaining elements are neither :enabled nor :disabled
  1670. return false;
  1671. };
  1672. }
  1673. /**
  1674. * Returns a function to use in pseudos for positionals
  1675. * @param {Function} fn
  1676. */
  1677. function createPositionalPseudo( fn ) {
  1678. return markFunction(function( argument ) {
  1679. argument = +argument;
  1680. return markFunction(function( seed, matches ) {
  1681. var j,
  1682. matchIndexes = fn( [], seed.length, argument ),
  1683. i = matchIndexes.length;
  1684. // Match elements found at the specified indexes
  1685. while ( i-- ) {
  1686. if ( seed[ (j = matchIndexes[i]) ] ) {
  1687. seed[j] = !(matches[j] = seed[j]);
  1688. }
  1689. }
  1690. });
  1691. });
  1692. }
  1693. /**
  1694. * Checks a node for validity as a Sizzle context
  1695. * @param {Element|Object=} context
  1696. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  1697. */
  1698. function testContext( context ) {
  1699. return context && typeof context.getElementsByTagName !== "undefined" && context;
  1700. }
  1701. // Expose support vars for convenience
  1702. support = Sizzle.support = {};
  1703. /**
  1704. * Detects XML nodes
  1705. * @param {Element|Object} elem An element or a document
  1706. * @returns {Boolean} True iff elem is a non-HTML XML node
  1707. */
  1708. isXML = Sizzle.isXML = function( elem ) {
  1709. var namespace = elem.namespaceURI,
  1710. docElem = (elem.ownerDocument || elem).documentElement;
  1711. // Support: IE <=8
  1712. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  1713. // https://bugs.jquery.com/ticket/4833
  1714. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  1715. };
  1716. /**
  1717. * Sets document-related variables once based on the current document
  1718. * @param {Element|Object} [doc] An element or document object to use to set the document
  1719. * @returns {Object} Returns the current document
  1720. */
  1721. setDocument = Sizzle.setDocument = function( node ) {
  1722. var hasCompare, subWindow,
  1723. doc = node ? node.ownerDocument || node : preferredDoc;
  1724. // Return early if doc is invalid or already selected
  1725. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  1726. return document;
  1727. }
  1728. // Update global variables
  1729. document = doc;
  1730. docElem = document.documentElement;
  1731. documentIsHTML = !isXML( document );
  1732. // Support: IE 9-11, Edge
  1733. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  1734. if ( preferredDoc !== document &&
  1735. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  1736. // Support: IE 11, Edge
  1737. if ( subWindow.addEventListener ) {
  1738. subWindow.addEventListener( "unload", unloadHandler, false );
  1739. // Support: IE 9 - 10 only
  1740. } else if ( subWindow.attachEvent ) {
  1741. subWindow.attachEvent( "onunload", unloadHandler );
  1742. }
  1743. }
  1744. /* Attributes
  1745. ---------------------------------------------------------------------- */
  1746. // Support: IE<8
  1747. // Verify that getAttribute really returns attributes and not properties
  1748. // (excepting IE8 booleans)
  1749. support.attributes = assert(function( el ) {
  1750. el.className = "i";
  1751. return !el.getAttribute("className");
  1752. });
  1753. /* getElement(s)By*
  1754. ---------------------------------------------------------------------- */
  1755. // Check if getElementsByTagName("*") returns only elements
  1756. support.getElementsByTagName = assert(function( el ) {
  1757. el.appendChild( document.createComment("") );
  1758. return !el.getElementsByTagName("*").length;
  1759. });
  1760. // Support: IE<9
  1761. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  1762. // Support: IE<10
  1763. // Check if getElementById returns elements by name
  1764. // The broken getElementById methods don't pick up programmatically-set names,
  1765. // so use a roundabout getElementsByName test
  1766. support.getById = assert(function( el ) {
  1767. docElem.appendChild( el ).id = expando;
  1768. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  1769. });
  1770. // ID filter and find
  1771. if ( support.getById ) {
  1772. Expr.filter["ID"] = function( id ) {
  1773. var attrId = id.replace( runescape, funescape );
  1774. return function( elem ) {
  1775. return elem.getAttribute("id") === attrId;
  1776. };
  1777. };
  1778. Expr.find["ID"] = function( id, context ) {
  1779. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1780. var elem = context.getElementById( id );
  1781. return elem ? [ elem ] : [];
  1782. }
  1783. };
  1784. } else {
  1785. Expr.filter["ID"] = function( id ) {
  1786. var attrId = id.replace( runescape, funescape );
  1787. return function( elem ) {
  1788. var node = typeof elem.getAttributeNode !== "undefined" &&
  1789. elem.getAttributeNode("id");
  1790. return node && node.value === attrId;
  1791. };
  1792. };
  1793. // Support: IE 6 - 7 only
  1794. // getElementById is not reliable as a find shortcut
  1795. Expr.find["ID"] = function( id, context ) {
  1796. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1797. var node, i, elems,
  1798. elem = context.getElementById( id );
  1799. if ( elem ) {
  1800. // Verify the id attribute
  1801. node = elem.getAttributeNode("id");
  1802. if ( node && node.value === id ) {
  1803. return [ elem ];
  1804. }
  1805. // Fall back on getElementsByName
  1806. elems = context.getElementsByName( id );
  1807. i = 0;
  1808. while ( (elem = elems[i++]) ) {
  1809. node = elem.getAttributeNode("id");
  1810. if ( node && node.value === id ) {
  1811. return [ elem ];
  1812. }
  1813. }
  1814. }
  1815. return [];
  1816. }
  1817. };
  1818. }
  1819. // Tag
  1820. Expr.find["TAG"] = support.getElementsByTagName ?
  1821. function( tag, context ) {
  1822. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1823. return context.getElementsByTagName( tag );
  1824. // DocumentFragment nodes don't have gEBTN
  1825. } else if ( support.qsa ) {
  1826. return context.querySelectorAll( tag );
  1827. }
  1828. } :
  1829. function( tag, context ) {
  1830. var elem,
  1831. tmp = [],
  1832. i = 0,
  1833. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  1834. results = context.getElementsByTagName( tag );
  1835. // Filter out possible comments
  1836. if ( tag === "*" ) {
  1837. while ( (elem = results[i++]) ) {
  1838. if ( elem.nodeType === 1 ) {
  1839. tmp.push( elem );
  1840. }
  1841. }
  1842. return tmp;
  1843. }
  1844. return results;
  1845. };
  1846. // Class
  1847. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  1848. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1849. return context.getElementsByClassName( className );
  1850. }
  1851. };
  1852. /* QSA/matchesSelector
  1853. ---------------------------------------------------------------------- */
  1854. // QSA and matchesSelector support
  1855. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1856. rbuggyMatches = [];
  1857. // qSa(:focus) reports false when true (Chrome 21)
  1858. // We allow this because of a bug in IE8/9 that throws an error
  1859. // whenever `document.activeElement` is accessed on an iframe
  1860. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1861. // See https://bugs.jquery.com/ticket/13378
  1862. rbuggyQSA = [];
  1863. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1864. // Build QSA regex
  1865. // Regex strategy adopted from Diego Perini
  1866. assert(function( el ) {
  1867. // Select is set to empty string on purpose
  1868. // This is to test IE's treatment of not explicitly
  1869. // setting a boolean content attribute,
  1870. // since its presence should be enough
  1871. // https://bugs.jquery.com/ticket/12359
  1872. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1873. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1874. "<option selected=''></option></select>";
  1875. // Support: IE8, Opera 11-12.16
  1876. // Nothing should be selected when empty strings follow ^= or $= or *=
  1877. // The test attribute must be unknown in Opera but "safe" for WinRT
  1878. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1879. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1880. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1881. }
  1882. // Support: IE8
  1883. // Boolean attributes and "value" are not treated correctly
  1884. if ( !el.querySelectorAll("[selected]").length ) {
  1885. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1886. }
  1887. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1888. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1889. rbuggyQSA.push("~=");
  1890. }
  1891. // Webkit/Opera - :checked should return selected option elements
  1892. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1893. // IE8 throws error here and will not see later tests
  1894. if ( !el.querySelectorAll(":checked").length ) {
  1895. rbuggyQSA.push(":checked");
  1896. }
  1897. // Support: Safari 8+, iOS 8+
  1898. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1899. // In-page `selector#id sibling-combinator selector` fails
  1900. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1901. rbuggyQSA.push(".#.+[+~]");
  1902. }
  1903. });
  1904. assert(function( el ) {
  1905. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1906. "<select disabled='disabled'><option/></select>";
  1907. // Support: Windows 8 Native Apps
  1908. // The type and name attributes are restricted during .innerHTML assignment
  1909. var input = document.createElement("input");
  1910. input.setAttribute( "type", "hidden" );
  1911. el.appendChild( input ).setAttribute( "name", "D" );
  1912. // Support: IE8
  1913. // Enforce case-sensitivity of name attribute
  1914. if ( el.querySelectorAll("[name=d]").length ) {
  1915. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1916. }
  1917. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1918. // IE8 throws error here and will not see later tests
  1919. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1920. rbuggyQSA.push( ":enabled", ":disabled" );
  1921. }
  1922. // Support: IE9-11+
  1923. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1924. docElem.appendChild( el ).disabled = true;
  1925. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1926. rbuggyQSA.push( ":enabled", ":disabled" );
  1927. }
  1928. // Opera 10-11 does not throw on post-comma invalid pseudos
  1929. el.querySelectorAll("*,:x");
  1930. rbuggyQSA.push(",.*:");
  1931. });
  1932. }
  1933. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1934. docElem.webkitMatchesSelector ||
  1935. docElem.mozMatchesSelector ||
  1936. docElem.oMatchesSelector ||
  1937. docElem.msMatchesSelector) )) ) {
  1938. assert(function( el ) {
  1939. // Check to see if it's possible to do matchesSelector
  1940. // on a disconnected node (IE 9)
  1941. support.disconnectedMatch = matches.call( el, "*" );
  1942. // This should fail with an exception
  1943. // Gecko does not error, returns false instead
  1944. matches.call( el, "[s!='']:x" );
  1945. rbuggyMatches.push( "!=", pseudos );
  1946. });
  1947. }
  1948. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1949. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1950. /* Contains
  1951. ---------------------------------------------------------------------- */
  1952. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1953. // Element contains another
  1954. // Purposefully self-exclusive
  1955. // As in, an element does not contain itself
  1956. contains = hasCompare || rnative.test( docElem.contains ) ?
  1957. function( a, b ) {
  1958. var adown = a.nodeType === 9 ? a.documentElement : a,
  1959. bup = b && b.parentNode;
  1960. return a === bup || !!( bup && bup.nodeType === 1 && (
  1961. adown.contains ?
  1962. adown.contains( bup ) :
  1963. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1964. ));
  1965. } :
  1966. function( a, b ) {
  1967. if ( b ) {
  1968. while ( (b = b.parentNode) ) {
  1969. if ( b === a ) {
  1970. return true;
  1971. }
  1972. }
  1973. }
  1974. return false;
  1975. };
  1976. /* Sorting
  1977. ---------------------------------------------------------------------- */
  1978. // Document order sorting
  1979. sortOrder = hasCompare ?
  1980. function( a, b ) {
  1981. // Flag for duplicate removal
  1982. if ( a === b ) {
  1983. hasDuplicate = true;
  1984. return 0;
  1985. }
  1986. // Sort on method existence if only one input has compareDocumentPosition
  1987. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1988. if ( compare ) {
  1989. return compare;
  1990. }
  1991. // Calculate position if both inputs belong to the same document
  1992. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1993. a.compareDocumentPosition( b ) :
  1994. // Otherwise we know they are disconnected
  1995. 1;
  1996. // Disconnected nodes
  1997. if ( compare & 1 ||
  1998. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1999. // Choose the first element that is related to our preferred document
  2000. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  2001. return -1;
  2002. }
  2003. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  2004. return 1;
  2005. }
  2006. // Maintain original order
  2007. return sortInput ?
  2008. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  2009. 0;
  2010. }
  2011. return compare & 4 ? -1 : 1;
  2012. } :
  2013. function( a, b ) {
  2014. // Exit early if the nodes are identical
  2015. if ( a === b ) {
  2016. hasDuplicate = true;
  2017. return 0;
  2018. }
  2019. var cur,
  2020. i = 0,
  2021. aup = a.parentNode,
  2022. bup = b.parentNode,
  2023. ap = [ a ],
  2024. bp = [ b ];
  2025. // Parentless nodes are either documents or disconnected
  2026. if ( !aup || !bup ) {
  2027. return a === document ? -1 :
  2028. b === document ? 1 :
  2029. aup ? -1 :
  2030. bup ? 1 :
  2031. sortInput ?
  2032. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  2033. 0;
  2034. // If the nodes are siblings, we can do a quick check
  2035. } else if ( aup === bup ) {
  2036. return siblingCheck( a, b );
  2037. }
  2038. // Otherwise we need full lists of their ancestors for comparison
  2039. cur = a;
  2040. while ( (cur = cur.parentNode) ) {
  2041. ap.unshift( cur );
  2042. }
  2043. cur = b;
  2044. while ( (cur = cur.parentNode) ) {
  2045. bp.unshift( cur );
  2046. }
  2047. // Walk down the tree looking for a discrepancy
  2048. while ( ap[i] === bp[i] ) {
  2049. i++;
  2050. }
  2051. return i ?
  2052. // Do a sibling check if the nodes have a common ancestor
  2053. siblingCheck( ap[i], bp[i] ) :
  2054. // Otherwise nodes in our document sort first
  2055. ap[i] === preferredDoc ? -1 :
  2056. bp[i] === preferredDoc ? 1 :
  2057. 0;
  2058. };
  2059. return document;
  2060. };
  2061. Sizzle.matches = function( expr, elements ) {
  2062. return Sizzle( expr, null, null, elements );
  2063. };
  2064. Sizzle.matchesSelector = function( elem, expr ) {
  2065. // Set document vars if needed
  2066. if ( ( elem.ownerDocument || elem ) !== document ) {
  2067. setDocument( elem );
  2068. }
  2069. if ( support.matchesSelector && documentIsHTML &&
  2070. !nonnativeSelectorCache[ expr + " " ] &&
  2071. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  2072. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  2073. try {
  2074. var ret = matches.call( elem, expr );
  2075. // IE 9's matchesSelector returns false on disconnected nodes
  2076. if ( ret || support.disconnectedMatch ||
  2077. // As well, disconnected nodes are said to be in a document
  2078. // fragment in IE 9
  2079. elem.document && elem.document.nodeType !== 11 ) {
  2080. return ret;
  2081. }
  2082. } catch (e) {
  2083. nonnativeSelectorCache( expr, true );
  2084. }
  2085. }
  2086. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  2087. };
  2088. Sizzle.contains = function( context, elem ) {
  2089. // Set document vars if needed
  2090. if ( ( context.ownerDocument || context ) !== document ) {
  2091. setDocument( context );
  2092. }
  2093. return contains( context, elem );
  2094. };
  2095. Sizzle.attr = function( elem, name ) {
  2096. // Set document vars if needed
  2097. if ( ( elem.ownerDocument || elem ) !== document ) {
  2098. setDocument( elem );
  2099. }
  2100. var fn = Expr.attrHandle[ name.toLowerCase() ],
  2101. // Don't get fooled by Object.prototype properties (jQuery #13807)
  2102. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  2103. fn( elem, name, !documentIsHTML ) :
  2104. undefined;
  2105. return val !== undefined ?
  2106. val :
  2107. support.attributes || !documentIsHTML ?
  2108. elem.getAttribute( name ) :
  2109. (val = elem.getAttributeNode(name)) && val.specified ?
  2110. val.value :
  2111. null;
  2112. };
  2113. Sizzle.escape = function( sel ) {
  2114. return (sel + "").replace( rcssescape, fcssescape );
  2115. };
  2116. Sizzle.error = function( msg ) {
  2117. throw new Error( "Syntax error, unrecognized expression: " + msg );
  2118. };
  2119. /**
  2120. * Document sorting and removing duplicates
  2121. * @param {ArrayLike} results
  2122. */
  2123. Sizzle.uniqueSort = function( results ) {
  2124. var elem,
  2125. duplicates = [],
  2126. j = 0,
  2127. i = 0;
  2128. // Unless we *know* we can detect duplicates, assume their presence
  2129. hasDuplicate = !support.detectDuplicates;
  2130. sortInput = !support.sortStable && results.slice( 0 );
  2131. results.sort( sortOrder );
  2132. if ( hasDuplicate ) {
  2133. while ( (elem = results[i++]) ) {
  2134. if ( elem === results[ i ] ) {
  2135. j = duplicates.push( i );
  2136. }
  2137. }
  2138. while ( j-- ) {
  2139. results.splice( duplicates[ j ], 1 );
  2140. }
  2141. }
  2142. // Clear input after sorting to release objects
  2143. // See https://github.com/jquery/sizzle/pull/225
  2144. sortInput = null;
  2145. return results;
  2146. };
  2147. /**
  2148. * Utility function for retrieving the text value of an array of DOM nodes
  2149. * @param {Array|Element} elem
  2150. */
  2151. getText = Sizzle.getText = function( elem ) {
  2152. var node,
  2153. ret = "",
  2154. i = 0,
  2155. nodeType = elem.nodeType;
  2156. if ( !nodeType ) {
  2157. // If no nodeType, this is expected to be an array
  2158. while ( (node = elem[i++]) ) {
  2159. // Do not traverse comment nodes
  2160. ret += getText( node );
  2161. }
  2162. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  2163. // Use textContent for elements
  2164. // innerText usage removed for consistency of new lines (jQuery #11153)
  2165. if ( typeof elem.textContent === "string" ) {
  2166. return elem.textContent;
  2167. } else {
  2168. // Traverse its children
  2169. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2170. ret += getText( elem );
  2171. }
  2172. }
  2173. } else if ( nodeType === 3 || nodeType === 4 ) {
  2174. return elem.nodeValue;
  2175. }
  2176. // Do not include comment or processing instruction nodes
  2177. return ret;
  2178. };
  2179. Expr = Sizzle.selectors = {
  2180. // Can be adjusted by the user
  2181. cacheLength: 50,
  2182. createPseudo: markFunction,
  2183. match: matchExpr,
  2184. attrHandle: {},
  2185. find: {},
  2186. relative: {
  2187. ">": { dir: "parentNode", first: true },
  2188. " ": { dir: "parentNode" },
  2189. "+": { dir: "previousSibling", first: true },
  2190. "~": { dir: "previousSibling" }
  2191. },
  2192. preFilter: {
  2193. "ATTR": function( match ) {
  2194. match[1] = match[1].replace( runescape, funescape );
  2195. // Move the given value to match[3] whether quoted or unquoted
  2196. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  2197. if ( match[2] === "~=" ) {
  2198. match[3] = " " + match[3] + " ";
  2199. }
  2200. return match.slice( 0, 4 );
  2201. },
  2202. "CHILD": function( match ) {
  2203. /* matches from matchExpr["CHILD"]
  2204. 1 type (only|nth|...)
  2205. 2 what (child|of-type)
  2206. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  2207. 4 xn-component of xn+y argument ([+-]?\d*n|)
  2208. 5 sign of xn-component
  2209. 6 x of xn-component
  2210. 7 sign of y-component
  2211. 8 y of y-component
  2212. */
  2213. match[1] = match[1].toLowerCase();
  2214. if ( match[1].slice( 0, 3 ) === "nth" ) {
  2215. // nth-* requires argument
  2216. if ( !match[3] ) {
  2217. Sizzle.error( match[0] );
  2218. }
  2219. // numeric x and y parameters for Expr.filter.CHILD
  2220. // remember that false/true cast respectively to 0/1
  2221. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  2222. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  2223. // other types prohibit arguments
  2224. } else if ( match[3] ) {
  2225. Sizzle.error( match[0] );
  2226. }
  2227. return match;
  2228. },
  2229. "PSEUDO": function( match ) {
  2230. var excess,
  2231. unquoted = !match[6] && match[2];
  2232. if ( matchExpr["CHILD"].test( match[0] ) ) {
  2233. return null;
  2234. }
  2235. // Accept quoted arguments as-is
  2236. if ( match[3] ) {
  2237. match[2] = match[4] || match[5] || "";
  2238. // Strip excess characters from unquoted arguments
  2239. } else if ( unquoted && rpseudo.test( unquoted ) &&
  2240. // Get excess from tokenize (recursively)
  2241. (excess = tokenize( unquoted, true )) &&
  2242. // advance to the next closing parenthesis
  2243. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  2244. // excess is a negative index
  2245. match[0] = match[0].slice( 0, excess );
  2246. match[2] = unquoted.slice( 0, excess );
  2247. }
  2248. // Return only captures needed by the pseudo filter method (type and argument)
  2249. return match.slice( 0, 3 );
  2250. }
  2251. },
  2252. filter: {
  2253. "TAG": function( nodeNameSelector ) {
  2254. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  2255. return nodeNameSelector === "*" ?
  2256. function() { return true; } :
  2257. function( elem ) {
  2258. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  2259. };
  2260. },
  2261. "CLASS": function( className ) {
  2262. var pattern = classCache[ className + " " ];
  2263. return pattern ||
  2264. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  2265. classCache( className, function( elem ) {
  2266. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  2267. });
  2268. },
  2269. "ATTR": function( name, operator, check ) {
  2270. return function( elem ) {
  2271. var result = Sizzle.attr( elem, name );
  2272. if ( result == null ) {
  2273. return operator === "!=";
  2274. }
  2275. if ( !operator ) {
  2276. return true;
  2277. }
  2278. result += "";
  2279. return operator === "=" ? result === check :
  2280. operator === "!=" ? result !== check :
  2281. operator === "^=" ? check && result.indexOf( check ) === 0 :
  2282. operator === "*=" ? check && result.indexOf( check ) > -1 :
  2283. operator === "$=" ? check && result.slice( -check.length ) === check :
  2284. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  2285. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  2286. false;
  2287. };
  2288. },
  2289. "CHILD": function( type, what, argument, first, last ) {
  2290. var simple = type.slice( 0, 3 ) !== "nth",
  2291. forward = type.slice( -4 ) !== "last",
  2292. ofType = what === "of-type";
  2293. return first === 1 && last === 0 ?
  2294. // Shortcut for :nth-*(n)
  2295. function( elem ) {
  2296. return !!elem.parentNode;
  2297. } :
  2298. function( elem, context, xml ) {
  2299. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  2300. dir = simple !== forward ? "nextSibling" : "previousSibling",
  2301. parent = elem.parentNode,
  2302. name = ofType && elem.nodeName.toLowerCase(),
  2303. useCache = !xml && !ofType,
  2304. diff = false;
  2305. if ( parent ) {
  2306. // :(first|last|only)-(child|of-type)
  2307. if ( simple ) {
  2308. while ( dir ) {
  2309. node = elem;
  2310. while ( (node = node[ dir ]) ) {
  2311. if ( ofType ?
  2312. node.nodeName.toLowerCase() === name :
  2313. node.nodeType === 1 ) {
  2314. return false;
  2315. }
  2316. }
  2317. // Reverse direction for :only-* (if we haven't yet done so)
  2318. start = dir = type === "only" && !start && "nextSibling";
  2319. }
  2320. return true;
  2321. }
  2322. start = [ forward ? parent.firstChild : parent.lastChild ];
  2323. // non-xml :nth-child(...) stores cache data on `parent`
  2324. if ( forward && useCache ) {
  2325. // Seek `elem` from a previously-cached index
  2326. // ...in a gzip-friendly way
  2327. node = parent;
  2328. outerCache = node[ expando ] || (node[ expando ] = {});
  2329. // Support: IE <9 only
  2330. // Defend against cloned attroperties (jQuery gh-1709)
  2331. uniqueCache = outerCache[ node.uniqueID ] ||
  2332. (outerCache[ node.uniqueID ] = {});
  2333. cache = uniqueCache[ type ] || [];
  2334. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2335. diff = nodeIndex && cache[ 2 ];
  2336. node = nodeIndex && parent.childNodes[ nodeIndex ];
  2337. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2338. // Fallback to seeking `elem` from the start
  2339. (diff = nodeIndex = 0) || start.pop()) ) {
  2340. // When found, cache indexes on `parent` and break
  2341. if ( node.nodeType === 1 && ++diff && node === elem ) {
  2342. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  2343. break;
  2344. }
  2345. }
  2346. } else {
  2347. // Use previously-cached element index if available
  2348. if ( useCache ) {
  2349. // ...in a gzip-friendly way
  2350. node = elem;
  2351. outerCache = node[ expando ] || (node[ expando ] = {});
  2352. // Support: IE <9 only
  2353. // Defend against cloned attroperties (jQuery gh-1709)
  2354. uniqueCache = outerCache[ node.uniqueID ] ||
  2355. (outerCache[ node.uniqueID ] = {});
  2356. cache = uniqueCache[ type ] || [];
  2357. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2358. diff = nodeIndex;
  2359. }
  2360. // xml :nth-child(...)
  2361. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  2362. if ( diff === false ) {
  2363. // Use the same loop as above to seek `elem` from the start
  2364. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2365. (diff = nodeIndex = 0) || start.pop()) ) {
  2366. if ( ( ofType ?
  2367. node.nodeName.toLowerCase() === name :
  2368. node.nodeType === 1 ) &&
  2369. ++diff ) {
  2370. // Cache the index of each encountered element
  2371. if ( useCache ) {
  2372. outerCache = node[ expando ] || (node[ expando ] = {});
  2373. // Support: IE <9 only
  2374. // Defend against cloned attroperties (jQuery gh-1709)
  2375. uniqueCache = outerCache[ node.uniqueID ] ||
  2376. (outerCache[ node.uniqueID ] = {});
  2377. uniqueCache[ type ] = [ dirruns, diff ];
  2378. }
  2379. if ( node === elem ) {
  2380. break;
  2381. }
  2382. }
  2383. }
  2384. }
  2385. }
  2386. // Incorporate the offset, then check against cycle size
  2387. diff -= last;
  2388. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  2389. }
  2390. };
  2391. },
  2392. "PSEUDO": function( pseudo, argument ) {
  2393. // pseudo-class names are case-insensitive
  2394. // http://www.w3.org/TR/selectors/#pseudo-classes
  2395. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  2396. // Remember that setFilters inherits from pseudos
  2397. var args,
  2398. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  2399. Sizzle.error( "unsupported pseudo: " + pseudo );
  2400. // The user may use createPseudo to indicate that
  2401. // arguments are needed to create the filter function
  2402. // just as Sizzle does
  2403. if ( fn[ expando ] ) {
  2404. return fn( argument );
  2405. }
  2406. // But maintain support for old signatures
  2407. if ( fn.length > 1 ) {
  2408. args = [ pseudo, pseudo, "", argument ];
  2409. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  2410. markFunction(function( seed, matches ) {
  2411. var idx,
  2412. matched = fn( seed, argument ),
  2413. i = matched.length;
  2414. while ( i-- ) {
  2415. idx = indexOf( seed, matched[i] );
  2416. seed[ idx ] = !( matches[ idx ] = matched[i] );
  2417. }
  2418. }) :
  2419. function( elem ) {
  2420. return fn( elem, 0, args );
  2421. };
  2422. }
  2423. return fn;
  2424. }
  2425. },
  2426. pseudos: {
  2427. // Potentially complex pseudos
  2428. "not": markFunction(function( selector ) {
  2429. // Trim the selector passed to compile
  2430. // to avoid treating leading and trailing
  2431. // spaces as combinators
  2432. var input = [],
  2433. results = [],
  2434. matcher = compile( selector.replace( rtrim, "$1" ) );
  2435. return matcher[ expando ] ?
  2436. markFunction(function( seed, matches, context, xml ) {
  2437. var elem,
  2438. unmatched = matcher( seed, null, xml, [] ),
  2439. i = seed.length;
  2440. // Match elements unmatched by `matcher`
  2441. while ( i-- ) {
  2442. if ( (elem = unmatched[i]) ) {
  2443. seed[i] = !(matches[i] = elem);
  2444. }
  2445. }
  2446. }) :
  2447. function( elem, context, xml ) {
  2448. input[0] = elem;
  2449. matcher( input, null, xml, results );
  2450. // Don't keep the element (issue #299)
  2451. input[0] = null;
  2452. return !results.pop();
  2453. };
  2454. }),
  2455. "has": markFunction(function( selector ) {
  2456. return function( elem ) {
  2457. return Sizzle( selector, elem ).length > 0;
  2458. };
  2459. }),
  2460. "contains": markFunction(function( text ) {
  2461. text = text.replace( runescape, funescape );
  2462. return function( elem ) {
  2463. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  2464. };
  2465. }),
  2466. // "Whether an element is represented by a :lang() selector
  2467. // is based solely on the element's language value
  2468. // being equal to the identifier C,
  2469. // or beginning with the identifier C immediately followed by "-".
  2470. // The matching of C against the element's language value is performed case-insensitively.
  2471. // The identifier C does not have to be a valid language name."
  2472. // http://www.w3.org/TR/selectors/#lang-pseudo
  2473. "lang": markFunction( function( lang ) {
  2474. // lang value must be a valid identifier
  2475. if ( !ridentifier.test(lang || "") ) {
  2476. Sizzle.error( "unsupported lang: " + lang );
  2477. }
  2478. lang = lang.replace( runescape, funescape ).toLowerCase();
  2479. return function( elem ) {
  2480. var elemLang;
  2481. do {
  2482. if ( (elemLang = documentIsHTML ?
  2483. elem.lang :
  2484. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  2485. elemLang = elemLang.toLowerCase();
  2486. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  2487. }
  2488. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  2489. return false;
  2490. };
  2491. }),
  2492. // Miscellaneous
  2493. "target": function( elem ) {
  2494. var hash = window.location && window.location.hash;
  2495. return hash && hash.slice( 1 ) === elem.id;
  2496. },
  2497. "root": function( elem ) {
  2498. return elem === docElem;
  2499. },
  2500. "focus": function( elem ) {
  2501. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  2502. },
  2503. // Boolean properties
  2504. "enabled": createDisabledPseudo( false ),
  2505. "disabled": createDisabledPseudo( true ),
  2506. "checked": function( elem ) {
  2507. // In CSS3, :checked should return both checked and selected elements
  2508. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2509. var nodeName = elem.nodeName.toLowerCase();
  2510. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  2511. },
  2512. "selected": function( elem ) {
  2513. // Accessing this property makes selected-by-default
  2514. // options in Safari work properly
  2515. if ( elem.parentNode ) {
  2516. elem.parentNode.selectedIndex;
  2517. }
  2518. return elem.selected === true;
  2519. },
  2520. // Contents
  2521. "empty": function( elem ) {
  2522. // http://www.w3.org/TR/selectors/#empty-pseudo
  2523. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  2524. // but not by others (comment: 8; processing instruction: 7; etc.)
  2525. // nodeType < 6 works because attributes (2) do not appear as children
  2526. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2527. if ( elem.nodeType < 6 ) {
  2528. return false;
  2529. }
  2530. }
  2531. return true;
  2532. },
  2533. "parent": function( elem ) {
  2534. return !Expr.pseudos["empty"]( elem );
  2535. },
  2536. // Element/input types
  2537. "header": function( elem ) {
  2538. return rheader.test( elem.nodeName );
  2539. },
  2540. "input": function( elem ) {
  2541. return rinputs.test( elem.nodeName );
  2542. },
  2543. "button": function( elem ) {
  2544. var name = elem.nodeName.toLowerCase();
  2545. return name === "input" && elem.type === "button" || name === "button";
  2546. },
  2547. "text": function( elem ) {
  2548. var attr;
  2549. return elem.nodeName.toLowerCase() === "input" &&
  2550. elem.type === "text" &&
  2551. // Support: IE<8
  2552. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  2553. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  2554. },
  2555. // Position-in-collection
  2556. "first": createPositionalPseudo(function() {
  2557. return [ 0 ];
  2558. }),
  2559. "last": createPositionalPseudo(function( matchIndexes, length ) {
  2560. return [ length - 1 ];
  2561. }),
  2562. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2563. return [ argument < 0 ? argument + length : argument ];
  2564. }),
  2565. "even": createPositionalPseudo(function( matchIndexes, length ) {
  2566. var i = 0;
  2567. for ( ; i < length; i += 2 ) {
  2568. matchIndexes.push( i );
  2569. }
  2570. return matchIndexes;
  2571. }),
  2572. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  2573. var i = 1;
  2574. for ( ; i < length; i += 2 ) {
  2575. matchIndexes.push( i );
  2576. }
  2577. return matchIndexes;
  2578. }),
  2579. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2580. var i = argument < 0 ?
  2581. argument + length :
  2582. argument > length ?
  2583. length :
  2584. argument;
  2585. for ( ; --i >= 0; ) {
  2586. matchIndexes.push( i );
  2587. }
  2588. return matchIndexes;
  2589. }),
  2590. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2591. var i = argument < 0 ? argument + length : argument;
  2592. for ( ; ++i < length; ) {
  2593. matchIndexes.push( i );
  2594. }
  2595. return matchIndexes;
  2596. })
  2597. }
  2598. };
  2599. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  2600. // Add button/input type pseudos
  2601. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  2602. Expr.pseudos[ i ] = createInputPseudo( i );
  2603. }
  2604. for ( i in { submit: true, reset: true } ) {
  2605. Expr.pseudos[ i ] = createButtonPseudo( i );
  2606. }
  2607. // Easy API for creating new setFilters
  2608. function setFilters() {}
  2609. setFilters.prototype = Expr.filters = Expr.pseudos;
  2610. Expr.setFilters = new setFilters();
  2611. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  2612. var matched, match, tokens, type,
  2613. soFar, groups, preFilters,
  2614. cached = tokenCache[ selector + " " ];
  2615. if ( cached ) {
  2616. return parseOnly ? 0 : cached.slice( 0 );
  2617. }
  2618. soFar = selector;
  2619. groups = [];
  2620. preFilters = Expr.preFilter;
  2621. while ( soFar ) {
  2622. // Comma and first run
  2623. if ( !matched || (match = rcomma.exec( soFar )) ) {
  2624. if ( match ) {
  2625. // Don't consume trailing commas as valid
  2626. soFar = soFar.slice( match[0].length ) || soFar;
  2627. }
  2628. groups.push( (tokens = []) );
  2629. }
  2630. matched = false;
  2631. // Combinators
  2632. if ( (match = rcombinators.exec( soFar )) ) {
  2633. matched = match.shift();
  2634. tokens.push({
  2635. value: matched,
  2636. // Cast descendant combinators to space
  2637. type: match[0].replace( rtrim, " " )
  2638. });
  2639. soFar = soFar.slice( matched.length );
  2640. }
  2641. // Filters
  2642. for ( type in Expr.filter ) {
  2643. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  2644. (match = preFilters[ type ]( match ))) ) {
  2645. matched = match.shift();
  2646. tokens.push({
  2647. value: matched,
  2648. type: type,
  2649. matches: match
  2650. });
  2651. soFar = soFar.slice( matched.length );
  2652. }
  2653. }
  2654. if ( !matched ) {
  2655. break;
  2656. }
  2657. }
  2658. // Return the length of the invalid excess
  2659. // if we're just parsing
  2660. // Otherwise, throw an error or return tokens
  2661. return parseOnly ?
  2662. soFar.length :
  2663. soFar ?
  2664. Sizzle.error( selector ) :
  2665. // Cache the tokens
  2666. tokenCache( selector, groups ).slice( 0 );
  2667. };
  2668. function toSelector( tokens ) {
  2669. var i = 0,
  2670. len = tokens.length,
  2671. selector = "";
  2672. for ( ; i < len; i++ ) {
  2673. selector += tokens[i].value;
  2674. }
  2675. return selector;
  2676. }
  2677. function addCombinator( matcher, combinator, base ) {
  2678. var dir = combinator.dir,
  2679. skip = combinator.next,
  2680. key = skip || dir,
  2681. checkNonElements = base && key === "parentNode",
  2682. doneName = done++;
  2683. return combinator.first ?
  2684. // Check against closest ancestor/preceding element
  2685. function( elem, context, xml ) {
  2686. while ( (elem = elem[ dir ]) ) {
  2687. if ( elem.nodeType === 1 || checkNonElements ) {
  2688. return matcher( elem, context, xml );
  2689. }
  2690. }
  2691. return false;
  2692. } :
  2693. // Check against all ancestor/preceding elements
  2694. function( elem, context, xml ) {
  2695. var oldCache, uniqueCache, outerCache,
  2696. newCache = [ dirruns, doneName ];
  2697. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  2698. if ( xml ) {
  2699. while ( (elem = elem[ dir ]) ) {
  2700. if ( elem.nodeType === 1 || checkNonElements ) {
  2701. if ( matcher( elem, context, xml ) ) {
  2702. return true;
  2703. }
  2704. }
  2705. }
  2706. } else {
  2707. while ( (elem = elem[ dir ]) ) {
  2708. if ( elem.nodeType === 1 || checkNonElements ) {
  2709. outerCache = elem[ expando ] || (elem[ expando ] = {});
  2710. // Support: IE <9 only
  2711. // Defend against cloned attroperties (jQuery gh-1709)
  2712. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  2713. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  2714. elem = elem[ dir ] || elem;
  2715. } else if ( (oldCache = uniqueCache[ key ]) &&
  2716. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  2717. // Assign to newCache so results back-propagate to previous elements
  2718. return (newCache[ 2 ] = oldCache[ 2 ]);
  2719. } else {
  2720. // Reuse newcache so results back-propagate to previous elements
  2721. uniqueCache[ key ] = newCache;
  2722. // A match means we're done; a fail means we have to keep checking
  2723. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  2724. return true;
  2725. }
  2726. }
  2727. }
  2728. }
  2729. }
  2730. return false;
  2731. };
  2732. }
  2733. function elementMatcher( matchers ) {
  2734. return matchers.length > 1 ?
  2735. function( elem, context, xml ) {
  2736. var i = matchers.length;
  2737. while ( i-- ) {
  2738. if ( !matchers[i]( elem, context, xml ) ) {
  2739. return false;
  2740. }
  2741. }
  2742. return true;
  2743. } :
  2744. matchers[0];
  2745. }
  2746. function multipleContexts( selector, contexts, results ) {
  2747. var i = 0,
  2748. len = contexts.length;
  2749. for ( ; i < len; i++ ) {
  2750. Sizzle( selector, contexts[i], results );
  2751. }
  2752. return results;
  2753. }
  2754. function condense( unmatched, map, filter, context, xml ) {
  2755. var elem,
  2756. newUnmatched = [],
  2757. i = 0,
  2758. len = unmatched.length,
  2759. mapped = map != null;
  2760. for ( ; i < len; i++ ) {
  2761. if ( (elem = unmatched[i]) ) {
  2762. if ( !filter || filter( elem, context, xml ) ) {
  2763. newUnmatched.push( elem );
  2764. if ( mapped ) {
  2765. map.push( i );
  2766. }
  2767. }
  2768. }
  2769. }
  2770. return newUnmatched;
  2771. }
  2772. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2773. if ( postFilter && !postFilter[ expando ] ) {
  2774. postFilter = setMatcher( postFilter );
  2775. }
  2776. if ( postFinder && !postFinder[ expando ] ) {
  2777. postFinder = setMatcher( postFinder, postSelector );
  2778. }
  2779. return markFunction(function( seed, results, context, xml ) {
  2780. var temp, i, elem,
  2781. preMap = [],
  2782. postMap = [],
  2783. preexisting = results.length,
  2784. // Get initial elements from seed or context
  2785. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  2786. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2787. matcherIn = preFilter && ( seed || !selector ) ?
  2788. condense( elems, preMap, preFilter, context, xml ) :
  2789. elems,
  2790. matcherOut = matcher ?
  2791. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  2792. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2793. // ...intermediate processing is necessary
  2794. [] :
  2795. // ...otherwise use results directly
  2796. results :
  2797. matcherIn;
  2798. // Find primary matches
  2799. if ( matcher ) {
  2800. matcher( matcherIn, matcherOut, context, xml );
  2801. }
  2802. // Apply postFilter
  2803. if ( postFilter ) {
  2804. temp = condense( matcherOut, postMap );
  2805. postFilter( temp, [], context, xml );
  2806. // Un-match failing elements by moving them back to matcherIn
  2807. i = temp.length;
  2808. while ( i-- ) {
  2809. if ( (elem = temp[i]) ) {
  2810. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  2811. }
  2812. }
  2813. }
  2814. if ( seed ) {
  2815. if ( postFinder || preFilter ) {
  2816. if ( postFinder ) {
  2817. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2818. temp = [];
  2819. i = matcherOut.length;
  2820. while ( i-- ) {
  2821. if ( (elem = matcherOut[i]) ) {
  2822. // Restore matcherIn since elem is not yet a final match
  2823. temp.push( (matcherIn[i] = elem) );
  2824. }
  2825. }
  2826. postFinder( null, (matcherOut = []), temp, xml );
  2827. }
  2828. // Move matched elements from seed to results to keep them synchronized
  2829. i = matcherOut.length;
  2830. while ( i-- ) {
  2831. if ( (elem = matcherOut[i]) &&
  2832. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  2833. seed[temp] = !(results[temp] = elem);
  2834. }
  2835. }
  2836. }
  2837. // Add elements to results, through postFinder if defined
  2838. } else {
  2839. matcherOut = condense(
  2840. matcherOut === results ?
  2841. matcherOut.splice( preexisting, matcherOut.length ) :
  2842. matcherOut
  2843. );
  2844. if ( postFinder ) {
  2845. postFinder( null, results, matcherOut, xml );
  2846. } else {
  2847. push.apply( results, matcherOut );
  2848. }
  2849. }
  2850. });
  2851. }
  2852. function matcherFromTokens( tokens ) {
  2853. var checkContext, matcher, j,
  2854. len = tokens.length,
  2855. leadingRelative = Expr.relative[ tokens[0].type ],
  2856. implicitRelative = leadingRelative || Expr.relative[" "],
  2857. i = leadingRelative ? 1 : 0,
  2858. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2859. matchContext = addCombinator( function( elem ) {
  2860. return elem === checkContext;
  2861. }, implicitRelative, true ),
  2862. matchAnyContext = addCombinator( function( elem ) {
  2863. return indexOf( checkContext, elem ) > -1;
  2864. }, implicitRelative, true ),
  2865. matchers = [ function( elem, context, xml ) {
  2866. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2867. (checkContext = context).nodeType ?
  2868. matchContext( elem, context, xml ) :
  2869. matchAnyContext( elem, context, xml ) );
  2870. // Avoid hanging onto element (issue #299)
  2871. checkContext = null;
  2872. return ret;
  2873. } ];
  2874. for ( ; i < len; i++ ) {
  2875. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2876. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2877. } else {
  2878. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2879. // Return special upon seeing a positional matcher
  2880. if ( matcher[ expando ] ) {
  2881. // Find the next relative operator (if any) for proper handling
  2882. j = ++i;
  2883. for ( ; j < len; j++ ) {
  2884. if ( Expr.relative[ tokens[j].type ] ) {
  2885. break;
  2886. }
  2887. }
  2888. return setMatcher(
  2889. i > 1 && elementMatcher( matchers ),
  2890. i > 1 && toSelector(
  2891. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2892. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2893. ).replace( rtrim, "$1" ),
  2894. matcher,
  2895. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2896. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2897. j < len && toSelector( tokens )
  2898. );
  2899. }
  2900. matchers.push( matcher );
  2901. }
  2902. }
  2903. return elementMatcher( matchers );
  2904. }
  2905. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2906. var bySet = setMatchers.length > 0,
  2907. byElement = elementMatchers.length > 0,
  2908. superMatcher = function( seed, context, xml, results, outermost ) {
  2909. var elem, j, matcher,
  2910. matchedCount = 0,
  2911. i = "0",
  2912. unmatched = seed && [],
  2913. setMatched = [],
  2914. contextBackup = outermostContext,
  2915. // We must always have either seed elements or outermost context
  2916. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2917. // Use integer dirruns iff this is the outermost matcher
  2918. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2919. len = elems.length;
  2920. if ( outermost ) {
  2921. outermostContext = context === document || context || outermost;
  2922. }
  2923. // Add elements passing elementMatchers directly to results
  2924. // Support: IE<9, Safari
  2925. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2926. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2927. if ( byElement && elem ) {
  2928. j = 0;
  2929. if ( !context && elem.ownerDocument !== document ) {
  2930. setDocument( elem );
  2931. xml = !documentIsHTML;
  2932. }
  2933. while ( (matcher = elementMatchers[j++]) ) {
  2934. if ( matcher( elem, context || document, xml) ) {
  2935. results.push( elem );
  2936. break;
  2937. }
  2938. }
  2939. if ( outermost ) {
  2940. dirruns = dirrunsUnique;
  2941. }
  2942. }
  2943. // Track unmatched elements for set filters
  2944. if ( bySet ) {
  2945. // They will have gone through all possible matchers
  2946. if ( (elem = !matcher && elem) ) {
  2947. matchedCount--;
  2948. }
  2949. // Lengthen the array for every element, matched or not
  2950. if ( seed ) {
  2951. unmatched.push( elem );
  2952. }
  2953. }
  2954. }
  2955. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2956. // makes the latter nonnegative.
  2957. matchedCount += i;
  2958. // Apply set filters to unmatched elements
  2959. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2960. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2961. // no element matchers and no seed.
  2962. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2963. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2964. // numerically zero.
  2965. if ( bySet && i !== matchedCount ) {
  2966. j = 0;
  2967. while ( (matcher = setMatchers[j++]) ) {
  2968. matcher( unmatched, setMatched, context, xml );
  2969. }
  2970. if ( seed ) {
  2971. // Reintegrate element matches to eliminate the need for sorting
  2972. if ( matchedCount > 0 ) {
  2973. while ( i-- ) {
  2974. if ( !(unmatched[i] || setMatched[i]) ) {
  2975. setMatched[i] = pop.call( results );
  2976. }
  2977. }
  2978. }
  2979. // Discard index placeholder values to get only actual matches
  2980. setMatched = condense( setMatched );
  2981. }
  2982. // Add matches to results
  2983. push.apply( results, setMatched );
  2984. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2985. if ( outermost && !seed && setMatched.length > 0 &&
  2986. ( matchedCount + setMatchers.length ) > 1 ) {
  2987. Sizzle.uniqueSort( results );
  2988. }
  2989. }
  2990. // Override manipulation of globals by nested matchers
  2991. if ( outermost ) {
  2992. dirruns = dirrunsUnique;
  2993. outermostContext = contextBackup;
  2994. }
  2995. return unmatched;
  2996. };
  2997. return bySet ?
  2998. markFunction( superMatcher ) :
  2999. superMatcher;
  3000. }
  3001. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  3002. var i,
  3003. setMatchers = [],
  3004. elementMatchers = [],
  3005. cached = compilerCache[ selector + " " ];
  3006. if ( !cached ) {
  3007. // Generate a function of recursive functions that can be used to check each element
  3008. if ( !match ) {
  3009. match = tokenize( selector );
  3010. }
  3011. i = match.length;
  3012. while ( i-- ) {
  3013. cached = matcherFromTokens( match[i] );
  3014. if ( cached[ expando ] ) {
  3015. setMatchers.push( cached );
  3016. } else {
  3017. elementMatchers.push( cached );
  3018. }
  3019. }
  3020. // Cache the compiled function
  3021. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  3022. // Save selector and tokenization
  3023. cached.selector = selector;
  3024. }
  3025. return cached;
  3026. };
  3027. /**
  3028. * A low-level selection function that works with Sizzle's compiled
  3029. * selector functions
  3030. * @param {String|Function} selector A selector or a pre-compiled
  3031. * selector function built with Sizzle.compile
  3032. * @param {Element} context
  3033. * @param {Array} [results]
  3034. * @param {Array} [seed] A set of elements to match against
  3035. */
  3036. select = Sizzle.select = function( selector, context, results, seed ) {
  3037. var i, tokens, token, type, find,
  3038. compiled = typeof selector === "function" && selector,
  3039. match = !seed && tokenize( (selector = compiled.selector || selector) );
  3040. results = results || [];
  3041. // Try to minimize operations if there is only one selector in the list and no seed
  3042. // (the latter of which guarantees us context)
  3043. if ( match.length === 1 ) {
  3044. // Reduce context if the leading compound selector is an ID
  3045. tokens = match[0] = match[0].slice( 0 );
  3046. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  3047. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  3048. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  3049. if ( !context ) {
  3050. return results;
  3051. // Precompiled matchers will still verify ancestry, so step up a level
  3052. } else if ( compiled ) {
  3053. context = context.parentNode;
  3054. }
  3055. selector = selector.slice( tokens.shift().value.length );
  3056. }
  3057. // Fetch a seed set for right-to-left matching
  3058. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  3059. while ( i-- ) {
  3060. token = tokens[i];
  3061. // Abort if we hit a combinator
  3062. if ( Expr.relative[ (type = token.type) ] ) {
  3063. break;
  3064. }
  3065. if ( (find = Expr.find[ type ]) ) {
  3066. // Search, expanding context for leading sibling combinators
  3067. if ( (seed = find(
  3068. token.matches[0].replace( runescape, funescape ),
  3069. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  3070. )) ) {
  3071. // If seed is empty or no tokens remain, we can return early
  3072. tokens.splice( i, 1 );
  3073. selector = seed.length && toSelector( tokens );
  3074. if ( !selector ) {
  3075. push.apply( results, seed );
  3076. return results;
  3077. }
  3078. break;
  3079. }
  3080. }
  3081. }
  3082. }
  3083. // Compile and execute a filtering function if one is not provided
  3084. // Provide `match` to avoid retokenization if we modified the selector above
  3085. ( compiled || compile( selector, match ) )(
  3086. seed,
  3087. context,
  3088. !documentIsHTML,
  3089. results,
  3090. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  3091. );
  3092. return results;
  3093. };
  3094. // One-time assignments
  3095. // Sort stability
  3096. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  3097. // Support: Chrome 14-35+
  3098. // Always assume duplicates if they aren't passed to the comparison function
  3099. support.detectDuplicates = !!hasDuplicate;
  3100. // Initialize against the default document
  3101. setDocument();
  3102. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  3103. // Detached nodes confoundingly follow *each other*
  3104. support.sortDetached = assert(function( el ) {
  3105. // Should return 1, but returns 4 (following)
  3106. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  3107. });
  3108. // Support: IE<8
  3109. // Prevent attribute/property "interpolation"
  3110. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  3111. if ( !assert(function( el ) {
  3112. el.innerHTML = "<a href='#'></a>";
  3113. return el.firstChild.getAttribute("href") === "#" ;
  3114. }) ) {
  3115. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  3116. if ( !isXML ) {
  3117. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  3118. }
  3119. });
  3120. }
  3121. // Support: IE<9
  3122. // Use defaultValue in place of getAttribute("value")
  3123. if ( !support.attributes || !assert(function( el ) {
  3124. el.innerHTML = "<input/>";
  3125. el.firstChild.setAttribute( "value", "" );
  3126. return el.firstChild.getAttribute( "value" ) === "";
  3127. }) ) {
  3128. addHandle( "value", function( elem, name, isXML ) {
  3129. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  3130. return elem.defaultValue;
  3131. }
  3132. });
  3133. }
  3134. // Support: IE<9
  3135. // Use getAttributeNode to fetch booleans when getAttribute lies
  3136. if ( !assert(function( el ) {
  3137. return el.getAttribute("disabled") == null;
  3138. }) ) {
  3139. addHandle( booleans, function( elem, name, isXML ) {
  3140. var val;
  3141. if ( !isXML ) {
  3142. return elem[ name ] === true ? name.toLowerCase() :
  3143. (val = elem.getAttributeNode( name )) && val.specified ?
  3144. val.value :
  3145. null;
  3146. }
  3147. });
  3148. }
  3149. return Sizzle;
  3150. })( window );
  3151. jQuery.find = Sizzle;
  3152. jQuery.expr = Sizzle.selectors;
  3153. // Deprecated
  3154. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  3155. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  3156. jQuery.text = Sizzle.getText;
  3157. jQuery.isXMLDoc = Sizzle.isXML;
  3158. jQuery.contains = Sizzle.contains;
  3159. jQuery.escapeSelector = Sizzle.escape;
  3160. var dir = function( elem, dir, until ) {
  3161. var matched = [],
  3162. truncate = until !== undefined;
  3163. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  3164. if ( elem.nodeType === 1 ) {
  3165. if ( truncate && jQuery( elem ).is( until ) ) {
  3166. break;
  3167. }
  3168. matched.push( elem );
  3169. }
  3170. }
  3171. return matched;
  3172. };
  3173. var siblings = function( n, elem ) {
  3174. var matched = [];
  3175. for ( ; n; n = n.nextSibling ) {
  3176. if ( n.nodeType === 1 && n !== elem ) {
  3177. matched.push( n );
  3178. }
  3179. }
  3180. return matched;
  3181. };
  3182. var rneedsContext = jQuery.expr.match.needsContext;
  3183. function nodeName( elem, name ) {
  3184. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  3185. };
  3186. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  3187. // Implement the identical functionality for filter and not
  3188. function winnow( elements, qualifier, not ) {
  3189. if ( isFunction( qualifier ) ) {
  3190. return jQuery.grep( elements, function( elem, i ) {
  3191. return !!qualifier.call( elem, i, elem ) !== not;
  3192. } );
  3193. }
  3194. // Single element
  3195. if ( qualifier.nodeType ) {
  3196. return jQuery.grep( elements, function( elem ) {
  3197. return ( elem === qualifier ) !== not;
  3198. } );
  3199. }
  3200. // Arraylike of elements (jQuery, arguments, Array)
  3201. if ( typeof qualifier !== "string" ) {
  3202. return jQuery.grep( elements, function( elem ) {
  3203. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  3204. } );
  3205. }
  3206. // Filtered directly for both simple and complex selectors
  3207. return jQuery.filter( qualifier, elements, not );
  3208. }
  3209. jQuery.filter = function( expr, elems, not ) {
  3210. var elem = elems[ 0 ];
  3211. if ( not ) {
  3212. expr = ":not(" + expr + ")";
  3213. }
  3214. if ( elems.length === 1 && elem.nodeType === 1 ) {
  3215. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  3216. }
  3217. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  3218. return elem.nodeType === 1;
  3219. } ) );
  3220. };
  3221. jQuery.fn.extend( {
  3222. find: function( selector ) {
  3223. var i, ret,
  3224. len = this.length,
  3225. self = this;
  3226. if ( typeof selector !== "string" ) {
  3227. return this.pushStack( jQuery( selector ).filter( function() {
  3228. for ( i = 0; i < len; i++ ) {
  3229. if ( jQuery.contains( self[ i ], this ) ) {
  3230. return true;
  3231. }
  3232. }
  3233. } ) );
  3234. }
  3235. ret = this.pushStack( [] );
  3236. for ( i = 0; i < len; i++ ) {
  3237. jQuery.find( selector, self[ i ], ret );
  3238. }
  3239. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  3240. },
  3241. filter: function( selector ) {
  3242. return this.pushStack( winnow( this, selector || [], false ) );
  3243. },
  3244. not: function( selector ) {
  3245. return this.pushStack( winnow( this, selector || [], true ) );
  3246. },
  3247. is: function( selector ) {
  3248. return !!winnow(
  3249. this,
  3250. // If this is a positional/relative selector, check membership in the returned set
  3251. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  3252. typeof selector === "string" && rneedsContext.test( selector ) ?
  3253. jQuery( selector ) :
  3254. selector || [],
  3255. false
  3256. ).length;
  3257. }
  3258. } );
  3259. // Initialize a jQuery object
  3260. // A central reference to the root jQuery(document)
  3261. var rootjQuery,
  3262. // A simple way to check for HTML strings
  3263. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  3264. // Strict HTML recognition (#11290: must start with <)
  3265. // Shortcut simple #id case for speed
  3266. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  3267. init = jQuery.fn.init = function( selector, context, root ) {
  3268. var match, elem;
  3269. // HANDLE: $(""), $(null), $(undefined), $(false)
  3270. if ( !selector ) {
  3271. return this;
  3272. }
  3273. // Method init() accepts an alternate rootjQuery
  3274. // so migrate can support jQuery.sub (gh-2101)
  3275. root = root || rootjQuery;
  3276. // Handle HTML strings
  3277. if ( typeof selector === "string" ) {
  3278. if ( selector[ 0 ] === "<" &&
  3279. selector[ selector.length - 1 ] === ">" &&
  3280. selector.length >= 3 ) {
  3281. // Assume that strings that start and end with <> are HTML and skip the regex check
  3282. match = [ null, selector, null ];
  3283. } else {
  3284. match = rquickExpr.exec( selector );
  3285. }
  3286. // Match html or make sure no context is specified for #id
  3287. if ( match && ( match[ 1 ] || !context ) ) {
  3288. // HANDLE: $(html) -> $(array)
  3289. if ( match[ 1 ] ) {
  3290. context = context instanceof jQuery ? context[ 0 ] : context;
  3291. // Option to run scripts is true for back-compat
  3292. // Intentionally let the error be thrown if parseHTML is not present
  3293. jQuery.merge( this, jQuery.parseHTML(
  3294. match[ 1 ],
  3295. context && context.nodeType ? context.ownerDocument || context : document,
  3296. true
  3297. ) );
  3298. // HANDLE: $(html, props)
  3299. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  3300. for ( match in context ) {
  3301. // Properties of context are called as methods if possible
  3302. if ( isFunction( this[ match ] ) ) {
  3303. this[ match ]( context[ match ] );
  3304. // ...and otherwise set as attributes
  3305. } else {
  3306. this.attr( match, context[ match ] );
  3307. }
  3308. }
  3309. }
  3310. return this;
  3311. // HANDLE: $(#id)
  3312. } else {
  3313. elem = document.getElementById( match[ 2 ] );
  3314. if ( elem ) {
  3315. // Inject the element directly into the jQuery object
  3316. this[ 0 ] = elem;
  3317. this.length = 1;
  3318. }
  3319. return this;
  3320. }
  3321. // HANDLE: $(expr, $(...))
  3322. } else if ( !context || context.jquery ) {
  3323. return ( context || root ).find( selector );
  3324. // HANDLE: $(expr, context)
  3325. // (which is just equivalent to: $(context).find(expr)
  3326. } else {
  3327. return this.constructor( context ).find( selector );
  3328. }
  3329. // HANDLE: $(DOMElement)
  3330. } else if ( selector.nodeType ) {
  3331. this[ 0 ] = selector;
  3332. this.length = 1;
  3333. return this;
  3334. // HANDLE: $(function)
  3335. // Shortcut for document ready
  3336. } else if ( isFunction( selector ) ) {
  3337. return root.ready !== undefined ?
  3338. root.ready( selector ) :
  3339. // Execute immediately if ready is not present
  3340. selector( jQuery );
  3341. }
  3342. return jQuery.makeArray( selector, this );
  3343. };
  3344. // Give the init function the jQuery prototype for later instantiation
  3345. init.prototype = jQuery.fn;
  3346. // Initialize central reference
  3347. rootjQuery = jQuery( document );
  3348. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  3349. // Methods guaranteed to produce a unique set when starting from a unique set
  3350. guaranteedUnique = {
  3351. children: true,
  3352. contents: true,
  3353. next: true,
  3354. prev: true
  3355. };
  3356. jQuery.fn.extend( {
  3357. has: function( target ) {
  3358. var targets = jQuery( target, this ),
  3359. l = targets.length;
  3360. return this.filter( function() {
  3361. var i = 0;
  3362. for ( ; i < l; i++ ) {
  3363. if ( jQuery.contains( this, targets[ i ] ) ) {
  3364. return true;
  3365. }
  3366. }
  3367. } );
  3368. },
  3369. closest: function( selectors, context ) {
  3370. var cur,
  3371. i = 0,
  3372. l = this.length,
  3373. matched = [],
  3374. targets = typeof selectors !== "string" && jQuery( selectors );
  3375. // Positional selectors never match, since there's no _selection_ context
  3376. if ( !rneedsContext.test( selectors ) ) {
  3377. for ( ; i < l; i++ ) {
  3378. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  3379. // Always skip document fragments
  3380. if ( cur.nodeType < 11 && ( targets ?
  3381. targets.index( cur ) > -1 :
  3382. // Don't pass non-elements to Sizzle
  3383. cur.nodeType === 1 &&
  3384. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  3385. matched.push( cur );
  3386. break;
  3387. }
  3388. }
  3389. }
  3390. }
  3391. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  3392. },
  3393. // Determine the position of an element within the set
  3394. index: function( elem ) {
  3395. // No argument, return index in parent
  3396. if ( !elem ) {
  3397. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  3398. }
  3399. // Index in selector
  3400. if ( typeof elem === "string" ) {
  3401. return indexOf.call( jQuery( elem ), this[ 0 ] );
  3402. }
  3403. // Locate the position of the desired element
  3404. return indexOf.call( this,
  3405. // If it receives a jQuery object, the first element is used
  3406. elem.jquery ? elem[ 0 ] : elem
  3407. );
  3408. },
  3409. add: function( selector, context ) {
  3410. return this.pushStack(
  3411. jQuery.uniqueSort(
  3412. jQuery.merge( this.get(), jQuery( selector, context ) )
  3413. )
  3414. );
  3415. },
  3416. addBack: function( selector ) {
  3417. return this.add( selector == null ?
  3418. this.prevObject : this.prevObject.filter( selector )
  3419. );
  3420. }
  3421. } );
  3422. function sibling( cur, dir ) {
  3423. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  3424. return cur;
  3425. }
  3426. jQuery.each( {
  3427. parent: function( elem ) {
  3428. var parent = elem.parentNode;
  3429. return parent && parent.nodeType !== 11 ? parent : null;
  3430. },
  3431. parents: function( elem ) {
  3432. return dir( elem, "parentNode" );
  3433. },
  3434. parentsUntil: function( elem, i, until ) {
  3435. return dir( elem, "parentNode", until );
  3436. },
  3437. next: function( elem ) {
  3438. return sibling( elem, "nextSibling" );
  3439. },
  3440. prev: function( elem ) {
  3441. return sibling( elem, "previousSibling" );
  3442. },
  3443. nextAll: function( elem ) {
  3444. return dir( elem, "nextSibling" );
  3445. },
  3446. prevAll: function( elem ) {
  3447. return dir( elem, "previousSibling" );
  3448. },
  3449. nextUntil: function( elem, i, until ) {
  3450. return dir( elem, "nextSibling", until );
  3451. },
  3452. prevUntil: function( elem, i, until ) {
  3453. return dir( elem, "previousSibling", until );
  3454. },
  3455. siblings: function( elem ) {
  3456. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  3457. },
  3458. children: function( elem ) {
  3459. return siblings( elem.firstChild );
  3460. },
  3461. contents: function( elem ) {
  3462. if ( typeof elem.contentDocument !== "undefined" ) {
  3463. return elem.contentDocument;
  3464. }
  3465. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  3466. // Treat the template element as a regular one in browsers that
  3467. // don't support it.
  3468. if ( nodeName( elem, "template" ) ) {
  3469. elem = elem.content || elem;
  3470. }
  3471. return jQuery.merge( [], elem.childNodes );
  3472. }
  3473. }, function( name, fn ) {
  3474. jQuery.fn[ name ] = function( until, selector ) {
  3475. var matched = jQuery.map( this, fn, until );
  3476. if ( name.slice( -5 ) !== "Until" ) {
  3477. selector = until;
  3478. }
  3479. if ( selector && typeof selector === "string" ) {
  3480. matched = jQuery.filter( selector, matched );
  3481. }
  3482. if ( this.length > 1 ) {
  3483. // Remove duplicates
  3484. if ( !guaranteedUnique[ name ] ) {
  3485. jQuery.uniqueSort( matched );
  3486. }
  3487. // Reverse order for parents* and prev-derivatives
  3488. if ( rparentsprev.test( name ) ) {
  3489. matched.reverse();
  3490. }
  3491. }
  3492. return this.pushStack( matched );
  3493. };
  3494. } );
  3495. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  3496. // Convert String-formatted options into Object-formatted ones
  3497. function createOptions( options ) {
  3498. var object = {};
  3499. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  3500. object[ flag ] = true;
  3501. } );
  3502. return object;
  3503. }
  3504. /*
  3505. * Create a callback list using the following parameters:
  3506. *
  3507. * options: an optional list of space-separated options that will change how
  3508. * the callback list behaves or a more traditional option object
  3509. *
  3510. * By default a callback list will act like an event callback list and can be
  3511. * "fired" multiple times.
  3512. *
  3513. * Possible options:
  3514. *
  3515. * once: will ensure the callback list can only be fired once (like a Deferred)
  3516. *
  3517. * memory: will keep track of previous values and will call any callback added
  3518. * after the list has been fired right away with the latest "memorized"
  3519. * values (like a Deferred)
  3520. *
  3521. * unique: will ensure a callback can only be added once (no duplicate in the list)
  3522. *
  3523. * stopOnFalse: interrupt callings when a callback returns false
  3524. *
  3525. */
  3526. jQuery.Callbacks = function( options ) {
  3527. // Convert options from String-formatted to Object-formatted if needed
  3528. // (we check in cache first)
  3529. options = typeof options === "string" ?
  3530. createOptions( options ) :
  3531. jQuery.extend( {}, options );
  3532. var // Flag to know if list is currently firing
  3533. firing,
  3534. // Last fire value for non-forgettable lists
  3535. memory,
  3536. // Flag to know if list was already fired
  3537. fired,
  3538. // Flag to prevent firing
  3539. locked,
  3540. // Actual callback list
  3541. list = [],
  3542. // Queue of execution data for repeatable lists
  3543. queue = [],
  3544. // Index of currently firing callback (modified by add/remove as needed)
  3545. firingIndex = -1,
  3546. // Fire callbacks
  3547. fire = function() {
  3548. // Enforce single-firing
  3549. locked = locked || options.once;
  3550. // Execute callbacks for all pending executions,
  3551. // respecting firingIndex overrides and runtime changes
  3552. fired = firing = true;
  3553. for ( ; queue.length; firingIndex = -1 ) {
  3554. memory = queue.shift();
  3555. while ( ++firingIndex < list.length ) {
  3556. // Run callback and check for early termination
  3557. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  3558. options.stopOnFalse ) {
  3559. // Jump to end and forget the data so .add doesn't re-fire
  3560. firingIndex = list.length;
  3561. memory = false;
  3562. }
  3563. }
  3564. }
  3565. // Forget the data if we're done with it
  3566. if ( !options.memory ) {
  3567. memory = false;
  3568. }
  3569. firing = false;
  3570. // Clean up if we're done firing for good
  3571. if ( locked ) {
  3572. // Keep an empty list if we have data for future add calls
  3573. if ( memory ) {
  3574. list = [];
  3575. // Otherwise, this object is spent
  3576. } else {
  3577. list = "";
  3578. }
  3579. }
  3580. },
  3581. // Actual Callbacks object
  3582. self = {
  3583. // Add a callback or a collection of callbacks to the list
  3584. add: function() {
  3585. if ( list ) {
  3586. // If we have memory from a past run, we should fire after adding
  3587. if ( memory && !firing ) {
  3588. firingIndex = list.length - 1;
  3589. queue.push( memory );
  3590. }
  3591. ( function add( args ) {
  3592. jQuery.each( args, function( _, arg ) {
  3593. if ( isFunction( arg ) ) {
  3594. if ( !options.unique || !self.has( arg ) ) {
  3595. list.push( arg );
  3596. }
  3597. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  3598. // Inspect recursively
  3599. add( arg );
  3600. }
  3601. } );
  3602. } )( arguments );
  3603. if ( memory && !firing ) {
  3604. fire();
  3605. }
  3606. }
  3607. return this;
  3608. },
  3609. // Remove a callback from the list
  3610. remove: function() {
  3611. jQuery.each( arguments, function( _, arg ) {
  3612. var index;
  3613. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  3614. list.splice( index, 1 );
  3615. // Handle firing indexes
  3616. if ( index <= firingIndex ) {
  3617. firingIndex--;
  3618. }
  3619. }
  3620. } );
  3621. return this;
  3622. },
  3623. // Check if a given callback is in the list.
  3624. // If no argument is given, return whether or not list has callbacks attached.
  3625. has: function( fn ) {
  3626. return fn ?
  3627. jQuery.inArray( fn, list ) > -1 :
  3628. list.length > 0;
  3629. },
  3630. // Remove all callbacks from the list
  3631. empty: function() {
  3632. if ( list ) {
  3633. list = [];
  3634. }
  3635. return this;
  3636. },
  3637. // Disable .fire and .add
  3638. // Abort any current/pending executions
  3639. // Clear all callbacks and values
  3640. disable: function() {
  3641. locked = queue = [];
  3642. list = memory = "";
  3643. return this;
  3644. },
  3645. disabled: function() {
  3646. return !list;
  3647. },
  3648. // Disable .fire
  3649. // Also disable .add unless we have memory (since it would have no effect)
  3650. // Abort any pending executions
  3651. lock: function() {
  3652. locked = queue = [];
  3653. if ( !memory && !firing ) {
  3654. list = memory = "";
  3655. }
  3656. return this;
  3657. },
  3658. locked: function() {
  3659. return !!locked;
  3660. },
  3661. // Call all callbacks with the given context and arguments
  3662. fireWith: function( context, args ) {
  3663. if ( !locked ) {
  3664. args = args || [];
  3665. args = [ context, args.slice ? args.slice() : args ];
  3666. queue.push( args );
  3667. if ( !firing ) {
  3668. fire();
  3669. }
  3670. }
  3671. return this;
  3672. },
  3673. // Call all the callbacks with the given arguments
  3674. fire: function() {
  3675. self.fireWith( this, arguments );
  3676. return this;
  3677. },
  3678. // To know if the callbacks have already been called at least once
  3679. fired: function() {
  3680. return !!fired;
  3681. }
  3682. };
  3683. return self;
  3684. };
  3685. function Identity( v ) {
  3686. return v;
  3687. }
  3688. function Thrower( ex ) {
  3689. throw ex;
  3690. }
  3691. function adoptValue( value, resolve, reject, noValue ) {
  3692. var method;
  3693. try {
  3694. // Check for promise aspect first to privilege synchronous behavior
  3695. if ( value && isFunction( ( method = value.promise ) ) ) {
  3696. method.call( value ).done( resolve ).fail( reject );
  3697. // Other thenables
  3698. } else if ( value && isFunction( ( method = value.then ) ) ) {
  3699. method.call( value, resolve, reject );
  3700. // Other non-thenables
  3701. } else {
  3702. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  3703. // * false: [ value ].slice( 0 ) => resolve( value )
  3704. // * true: [ value ].slice( 1 ) => resolve()
  3705. resolve.apply( undefined, [ value ].slice( noValue ) );
  3706. }
  3707. // For Promises/A+, convert exceptions into rejections
  3708. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  3709. // Deferred#then to conditionally suppress rejection.
  3710. } catch ( value ) {
  3711. // Support: Android 4.0 only
  3712. // Strict mode functions invoked without .call/.apply get global-object context
  3713. reject.apply( undefined, [ value ] );
  3714. }
  3715. }
  3716. jQuery.extend( {
  3717. Deferred: function( func ) {
  3718. var tuples = [
  3719. // action, add listener, callbacks,
  3720. // ... .then handlers, argument index, [final state]
  3721. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  3722. jQuery.Callbacks( "memory" ), 2 ],
  3723. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  3724. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  3725. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  3726. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  3727. ],
  3728. state = "pending",
  3729. promise = {
  3730. state: function() {
  3731. return state;
  3732. },
  3733. always: function() {
  3734. deferred.done( arguments ).fail( arguments );
  3735. return this;
  3736. },
  3737. "catch": function( fn ) {
  3738. return promise.then( null, fn );
  3739. },
  3740. // Keep pipe for back-compat
  3741. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  3742. var fns = arguments;
  3743. return jQuery.Deferred( function( newDefer ) {
  3744. jQuery.each( tuples, function( i, tuple ) {
  3745. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  3746. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  3747. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  3748. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  3749. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  3750. deferred[ tuple[ 1 ] ]( function() {
  3751. var returned = fn && fn.apply( this, arguments );
  3752. if ( returned && isFunction( returned.promise ) ) {
  3753. returned.promise()
  3754. .progress( newDefer.notify )
  3755. .done( newDefer.resolve )
  3756. .fail( newDefer.reject );
  3757. } else {
  3758. newDefer[ tuple[ 0 ] + "With" ](
  3759. this,
  3760. fn ? [ returned ] : arguments
  3761. );
  3762. }
  3763. } );
  3764. } );
  3765. fns = null;
  3766. } ).promise();
  3767. },
  3768. then: function( onFulfilled, onRejected, onProgress ) {
  3769. var maxDepth = 0;
  3770. function resolve( depth, deferred, handler, special ) {
  3771. return function() {
  3772. var that = this,
  3773. args = arguments,
  3774. mightThrow = function() {
  3775. var returned, then;
  3776. // Support: Promises/A+ section 2.3.3.3.3
  3777. // https://promisesaplus.com/#point-59
  3778. // Ignore double-resolution attempts
  3779. if ( depth < maxDepth ) {
  3780. return;
  3781. }
  3782. returned = handler.apply( that, args );
  3783. // Support: Promises/A+ section 2.3.1
  3784. // https://promisesaplus.com/#point-48
  3785. if ( returned === deferred.promise() ) {
  3786. throw new TypeError( "Thenable self-resolution" );
  3787. }
  3788. // Support: Promises/A+ sections 2.3.3.1, 3.5
  3789. // https://promisesaplus.com/#point-54
  3790. // https://promisesaplus.com/#point-75
  3791. // Retrieve `then` only once
  3792. then = returned &&
  3793. // Support: Promises/A+ section 2.3.4
  3794. // https://promisesaplus.com/#point-64
  3795. // Only check objects and functions for thenability
  3796. ( typeof returned === "object" ||
  3797. typeof returned === "function" ) &&
  3798. returned.then;
  3799. // Handle a returned thenable
  3800. if ( isFunction( then ) ) {
  3801. // Special processors (notify) just wait for resolution
  3802. if ( special ) {
  3803. then.call(
  3804. returned,
  3805. resolve( maxDepth, deferred, Identity, special ),
  3806. resolve( maxDepth, deferred, Thrower, special )
  3807. );
  3808. // Normal processors (resolve) also hook into progress
  3809. } else {
  3810. // ...and disregard older resolution values
  3811. maxDepth++;
  3812. then.call(
  3813. returned,
  3814. resolve( maxDepth, deferred, Identity, special ),
  3815. resolve( maxDepth, deferred, Thrower, special ),
  3816. resolve( maxDepth, deferred, Identity,
  3817. deferred.notifyWith )
  3818. );
  3819. }
  3820. // Handle all other returned values
  3821. } else {
  3822. // Only substitute handlers pass on context
  3823. // and multiple values (non-spec behavior)
  3824. if ( handler !== Identity ) {
  3825. that = undefined;
  3826. args = [ returned ];
  3827. }
  3828. // Process the value(s)
  3829. // Default process is resolve
  3830. ( special || deferred.resolveWith )( that, args );
  3831. }
  3832. },
  3833. // Only normal processors (resolve) catch and reject exceptions
  3834. process = special ?
  3835. mightThrow :
  3836. function() {
  3837. try {
  3838. mightThrow();
  3839. } catch ( e ) {
  3840. if ( jQuery.Deferred.exceptionHook ) {
  3841. jQuery.Deferred.exceptionHook( e,
  3842. process.stackTrace );
  3843. }
  3844. // Support: Promises/A+ section 2.3.3.3.4.1
  3845. // https://promisesaplus.com/#point-61
  3846. // Ignore post-resolution exceptions
  3847. if ( depth + 1 >= maxDepth ) {
  3848. // Only substitute handlers pass on context
  3849. // and multiple values (non-spec behavior)
  3850. if ( handler !== Thrower ) {
  3851. that = undefined;
  3852. args = [ e ];
  3853. }
  3854. deferred.rejectWith( that, args );
  3855. }
  3856. }
  3857. };
  3858. // Support: Promises/A+ section 2.3.3.3.1
  3859. // https://promisesaplus.com/#point-57
  3860. // Re-resolve promises immediately to dodge false rejection from
  3861. // subsequent errors
  3862. if ( depth ) {
  3863. process();
  3864. } else {
  3865. // Call an optional hook to record the stack, in case of exception
  3866. // since it's otherwise lost when execution goes async
  3867. if ( jQuery.Deferred.getStackHook ) {
  3868. process.stackTrace = jQuery.Deferred.getStackHook();
  3869. }
  3870. window.setTimeout( process );
  3871. }
  3872. };
  3873. }
  3874. return jQuery.Deferred( function( newDefer ) {
  3875. // progress_handlers.add( ... )
  3876. tuples[ 0 ][ 3 ].add(
  3877. resolve(
  3878. 0,
  3879. newDefer,
  3880. isFunction( onProgress ) ?
  3881. onProgress :
  3882. Identity,
  3883. newDefer.notifyWith
  3884. )
  3885. );
  3886. // fulfilled_handlers.add( ... )
  3887. tuples[ 1 ][ 3 ].add(
  3888. resolve(
  3889. 0,
  3890. newDefer,
  3891. isFunction( onFulfilled ) ?
  3892. onFulfilled :
  3893. Identity
  3894. )
  3895. );
  3896. // rejected_handlers.add( ... )
  3897. tuples[ 2 ][ 3 ].add(
  3898. resolve(
  3899. 0,
  3900. newDefer,
  3901. isFunction( onRejected ) ?
  3902. onRejected :
  3903. Thrower
  3904. )
  3905. );
  3906. } ).promise();
  3907. },
  3908. // Get a promise for this deferred
  3909. // If obj is provided, the promise aspect is added to the object
  3910. promise: function( obj ) {
  3911. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3912. }
  3913. },
  3914. deferred = {};
  3915. // Add list-specific methods
  3916. jQuery.each( tuples, function( i, tuple ) {
  3917. var list = tuple[ 2 ],
  3918. stateString = tuple[ 5 ];
  3919. // promise.progress = list.add
  3920. // promise.done = list.add
  3921. // promise.fail = list.add
  3922. promise[ tuple[ 1 ] ] = list.add;
  3923. // Handle state
  3924. if ( stateString ) {
  3925. list.add(
  3926. function() {
  3927. // state = "resolved" (i.e., fulfilled)
  3928. // state = "rejected"
  3929. state = stateString;
  3930. },
  3931. // rejected_callbacks.disable
  3932. // fulfilled_callbacks.disable
  3933. tuples[ 3 - i ][ 2 ].disable,
  3934. // rejected_handlers.disable
  3935. // fulfilled_handlers.disable
  3936. tuples[ 3 - i ][ 3 ].disable,
  3937. // progress_callbacks.lock
  3938. tuples[ 0 ][ 2 ].lock,
  3939. // progress_handlers.lock
  3940. tuples[ 0 ][ 3 ].lock
  3941. );
  3942. }
  3943. // progress_handlers.fire
  3944. // fulfilled_handlers.fire
  3945. // rejected_handlers.fire
  3946. list.add( tuple[ 3 ].fire );
  3947. // deferred.notify = function() { deferred.notifyWith(...) }
  3948. // deferred.resolve = function() { deferred.resolveWith(...) }
  3949. // deferred.reject = function() { deferred.rejectWith(...) }
  3950. deferred[ tuple[ 0 ] ] = function() {
  3951. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3952. return this;
  3953. };
  3954. // deferred.notifyWith = list.fireWith
  3955. // deferred.resolveWith = list.fireWith
  3956. // deferred.rejectWith = list.fireWith
  3957. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3958. } );
  3959. // Make the deferred a promise
  3960. promise.promise( deferred );
  3961. // Call given func if any
  3962. if ( func ) {
  3963. func.call( deferred, deferred );
  3964. }
  3965. // All done!
  3966. return deferred;
  3967. },
  3968. // Deferred helper
  3969. when: function( singleValue ) {
  3970. var
  3971. // count of uncompleted subordinates
  3972. remaining = arguments.length,
  3973. // count of unprocessed arguments
  3974. i = remaining,
  3975. // subordinate fulfillment data
  3976. resolveContexts = Array( i ),
  3977. resolveValues = slice.call( arguments ),
  3978. // the master Deferred
  3979. master = jQuery.Deferred(),
  3980. // subordinate callback factory
  3981. updateFunc = function( i ) {
  3982. return function( value ) {
  3983. resolveContexts[ i ] = this;
  3984. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3985. if ( !( --remaining ) ) {
  3986. master.resolveWith( resolveContexts, resolveValues );
  3987. }
  3988. };
  3989. };
  3990. // Single- and empty arguments are adopted like Promise.resolve
  3991. if ( remaining <= 1 ) {
  3992. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3993. !remaining );
  3994. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3995. if ( master.state() === "pending" ||
  3996. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3997. return master.then();
  3998. }
  3999. }
  4000. // Multiple arguments are aggregated like Promise.all array elements
  4001. while ( i-- ) {
  4002. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  4003. }
  4004. return master.promise();
  4005. }
  4006. } );
  4007. // These usually indicate a programmer mistake during development,
  4008. // warn about them ASAP rather than swallowing them by default.
  4009. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  4010. jQuery.Deferred.exceptionHook = function( error, stack ) {
  4011. // Support: IE 8 - 9 only
  4012. // Console exists when dev tools are open, which can happen at any time
  4013. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  4014. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  4015. }
  4016. };
  4017. jQuery.readyException = function( error ) {
  4018. window.setTimeout( function() {
  4019. throw error;
  4020. } );
  4021. };
  4022. // The deferred used on DOM ready
  4023. var readyList = jQuery.Deferred();
  4024. jQuery.fn.ready = function( fn ) {
  4025. readyList
  4026. .then( fn )
  4027. // Wrap jQuery.readyException in a function so that the lookup
  4028. // happens at the time of error handling instead of callback
  4029. // registration.
  4030. .catch( function( error ) {
  4031. jQuery.readyException( error );
  4032. } );
  4033. return this;
  4034. };
  4035. jQuery.extend( {
  4036. // Is the DOM ready to be used? Set to true once it occurs.
  4037. isReady: false,
  4038. // A counter to track how many items to wait for before
  4039. // the ready event fires. See #6781
  4040. readyWait: 1,
  4041. // Handle when the DOM is ready
  4042. ready: function( wait ) {
  4043. // Abort if there are pending holds or we're already ready
  4044. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  4045. return;
  4046. }
  4047. // Remember that the DOM is ready
  4048. jQuery.isReady = true;
  4049. // If a normal DOM Ready event fired, decrement, and wait if need be
  4050. if ( wait !== true && --jQuery.readyWait > 0 ) {
  4051. return;
  4052. }
  4053. // If there are functions bound, to execute
  4054. readyList.resolveWith( document, [ jQuery ] );
  4055. }
  4056. } );
  4057. jQuery.ready.then = readyList.then;
  4058. // The ready event handler and self cleanup method
  4059. function completed() {
  4060. document.removeEventListener( "DOMContentLoaded", completed );
  4061. window.removeEventListener( "load", completed );
  4062. jQuery.ready();
  4063. }
  4064. // Catch cases where $(document).ready() is called
  4065. // after the browser event has already occurred.
  4066. // Support: IE <=9 - 10 only
  4067. // Older IE sometimes signals "interactive" too soon
  4068. if ( document.readyState === "complete" ||
  4069. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  4070. // Handle it asynchronously to allow scripts the opportunity to delay ready
  4071. window.setTimeout( jQuery.ready );
  4072. } else {
  4073. // Use the handy event callback
  4074. document.addEventListener( "DOMContentLoaded", completed );
  4075. // A fallback to window.onload, that will always work
  4076. window.addEventListener( "load", completed );
  4077. }
  4078. // Multifunctional method to get and set values of a collection
  4079. // The value/s can optionally be executed if it's a function
  4080. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  4081. var i = 0,
  4082. len = elems.length,
  4083. bulk = key == null;
  4084. // Sets many values
  4085. if ( toType( key ) === "object" ) {
  4086. chainable = true;
  4087. for ( i in key ) {
  4088. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  4089. }
  4090. // Sets one value
  4091. } else if ( value !== undefined ) {
  4092. chainable = true;
  4093. if ( !isFunction( value ) ) {
  4094. raw = true;
  4095. }
  4096. if ( bulk ) {
  4097. // Bulk operations run against the entire set
  4098. if ( raw ) {
  4099. fn.call( elems, value );
  4100. fn = null;
  4101. // ...except when executing function values
  4102. } else {
  4103. bulk = fn;
  4104. fn = function( elem, key, value ) {
  4105. return bulk.call( jQuery( elem ), value );
  4106. };
  4107. }
  4108. }
  4109. if ( fn ) {
  4110. for ( ; i < len; i++ ) {
  4111. fn(
  4112. elems[ i ], key, raw ?
  4113. value :
  4114. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  4115. );
  4116. }
  4117. }
  4118. }
  4119. if ( chainable ) {
  4120. return elems;
  4121. }
  4122. // Gets
  4123. if ( bulk ) {
  4124. return fn.call( elems );
  4125. }
  4126. return len ? fn( elems[ 0 ], key ) : emptyGet;
  4127. };
  4128. // Matches dashed string for camelizing
  4129. var rmsPrefix = /^-ms-/,
  4130. rdashAlpha = /-([a-z])/g;
  4131. // Used by camelCase as callback to replace()
  4132. function fcamelCase( all, letter ) {
  4133. return letter.toUpperCase();
  4134. }
  4135. // Convert dashed to camelCase; used by the css and data modules
  4136. // Support: IE <=9 - 11, Edge 12 - 15
  4137. // Microsoft forgot to hump their vendor prefix (#9572)
  4138. function camelCase( string ) {
  4139. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  4140. }
  4141. var acceptData = function( owner ) {
  4142. // Accepts only:
  4143. // - Node
  4144. // - Node.ELEMENT_NODE
  4145. // - Node.DOCUMENT_NODE
  4146. // - Object
  4147. // - Any
  4148. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  4149. };
  4150. function Data() {
  4151. this.expando = jQuery.expando + Data.uid++;
  4152. }
  4153. Data.uid = 1;
  4154. Data.prototype = {
  4155. cache: function( owner ) {
  4156. // Check if the owner object already has a cache
  4157. var value = owner[ this.expando ];
  4158. // If not, create one
  4159. if ( !value ) {
  4160. value = {};
  4161. // We can accept data for non-element nodes in modern browsers,
  4162. // but we should not, see #8335.
  4163. // Always return an empty object.
  4164. if ( acceptData( owner ) ) {
  4165. // If it is a node unlikely to be stringify-ed or looped over
  4166. // use plain assignment
  4167. if ( owner.nodeType ) {
  4168. owner[ this.expando ] = value;
  4169. // Otherwise secure it in a non-enumerable property
  4170. // configurable must be true to allow the property to be
  4171. // deleted when data is removed
  4172. } else {
  4173. Object.defineProperty( owner, this.expando, {
  4174. value: value,
  4175. configurable: true
  4176. } );
  4177. }
  4178. }
  4179. }
  4180. return value;
  4181. },
  4182. set: function( owner, data, value ) {
  4183. var prop,
  4184. cache = this.cache( owner );
  4185. // Handle: [ owner, key, value ] args
  4186. // Always use camelCase key (gh-2257)
  4187. if ( typeof data === "string" ) {
  4188. cache[ camelCase( data ) ] = value;
  4189. // Handle: [ owner, { properties } ] args
  4190. } else {
  4191. // Copy the properties one-by-one to the cache object
  4192. for ( prop in data ) {
  4193. cache[ camelCase( prop ) ] = data[ prop ];
  4194. }
  4195. }
  4196. return cache;
  4197. },
  4198. get: function( owner, key ) {
  4199. return key === undefined ?
  4200. this.cache( owner ) :
  4201. // Always use camelCase key (gh-2257)
  4202. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  4203. },
  4204. access: function( owner, key, value ) {
  4205. // In cases where either:
  4206. //
  4207. // 1. No key was specified
  4208. // 2. A string key was specified, but no value provided
  4209. //
  4210. // Take the "read" path and allow the get method to determine
  4211. // which value to return, respectively either:
  4212. //
  4213. // 1. The entire cache object
  4214. // 2. The data stored at the key
  4215. //
  4216. if ( key === undefined ||
  4217. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  4218. return this.get( owner, key );
  4219. }
  4220. // When the key is not a string, or both a key and value
  4221. // are specified, set or extend (existing objects) with either:
  4222. //
  4223. // 1. An object of properties
  4224. // 2. A key and value
  4225. //
  4226. this.set( owner, key, value );
  4227. // Since the "set" path can have two possible entry points
  4228. // return the expected data based on which path was taken[*]
  4229. return value !== undefined ? value : key;
  4230. },
  4231. remove: function( owner, key ) {
  4232. var i,
  4233. cache = owner[ this.expando ];
  4234. if ( cache === undefined ) {
  4235. return;
  4236. }
  4237. if ( key !== undefined ) {
  4238. // Support array or space separated string of keys
  4239. if ( Array.isArray( key ) ) {
  4240. // If key is an array of keys...
  4241. // We always set camelCase keys, so remove that.
  4242. key = key.map( camelCase );
  4243. } else {
  4244. key = camelCase( key );
  4245. // If a key with the spaces exists, use it.
  4246. // Otherwise, create an array by matching non-whitespace
  4247. key = key in cache ?
  4248. [ key ] :
  4249. ( key.match( rnothtmlwhite ) || [] );
  4250. }
  4251. i = key.length;
  4252. while ( i-- ) {
  4253. delete cache[ key[ i ] ];
  4254. }
  4255. }
  4256. // Remove the expando if there's no more data
  4257. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  4258. // Support: Chrome <=35 - 45
  4259. // Webkit & Blink performance suffers when deleting properties
  4260. // from DOM nodes, so set to undefined instead
  4261. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  4262. if ( owner.nodeType ) {
  4263. owner[ this.expando ] = undefined;
  4264. } else {
  4265. delete owner[ this.expando ];
  4266. }
  4267. }
  4268. },
  4269. hasData: function( owner ) {
  4270. var cache = owner[ this.expando ];
  4271. return cache !== undefined && !jQuery.isEmptyObject( cache );
  4272. }
  4273. };
  4274. var dataPriv = new Data();
  4275. var dataUser = new Data();
  4276. // Implementation Summary
  4277. //
  4278. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  4279. // 2. Improve the module's maintainability by reducing the storage
  4280. // paths to a single mechanism.
  4281. // 3. Use the same single mechanism to support "private" and "user" data.
  4282. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  4283. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  4284. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  4285. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  4286. rmultiDash = /[A-Z]/g;
  4287. function getData( data ) {
  4288. if ( data === "true" ) {
  4289. return true;
  4290. }
  4291. if ( data === "false" ) {
  4292. return false;
  4293. }
  4294. if ( data === "null" ) {
  4295. return null;
  4296. }
  4297. // Only convert to a number if it doesn't change the string
  4298. if ( data === +data + "" ) {
  4299. return +data;
  4300. }
  4301. if ( rbrace.test( data ) ) {
  4302. return JSON.parse( data );
  4303. }
  4304. return data;
  4305. }
  4306. function dataAttr( elem, key, data ) {
  4307. var name;
  4308. // If nothing was found internally, try to fetch any
  4309. // data from the HTML5 data-* attribute
  4310. if ( data === undefined && elem.nodeType === 1 ) {
  4311. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  4312. data = elem.getAttribute( name );
  4313. if ( typeof data === "string" ) {
  4314. try {
  4315. data = getData( data );
  4316. } catch ( e ) {}
  4317. // Make sure we set the data so it isn't changed later
  4318. dataUser.set( elem, key, data );
  4319. } else {
  4320. data = undefined;
  4321. }
  4322. }
  4323. return data;
  4324. }
  4325. jQuery.extend( {
  4326. hasData: function( elem ) {
  4327. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  4328. },
  4329. data: function( elem, name, data ) {
  4330. return dataUser.access( elem, name, data );
  4331. },
  4332. removeData: function( elem, name ) {
  4333. dataUser.remove( elem, name );
  4334. },
  4335. // TODO: Now that all calls to _data and _removeData have been replaced
  4336. // with direct calls to dataPriv methods, these can be deprecated.
  4337. _data: function( elem, name, data ) {
  4338. return dataPriv.access( elem, name, data );
  4339. },
  4340. _removeData: function( elem, name ) {
  4341. dataPriv.remove( elem, name );
  4342. }
  4343. } );
  4344. jQuery.fn.extend( {
  4345. data: function( key, value ) {
  4346. var i, name, data,
  4347. elem = this[ 0 ],
  4348. attrs = elem && elem.attributes;
  4349. // Gets all values
  4350. if ( key === undefined ) {
  4351. if ( this.length ) {
  4352. data = dataUser.get( elem );
  4353. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  4354. i = attrs.length;
  4355. while ( i-- ) {
  4356. // Support: IE 11 only
  4357. // The attrs elements can be null (#14894)
  4358. if ( attrs[ i ] ) {
  4359. name = attrs[ i ].name;
  4360. if ( name.indexOf( "data-" ) === 0 ) {
  4361. name = camelCase( name.slice( 5 ) );
  4362. dataAttr( elem, name, data[ name ] );
  4363. }
  4364. }
  4365. }
  4366. dataPriv.set( elem, "hasDataAttrs", true );
  4367. }
  4368. }
  4369. return data;
  4370. }
  4371. // Sets multiple values
  4372. if ( typeof key === "object" ) {
  4373. return this.each( function() {
  4374. dataUser.set( this, key );
  4375. } );
  4376. }
  4377. return access( this, function( value ) {
  4378. var data;
  4379. // The calling jQuery object (element matches) is not empty
  4380. // (and therefore has an element appears at this[ 0 ]) and the
  4381. // `value` parameter was not undefined. An empty jQuery object
  4382. // will result in `undefined` for elem = this[ 0 ] which will
  4383. // throw an exception if an attempt to read a data cache is made.
  4384. if ( elem && value === undefined ) {
  4385. // Attempt to get data from the cache
  4386. // The key will always be camelCased in Data
  4387. data = dataUser.get( elem, key );
  4388. if ( data !== undefined ) {
  4389. return data;
  4390. }
  4391. // Attempt to "discover" the data in
  4392. // HTML5 custom data-* attrs
  4393. data = dataAttr( elem, key );
  4394. if ( data !== undefined ) {
  4395. return data;
  4396. }
  4397. // We tried really hard, but the data doesn't exist.
  4398. return;
  4399. }
  4400. // Set the data...
  4401. this.each( function() {
  4402. // We always store the camelCased key
  4403. dataUser.set( this, key, value );
  4404. } );
  4405. }, null, value, arguments.length > 1, null, true );
  4406. },
  4407. removeData: function( key ) {
  4408. return this.each( function() {
  4409. dataUser.remove( this, key );
  4410. } );
  4411. }
  4412. } );
  4413. jQuery.extend( {
  4414. queue: function( elem, type, data ) {
  4415. var queue;
  4416. if ( elem ) {
  4417. type = ( type || "fx" ) + "queue";
  4418. queue = dataPriv.get( elem, type );
  4419. // Speed up dequeue by getting out quickly if this is just a lookup
  4420. if ( data ) {
  4421. if ( !queue || Array.isArray( data ) ) {
  4422. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  4423. } else {
  4424. queue.push( data );
  4425. }
  4426. }
  4427. return queue || [];
  4428. }
  4429. },
  4430. dequeue: function( elem, type ) {
  4431. type = type || "fx";
  4432. var queue = jQuery.queue( elem, type ),
  4433. startLength = queue.length,
  4434. fn = queue.shift(),
  4435. hooks = jQuery._queueHooks( elem, type ),
  4436. next = function() {
  4437. jQuery.dequeue( elem, type );
  4438. };
  4439. // If the fx queue is dequeued, always remove the progress sentinel
  4440. if ( fn === "inprogress" ) {
  4441. fn = queue.shift();
  4442. startLength--;
  4443. }
  4444. if ( fn ) {
  4445. // Add a progress sentinel to prevent the fx queue from being
  4446. // automatically dequeued
  4447. if ( type === "fx" ) {
  4448. queue.unshift( "inprogress" );
  4449. }
  4450. // Clear up the last queue stop function
  4451. delete hooks.stop;
  4452. fn.call( elem, next, hooks );
  4453. }
  4454. if ( !startLength && hooks ) {
  4455. hooks.empty.fire();
  4456. }
  4457. },
  4458. // Not public - generate a queueHooks object, or return the current one
  4459. _queueHooks: function( elem, type ) {
  4460. var key = type + "queueHooks";
  4461. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  4462. empty: jQuery.Callbacks( "once memory" ).add( function() {
  4463. dataPriv.remove( elem, [ type + "queue", key ] );
  4464. } )
  4465. } );
  4466. }
  4467. } );
  4468. jQuery.fn.extend( {
  4469. queue: function( type, data ) {
  4470. var setter = 2;
  4471. if ( typeof type !== "string" ) {
  4472. data = type;
  4473. type = "fx";
  4474. setter--;
  4475. }
  4476. if ( arguments.length < setter ) {
  4477. return jQuery.queue( this[ 0 ], type );
  4478. }
  4479. return data === undefined ?
  4480. this :
  4481. this.each( function() {
  4482. var queue = jQuery.queue( this, type, data );
  4483. // Ensure a hooks for this queue
  4484. jQuery._queueHooks( this, type );
  4485. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  4486. jQuery.dequeue( this, type );
  4487. }
  4488. } );
  4489. },
  4490. dequeue: function( type ) {
  4491. return this.each( function() {
  4492. jQuery.dequeue( this, type );
  4493. } );
  4494. },
  4495. clearQueue: function( type ) {
  4496. return this.queue( type || "fx", [] );
  4497. },
  4498. // Get a promise resolved when queues of a certain type
  4499. // are emptied (fx is the type by default)
  4500. promise: function( type, obj ) {
  4501. var tmp,
  4502. count = 1,
  4503. defer = jQuery.Deferred(),
  4504. elements = this,
  4505. i = this.length,
  4506. resolve = function() {
  4507. if ( !( --count ) ) {
  4508. defer.resolveWith( elements, [ elements ] );
  4509. }
  4510. };
  4511. if ( typeof type !== "string" ) {
  4512. obj = type;
  4513. type = undefined;
  4514. }
  4515. type = type || "fx";
  4516. while ( i-- ) {
  4517. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  4518. if ( tmp && tmp.empty ) {
  4519. count++;
  4520. tmp.empty.add( resolve );
  4521. }
  4522. }
  4523. resolve();
  4524. return defer.promise( obj );
  4525. }
  4526. } );
  4527. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  4528. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  4529. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  4530. var documentElement = document.documentElement;
  4531. var isAttached = function( elem ) {
  4532. return jQuery.contains( elem.ownerDocument, elem );
  4533. },
  4534. composed = { composed: true };
  4535. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  4536. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  4537. // Support: iOS 10.0-10.2 only
  4538. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  4539. // leading to errors. We need to check for `getRootNode`.
  4540. if ( documentElement.getRootNode ) {
  4541. isAttached = function( elem ) {
  4542. return jQuery.contains( elem.ownerDocument, elem ) ||
  4543. elem.getRootNode( composed ) === elem.ownerDocument;
  4544. };
  4545. }
  4546. var isHiddenWithinTree = function( elem, el ) {
  4547. // isHiddenWithinTree might be called from jQuery#filter function;
  4548. // in that case, element will be second argument
  4549. elem = el || elem;
  4550. // Inline style trumps all
  4551. return elem.style.display === "none" ||
  4552. elem.style.display === "" &&
  4553. // Otherwise, check computed style
  4554. // Support: Firefox <=43 - 45
  4555. // Disconnected elements can have computed display: none, so first confirm that elem is
  4556. // in the document.
  4557. isAttached( elem ) &&
  4558. jQuery.css( elem, "display" ) === "none";
  4559. };
  4560. var swap = function( elem, options, callback, args ) {
  4561. var ret, name,
  4562. old = {};
  4563. // Remember the old values, and insert the new ones
  4564. for ( name in options ) {
  4565. old[ name ] = elem.style[ name ];
  4566. elem.style[ name ] = options[ name ];
  4567. }
  4568. ret = callback.apply( elem, args || [] );
  4569. // Revert the old values
  4570. for ( name in options ) {
  4571. elem.style[ name ] = old[ name ];
  4572. }
  4573. return ret;
  4574. };
  4575. function adjustCSS( elem, prop, valueParts, tween ) {
  4576. var adjusted, scale,
  4577. maxIterations = 20,
  4578. currentValue = tween ?
  4579. function() {
  4580. return tween.cur();
  4581. } :
  4582. function() {
  4583. return jQuery.css( elem, prop, "" );
  4584. },
  4585. initial = currentValue(),
  4586. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  4587. // Starting value computation is required for potential unit mismatches
  4588. initialInUnit = elem.nodeType &&
  4589. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  4590. rcssNum.exec( jQuery.css( elem, prop ) );
  4591. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  4592. // Support: Firefox <=54
  4593. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  4594. initial = initial / 2;
  4595. // Trust units reported by jQuery.css
  4596. unit = unit || initialInUnit[ 3 ];
  4597. // Iteratively approximate from a nonzero starting point
  4598. initialInUnit = +initial || 1;
  4599. while ( maxIterations-- ) {
  4600. // Evaluate and update our best guess (doubling guesses that zero out).
  4601. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  4602. jQuery.style( elem, prop, initialInUnit + unit );
  4603. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  4604. maxIterations = 0;
  4605. }
  4606. initialInUnit = initialInUnit / scale;
  4607. }
  4608. initialInUnit = initialInUnit * 2;
  4609. jQuery.style( elem, prop, initialInUnit + unit );
  4610. // Make sure we update the tween properties later on
  4611. valueParts = valueParts || [];
  4612. }
  4613. if ( valueParts ) {
  4614. initialInUnit = +initialInUnit || +initial || 0;
  4615. // Apply relative offset (+=/-=) if specified
  4616. adjusted = valueParts[ 1 ] ?
  4617. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  4618. +valueParts[ 2 ];
  4619. if ( tween ) {
  4620. tween.unit = unit;
  4621. tween.start = initialInUnit;
  4622. tween.end = adjusted;
  4623. }
  4624. }
  4625. return adjusted;
  4626. }
  4627. var defaultDisplayMap = {};
  4628. function getDefaultDisplay( elem ) {
  4629. var temp,
  4630. doc = elem.ownerDocument,
  4631. nodeName = elem.nodeName,
  4632. display = defaultDisplayMap[ nodeName ];
  4633. if ( display ) {
  4634. return display;
  4635. }
  4636. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  4637. display = jQuery.css( temp, "display" );
  4638. temp.parentNode.removeChild( temp );
  4639. if ( display === "none" ) {
  4640. display = "block";
  4641. }
  4642. defaultDisplayMap[ nodeName ] = display;
  4643. return display;
  4644. }
  4645. function showHide( elements, show ) {
  4646. var display, elem,
  4647. values = [],
  4648. index = 0,
  4649. length = elements.length;
  4650. // Determine new display value for elements that need to change
  4651. for ( ; index < length; index++ ) {
  4652. elem = elements[ index ];
  4653. if ( !elem.style ) {
  4654. continue;
  4655. }
  4656. display = elem.style.display;
  4657. if ( show ) {
  4658. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  4659. // check is required in this first loop unless we have a nonempty display value (either
  4660. // inline or about-to-be-restored)
  4661. if ( display === "none" ) {
  4662. values[ index ] = dataPriv.get( elem, "display" ) || null;
  4663. if ( !values[ index ] ) {
  4664. elem.style.display = "";
  4665. }
  4666. }
  4667. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  4668. values[ index ] = getDefaultDisplay( elem );
  4669. }
  4670. } else {
  4671. if ( display !== "none" ) {
  4672. values[ index ] = "none";
  4673. // Remember what we're overwriting
  4674. dataPriv.set( elem, "display", display );
  4675. }
  4676. }
  4677. }
  4678. // Set the display of the elements in a second loop to avoid constant reflow
  4679. for ( index = 0; index < length; index++ ) {
  4680. if ( values[ index ] != null ) {
  4681. elements[ index ].style.display = values[ index ];
  4682. }
  4683. }
  4684. return elements;
  4685. }
  4686. jQuery.fn.extend( {
  4687. show: function() {
  4688. return showHide( this, true );
  4689. },
  4690. hide: function() {
  4691. return showHide( this );
  4692. },
  4693. toggle: function( state ) {
  4694. if ( typeof state === "boolean" ) {
  4695. return state ? this.show() : this.hide();
  4696. }
  4697. return this.each( function() {
  4698. if ( isHiddenWithinTree( this ) ) {
  4699. jQuery( this ).show();
  4700. } else {
  4701. jQuery( this ).hide();
  4702. }
  4703. } );
  4704. }
  4705. } );
  4706. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  4707. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  4708. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  4709. // We have to close these tags to support XHTML (#13200)
  4710. var wrapMap = {
  4711. // Support: IE <=9 only
  4712. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4713. // XHTML parsers do not magically insert elements in the
  4714. // same way that tag soup parsers do. So we cannot shorten
  4715. // this by omitting <tbody> or other required elements.
  4716. thead: [ 1, "<table>", "</table>" ],
  4717. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4718. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4719. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4720. _default: [ 0, "", "" ]
  4721. };
  4722. // Support: IE <=9 only
  4723. wrapMap.optgroup = wrapMap.option;
  4724. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4725. wrapMap.th = wrapMap.td;
  4726. function getAll( context, tag ) {
  4727. // Support: IE <=9 - 11 only
  4728. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  4729. var ret;
  4730. if ( typeof context.getElementsByTagName !== "undefined" ) {
  4731. ret = context.getElementsByTagName( tag || "*" );
  4732. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  4733. ret = context.querySelectorAll( tag || "*" );
  4734. } else {
  4735. ret = [];
  4736. }
  4737. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  4738. return jQuery.merge( [ context ], ret );
  4739. }
  4740. return ret;
  4741. }
  4742. // Mark scripts as having already been evaluated
  4743. function setGlobalEval( elems, refElements ) {
  4744. var i = 0,
  4745. l = elems.length;
  4746. for ( ; i < l; i++ ) {
  4747. dataPriv.set(
  4748. elems[ i ],
  4749. "globalEval",
  4750. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  4751. );
  4752. }
  4753. }
  4754. var rhtml = /<|&#?\w+;/;
  4755. function buildFragment( elems, context, scripts, selection, ignored ) {
  4756. var elem, tmp, tag, wrap, attached, j,
  4757. fragment = context.createDocumentFragment(),
  4758. nodes = [],
  4759. i = 0,
  4760. l = elems.length;
  4761. for ( ; i < l; i++ ) {
  4762. elem = elems[ i ];
  4763. if ( elem || elem === 0 ) {
  4764. // Add nodes directly
  4765. if ( toType( elem ) === "object" ) {
  4766. // Support: Android <=4.0 only, PhantomJS 1 only
  4767. // push.apply(_, arraylike) throws on ancient WebKit
  4768. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4769. // Convert non-html into a text node
  4770. } else if ( !rhtml.test( elem ) ) {
  4771. nodes.push( context.createTextNode( elem ) );
  4772. // Convert html into DOM nodes
  4773. } else {
  4774. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  4775. // Deserialize a standard representation
  4776. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4777. wrap = wrapMap[ tag ] || wrapMap._default;
  4778. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  4779. // Descend through wrappers to the right content
  4780. j = wrap[ 0 ];
  4781. while ( j-- ) {
  4782. tmp = tmp.lastChild;
  4783. }
  4784. // Support: Android <=4.0 only, PhantomJS 1 only
  4785. // push.apply(_, arraylike) throws on ancient WebKit
  4786. jQuery.merge( nodes, tmp.childNodes );
  4787. // Remember the top-level container
  4788. tmp = fragment.firstChild;
  4789. // Ensure the created nodes are orphaned (#12392)
  4790. tmp.textContent = "";
  4791. }
  4792. }
  4793. }
  4794. // Remove wrapper from fragment
  4795. fragment.textContent = "";
  4796. i = 0;
  4797. while ( ( elem = nodes[ i++ ] ) ) {
  4798. // Skip elements already in the context collection (trac-4087)
  4799. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  4800. if ( ignored ) {
  4801. ignored.push( elem );
  4802. }
  4803. continue;
  4804. }
  4805. attached = isAttached( elem );
  4806. // Append to fragment
  4807. tmp = getAll( fragment.appendChild( elem ), "script" );
  4808. // Preserve script evaluation history
  4809. if ( attached ) {
  4810. setGlobalEval( tmp );
  4811. }
  4812. // Capture executables
  4813. if ( scripts ) {
  4814. j = 0;
  4815. while ( ( elem = tmp[ j++ ] ) ) {
  4816. if ( rscriptType.test( elem.type || "" ) ) {
  4817. scripts.push( elem );
  4818. }
  4819. }
  4820. }
  4821. }
  4822. return fragment;
  4823. }
  4824. ( function() {
  4825. var fragment = document.createDocumentFragment(),
  4826. div = fragment.appendChild( document.createElement( "div" ) ),
  4827. input = document.createElement( "input" );
  4828. // Support: Android 4.0 - 4.3 only
  4829. // Check state lost if the name is set (#11217)
  4830. // Support: Windows Web Apps (WWA)
  4831. // `name` and `type` must use .setAttribute for WWA (#14901)
  4832. input.setAttribute( "type", "radio" );
  4833. input.setAttribute( "checked", "checked" );
  4834. input.setAttribute( "name", "t" );
  4835. div.appendChild( input );
  4836. // Support: Android <=4.1 only
  4837. // Older WebKit doesn't clone checked state correctly in fragments
  4838. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  4839. // Support: IE <=11 only
  4840. // Make sure textarea (and checkbox) defaultValue is properly cloned
  4841. div.innerHTML = "<textarea>x</textarea>";
  4842. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  4843. } )();
  4844. var
  4845. rkeyEvent = /^key/,
  4846. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  4847. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4848. function returnTrue() {
  4849. return true;
  4850. }
  4851. function returnFalse() {
  4852. return false;
  4853. }
  4854. // Support: IE <=9 - 11+
  4855. // focus() and blur() are asynchronous, except when they are no-op.
  4856. // So expect focus to be synchronous when the element is already active,
  4857. // and blur to be synchronous when the element is not already active.
  4858. // (focus and blur are always synchronous in other supported browsers,
  4859. // this just defines when we can count on it).
  4860. function expectSync( elem, type ) {
  4861. return ( elem === safeActiveElement() ) === ( type === "focus" );
  4862. }
  4863. // Support: IE <=9 only
  4864. // Accessing document.activeElement can throw unexpectedly
  4865. // https://bugs.jquery.com/ticket/13393
  4866. function safeActiveElement() {
  4867. try {
  4868. return document.activeElement;
  4869. } catch ( err ) { }
  4870. }
  4871. function on( elem, types, selector, data, fn, one ) {
  4872. var origFn, type;
  4873. // Types can be a map of types/handlers
  4874. if ( typeof types === "object" ) {
  4875. // ( types-Object, selector, data )
  4876. if ( typeof selector !== "string" ) {
  4877. // ( types-Object, data )
  4878. data = data || selector;
  4879. selector = undefined;
  4880. }
  4881. for ( type in types ) {
  4882. on( elem, type, selector, data, types[ type ], one );
  4883. }
  4884. return elem;
  4885. }
  4886. if ( data == null && fn == null ) {
  4887. // ( types, fn )
  4888. fn = selector;
  4889. data = selector = undefined;
  4890. } else if ( fn == null ) {
  4891. if ( typeof selector === "string" ) {
  4892. // ( types, selector, fn )
  4893. fn = data;
  4894. data = undefined;
  4895. } else {
  4896. // ( types, data, fn )
  4897. fn = data;
  4898. data = selector;
  4899. selector = undefined;
  4900. }
  4901. }
  4902. if ( fn === false ) {
  4903. fn = returnFalse;
  4904. } else if ( !fn ) {
  4905. return elem;
  4906. }
  4907. if ( one === 1 ) {
  4908. origFn = fn;
  4909. fn = function( event ) {
  4910. // Can use an empty set, since event contains the info
  4911. jQuery().off( event );
  4912. return origFn.apply( this, arguments );
  4913. };
  4914. // Use same guid so caller can remove using origFn
  4915. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4916. }
  4917. return elem.each( function() {
  4918. jQuery.event.add( this, types, fn, data, selector );
  4919. } );
  4920. }
  4921. /*
  4922. * Helper functions for managing events -- not part of the public interface.
  4923. * Props to Dean Edwards' addEvent library for many of the ideas.
  4924. */
  4925. jQuery.event = {
  4926. global: {},
  4927. add: function( elem, types, handler, data, selector ) {
  4928. var handleObjIn, eventHandle, tmp,
  4929. events, t, handleObj,
  4930. special, handlers, type, namespaces, origType,
  4931. elemData = dataPriv.get( elem );
  4932. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4933. if ( !elemData ) {
  4934. return;
  4935. }
  4936. // Caller can pass in an object of custom data in lieu of the handler
  4937. if ( handler.handler ) {
  4938. handleObjIn = handler;
  4939. handler = handleObjIn.handler;
  4940. selector = handleObjIn.selector;
  4941. }
  4942. // Ensure that invalid selectors throw exceptions at attach time
  4943. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4944. if ( selector ) {
  4945. jQuery.find.matchesSelector( documentElement, selector );
  4946. }
  4947. // Make sure that the handler has a unique ID, used to find/remove it later
  4948. if ( !handler.guid ) {
  4949. handler.guid = jQuery.guid++;
  4950. }
  4951. // Init the element's event structure and main handler, if this is the first
  4952. if ( !( events = elemData.events ) ) {
  4953. events = elemData.events = {};
  4954. }
  4955. if ( !( eventHandle = elemData.handle ) ) {
  4956. eventHandle = elemData.handle = function( e ) {
  4957. // Discard the second event of a jQuery.event.trigger() and
  4958. // when an event is called after a page has unloaded
  4959. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4960. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4961. };
  4962. }
  4963. // Handle multiple events separated by a space
  4964. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4965. t = types.length;
  4966. while ( t-- ) {
  4967. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4968. type = origType = tmp[ 1 ];
  4969. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4970. // There *must* be a type, no attaching namespace-only handlers
  4971. if ( !type ) {
  4972. continue;
  4973. }
  4974. // If event changes its type, use the special event handlers for the changed type
  4975. special = jQuery.event.special[ type ] || {};
  4976. // If selector defined, determine special event api type, otherwise given type
  4977. type = ( selector ? special.delegateType : special.bindType ) || type;
  4978. // Update special based on newly reset type
  4979. special = jQuery.event.special[ type ] || {};
  4980. // handleObj is passed to all event handlers
  4981. handleObj = jQuery.extend( {
  4982. type: type,
  4983. origType: origType,
  4984. data: data,
  4985. handler: handler,
  4986. guid: handler.guid,
  4987. selector: selector,
  4988. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4989. namespace: namespaces.join( "." )
  4990. }, handleObjIn );
  4991. // Init the event handler queue if we're the first
  4992. if ( !( handlers = events[ type ] ) ) {
  4993. handlers = events[ type ] = [];
  4994. handlers.delegateCount = 0;
  4995. // Only use addEventListener if the special events handler returns false
  4996. if ( !special.setup ||
  4997. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4998. if ( elem.addEventListener ) {
  4999. elem.addEventListener( type, eventHandle );
  5000. }
  5001. }
  5002. }
  5003. if ( special.add ) {
  5004. special.add.call( elem, handleObj );
  5005. if ( !handleObj.handler.guid ) {
  5006. handleObj.handler.guid = handler.guid;
  5007. }
  5008. }
  5009. // Add to the element's handler list, delegates in front
  5010. if ( selector ) {
  5011. handlers.splice( handlers.delegateCount++, 0, handleObj );
  5012. } else {
  5013. handlers.push( handleObj );
  5014. }
  5015. // Keep track of which events have ever been used, for event optimization
  5016. jQuery.event.global[ type ] = true;
  5017. }
  5018. },
  5019. // Detach an event or set of events from an element
  5020. remove: function( elem, types, handler, selector, mappedTypes ) {
  5021. var j, origCount, tmp,
  5022. events, t, handleObj,
  5023. special, handlers, type, namespaces, origType,
  5024. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  5025. if ( !elemData || !( events = elemData.events ) ) {
  5026. return;
  5027. }
  5028. // Once for each type.namespace in types; type may be omitted
  5029. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  5030. t = types.length;
  5031. while ( t-- ) {
  5032. tmp = rtypenamespace.exec( types[ t ] ) || [];
  5033. type = origType = tmp[ 1 ];
  5034. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  5035. // Unbind all events (on this namespace, if provided) for the element
  5036. if ( !type ) {
  5037. for ( type in events ) {
  5038. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  5039. }
  5040. continue;
  5041. }
  5042. special = jQuery.event.special[ type ] || {};
  5043. type = ( selector ? special.delegateType : special.bindType ) || type;
  5044. handlers = events[ type ] || [];
  5045. tmp = tmp[ 2 ] &&
  5046. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  5047. // Remove matching events
  5048. origCount = j = handlers.length;
  5049. while ( j-- ) {
  5050. handleObj = handlers[ j ];
  5051. if ( ( mappedTypes || origType === handleObj.origType ) &&
  5052. ( !handler || handler.guid === handleObj.guid ) &&
  5053. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  5054. ( !selector || selector === handleObj.selector ||
  5055. selector === "**" && handleObj.selector ) ) {
  5056. handlers.splice( j, 1 );
  5057. if ( handleObj.selector ) {
  5058. handlers.delegateCount--;
  5059. }
  5060. if ( special.remove ) {
  5061. special.remove.call( elem, handleObj );
  5062. }
  5063. }
  5064. }
  5065. // Remove generic event handler if we removed something and no more handlers exist
  5066. // (avoids potential for endless recursion during removal of special event handlers)
  5067. if ( origCount && !handlers.length ) {
  5068. if ( !special.teardown ||
  5069. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  5070. jQuery.removeEvent( elem, type, elemData.handle );
  5071. }
  5072. delete events[ type ];
  5073. }
  5074. }
  5075. // Remove data and the expando if it's no longer used
  5076. if ( jQuery.isEmptyObject( events ) ) {
  5077. dataPriv.remove( elem, "handle events" );
  5078. }
  5079. },
  5080. dispatch: function( nativeEvent ) {
  5081. // Make a writable jQuery.Event from the native event object
  5082. var event = jQuery.event.fix( nativeEvent );
  5083. var i, j, ret, matched, handleObj, handlerQueue,
  5084. args = new Array( arguments.length ),
  5085. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  5086. special = jQuery.event.special[ event.type ] || {};
  5087. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  5088. args[ 0 ] = event;
  5089. for ( i = 1; i < arguments.length; i++ ) {
  5090. args[ i ] = arguments[ i ];
  5091. }
  5092. event.delegateTarget = this;
  5093. // Call the preDispatch hook for the mapped type, and let it bail if desired
  5094. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  5095. return;
  5096. }
  5097. // Determine handlers
  5098. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  5099. // Run delegates first; they may want to stop propagation beneath us
  5100. i = 0;
  5101. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  5102. event.currentTarget = matched.elem;
  5103. j = 0;
  5104. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  5105. !event.isImmediatePropagationStopped() ) {
  5106. // If the event is namespaced, then each handler is only invoked if it is
  5107. // specially universal or its namespaces are a superset of the event's.
  5108. if ( !event.rnamespace || handleObj.namespace === false ||
  5109. event.rnamespace.test( handleObj.namespace ) ) {
  5110. event.handleObj = handleObj;
  5111. event.data = handleObj.data;
  5112. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  5113. handleObj.handler ).apply( matched.elem, args );
  5114. if ( ret !== undefined ) {
  5115. if ( ( event.result = ret ) === false ) {
  5116. event.preventDefault();
  5117. event.stopPropagation();
  5118. }
  5119. }
  5120. }
  5121. }
  5122. }
  5123. // Call the postDispatch hook for the mapped type
  5124. if ( special.postDispatch ) {
  5125. special.postDispatch.call( this, event );
  5126. }
  5127. return event.result;
  5128. },
  5129. handlers: function( event, handlers ) {
  5130. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  5131. handlerQueue = [],
  5132. delegateCount = handlers.delegateCount,
  5133. cur = event.target;
  5134. // Find delegate handlers
  5135. if ( delegateCount &&
  5136. // Support: IE <=9
  5137. // Black-hole SVG <use> instance trees (trac-13180)
  5138. cur.nodeType &&
  5139. // Support: Firefox <=42
  5140. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  5141. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  5142. // Support: IE 11 only
  5143. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  5144. !( event.type === "click" && event.button >= 1 ) ) {
  5145. for ( ; cur !== this; cur = cur.parentNode || this ) {
  5146. // Don't check non-elements (#13208)
  5147. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  5148. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  5149. matchedHandlers = [];
  5150. matchedSelectors = {};
  5151. for ( i = 0; i < delegateCount; i++ ) {
  5152. handleObj = handlers[ i ];
  5153. // Don't conflict with Object.prototype properties (#13203)
  5154. sel = handleObj.selector + " ";
  5155. if ( matchedSelectors[ sel ] === undefined ) {
  5156. matchedSelectors[ sel ] = handleObj.needsContext ?
  5157. jQuery( sel, this ).index( cur ) > -1 :
  5158. jQuery.find( sel, this, null, [ cur ] ).length;
  5159. }
  5160. if ( matchedSelectors[ sel ] ) {
  5161. matchedHandlers.push( handleObj );
  5162. }
  5163. }
  5164. if ( matchedHandlers.length ) {
  5165. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  5166. }
  5167. }
  5168. }
  5169. }
  5170. // Add the remaining (directly-bound) handlers
  5171. cur = this;
  5172. if ( delegateCount < handlers.length ) {
  5173. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  5174. }
  5175. return handlerQueue;
  5176. },
  5177. addProp: function( name, hook ) {
  5178. Object.defineProperty( jQuery.Event.prototype, name, {
  5179. enumerable: true,
  5180. configurable: true,
  5181. get: isFunction( hook ) ?
  5182. function() {
  5183. if ( this.originalEvent ) {
  5184. return hook( this.originalEvent );
  5185. }
  5186. } :
  5187. function() {
  5188. if ( this.originalEvent ) {
  5189. return this.originalEvent[ name ];
  5190. }
  5191. },
  5192. set: function( value ) {
  5193. Object.defineProperty( this, name, {
  5194. enumerable: true,
  5195. configurable: true,
  5196. writable: true,
  5197. value: value
  5198. } );
  5199. }
  5200. } );
  5201. },
  5202. fix: function( originalEvent ) {
  5203. return originalEvent[ jQuery.expando ] ?
  5204. originalEvent :
  5205. new jQuery.Event( originalEvent );
  5206. },
  5207. special: {
  5208. load: {
  5209. // Prevent triggered image.load events from bubbling to window.load
  5210. noBubble: true
  5211. },
  5212. click: {
  5213. // Utilize native event to ensure correct state for checkable inputs
  5214. setup: function( data ) {
  5215. // For mutual compressibility with _default, replace `this` access with a local var.
  5216. // `|| data` is dead code meant only to preserve the variable through minification.
  5217. var el = this || data;
  5218. // Claim the first handler
  5219. if ( rcheckableType.test( el.type ) &&
  5220. el.click && nodeName( el, "input" ) ) {
  5221. // dataPriv.set( el, "click", ... )
  5222. leverageNative( el, "click", returnTrue );
  5223. }
  5224. // Return false to allow normal processing in the caller
  5225. return false;
  5226. },
  5227. trigger: function( data ) {
  5228. // For mutual compressibility with _default, replace `this` access with a local var.
  5229. // `|| data` is dead code meant only to preserve the variable through minification.
  5230. var el = this || data;
  5231. // Force setup before triggering a click
  5232. if ( rcheckableType.test( el.type ) &&
  5233. el.click && nodeName( el, "input" ) ) {
  5234. leverageNative( el, "click" );
  5235. }
  5236. // Return non-false to allow normal event-path propagation
  5237. return true;
  5238. },
  5239. // For cross-browser consistency, suppress native .click() on links
  5240. // Also prevent it if we're currently inside a leveraged native-event stack
  5241. _default: function( event ) {
  5242. var target = event.target;
  5243. return rcheckableType.test( target.type ) &&
  5244. target.click && nodeName( target, "input" ) &&
  5245. dataPriv.get( target, "click" ) ||
  5246. nodeName( target, "a" );
  5247. }
  5248. },
  5249. beforeunload: {
  5250. postDispatch: function( event ) {
  5251. // Support: Firefox 20+
  5252. // Firefox doesn't alert if the returnValue field is not set.
  5253. if ( event.result !== undefined && event.originalEvent ) {
  5254. event.originalEvent.returnValue = event.result;
  5255. }
  5256. }
  5257. }
  5258. }
  5259. };
  5260. // Ensure the presence of an event listener that handles manually-triggered
  5261. // synthetic events by interrupting progress until reinvoked in response to
  5262. // *native* events that it fires directly, ensuring that state changes have
  5263. // already occurred before other listeners are invoked.
  5264. function leverageNative( el, type, expectSync ) {
  5265. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  5266. if ( !expectSync ) {
  5267. if ( dataPriv.get( el, type ) === undefined ) {
  5268. jQuery.event.add( el, type, returnTrue );
  5269. }
  5270. return;
  5271. }
  5272. // Register the controller as a special universal handler for all event namespaces
  5273. dataPriv.set( el, type, false );
  5274. jQuery.event.add( el, type, {
  5275. namespace: false,
  5276. handler: function( event ) {
  5277. var notAsync, result,
  5278. saved = dataPriv.get( this, type );
  5279. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  5280. // Interrupt processing of the outer synthetic .trigger()ed event
  5281. // Saved data should be false in such cases, but might be a leftover capture object
  5282. // from an async native handler (gh-4350)
  5283. if ( !saved.length ) {
  5284. // Store arguments for use when handling the inner native event
  5285. // There will always be at least one argument (an event object), so this array
  5286. // will not be confused with a leftover capture object.
  5287. saved = slice.call( arguments );
  5288. dataPriv.set( this, type, saved );
  5289. // Trigger the native event and capture its result
  5290. // Support: IE <=9 - 11+
  5291. // focus() and blur() are asynchronous
  5292. notAsync = expectSync( this, type );
  5293. this[ type ]();
  5294. result = dataPriv.get( this, type );
  5295. if ( saved !== result || notAsync ) {
  5296. dataPriv.set( this, type, false );
  5297. } else {
  5298. result = {};
  5299. }
  5300. if ( saved !== result ) {
  5301. // Cancel the outer synthetic event
  5302. event.stopImmediatePropagation();
  5303. event.preventDefault();
  5304. return result.value;
  5305. }
  5306. // If this is an inner synthetic event for an event with a bubbling surrogate
  5307. // (focus or blur), assume that the surrogate already propagated from triggering the
  5308. // native event and prevent that from happening again here.
  5309. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  5310. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  5311. // less bad than duplication.
  5312. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  5313. event.stopPropagation();
  5314. }
  5315. // If this is a native event triggered above, everything is now in order
  5316. // Fire an inner synthetic event with the original arguments
  5317. } else if ( saved.length ) {
  5318. // ...and capture the result
  5319. dataPriv.set( this, type, {
  5320. value: jQuery.event.trigger(
  5321. // Support: IE <=9 - 11+
  5322. // Extend with the prototype to reset the above stopImmediatePropagation()
  5323. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  5324. saved.slice( 1 ),
  5325. this
  5326. )
  5327. } );
  5328. // Abort handling of the native event
  5329. event.stopImmediatePropagation();
  5330. }
  5331. }
  5332. } );
  5333. }
  5334. jQuery.removeEvent = function( elem, type, handle ) {
  5335. // This "if" is needed for plain objects
  5336. if ( elem.removeEventListener ) {
  5337. elem.removeEventListener( type, handle );
  5338. }
  5339. };
  5340. jQuery.Event = function( src, props ) {
  5341. // Allow instantiation without the 'new' keyword
  5342. if ( !( this instanceof jQuery.Event ) ) {
  5343. return new jQuery.Event( src, props );
  5344. }
  5345. // Event object
  5346. if ( src && src.type ) {
  5347. this.originalEvent = src;
  5348. this.type = src.type;
  5349. // Events bubbling up the document may have been marked as prevented
  5350. // by a handler lower down the tree; reflect the correct value.
  5351. this.isDefaultPrevented = src.defaultPrevented ||
  5352. src.defaultPrevented === undefined &&
  5353. // Support: Android <=2.3 only
  5354. src.returnValue === false ?
  5355. returnTrue :
  5356. returnFalse;
  5357. // Create target properties
  5358. // Support: Safari <=6 - 7 only
  5359. // Target should not be a text node (#504, #13143)
  5360. this.target = ( src.target && src.target.nodeType === 3 ) ?
  5361. src.target.parentNode :
  5362. src.target;
  5363. this.currentTarget = src.currentTarget;
  5364. this.relatedTarget = src.relatedTarget;
  5365. // Event type
  5366. } else {
  5367. this.type = src;
  5368. }
  5369. // Put explicitly provided properties onto the event object
  5370. if ( props ) {
  5371. jQuery.extend( this, props );
  5372. }
  5373. // Create a timestamp if incoming event doesn't have one
  5374. this.timeStamp = src && src.timeStamp || Date.now();
  5375. // Mark it as fixed
  5376. this[ jQuery.expando ] = true;
  5377. };
  5378. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  5379. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  5380. jQuery.Event.prototype = {
  5381. constructor: jQuery.Event,
  5382. isDefaultPrevented: returnFalse,
  5383. isPropagationStopped: returnFalse,
  5384. isImmediatePropagationStopped: returnFalse,
  5385. isSimulated: false,
  5386. preventDefault: function() {
  5387. var e = this.originalEvent;
  5388. this.isDefaultPrevented = returnTrue;
  5389. if ( e && !this.isSimulated ) {
  5390. e.preventDefault();
  5391. }
  5392. },
  5393. stopPropagation: function() {
  5394. var e = this.originalEvent;
  5395. this.isPropagationStopped = returnTrue;
  5396. if ( e && !this.isSimulated ) {
  5397. e.stopPropagation();
  5398. }
  5399. },
  5400. stopImmediatePropagation: function() {
  5401. var e = this.originalEvent;
  5402. this.isImmediatePropagationStopped = returnTrue;
  5403. if ( e && !this.isSimulated ) {
  5404. e.stopImmediatePropagation();
  5405. }
  5406. this.stopPropagation();
  5407. }
  5408. };
  5409. // Includes all common event props including KeyEvent and MouseEvent specific props
  5410. jQuery.each( {
  5411. altKey: true,
  5412. bubbles: true,
  5413. cancelable: true,
  5414. changedTouches: true,
  5415. ctrlKey: true,
  5416. detail: true,
  5417. eventPhase: true,
  5418. metaKey: true,
  5419. pageX: true,
  5420. pageY: true,
  5421. shiftKey: true,
  5422. view: true,
  5423. "char": true,
  5424. code: true,
  5425. charCode: true,
  5426. key: true,
  5427. keyCode: true,
  5428. button: true,
  5429. buttons: true,
  5430. clientX: true,
  5431. clientY: true,
  5432. offsetX: true,
  5433. offsetY: true,
  5434. pointerId: true,
  5435. pointerType: true,
  5436. screenX: true,
  5437. screenY: true,
  5438. targetTouches: true,
  5439. toElement: true,
  5440. touches: true,
  5441. which: function( event ) {
  5442. var button = event.button;
  5443. // Add which for key events
  5444. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  5445. return event.charCode != null ? event.charCode : event.keyCode;
  5446. }
  5447. // Add which for click: 1 === left; 2 === middle; 3 === right
  5448. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  5449. if ( button & 1 ) {
  5450. return 1;
  5451. }
  5452. if ( button & 2 ) {
  5453. return 3;
  5454. }
  5455. if ( button & 4 ) {
  5456. return 2;
  5457. }
  5458. return 0;
  5459. }
  5460. return event.which;
  5461. }
  5462. }, jQuery.event.addProp );
  5463. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  5464. jQuery.event.special[ type ] = {
  5465. // Utilize native event if possible so blur/focus sequence is correct
  5466. setup: function() {
  5467. // Claim the first handler
  5468. // dataPriv.set( this, "focus", ... )
  5469. // dataPriv.set( this, "blur", ... )
  5470. leverageNative( this, type, expectSync );
  5471. // Return false to allow normal processing in the caller
  5472. return false;
  5473. },
  5474. trigger: function() {
  5475. // Force setup before trigger
  5476. leverageNative( this, type );
  5477. // Return non-false to allow normal event-path propagation
  5478. return true;
  5479. },
  5480. delegateType: delegateType
  5481. };
  5482. } );
  5483. // Create mouseenter/leave events using mouseover/out and event-time checks
  5484. // so that event delegation works in jQuery.
  5485. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  5486. //
  5487. // Support: Safari 7 only
  5488. // Safari sends mouseenter too often; see:
  5489. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  5490. // for the description of the bug (it existed in older Chrome versions as well).
  5491. jQuery.each( {
  5492. mouseenter: "mouseover",
  5493. mouseleave: "mouseout",
  5494. pointerenter: "pointerover",
  5495. pointerleave: "pointerout"
  5496. }, function( orig, fix ) {
  5497. jQuery.event.special[ orig ] = {
  5498. delegateType: fix,
  5499. bindType: fix,
  5500. handle: function( event ) {
  5501. var ret,
  5502. target = this,
  5503. related = event.relatedTarget,
  5504. handleObj = event.handleObj;
  5505. // For mouseenter/leave call the handler if related is outside the target.
  5506. // NB: No relatedTarget if the mouse left/entered the browser window
  5507. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  5508. event.type = handleObj.origType;
  5509. ret = handleObj.handler.apply( this, arguments );
  5510. event.type = fix;
  5511. }
  5512. return ret;
  5513. }
  5514. };
  5515. } );
  5516. jQuery.fn.extend( {
  5517. on: function( types, selector, data, fn ) {
  5518. return on( this, types, selector, data, fn );
  5519. },
  5520. one: function( types, selector, data, fn ) {
  5521. return on( this, types, selector, data, fn, 1 );
  5522. },
  5523. off: function( types, selector, fn ) {
  5524. var handleObj, type;
  5525. if ( types && types.preventDefault && types.handleObj ) {
  5526. // ( event ) dispatched jQuery.Event
  5527. handleObj = types.handleObj;
  5528. jQuery( types.delegateTarget ).off(
  5529. handleObj.namespace ?
  5530. handleObj.origType + "." + handleObj.namespace :
  5531. handleObj.origType,
  5532. handleObj.selector,
  5533. handleObj.handler
  5534. );
  5535. return this;
  5536. }
  5537. if ( typeof types === "object" ) {
  5538. // ( types-object [, selector] )
  5539. for ( type in types ) {
  5540. this.off( type, selector, types[ type ] );
  5541. }
  5542. return this;
  5543. }
  5544. if ( selector === false || typeof selector === "function" ) {
  5545. // ( types [, fn] )
  5546. fn = selector;
  5547. selector = undefined;
  5548. }
  5549. if ( fn === false ) {
  5550. fn = returnFalse;
  5551. }
  5552. return this.each( function() {
  5553. jQuery.event.remove( this, types, fn, selector );
  5554. } );
  5555. }
  5556. } );
  5557. var
  5558. /* eslint-disable max-len */
  5559. // See https://github.com/eslint/eslint/issues/3229
  5560. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  5561. /* eslint-enable */
  5562. // Support: IE <=10 - 11, Edge 12 - 13 only
  5563. // In IE/Edge using regex groups here causes severe slowdowns.
  5564. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  5565. rnoInnerhtml = /<script|<style|<link/i,
  5566. // checked="checked" or checked
  5567. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  5568. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  5569. // Prefer a tbody over its parent table for containing new rows
  5570. function manipulationTarget( elem, content ) {
  5571. if ( nodeName( elem, "table" ) &&
  5572. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  5573. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  5574. }
  5575. return elem;
  5576. }
  5577. // Replace/restore the type attribute of script elements for safe DOM manipulation
  5578. function disableScript( elem ) {
  5579. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  5580. return elem;
  5581. }
  5582. function restoreScript( elem ) {
  5583. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  5584. elem.type = elem.type.slice( 5 );
  5585. } else {
  5586. elem.removeAttribute( "type" );
  5587. }
  5588. return elem;
  5589. }
  5590. function cloneCopyEvent( src, dest ) {
  5591. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  5592. if ( dest.nodeType !== 1 ) {
  5593. return;
  5594. }
  5595. // 1. Copy private data: events, handlers, etc.
  5596. if ( dataPriv.hasData( src ) ) {
  5597. pdataOld = dataPriv.access( src );
  5598. pdataCur = dataPriv.set( dest, pdataOld );
  5599. events = pdataOld.events;
  5600. if ( events ) {
  5601. delete pdataCur.handle;
  5602. pdataCur.events = {};
  5603. for ( type in events ) {
  5604. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  5605. jQuery.event.add( dest, type, events[ type ][ i ] );
  5606. }
  5607. }
  5608. }
  5609. }
  5610. // 2. Copy user data
  5611. if ( dataUser.hasData( src ) ) {
  5612. udataOld = dataUser.access( src );
  5613. udataCur = jQuery.extend( {}, udataOld );
  5614. dataUser.set( dest, udataCur );
  5615. }
  5616. }
  5617. // Fix IE bugs, see support tests
  5618. function fixInput( src, dest ) {
  5619. var nodeName = dest.nodeName.toLowerCase();
  5620. // Fails to persist the checked state of a cloned checkbox or radio button.
  5621. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  5622. dest.checked = src.checked;
  5623. // Fails to return the selected option to the default selected state when cloning options
  5624. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  5625. dest.defaultValue = src.defaultValue;
  5626. }
  5627. }
  5628. function domManip( collection, args, callback, ignored ) {
  5629. // Flatten any nested arrays
  5630. args = concat.apply( [], args );
  5631. var fragment, first, scripts, hasScripts, node, doc,
  5632. i = 0,
  5633. l = collection.length,
  5634. iNoClone = l - 1,
  5635. value = args[ 0 ],
  5636. valueIsFunction = isFunction( value );
  5637. // We can't cloneNode fragments that contain checked, in WebKit
  5638. if ( valueIsFunction ||
  5639. ( l > 1 && typeof value === "string" &&
  5640. !support.checkClone && rchecked.test( value ) ) ) {
  5641. return collection.each( function( index ) {
  5642. var self = collection.eq( index );
  5643. if ( valueIsFunction ) {
  5644. args[ 0 ] = value.call( this, index, self.html() );
  5645. }
  5646. domManip( self, args, callback, ignored );
  5647. } );
  5648. }
  5649. if ( l ) {
  5650. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  5651. first = fragment.firstChild;
  5652. if ( fragment.childNodes.length === 1 ) {
  5653. fragment = first;
  5654. }
  5655. // Require either new content or an interest in ignored elements to invoke the callback
  5656. if ( first || ignored ) {
  5657. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  5658. hasScripts = scripts.length;
  5659. // Use the original fragment for the last item
  5660. // instead of the first because it can end up
  5661. // being emptied incorrectly in certain situations (#8070).
  5662. for ( ; i < l; i++ ) {
  5663. node = fragment;
  5664. if ( i !== iNoClone ) {
  5665. node = jQuery.clone( node, true, true );
  5666. // Keep references to cloned scripts for later restoration
  5667. if ( hasScripts ) {
  5668. // Support: Android <=4.0 only, PhantomJS 1 only
  5669. // push.apply(_, arraylike) throws on ancient WebKit
  5670. jQuery.merge( scripts, getAll( node, "script" ) );
  5671. }
  5672. }
  5673. callback.call( collection[ i ], node, i );
  5674. }
  5675. if ( hasScripts ) {
  5676. doc = scripts[ scripts.length - 1 ].ownerDocument;
  5677. // Reenable scripts
  5678. jQuery.map( scripts, restoreScript );
  5679. // Evaluate executable scripts on first document insertion
  5680. for ( i = 0; i < hasScripts; i++ ) {
  5681. node = scripts[ i ];
  5682. if ( rscriptType.test( node.type || "" ) &&
  5683. !dataPriv.access( node, "globalEval" ) &&
  5684. jQuery.contains( doc, node ) ) {
  5685. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  5686. // Optional AJAX dependency, but won't run scripts if not present
  5687. if ( jQuery._evalUrl && !node.noModule ) {
  5688. jQuery._evalUrl( node.src, {
  5689. nonce: node.nonce || node.getAttribute( "nonce" )
  5690. } );
  5691. }
  5692. } else {
  5693. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  5694. }
  5695. }
  5696. }
  5697. }
  5698. }
  5699. }
  5700. return collection;
  5701. }
  5702. function remove( elem, selector, keepData ) {
  5703. var node,
  5704. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  5705. i = 0;
  5706. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  5707. if ( !keepData && node.nodeType === 1 ) {
  5708. jQuery.cleanData( getAll( node ) );
  5709. }
  5710. if ( node.parentNode ) {
  5711. if ( keepData && isAttached( node ) ) {
  5712. setGlobalEval( getAll( node, "script" ) );
  5713. }
  5714. node.parentNode.removeChild( node );
  5715. }
  5716. }
  5717. return elem;
  5718. }
  5719. jQuery.extend( {
  5720. htmlPrefilter: function( html ) {
  5721. return html.replace( rxhtmlTag, "<$1></$2>" );
  5722. },
  5723. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  5724. var i, l, srcElements, destElements,
  5725. clone = elem.cloneNode( true ),
  5726. inPage = isAttached( elem );
  5727. // Fix IE cloning issues
  5728. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  5729. !jQuery.isXMLDoc( elem ) ) {
  5730. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  5731. destElements = getAll( clone );
  5732. srcElements = getAll( elem );
  5733. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5734. fixInput( srcElements[ i ], destElements[ i ] );
  5735. }
  5736. }
  5737. // Copy the events from the original to the clone
  5738. if ( dataAndEvents ) {
  5739. if ( deepDataAndEvents ) {
  5740. srcElements = srcElements || getAll( elem );
  5741. destElements = destElements || getAll( clone );
  5742. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5743. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  5744. }
  5745. } else {
  5746. cloneCopyEvent( elem, clone );
  5747. }
  5748. }
  5749. // Preserve script evaluation history
  5750. destElements = getAll( clone, "script" );
  5751. if ( destElements.length > 0 ) {
  5752. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  5753. }
  5754. // Return the cloned set
  5755. return clone;
  5756. },
  5757. cleanData: function( elems ) {
  5758. var data, elem, type,
  5759. special = jQuery.event.special,
  5760. i = 0;
  5761. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  5762. if ( acceptData( elem ) ) {
  5763. if ( ( data = elem[ dataPriv.expando ] ) ) {
  5764. if ( data.events ) {
  5765. for ( type in data.events ) {
  5766. if ( special[ type ] ) {
  5767. jQuery.event.remove( elem, type );
  5768. // This is a shortcut to avoid jQuery.event.remove's overhead
  5769. } else {
  5770. jQuery.removeEvent( elem, type, data.handle );
  5771. }
  5772. }
  5773. }
  5774. // Support: Chrome <=35 - 45+
  5775. // Assign undefined instead of using delete, see Data#remove
  5776. elem[ dataPriv.expando ] = undefined;
  5777. }
  5778. if ( elem[ dataUser.expando ] ) {
  5779. // Support: Chrome <=35 - 45+
  5780. // Assign undefined instead of using delete, see Data#remove
  5781. elem[ dataUser.expando ] = undefined;
  5782. }
  5783. }
  5784. }
  5785. }
  5786. } );
  5787. jQuery.fn.extend( {
  5788. detach: function( selector ) {
  5789. return remove( this, selector, true );
  5790. },
  5791. remove: function( selector ) {
  5792. return remove( this, selector );
  5793. },
  5794. text: function( value ) {
  5795. return access( this, function( value ) {
  5796. return value === undefined ?
  5797. jQuery.text( this ) :
  5798. this.empty().each( function() {
  5799. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5800. this.textContent = value;
  5801. }
  5802. } );
  5803. }, null, value, arguments.length );
  5804. },
  5805. append: function() {
  5806. return domManip( this, arguments, function( elem ) {
  5807. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5808. var target = manipulationTarget( this, elem );
  5809. target.appendChild( elem );
  5810. }
  5811. } );
  5812. },
  5813. prepend: function() {
  5814. return domManip( this, arguments, function( elem ) {
  5815. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5816. var target = manipulationTarget( this, elem );
  5817. target.insertBefore( elem, target.firstChild );
  5818. }
  5819. } );
  5820. },
  5821. before: function() {
  5822. return domManip( this, arguments, function( elem ) {
  5823. if ( this.parentNode ) {
  5824. this.parentNode.insertBefore( elem, this );
  5825. }
  5826. } );
  5827. },
  5828. after: function() {
  5829. return domManip( this, arguments, function( elem ) {
  5830. if ( this.parentNode ) {
  5831. this.parentNode.insertBefore( elem, this.nextSibling );
  5832. }
  5833. } );
  5834. },
  5835. empty: function() {
  5836. var elem,
  5837. i = 0;
  5838. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  5839. if ( elem.nodeType === 1 ) {
  5840. // Prevent memory leaks
  5841. jQuery.cleanData( getAll( elem, false ) );
  5842. // Remove any remaining nodes
  5843. elem.textContent = "";
  5844. }
  5845. }
  5846. return this;
  5847. },
  5848. clone: function( dataAndEvents, deepDataAndEvents ) {
  5849. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5850. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5851. return this.map( function() {
  5852. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  5853. } );
  5854. },
  5855. html: function( value ) {
  5856. return access( this, function( value ) {
  5857. var elem = this[ 0 ] || {},
  5858. i = 0,
  5859. l = this.length;
  5860. if ( value === undefined && elem.nodeType === 1 ) {
  5861. return elem.innerHTML;
  5862. }
  5863. // See if we can take a shortcut and just use innerHTML
  5864. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  5865. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  5866. value = jQuery.htmlPrefilter( value );
  5867. try {
  5868. for ( ; i < l; i++ ) {
  5869. elem = this[ i ] || {};
  5870. // Remove element nodes and prevent memory leaks
  5871. if ( elem.nodeType === 1 ) {
  5872. jQuery.cleanData( getAll( elem, false ) );
  5873. elem.innerHTML = value;
  5874. }
  5875. }
  5876. elem = 0;
  5877. // If using innerHTML throws an exception, use the fallback method
  5878. } catch ( e ) {}
  5879. }
  5880. if ( elem ) {
  5881. this.empty().append( value );
  5882. }
  5883. }, null, value, arguments.length );
  5884. },
  5885. replaceWith: function() {
  5886. var ignored = [];
  5887. // Make the changes, replacing each non-ignored context element with the new content
  5888. return domManip( this, arguments, function( elem ) {
  5889. var parent = this.parentNode;
  5890. if ( jQuery.inArray( this, ignored ) < 0 ) {
  5891. jQuery.cleanData( getAll( this ) );
  5892. if ( parent ) {
  5893. parent.replaceChild( elem, this );
  5894. }
  5895. }
  5896. // Force callback invocation
  5897. }, ignored );
  5898. }
  5899. } );
  5900. jQuery.each( {
  5901. appendTo: "append",
  5902. prependTo: "prepend",
  5903. insertBefore: "before",
  5904. insertAfter: "after",
  5905. replaceAll: "replaceWith"
  5906. }, function( name, original ) {
  5907. jQuery.fn[ name ] = function( selector ) {
  5908. var elems,
  5909. ret = [],
  5910. insert = jQuery( selector ),
  5911. last = insert.length - 1,
  5912. i = 0;
  5913. for ( ; i <= last; i++ ) {
  5914. elems = i === last ? this : this.clone( true );
  5915. jQuery( insert[ i ] )[ original ]( elems );
  5916. // Support: Android <=4.0 only, PhantomJS 1 only
  5917. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  5918. push.apply( ret, elems.get() );
  5919. }
  5920. return this.pushStack( ret );
  5921. };
  5922. } );
  5923. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  5924. var getStyles = function( elem ) {
  5925. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  5926. // IE throws on elements created in popups
  5927. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  5928. var view = elem.ownerDocument.defaultView;
  5929. if ( !view || !view.opener ) {
  5930. view = window;
  5931. }
  5932. return view.getComputedStyle( elem );
  5933. };
  5934. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  5935. ( function() {
  5936. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  5937. // so they're executed at the same time to save the second computation.
  5938. function computeStyleTests() {
  5939. // This is a singleton, we need to execute it only once
  5940. if ( !div ) {
  5941. return;
  5942. }
  5943. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  5944. "margin-top:1px;padding:0;border:0";
  5945. div.style.cssText =
  5946. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  5947. "margin:auto;border:1px;padding:1px;" +
  5948. "width:60%;top:1%";
  5949. documentElement.appendChild( container ).appendChild( div );
  5950. var divStyle = window.getComputedStyle( div );
  5951. pixelPositionVal = divStyle.top !== "1%";
  5952. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  5953. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  5954. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  5955. // Some styles come back with percentage values, even though they shouldn't
  5956. div.style.right = "60%";
  5957. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  5958. // Support: IE 9 - 11 only
  5959. // Detect misreporting of content dimensions for box-sizing:border-box elements
  5960. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  5961. // Support: IE 9 only
  5962. // Detect overflow:scroll screwiness (gh-3699)
  5963. // Support: Chrome <=64
  5964. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  5965. div.style.position = "absolute";
  5966. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  5967. documentElement.removeChild( container );
  5968. // Nullify the div so it wouldn't be stored in the memory and
  5969. // it will also be a sign that checks already performed
  5970. div = null;
  5971. }
  5972. function roundPixelMeasures( measure ) {
  5973. return Math.round( parseFloat( measure ) );
  5974. }
  5975. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  5976. reliableMarginLeftVal,
  5977. container = document.createElement( "div" ),
  5978. div = document.createElement( "div" );
  5979. // Finish early in limited (non-browser) environments
  5980. if ( !div.style ) {
  5981. return;
  5982. }
  5983. // Support: IE <=9 - 11 only
  5984. // Style of cloned element affects source element cloned (#8908)
  5985. div.style.backgroundClip = "content-box";
  5986. div.cloneNode( true ).style.backgroundClip = "";
  5987. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5988. jQuery.extend( support, {
  5989. boxSizingReliable: function() {
  5990. computeStyleTests();
  5991. return boxSizingReliableVal;
  5992. },
  5993. pixelBoxStyles: function() {
  5994. computeStyleTests();
  5995. return pixelBoxStylesVal;
  5996. },
  5997. pixelPosition: function() {
  5998. computeStyleTests();
  5999. return pixelPositionVal;
  6000. },
  6001. reliableMarginLeft: function() {
  6002. computeStyleTests();
  6003. return reliableMarginLeftVal;
  6004. },
  6005. scrollboxSize: function() {
  6006. computeStyleTests();
  6007. return scrollboxSizeVal;
  6008. }
  6009. } );
  6010. } )();
  6011. function curCSS( elem, name, computed ) {
  6012. var width, minWidth, maxWidth, ret,
  6013. // Support: Firefox 51+
  6014. // Retrieving style before computed somehow
  6015. // fixes an issue with getting wrong values
  6016. // on detached elements
  6017. style = elem.style;
  6018. computed = computed || getStyles( elem );
  6019. // getPropertyValue is needed for:
  6020. // .css('filter') (IE 9 only, #12537)
  6021. // .css('--customProperty) (#3144)
  6022. if ( computed ) {
  6023. ret = computed.getPropertyValue( name ) || computed[ name ];
  6024. if ( ret === "" && !isAttached( elem ) ) {
  6025. ret = jQuery.style( elem, name );
  6026. }
  6027. // A tribute to the "awesome hack by Dean Edwards"
  6028. // Android Browser returns percentage for some values,
  6029. // but width seems to be reliably pixels.
  6030. // This is against the CSSOM draft spec:
  6031. // https://drafts.csswg.org/cssom/#resolved-values
  6032. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  6033. // Remember the original values
  6034. width = style.width;
  6035. minWidth = style.minWidth;
  6036. maxWidth = style.maxWidth;
  6037. // Put in the new values to get a computed value out
  6038. style.minWidth = style.maxWidth = style.width = ret;
  6039. ret = computed.width;
  6040. // Revert the changed values
  6041. style.width = width;
  6042. style.minWidth = minWidth;
  6043. style.maxWidth = maxWidth;
  6044. }
  6045. }
  6046. return ret !== undefined ?
  6047. // Support: IE <=9 - 11 only
  6048. // IE returns zIndex value as an integer.
  6049. ret + "" :
  6050. ret;
  6051. }
  6052. function addGetHookIf( conditionFn, hookFn ) {
  6053. // Define the hook, we'll check on the first run if it's really needed.
  6054. return {
  6055. get: function() {
  6056. if ( conditionFn() ) {
  6057. // Hook not needed (or it's not possible to use it due
  6058. // to missing dependency), remove it.
  6059. delete this.get;
  6060. return;
  6061. }
  6062. // Hook needed; redefine it so that the support test is not executed again.
  6063. return ( this.get = hookFn ).apply( this, arguments );
  6064. }
  6065. };
  6066. }
  6067. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  6068. emptyStyle = document.createElement( "div" ).style,
  6069. vendorProps = {};
  6070. // Return a vendor-prefixed property or undefined
  6071. function vendorPropName( name ) {
  6072. // Check for vendor prefixed names
  6073. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  6074. i = cssPrefixes.length;
  6075. while ( i-- ) {
  6076. name = cssPrefixes[ i ] + capName;
  6077. if ( name in emptyStyle ) {
  6078. return name;
  6079. }
  6080. }
  6081. }
  6082. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  6083. function finalPropName( name ) {
  6084. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  6085. if ( final ) {
  6086. return final;
  6087. }
  6088. if ( name in emptyStyle ) {
  6089. return name;
  6090. }
  6091. return vendorProps[ name ] = vendorPropName( name ) || name;
  6092. }
  6093. var
  6094. // Swappable if display is none or starts with table
  6095. // except "table", "table-cell", or "table-caption"
  6096. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  6097. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  6098. rcustomProp = /^--/,
  6099. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  6100. cssNormalTransform = {
  6101. letterSpacing: "0",
  6102. fontWeight: "400"
  6103. };
  6104. function setPositiveNumber( elem, value, subtract ) {
  6105. // Any relative (+/-) values have already been
  6106. // normalized at this point
  6107. var matches = rcssNum.exec( value );
  6108. return matches ?
  6109. // Guard against undefined "subtract", e.g., when used as in cssHooks
  6110. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  6111. value;
  6112. }
  6113. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  6114. var i = dimension === "width" ? 1 : 0,
  6115. extra = 0,
  6116. delta = 0;
  6117. // Adjustment may not be necessary
  6118. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  6119. return 0;
  6120. }
  6121. for ( ; i < 4; i += 2 ) {
  6122. // Both box models exclude margin
  6123. if ( box === "margin" ) {
  6124. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  6125. }
  6126. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  6127. if ( !isBorderBox ) {
  6128. // Add padding
  6129. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  6130. // For "border" or "margin", add border
  6131. if ( box !== "padding" ) {
  6132. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6133. // But still keep track of it otherwise
  6134. } else {
  6135. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6136. }
  6137. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  6138. // "padding" or "margin"
  6139. } else {
  6140. // For "content", subtract padding
  6141. if ( box === "content" ) {
  6142. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  6143. }
  6144. // For "content" or "padding", subtract border
  6145. if ( box !== "margin" ) {
  6146. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6147. }
  6148. }
  6149. }
  6150. // Account for positive content-box scroll gutter when requested by providing computedVal
  6151. if ( !isBorderBox && computedVal >= 0 ) {
  6152. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  6153. // Assuming integer scroll gutter, subtract the rest and round down
  6154. delta += Math.max( 0, Math.ceil(
  6155. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  6156. computedVal -
  6157. delta -
  6158. extra -
  6159. 0.5
  6160. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  6161. // Use an explicit zero to avoid NaN (gh-3964)
  6162. ) ) || 0;
  6163. }
  6164. return delta;
  6165. }
  6166. function getWidthOrHeight( elem, dimension, extra ) {
  6167. // Start with computed style
  6168. var styles = getStyles( elem ),
  6169. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  6170. // Fake content-box until we know it's needed to know the true value.
  6171. boxSizingNeeded = !support.boxSizingReliable() || extra,
  6172. isBorderBox = boxSizingNeeded &&
  6173. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6174. valueIsBorderBox = isBorderBox,
  6175. val = curCSS( elem, dimension, styles ),
  6176. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  6177. // Support: Firefox <=54
  6178. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  6179. if ( rnumnonpx.test( val ) ) {
  6180. if ( !extra ) {
  6181. return val;
  6182. }
  6183. val = "auto";
  6184. }
  6185. // Fall back to offsetWidth/offsetHeight when value is "auto"
  6186. // This happens for inline elements with no explicit setting (gh-3571)
  6187. // Support: Android <=4.1 - 4.3 only
  6188. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  6189. // Support: IE 9-11 only
  6190. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  6191. // We use getClientRects() to check for hidden/disconnected.
  6192. // In those cases, the computed value can be trusted to be border-box
  6193. if ( ( !support.boxSizingReliable() && isBorderBox ||
  6194. val === "auto" ||
  6195. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  6196. elem.getClientRects().length ) {
  6197. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  6198. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  6199. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  6200. // retrieved value as a content box dimension.
  6201. valueIsBorderBox = offsetProp in elem;
  6202. if ( valueIsBorderBox ) {
  6203. val = elem[ offsetProp ];
  6204. }
  6205. }
  6206. // Normalize "" and auto
  6207. val = parseFloat( val ) || 0;
  6208. // Adjust for the element's box model
  6209. return ( val +
  6210. boxModelAdjustment(
  6211. elem,
  6212. dimension,
  6213. extra || ( isBorderBox ? "border" : "content" ),
  6214. valueIsBorderBox,
  6215. styles,
  6216. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  6217. val
  6218. )
  6219. ) + "px";
  6220. }
  6221. jQuery.extend( {
  6222. // Add in style property hooks for overriding the default
  6223. // behavior of getting and setting a style property
  6224. cssHooks: {
  6225. opacity: {
  6226. get: function( elem, computed ) {
  6227. if ( computed ) {
  6228. // We should always get a number back from opacity
  6229. var ret = curCSS( elem, "opacity" );
  6230. return ret === "" ? "1" : ret;
  6231. }
  6232. }
  6233. }
  6234. },
  6235. // Don't automatically add "px" to these possibly-unitless properties
  6236. cssNumber: {
  6237. "animationIterationCount": true,
  6238. "columnCount": true,
  6239. "fillOpacity": true,
  6240. "flexGrow": true,
  6241. "flexShrink": true,
  6242. "fontWeight": true,
  6243. "gridArea": true,
  6244. "gridColumn": true,
  6245. "gridColumnEnd": true,
  6246. "gridColumnStart": true,
  6247. "gridRow": true,
  6248. "gridRowEnd": true,
  6249. "gridRowStart": true,
  6250. "lineHeight": true,
  6251. "opacity": true,
  6252. "order": true,
  6253. "orphans": true,
  6254. "widows": true,
  6255. "zIndex": true,
  6256. "zoom": true
  6257. },
  6258. // Add in properties whose names you wish to fix before
  6259. // setting or getting the value
  6260. cssProps: {},
  6261. // Get and set the style property on a DOM Node
  6262. style: function( elem, name, value, extra ) {
  6263. // Don't set styles on text and comment nodes
  6264. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  6265. return;
  6266. }
  6267. // Make sure that we're working with the right name
  6268. var ret, type, hooks,
  6269. origName = camelCase( name ),
  6270. isCustomProp = rcustomProp.test( name ),
  6271. style = elem.style;
  6272. // Make sure that we're working with the right name. We don't
  6273. // want to query the value if it is a CSS custom property
  6274. // since they are user-defined.
  6275. if ( !isCustomProp ) {
  6276. name = finalPropName( origName );
  6277. }
  6278. // Gets hook for the prefixed version, then unprefixed version
  6279. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6280. // Check if we're setting a value
  6281. if ( value !== undefined ) {
  6282. type = typeof value;
  6283. // Convert "+=" or "-=" to relative numbers (#7345)
  6284. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  6285. value = adjustCSS( elem, name, ret );
  6286. // Fixes bug #9237
  6287. type = "number";
  6288. }
  6289. // Make sure that null and NaN values aren't set (#7116)
  6290. if ( value == null || value !== value ) {
  6291. return;
  6292. }
  6293. // If a number was passed in, add the unit (except for certain CSS properties)
  6294. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  6295. // "px" to a few hardcoded values.
  6296. if ( type === "number" && !isCustomProp ) {
  6297. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  6298. }
  6299. // background-* props affect original clone's values
  6300. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  6301. style[ name ] = "inherit";
  6302. }
  6303. // If a hook was provided, use that value, otherwise just set the specified value
  6304. if ( !hooks || !( "set" in hooks ) ||
  6305. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  6306. if ( isCustomProp ) {
  6307. style.setProperty( name, value );
  6308. } else {
  6309. style[ name ] = value;
  6310. }
  6311. }
  6312. } else {
  6313. // If a hook was provided get the non-computed value from there
  6314. if ( hooks && "get" in hooks &&
  6315. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  6316. return ret;
  6317. }
  6318. // Otherwise just get the value from the style object
  6319. return style[ name ];
  6320. }
  6321. },
  6322. css: function( elem, name, extra, styles ) {
  6323. var val, num, hooks,
  6324. origName = camelCase( name ),
  6325. isCustomProp = rcustomProp.test( name );
  6326. // Make sure that we're working with the right name. We don't
  6327. // want to modify the value if it is a CSS custom property
  6328. // since they are user-defined.
  6329. if ( !isCustomProp ) {
  6330. name = finalPropName( origName );
  6331. }
  6332. // Try prefixed name followed by the unprefixed name
  6333. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6334. // If a hook was provided get the computed value from there
  6335. if ( hooks && "get" in hooks ) {
  6336. val = hooks.get( elem, true, extra );
  6337. }
  6338. // Otherwise, if a way to get the computed value exists, use that
  6339. if ( val === undefined ) {
  6340. val = curCSS( elem, name, styles );
  6341. }
  6342. // Convert "normal" to computed value
  6343. if ( val === "normal" && name in cssNormalTransform ) {
  6344. val = cssNormalTransform[ name ];
  6345. }
  6346. // Make numeric if forced or a qualifier was provided and val looks numeric
  6347. if ( extra === "" || extra ) {
  6348. num = parseFloat( val );
  6349. return extra === true || isFinite( num ) ? num || 0 : val;
  6350. }
  6351. return val;
  6352. }
  6353. } );
  6354. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  6355. jQuery.cssHooks[ dimension ] = {
  6356. get: function( elem, computed, extra ) {
  6357. if ( computed ) {
  6358. // Certain elements can have dimension info if we invisibly show them
  6359. // but it must have a current display style that would benefit
  6360. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  6361. // Support: Safari 8+
  6362. // Table columns in Safari have non-zero offsetWidth & zero
  6363. // getBoundingClientRect().width unless display is changed.
  6364. // Support: IE <=11 only
  6365. // Running getBoundingClientRect on a disconnected node
  6366. // in IE throws an error.
  6367. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  6368. swap( elem, cssShow, function() {
  6369. return getWidthOrHeight( elem, dimension, extra );
  6370. } ) :
  6371. getWidthOrHeight( elem, dimension, extra );
  6372. }
  6373. },
  6374. set: function( elem, value, extra ) {
  6375. var matches,
  6376. styles = getStyles( elem ),
  6377. // Only read styles.position if the test has a chance to fail
  6378. // to avoid forcing a reflow.
  6379. scrollboxSizeBuggy = !support.scrollboxSize() &&
  6380. styles.position === "absolute",
  6381. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  6382. boxSizingNeeded = scrollboxSizeBuggy || extra,
  6383. isBorderBox = boxSizingNeeded &&
  6384. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6385. subtract = extra ?
  6386. boxModelAdjustment(
  6387. elem,
  6388. dimension,
  6389. extra,
  6390. isBorderBox,
  6391. styles
  6392. ) :
  6393. 0;
  6394. // Account for unreliable border-box dimensions by comparing offset* to computed and
  6395. // faking a content-box to get border and padding (gh-3699)
  6396. if ( isBorderBox && scrollboxSizeBuggy ) {
  6397. subtract -= Math.ceil(
  6398. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  6399. parseFloat( styles[ dimension ] ) -
  6400. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  6401. 0.5
  6402. );
  6403. }
  6404. // Convert to pixels if value adjustment is needed
  6405. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  6406. ( matches[ 3 ] || "px" ) !== "px" ) {
  6407. elem.style[ dimension ] = value;
  6408. value = jQuery.css( elem, dimension );
  6409. }
  6410. return setPositiveNumber( elem, value, subtract );
  6411. }
  6412. };
  6413. } );
  6414. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  6415. function( elem, computed ) {
  6416. if ( computed ) {
  6417. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  6418. elem.getBoundingClientRect().left -
  6419. swap( elem, { marginLeft: 0 }, function() {
  6420. return elem.getBoundingClientRect().left;
  6421. } )
  6422. ) + "px";
  6423. }
  6424. }
  6425. );
  6426. // These hooks are used by animate to expand properties
  6427. jQuery.each( {
  6428. margin: "",
  6429. padding: "",
  6430. border: "Width"
  6431. }, function( prefix, suffix ) {
  6432. jQuery.cssHooks[ prefix + suffix ] = {
  6433. expand: function( value ) {
  6434. var i = 0,
  6435. expanded = {},
  6436. // Assumes a single number if not a string
  6437. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  6438. for ( ; i < 4; i++ ) {
  6439. expanded[ prefix + cssExpand[ i ] + suffix ] =
  6440. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  6441. }
  6442. return expanded;
  6443. }
  6444. };
  6445. if ( prefix !== "margin" ) {
  6446. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  6447. }
  6448. } );
  6449. jQuery.fn.extend( {
  6450. css: function( name, value ) {
  6451. return access( this, function( elem, name, value ) {
  6452. var styles, len,
  6453. map = {},
  6454. i = 0;
  6455. if ( Array.isArray( name ) ) {
  6456. styles = getStyles( elem );
  6457. len = name.length;
  6458. for ( ; i < len; i++ ) {
  6459. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  6460. }
  6461. return map;
  6462. }
  6463. return value !== undefined ?
  6464. jQuery.style( elem, name, value ) :
  6465. jQuery.css( elem, name );
  6466. }, name, value, arguments.length > 1 );
  6467. }
  6468. } );
  6469. function Tween( elem, options, prop, end, easing ) {
  6470. return new Tween.prototype.init( elem, options, prop, end, easing );
  6471. }
  6472. jQuery.Tween = Tween;
  6473. Tween.prototype = {
  6474. constructor: Tween,
  6475. init: function( elem, options, prop, end, easing, unit ) {
  6476. this.elem = elem;
  6477. this.prop = prop;
  6478. this.easing = easing || jQuery.easing._default;
  6479. this.options = options;
  6480. this.start = this.now = this.cur();
  6481. this.end = end;
  6482. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  6483. },
  6484. cur: function() {
  6485. var hooks = Tween.propHooks[ this.prop ];
  6486. return hooks && hooks.get ?
  6487. hooks.get( this ) :
  6488. Tween.propHooks._default.get( this );
  6489. },
  6490. run: function( percent ) {
  6491. var eased,
  6492. hooks = Tween.propHooks[ this.prop ];
  6493. if ( this.options.duration ) {
  6494. this.pos = eased = jQuery.easing[ this.easing ](
  6495. percent, this.options.duration * percent, 0, 1, this.options.duration
  6496. );
  6497. } else {
  6498. this.pos = eased = percent;
  6499. }
  6500. this.now = ( this.end - this.start ) * eased + this.start;
  6501. if ( this.options.step ) {
  6502. this.options.step.call( this.elem, this.now, this );
  6503. }
  6504. if ( hooks && hooks.set ) {
  6505. hooks.set( this );
  6506. } else {
  6507. Tween.propHooks._default.set( this );
  6508. }
  6509. return this;
  6510. }
  6511. };
  6512. Tween.prototype.init.prototype = Tween.prototype;
  6513. Tween.propHooks = {
  6514. _default: {
  6515. get: function( tween ) {
  6516. var result;
  6517. // Use a property on the element directly when it is not a DOM element,
  6518. // or when there is no matching style property that exists.
  6519. if ( tween.elem.nodeType !== 1 ||
  6520. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  6521. return tween.elem[ tween.prop ];
  6522. }
  6523. // Passing an empty string as a 3rd parameter to .css will automatically
  6524. // attempt a parseFloat and fallback to a string if the parse fails.
  6525. // Simple values such as "10px" are parsed to Float;
  6526. // complex values such as "rotate(1rad)" are returned as-is.
  6527. result = jQuery.css( tween.elem, tween.prop, "" );
  6528. // Empty strings, null, undefined and "auto" are converted to 0.
  6529. return !result || result === "auto" ? 0 : result;
  6530. },
  6531. set: function( tween ) {
  6532. // Use step hook for back compat.
  6533. // Use cssHook if its there.
  6534. // Use .style if available and use plain properties where available.
  6535. if ( jQuery.fx.step[ tween.prop ] ) {
  6536. jQuery.fx.step[ tween.prop ]( tween );
  6537. } else if ( tween.elem.nodeType === 1 && (
  6538. jQuery.cssHooks[ tween.prop ] ||
  6539. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  6540. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  6541. } else {
  6542. tween.elem[ tween.prop ] = tween.now;
  6543. }
  6544. }
  6545. }
  6546. };
  6547. // Support: IE <=9 only
  6548. // Panic based approach to setting things on disconnected nodes
  6549. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  6550. set: function( tween ) {
  6551. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  6552. tween.elem[ tween.prop ] = tween.now;
  6553. }
  6554. }
  6555. };
  6556. jQuery.easing = {
  6557. linear: function( p ) {
  6558. return p;
  6559. },
  6560. swing: function( p ) {
  6561. return 0.5 - Math.cos( p * Math.PI ) / 2;
  6562. },
  6563. _default: "swing"
  6564. };
  6565. jQuery.fx = Tween.prototype.init;
  6566. // Back compat <1.8 extension point
  6567. jQuery.fx.step = {};
  6568. var
  6569. fxNow, inProgress,
  6570. rfxtypes = /^(?:toggle|show|hide)$/,
  6571. rrun = /queueHooks$/;
  6572. function schedule() {
  6573. if ( inProgress ) {
  6574. if ( document.hidden === false && window.requestAnimationFrame ) {
  6575. window.requestAnimationFrame( schedule );
  6576. } else {
  6577. window.setTimeout( schedule, jQuery.fx.interval );
  6578. }
  6579. jQuery.fx.tick();
  6580. }
  6581. }
  6582. // Animations created synchronously will run synchronously
  6583. function createFxNow() {
  6584. window.setTimeout( function() {
  6585. fxNow = undefined;
  6586. } );
  6587. return ( fxNow = Date.now() );
  6588. }
  6589. // Generate parameters to create a standard animation
  6590. function genFx( type, includeWidth ) {
  6591. var which,
  6592. i = 0,
  6593. attrs = { height: type };
  6594. // If we include width, step value is 1 to do all cssExpand values,
  6595. // otherwise step value is 2 to skip over Left and Right
  6596. includeWidth = includeWidth ? 1 : 0;
  6597. for ( ; i < 4; i += 2 - includeWidth ) {
  6598. which = cssExpand[ i ];
  6599. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  6600. }
  6601. if ( includeWidth ) {
  6602. attrs.opacity = attrs.width = type;
  6603. }
  6604. return attrs;
  6605. }
  6606. function createTween( value, prop, animation ) {
  6607. var tween,
  6608. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  6609. index = 0,
  6610. length = collection.length;
  6611. for ( ; index < length; index++ ) {
  6612. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  6613. // We're done with this property
  6614. return tween;
  6615. }
  6616. }
  6617. }
  6618. function defaultPrefilter( elem, props, opts ) {
  6619. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  6620. isBox = "width" in props || "height" in props,
  6621. anim = this,
  6622. orig = {},
  6623. style = elem.style,
  6624. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  6625. dataShow = dataPriv.get( elem, "fxshow" );
  6626. // Queue-skipping animations hijack the fx hooks
  6627. if ( !opts.queue ) {
  6628. hooks = jQuery._queueHooks( elem, "fx" );
  6629. if ( hooks.unqueued == null ) {
  6630. hooks.unqueued = 0;
  6631. oldfire = hooks.empty.fire;
  6632. hooks.empty.fire = function() {
  6633. if ( !hooks.unqueued ) {
  6634. oldfire();
  6635. }
  6636. };
  6637. }
  6638. hooks.unqueued++;
  6639. anim.always( function() {
  6640. // Ensure the complete handler is called before this completes
  6641. anim.always( function() {
  6642. hooks.unqueued--;
  6643. if ( !jQuery.queue( elem, "fx" ).length ) {
  6644. hooks.empty.fire();
  6645. }
  6646. } );
  6647. } );
  6648. }
  6649. // Detect show/hide animations
  6650. for ( prop in props ) {
  6651. value = props[ prop ];
  6652. if ( rfxtypes.test( value ) ) {
  6653. delete props[ prop ];
  6654. toggle = toggle || value === "toggle";
  6655. if ( value === ( hidden ? "hide" : "show" ) ) {
  6656. // Pretend to be hidden if this is a "show" and
  6657. // there is still data from a stopped show/hide
  6658. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  6659. hidden = true;
  6660. // Ignore all other no-op show/hide data
  6661. } else {
  6662. continue;
  6663. }
  6664. }
  6665. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  6666. }
  6667. }
  6668. // Bail out if this is a no-op like .hide().hide()
  6669. propTween = !jQuery.isEmptyObject( props );
  6670. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  6671. return;
  6672. }
  6673. // Restrict "overflow" and "display" styles during box animations
  6674. if ( isBox && elem.nodeType === 1 ) {
  6675. // Support: IE <=9 - 11, Edge 12 - 15
  6676. // Record all 3 overflow attributes because IE does not infer the shorthand
  6677. // from identically-valued overflowX and overflowY and Edge just mirrors
  6678. // the overflowX value there.
  6679. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  6680. // Identify a display type, preferring old show/hide data over the CSS cascade
  6681. restoreDisplay = dataShow && dataShow.display;
  6682. if ( restoreDisplay == null ) {
  6683. restoreDisplay = dataPriv.get( elem, "display" );
  6684. }
  6685. display = jQuery.css( elem, "display" );
  6686. if ( display === "none" ) {
  6687. if ( restoreDisplay ) {
  6688. display = restoreDisplay;
  6689. } else {
  6690. // Get nonempty value(s) by temporarily forcing visibility
  6691. showHide( [ elem ], true );
  6692. restoreDisplay = elem.style.display || restoreDisplay;
  6693. display = jQuery.css( elem, "display" );
  6694. showHide( [ elem ] );
  6695. }
  6696. }
  6697. // Animate inline elements as inline-block
  6698. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  6699. if ( jQuery.css( elem, "float" ) === "none" ) {
  6700. // Restore the original display value at the end of pure show/hide animations
  6701. if ( !propTween ) {
  6702. anim.done( function() {
  6703. style.display = restoreDisplay;
  6704. } );
  6705. if ( restoreDisplay == null ) {
  6706. display = style.display;
  6707. restoreDisplay = display === "none" ? "" : display;
  6708. }
  6709. }
  6710. style.display = "inline-block";
  6711. }
  6712. }
  6713. }
  6714. if ( opts.overflow ) {
  6715. style.overflow = "hidden";
  6716. anim.always( function() {
  6717. style.overflow = opts.overflow[ 0 ];
  6718. style.overflowX = opts.overflow[ 1 ];
  6719. style.overflowY = opts.overflow[ 2 ];
  6720. } );
  6721. }
  6722. // Implement show/hide animations
  6723. propTween = false;
  6724. for ( prop in orig ) {
  6725. // General show/hide setup for this element animation
  6726. if ( !propTween ) {
  6727. if ( dataShow ) {
  6728. if ( "hidden" in dataShow ) {
  6729. hidden = dataShow.hidden;
  6730. }
  6731. } else {
  6732. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  6733. }
  6734. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  6735. if ( toggle ) {
  6736. dataShow.hidden = !hidden;
  6737. }
  6738. // Show elements before animating them
  6739. if ( hidden ) {
  6740. showHide( [ elem ], true );
  6741. }
  6742. /* eslint-disable no-loop-func */
  6743. anim.done( function() {
  6744. /* eslint-enable no-loop-func */
  6745. // The final step of a "hide" animation is actually hiding the element
  6746. if ( !hidden ) {
  6747. showHide( [ elem ] );
  6748. }
  6749. dataPriv.remove( elem, "fxshow" );
  6750. for ( prop in orig ) {
  6751. jQuery.style( elem, prop, orig[ prop ] );
  6752. }
  6753. } );
  6754. }
  6755. // Per-property setup
  6756. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  6757. if ( !( prop in dataShow ) ) {
  6758. dataShow[ prop ] = propTween.start;
  6759. if ( hidden ) {
  6760. propTween.end = propTween.start;
  6761. propTween.start = 0;
  6762. }
  6763. }
  6764. }
  6765. }
  6766. function propFilter( props, specialEasing ) {
  6767. var index, name, easing, value, hooks;
  6768. // camelCase, specialEasing and expand cssHook pass
  6769. for ( index in props ) {
  6770. name = camelCase( index );
  6771. easing = specialEasing[ name ];
  6772. value = props[ index ];
  6773. if ( Array.isArray( value ) ) {
  6774. easing = value[ 1 ];
  6775. value = props[ index ] = value[ 0 ];
  6776. }
  6777. if ( index !== name ) {
  6778. props[ name ] = value;
  6779. delete props[ index ];
  6780. }
  6781. hooks = jQuery.cssHooks[ name ];
  6782. if ( hooks && "expand" in hooks ) {
  6783. value = hooks.expand( value );
  6784. delete props[ name ];
  6785. // Not quite $.extend, this won't overwrite existing keys.
  6786. // Reusing 'index' because we have the correct "name"
  6787. for ( index in value ) {
  6788. if ( !( index in props ) ) {
  6789. props[ index ] = value[ index ];
  6790. specialEasing[ index ] = easing;
  6791. }
  6792. }
  6793. } else {
  6794. specialEasing[ name ] = easing;
  6795. }
  6796. }
  6797. }
  6798. function Animation( elem, properties, options ) {
  6799. var result,
  6800. stopped,
  6801. index = 0,
  6802. length = Animation.prefilters.length,
  6803. deferred = jQuery.Deferred().always( function() {
  6804. // Don't match elem in the :animated selector
  6805. delete tick.elem;
  6806. } ),
  6807. tick = function() {
  6808. if ( stopped ) {
  6809. return false;
  6810. }
  6811. var currentTime = fxNow || createFxNow(),
  6812. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  6813. // Support: Android 2.3 only
  6814. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  6815. temp = remaining / animation.duration || 0,
  6816. percent = 1 - temp,
  6817. index = 0,
  6818. length = animation.tweens.length;
  6819. for ( ; index < length; index++ ) {
  6820. animation.tweens[ index ].run( percent );
  6821. }
  6822. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  6823. // If there's more to do, yield
  6824. if ( percent < 1 && length ) {
  6825. return remaining;
  6826. }
  6827. // If this was an empty animation, synthesize a final progress notification
  6828. if ( !length ) {
  6829. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6830. }
  6831. // Resolve the animation and report its conclusion
  6832. deferred.resolveWith( elem, [ animation ] );
  6833. return false;
  6834. },
  6835. animation = deferred.promise( {
  6836. elem: elem,
  6837. props: jQuery.extend( {}, properties ),
  6838. opts: jQuery.extend( true, {
  6839. specialEasing: {},
  6840. easing: jQuery.easing._default
  6841. }, options ),
  6842. originalProperties: properties,
  6843. originalOptions: options,
  6844. startTime: fxNow || createFxNow(),
  6845. duration: options.duration,
  6846. tweens: [],
  6847. createTween: function( prop, end ) {
  6848. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  6849. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  6850. animation.tweens.push( tween );
  6851. return tween;
  6852. },
  6853. stop: function( gotoEnd ) {
  6854. var index = 0,
  6855. // If we are going to the end, we want to run all the tweens
  6856. // otherwise we skip this part
  6857. length = gotoEnd ? animation.tweens.length : 0;
  6858. if ( stopped ) {
  6859. return this;
  6860. }
  6861. stopped = true;
  6862. for ( ; index < length; index++ ) {
  6863. animation.tweens[ index ].run( 1 );
  6864. }
  6865. // Resolve when we played the last frame; otherwise, reject
  6866. if ( gotoEnd ) {
  6867. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6868. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  6869. } else {
  6870. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  6871. }
  6872. return this;
  6873. }
  6874. } ),
  6875. props = animation.props;
  6876. propFilter( props, animation.opts.specialEasing );
  6877. for ( ; index < length; index++ ) {
  6878. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  6879. if ( result ) {
  6880. if ( isFunction( result.stop ) ) {
  6881. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  6882. result.stop.bind( result );
  6883. }
  6884. return result;
  6885. }
  6886. }
  6887. jQuery.map( props, createTween, animation );
  6888. if ( isFunction( animation.opts.start ) ) {
  6889. animation.opts.start.call( elem, animation );
  6890. }
  6891. // Attach callbacks from options
  6892. animation
  6893. .progress( animation.opts.progress )
  6894. .done( animation.opts.done, animation.opts.complete )
  6895. .fail( animation.opts.fail )
  6896. .always( animation.opts.always );
  6897. jQuery.fx.timer(
  6898. jQuery.extend( tick, {
  6899. elem: elem,
  6900. anim: animation,
  6901. queue: animation.opts.queue
  6902. } )
  6903. );
  6904. return animation;
  6905. }
  6906. jQuery.Animation = jQuery.extend( Animation, {
  6907. tweeners: {
  6908. "*": [ function( prop, value ) {
  6909. var tween = this.createTween( prop, value );
  6910. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  6911. return tween;
  6912. } ]
  6913. },
  6914. tweener: function( props, callback ) {
  6915. if ( isFunction( props ) ) {
  6916. callback = props;
  6917. props = [ "*" ];
  6918. } else {
  6919. props = props.match( rnothtmlwhite );
  6920. }
  6921. var prop,
  6922. index = 0,
  6923. length = props.length;
  6924. for ( ; index < length; index++ ) {
  6925. prop = props[ index ];
  6926. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  6927. Animation.tweeners[ prop ].unshift( callback );
  6928. }
  6929. },
  6930. prefilters: [ defaultPrefilter ],
  6931. prefilter: function( callback, prepend ) {
  6932. if ( prepend ) {
  6933. Animation.prefilters.unshift( callback );
  6934. } else {
  6935. Animation.prefilters.push( callback );
  6936. }
  6937. }
  6938. } );
  6939. jQuery.speed = function( speed, easing, fn ) {
  6940. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  6941. complete: fn || !fn && easing ||
  6942. isFunction( speed ) && speed,
  6943. duration: speed,
  6944. easing: fn && easing || easing && !isFunction( easing ) && easing
  6945. };
  6946. // Go to the end state if fx are off
  6947. if ( jQuery.fx.off ) {
  6948. opt.duration = 0;
  6949. } else {
  6950. if ( typeof opt.duration !== "number" ) {
  6951. if ( opt.duration in jQuery.fx.speeds ) {
  6952. opt.duration = jQuery.fx.speeds[ opt.duration ];
  6953. } else {
  6954. opt.duration = jQuery.fx.speeds._default;
  6955. }
  6956. }
  6957. }
  6958. // Normalize opt.queue - true/undefined/null -> "fx"
  6959. if ( opt.queue == null || opt.queue === true ) {
  6960. opt.queue = "fx";
  6961. }
  6962. // Queueing
  6963. opt.old = opt.complete;
  6964. opt.complete = function() {
  6965. if ( isFunction( opt.old ) ) {
  6966. opt.old.call( this );
  6967. }
  6968. if ( opt.queue ) {
  6969. jQuery.dequeue( this, opt.queue );
  6970. }
  6971. };
  6972. return opt;
  6973. };
  6974. jQuery.fn.extend( {
  6975. fadeTo: function( speed, to, easing, callback ) {
  6976. // Show any hidden elements after setting opacity to 0
  6977. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  6978. // Animate to the value specified
  6979. .end().animate( { opacity: to }, speed, easing, callback );
  6980. },
  6981. animate: function( prop, speed, easing, callback ) {
  6982. var empty = jQuery.isEmptyObject( prop ),
  6983. optall = jQuery.speed( speed, easing, callback ),
  6984. doAnimation = function() {
  6985. // Operate on a copy of prop so per-property easing won't be lost
  6986. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  6987. // Empty animations, or finishing resolves immediately
  6988. if ( empty || dataPriv.get( this, "finish" ) ) {
  6989. anim.stop( true );
  6990. }
  6991. };
  6992. doAnimation.finish = doAnimation;
  6993. return empty || optall.queue === false ?
  6994. this.each( doAnimation ) :
  6995. this.queue( optall.queue, doAnimation );
  6996. },
  6997. stop: function( type, clearQueue, gotoEnd ) {
  6998. var stopQueue = function( hooks ) {
  6999. var stop = hooks.stop;
  7000. delete hooks.stop;
  7001. stop( gotoEnd );
  7002. };
  7003. if ( typeof type !== "string" ) {
  7004. gotoEnd = clearQueue;
  7005. clearQueue = type;
  7006. type = undefined;
  7007. }
  7008. if ( clearQueue && type !== false ) {
  7009. this.queue( type || "fx", [] );
  7010. }
  7011. return this.each( function() {
  7012. var dequeue = true,
  7013. index = type != null && type + "queueHooks",
  7014. timers = jQuery.timers,
  7015. data = dataPriv.get( this );
  7016. if ( index ) {
  7017. if ( data[ index ] && data[ index ].stop ) {
  7018. stopQueue( data[ index ] );
  7019. }
  7020. } else {
  7021. for ( index in data ) {
  7022. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  7023. stopQueue( data[ index ] );
  7024. }
  7025. }
  7026. }
  7027. for ( index = timers.length; index--; ) {
  7028. if ( timers[ index ].elem === this &&
  7029. ( type == null || timers[ index ].queue === type ) ) {
  7030. timers[ index ].anim.stop( gotoEnd );
  7031. dequeue = false;
  7032. timers.splice( index, 1 );
  7033. }
  7034. }
  7035. // Start the next in the queue if the last step wasn't forced.
  7036. // Timers currently will call their complete callbacks, which
  7037. // will dequeue but only if they were gotoEnd.
  7038. if ( dequeue || !gotoEnd ) {
  7039. jQuery.dequeue( this, type );
  7040. }
  7041. } );
  7042. },
  7043. finish: function( type ) {
  7044. if ( type !== false ) {
  7045. type = type || "fx";
  7046. }
  7047. return this.each( function() {
  7048. var index,
  7049. data = dataPriv.get( this ),
  7050. queue = data[ type + "queue" ],
  7051. hooks = data[ type + "queueHooks" ],
  7052. timers = jQuery.timers,
  7053. length = queue ? queue.length : 0;
  7054. // Enable finishing flag on private data
  7055. data.finish = true;
  7056. // Empty the queue first
  7057. jQuery.queue( this, type, [] );
  7058. if ( hooks && hooks.stop ) {
  7059. hooks.stop.call( this, true );
  7060. }
  7061. // Look for any active animations, and finish them
  7062. for ( index = timers.length; index--; ) {
  7063. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  7064. timers[ index ].anim.stop( true );
  7065. timers.splice( index, 1 );
  7066. }
  7067. }
  7068. // Look for any animations in the old queue and finish them
  7069. for ( index = 0; index < length; index++ ) {
  7070. if ( queue[ index ] && queue[ index ].finish ) {
  7071. queue[ index ].finish.call( this );
  7072. }
  7073. }
  7074. // Turn off finishing flag
  7075. delete data.finish;
  7076. } );
  7077. }
  7078. } );
  7079. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  7080. var cssFn = jQuery.fn[ name ];
  7081. jQuery.fn[ name ] = function( speed, easing, callback ) {
  7082. return speed == null || typeof speed === "boolean" ?
  7083. cssFn.apply( this, arguments ) :
  7084. this.animate( genFx( name, true ), speed, easing, callback );
  7085. };
  7086. } );
  7087. // Generate shortcuts for custom animations
  7088. jQuery.each( {
  7089. slideDown: genFx( "show" ),
  7090. slideUp: genFx( "hide" ),
  7091. slideToggle: genFx( "toggle" ),
  7092. fadeIn: { opacity: "show" },
  7093. fadeOut: { opacity: "hide" },
  7094. fadeToggle: { opacity: "toggle" }
  7095. }, function( name, props ) {
  7096. jQuery.fn[ name ] = function( speed, easing, callback ) {
  7097. return this.animate( props, speed, easing, callback );
  7098. };
  7099. } );
  7100. jQuery.timers = [];
  7101. jQuery.fx.tick = function() {
  7102. var timer,
  7103. i = 0,
  7104. timers = jQuery.timers;
  7105. fxNow = Date.now();
  7106. for ( ; i < timers.length; i++ ) {
  7107. timer = timers[ i ];
  7108. // Run the timer and safely remove it when done (allowing for external removal)
  7109. if ( !timer() && timers[ i ] === timer ) {
  7110. timers.splice( i--, 1 );
  7111. }
  7112. }
  7113. if ( !timers.length ) {
  7114. jQuery.fx.stop();
  7115. }
  7116. fxNow = undefined;
  7117. };
  7118. jQuery.fx.timer = function( timer ) {
  7119. jQuery.timers.push( timer );
  7120. jQuery.fx.start();
  7121. };
  7122. jQuery.fx.interval = 13;
  7123. jQuery.fx.start = function() {
  7124. if ( inProgress ) {
  7125. return;
  7126. }
  7127. inProgress = true;
  7128. schedule();
  7129. };
  7130. jQuery.fx.stop = function() {
  7131. inProgress = null;
  7132. };
  7133. jQuery.fx.speeds = {
  7134. slow: 600,
  7135. fast: 200,
  7136. // Default speed
  7137. _default: 400
  7138. };
  7139. // Based off of the plugin by Clint Helfers, with permission.
  7140. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  7141. jQuery.fn.delay = function( time, type ) {
  7142. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  7143. type = type || "fx";
  7144. return this.queue( type, function( next, hooks ) {
  7145. var timeout = window.setTimeout( next, time );
  7146. hooks.stop = function() {
  7147. window.clearTimeout( timeout );
  7148. };
  7149. } );
  7150. };
  7151. ( function() {
  7152. var input = document.createElement( "input" ),
  7153. select = document.createElement( "select" ),
  7154. opt = select.appendChild( document.createElement( "option" ) );
  7155. input.type = "checkbox";
  7156. // Support: Android <=4.3 only
  7157. // Default value for a checkbox should be "on"
  7158. support.checkOn = input.value !== "";
  7159. // Support: IE <=11 only
  7160. // Must access selectedIndex to make default options select
  7161. support.optSelected = opt.selected;
  7162. // Support: IE <=11 only
  7163. // An input loses its value after becoming a radio
  7164. input = document.createElement( "input" );
  7165. input.value = "t";
  7166. input.type = "radio";
  7167. support.radioValue = input.value === "t";
  7168. } )();
  7169. var boolHook,
  7170. attrHandle = jQuery.expr.attrHandle;
  7171. jQuery.fn.extend( {
  7172. attr: function( name, value ) {
  7173. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  7174. },
  7175. removeAttr: function( name ) {
  7176. return this.each( function() {
  7177. jQuery.removeAttr( this, name );
  7178. } );
  7179. }
  7180. } );
  7181. jQuery.extend( {
  7182. attr: function( elem, name, value ) {
  7183. var ret, hooks,
  7184. nType = elem.nodeType;
  7185. // Don't get/set attributes on text, comment and attribute nodes
  7186. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7187. return;
  7188. }
  7189. // Fallback to prop when attributes are not supported
  7190. if ( typeof elem.getAttribute === "undefined" ) {
  7191. return jQuery.prop( elem, name, value );
  7192. }
  7193. // Attribute hooks are determined by the lowercase version
  7194. // Grab necessary hook if one is defined
  7195. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7196. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  7197. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  7198. }
  7199. if ( value !== undefined ) {
  7200. if ( value === null ) {
  7201. jQuery.removeAttr( elem, name );
  7202. return;
  7203. }
  7204. if ( hooks && "set" in hooks &&
  7205. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7206. return ret;
  7207. }
  7208. elem.setAttribute( name, value + "" );
  7209. return value;
  7210. }
  7211. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7212. return ret;
  7213. }
  7214. ret = jQuery.find.attr( elem, name );
  7215. // Non-existent attributes return null, we normalize to undefined
  7216. return ret == null ? undefined : ret;
  7217. },
  7218. attrHooks: {
  7219. type: {
  7220. set: function( elem, value ) {
  7221. if ( !support.radioValue && value === "radio" &&
  7222. nodeName( elem, "input" ) ) {
  7223. var val = elem.value;
  7224. elem.setAttribute( "type", value );
  7225. if ( val ) {
  7226. elem.value = val;
  7227. }
  7228. return value;
  7229. }
  7230. }
  7231. }
  7232. },
  7233. removeAttr: function( elem, value ) {
  7234. var name,
  7235. i = 0,
  7236. // Attribute names can contain non-HTML whitespace characters
  7237. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  7238. attrNames = value && value.match( rnothtmlwhite );
  7239. if ( attrNames && elem.nodeType === 1 ) {
  7240. while ( ( name = attrNames[ i++ ] ) ) {
  7241. elem.removeAttribute( name );
  7242. }
  7243. }
  7244. }
  7245. } );
  7246. // Hooks for boolean attributes
  7247. boolHook = {
  7248. set: function( elem, value, name ) {
  7249. if ( value === false ) {
  7250. // Remove boolean attributes when set to false
  7251. jQuery.removeAttr( elem, name );
  7252. } else {
  7253. elem.setAttribute( name, name );
  7254. }
  7255. return name;
  7256. }
  7257. };
  7258. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  7259. var getter = attrHandle[ name ] || jQuery.find.attr;
  7260. attrHandle[ name ] = function( elem, name, isXML ) {
  7261. var ret, handle,
  7262. lowercaseName = name.toLowerCase();
  7263. if ( !isXML ) {
  7264. // Avoid an infinite loop by temporarily removing this function from the getter
  7265. handle = attrHandle[ lowercaseName ];
  7266. attrHandle[ lowercaseName ] = ret;
  7267. ret = getter( elem, name, isXML ) != null ?
  7268. lowercaseName :
  7269. null;
  7270. attrHandle[ lowercaseName ] = handle;
  7271. }
  7272. return ret;
  7273. };
  7274. } );
  7275. var rfocusable = /^(?:input|select|textarea|button)$/i,
  7276. rclickable = /^(?:a|area)$/i;
  7277. jQuery.fn.extend( {
  7278. prop: function( name, value ) {
  7279. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  7280. },
  7281. removeProp: function( name ) {
  7282. return this.each( function() {
  7283. delete this[ jQuery.propFix[ name ] || name ];
  7284. } );
  7285. }
  7286. } );
  7287. jQuery.extend( {
  7288. prop: function( elem, name, value ) {
  7289. var ret, hooks,
  7290. nType = elem.nodeType;
  7291. // Don't get/set properties on text, comment and attribute nodes
  7292. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7293. return;
  7294. }
  7295. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7296. // Fix name and attach hooks
  7297. name = jQuery.propFix[ name ] || name;
  7298. hooks = jQuery.propHooks[ name ];
  7299. }
  7300. if ( value !== undefined ) {
  7301. if ( hooks && "set" in hooks &&
  7302. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7303. return ret;
  7304. }
  7305. return ( elem[ name ] = value );
  7306. }
  7307. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7308. return ret;
  7309. }
  7310. return elem[ name ];
  7311. },
  7312. propHooks: {
  7313. tabIndex: {
  7314. get: function( elem ) {
  7315. // Support: IE <=9 - 11 only
  7316. // elem.tabIndex doesn't always return the
  7317. // correct value when it hasn't been explicitly set
  7318. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  7319. // Use proper attribute retrieval(#12072)
  7320. var tabindex = jQuery.find.attr( elem, "tabindex" );
  7321. if ( tabindex ) {
  7322. return parseInt( tabindex, 10 );
  7323. }
  7324. if (
  7325. rfocusable.test( elem.nodeName ) ||
  7326. rclickable.test( elem.nodeName ) &&
  7327. elem.href
  7328. ) {
  7329. return 0;
  7330. }
  7331. return -1;
  7332. }
  7333. }
  7334. },
  7335. propFix: {
  7336. "for": "htmlFor",
  7337. "class": "className"
  7338. }
  7339. } );
  7340. // Support: IE <=11 only
  7341. // Accessing the selectedIndex property
  7342. // forces the browser to respect setting selected
  7343. // on the option
  7344. // The getter ensures a default option is selected
  7345. // when in an optgroup
  7346. // eslint rule "no-unused-expressions" is disabled for this code
  7347. // since it considers such accessions noop
  7348. if ( !support.optSelected ) {
  7349. jQuery.propHooks.selected = {
  7350. get: function( elem ) {
  7351. /* eslint no-unused-expressions: "off" */
  7352. var parent = elem.parentNode;
  7353. if ( parent && parent.parentNode ) {
  7354. parent.parentNode.selectedIndex;
  7355. }
  7356. return null;
  7357. },
  7358. set: function( elem ) {
  7359. /* eslint no-unused-expressions: "off" */
  7360. var parent = elem.parentNode;
  7361. if ( parent ) {
  7362. parent.selectedIndex;
  7363. if ( parent.parentNode ) {
  7364. parent.parentNode.selectedIndex;
  7365. }
  7366. }
  7367. }
  7368. };
  7369. }
  7370. jQuery.each( [
  7371. "tabIndex",
  7372. "readOnly",
  7373. "maxLength",
  7374. "cellSpacing",
  7375. "cellPadding",
  7376. "rowSpan",
  7377. "colSpan",
  7378. "useMap",
  7379. "frameBorder",
  7380. "contentEditable"
  7381. ], function() {
  7382. jQuery.propFix[ this.toLowerCase() ] = this;
  7383. } );
  7384. // Strip and collapse whitespace according to HTML spec
  7385. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  7386. function stripAndCollapse( value ) {
  7387. var tokens = value.match( rnothtmlwhite ) || [];
  7388. return tokens.join( " " );
  7389. }
  7390. function getClass( elem ) {
  7391. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  7392. }
  7393. function classesToArray( value ) {
  7394. if ( Array.isArray( value ) ) {
  7395. return value;
  7396. }
  7397. if ( typeof value === "string" ) {
  7398. return value.match( rnothtmlwhite ) || [];
  7399. }
  7400. return [];
  7401. }
  7402. jQuery.fn.extend( {
  7403. addClass: function( value ) {
  7404. var classes, elem, cur, curValue, clazz, j, finalValue,
  7405. i = 0;
  7406. if ( isFunction( value ) ) {
  7407. return this.each( function( j ) {
  7408. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7409. } );
  7410. }
  7411. classes = classesToArray( value );
  7412. if ( classes.length ) {
  7413. while ( ( elem = this[ i++ ] ) ) {
  7414. curValue = getClass( elem );
  7415. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7416. if ( cur ) {
  7417. j = 0;
  7418. while ( ( clazz = classes[ j++ ] ) ) {
  7419. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  7420. cur += clazz + " ";
  7421. }
  7422. }
  7423. // Only assign if different to avoid unneeded rendering.
  7424. finalValue = stripAndCollapse( cur );
  7425. if ( curValue !== finalValue ) {
  7426. elem.setAttribute( "class", finalValue );
  7427. }
  7428. }
  7429. }
  7430. }
  7431. return this;
  7432. },
  7433. removeClass: function( value ) {
  7434. var classes, elem, cur, curValue, clazz, j, finalValue,
  7435. i = 0;
  7436. if ( isFunction( value ) ) {
  7437. return this.each( function( j ) {
  7438. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7439. } );
  7440. }
  7441. if ( !arguments.length ) {
  7442. return this.attr( "class", "" );
  7443. }
  7444. classes = classesToArray( value );
  7445. if ( classes.length ) {
  7446. while ( ( elem = this[ i++ ] ) ) {
  7447. curValue = getClass( elem );
  7448. // This expression is here for better compressibility (see addClass)
  7449. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7450. if ( cur ) {
  7451. j = 0;
  7452. while ( ( clazz = classes[ j++ ] ) ) {
  7453. // Remove *all* instances
  7454. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  7455. cur = cur.replace( " " + clazz + " ", " " );
  7456. }
  7457. }
  7458. // Only assign if different to avoid unneeded rendering.
  7459. finalValue = stripAndCollapse( cur );
  7460. if ( curValue !== finalValue ) {
  7461. elem.setAttribute( "class", finalValue );
  7462. }
  7463. }
  7464. }
  7465. }
  7466. return this;
  7467. },
  7468. toggleClass: function( value, stateVal ) {
  7469. var type = typeof value,
  7470. isValidValue = type === "string" || Array.isArray( value );
  7471. if ( typeof stateVal === "boolean" && isValidValue ) {
  7472. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7473. }
  7474. if ( isFunction( value ) ) {
  7475. return this.each( function( i ) {
  7476. jQuery( this ).toggleClass(
  7477. value.call( this, i, getClass( this ), stateVal ),
  7478. stateVal
  7479. );
  7480. } );
  7481. }
  7482. return this.each( function() {
  7483. var className, i, self, classNames;
  7484. if ( isValidValue ) {
  7485. // Toggle individual class names
  7486. i = 0;
  7487. self = jQuery( this );
  7488. classNames = classesToArray( value );
  7489. while ( ( className = classNames[ i++ ] ) ) {
  7490. // Check each className given, space separated list
  7491. if ( self.hasClass( className ) ) {
  7492. self.removeClass( className );
  7493. } else {
  7494. self.addClass( className );
  7495. }
  7496. }
  7497. // Toggle whole class name
  7498. } else if ( value === undefined || type === "boolean" ) {
  7499. className = getClass( this );
  7500. if ( className ) {
  7501. // Store className if set
  7502. dataPriv.set( this, "__className__", className );
  7503. }
  7504. // If the element has a class name or if we're passed `false`,
  7505. // then remove the whole classname (if there was one, the above saved it).
  7506. // Otherwise bring back whatever was previously saved (if anything),
  7507. // falling back to the empty string if nothing was stored.
  7508. if ( this.setAttribute ) {
  7509. this.setAttribute( "class",
  7510. className || value === false ?
  7511. "" :
  7512. dataPriv.get( this, "__className__" ) || ""
  7513. );
  7514. }
  7515. }
  7516. } );
  7517. },
  7518. hasClass: function( selector ) {
  7519. var className, elem,
  7520. i = 0;
  7521. className = " " + selector + " ";
  7522. while ( ( elem = this[ i++ ] ) ) {
  7523. if ( elem.nodeType === 1 &&
  7524. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  7525. return true;
  7526. }
  7527. }
  7528. return false;
  7529. }
  7530. } );
  7531. var rreturn = /\r/g;
  7532. jQuery.fn.extend( {
  7533. val: function( value ) {
  7534. var hooks, ret, valueIsFunction,
  7535. elem = this[ 0 ];
  7536. if ( !arguments.length ) {
  7537. if ( elem ) {
  7538. hooks = jQuery.valHooks[ elem.type ] ||
  7539. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  7540. if ( hooks &&
  7541. "get" in hooks &&
  7542. ( ret = hooks.get( elem, "value" ) ) !== undefined
  7543. ) {
  7544. return ret;
  7545. }
  7546. ret = elem.value;
  7547. // Handle most common string cases
  7548. if ( typeof ret === "string" ) {
  7549. return ret.replace( rreturn, "" );
  7550. }
  7551. // Handle cases where value is null/undef or number
  7552. return ret == null ? "" : ret;
  7553. }
  7554. return;
  7555. }
  7556. valueIsFunction = isFunction( value );
  7557. return this.each( function( i ) {
  7558. var val;
  7559. if ( this.nodeType !== 1 ) {
  7560. return;
  7561. }
  7562. if ( valueIsFunction ) {
  7563. val = value.call( this, i, jQuery( this ).val() );
  7564. } else {
  7565. val = value;
  7566. }
  7567. // Treat null/undefined as ""; convert numbers to string
  7568. if ( val == null ) {
  7569. val = "";
  7570. } else if ( typeof val === "number" ) {
  7571. val += "";
  7572. } else if ( Array.isArray( val ) ) {
  7573. val = jQuery.map( val, function( value ) {
  7574. return value == null ? "" : value + "";
  7575. } );
  7576. }
  7577. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  7578. // If set returns undefined, fall back to normal setting
  7579. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  7580. this.value = val;
  7581. }
  7582. } );
  7583. }
  7584. } );
  7585. jQuery.extend( {
  7586. valHooks: {
  7587. option: {
  7588. get: function( elem ) {
  7589. var val = jQuery.find.attr( elem, "value" );
  7590. return val != null ?
  7591. val :
  7592. // Support: IE <=10 - 11 only
  7593. // option.text throws exceptions (#14686, #14858)
  7594. // Strip and collapse whitespace
  7595. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  7596. stripAndCollapse( jQuery.text( elem ) );
  7597. }
  7598. },
  7599. select: {
  7600. get: function( elem ) {
  7601. var value, option, i,
  7602. options = elem.options,
  7603. index = elem.selectedIndex,
  7604. one = elem.type === "select-one",
  7605. values = one ? null : [],
  7606. max = one ? index + 1 : options.length;
  7607. if ( index < 0 ) {
  7608. i = max;
  7609. } else {
  7610. i = one ? index : 0;
  7611. }
  7612. // Loop through all the selected options
  7613. for ( ; i < max; i++ ) {
  7614. option = options[ i ];
  7615. // Support: IE <=9 only
  7616. // IE8-9 doesn't update selected after form reset (#2551)
  7617. if ( ( option.selected || i === index ) &&
  7618. // Don't return options that are disabled or in a disabled optgroup
  7619. !option.disabled &&
  7620. ( !option.parentNode.disabled ||
  7621. !nodeName( option.parentNode, "optgroup" ) ) ) {
  7622. // Get the specific value for the option
  7623. value = jQuery( option ).val();
  7624. // We don't need an array for one selects
  7625. if ( one ) {
  7626. return value;
  7627. }
  7628. // Multi-Selects return an array
  7629. values.push( value );
  7630. }
  7631. }
  7632. return values;
  7633. },
  7634. set: function( elem, value ) {
  7635. var optionSet, option,
  7636. options = elem.options,
  7637. values = jQuery.makeArray( value ),
  7638. i = options.length;
  7639. while ( i-- ) {
  7640. option = options[ i ];
  7641. /* eslint-disable no-cond-assign */
  7642. if ( option.selected =
  7643. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  7644. ) {
  7645. optionSet = true;
  7646. }
  7647. /* eslint-enable no-cond-assign */
  7648. }
  7649. // Force browsers to behave consistently when non-matching value is set
  7650. if ( !optionSet ) {
  7651. elem.selectedIndex = -1;
  7652. }
  7653. return values;
  7654. }
  7655. }
  7656. }
  7657. } );
  7658. // Radios and checkboxes getter/setter
  7659. jQuery.each( [ "radio", "checkbox" ], function() {
  7660. jQuery.valHooks[ this ] = {
  7661. set: function( elem, value ) {
  7662. if ( Array.isArray( value ) ) {
  7663. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  7664. }
  7665. }
  7666. };
  7667. if ( !support.checkOn ) {
  7668. jQuery.valHooks[ this ].get = function( elem ) {
  7669. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  7670. };
  7671. }
  7672. } );
  7673. // Return jQuery for attributes-only inclusion
  7674. support.focusin = "onfocusin" in window;
  7675. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  7676. stopPropagationCallback = function( e ) {
  7677. e.stopPropagation();
  7678. };
  7679. jQuery.extend( jQuery.event, {
  7680. trigger: function( event, data, elem, onlyHandlers ) {
  7681. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  7682. eventPath = [ elem || document ],
  7683. type = hasOwn.call( event, "type" ) ? event.type : event,
  7684. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  7685. cur = lastElement = tmp = elem = elem || document;
  7686. // Don't do events on text and comment nodes
  7687. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  7688. return;
  7689. }
  7690. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  7691. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  7692. return;
  7693. }
  7694. if ( type.indexOf( "." ) > -1 ) {
  7695. // Namespaced trigger; create a regexp to match event type in handle()
  7696. namespaces = type.split( "." );
  7697. type = namespaces.shift();
  7698. namespaces.sort();
  7699. }
  7700. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  7701. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  7702. event = event[ jQuery.expando ] ?
  7703. event :
  7704. new jQuery.Event( type, typeof event === "object" && event );
  7705. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  7706. event.isTrigger = onlyHandlers ? 2 : 3;
  7707. event.namespace = namespaces.join( "." );
  7708. event.rnamespace = event.namespace ?
  7709. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  7710. null;
  7711. // Clean up the event in case it is being reused
  7712. event.result = undefined;
  7713. if ( !event.target ) {
  7714. event.target = elem;
  7715. }
  7716. // Clone any incoming data and prepend the event, creating the handler arg list
  7717. data = data == null ?
  7718. [ event ] :
  7719. jQuery.makeArray( data, [ event ] );
  7720. // Allow special events to draw outside the lines
  7721. special = jQuery.event.special[ type ] || {};
  7722. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  7723. return;
  7724. }
  7725. // Determine event propagation path in advance, per W3C events spec (#9951)
  7726. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  7727. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  7728. bubbleType = special.delegateType || type;
  7729. if ( !rfocusMorph.test( bubbleType + type ) ) {
  7730. cur = cur.parentNode;
  7731. }
  7732. for ( ; cur; cur = cur.parentNode ) {
  7733. eventPath.push( cur );
  7734. tmp = cur;
  7735. }
  7736. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  7737. if ( tmp === ( elem.ownerDocument || document ) ) {
  7738. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  7739. }
  7740. }
  7741. // Fire handlers on the event path
  7742. i = 0;
  7743. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  7744. lastElement = cur;
  7745. event.type = i > 1 ?
  7746. bubbleType :
  7747. special.bindType || type;
  7748. // jQuery handler
  7749. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  7750. dataPriv.get( cur, "handle" );
  7751. if ( handle ) {
  7752. handle.apply( cur, data );
  7753. }
  7754. // Native handler
  7755. handle = ontype && cur[ ontype ];
  7756. if ( handle && handle.apply && acceptData( cur ) ) {
  7757. event.result = handle.apply( cur, data );
  7758. if ( event.result === false ) {
  7759. event.preventDefault();
  7760. }
  7761. }
  7762. }
  7763. event.type = type;
  7764. // If nobody prevented the default action, do it now
  7765. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  7766. if ( ( !special._default ||
  7767. special._default.apply( eventPath.pop(), data ) === false ) &&
  7768. acceptData( elem ) ) {
  7769. // Call a native DOM method on the target with the same name as the event.
  7770. // Don't do default actions on window, that's where global variables be (#6170)
  7771. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  7772. // Don't re-trigger an onFOO event when we call its FOO() method
  7773. tmp = elem[ ontype ];
  7774. if ( tmp ) {
  7775. elem[ ontype ] = null;
  7776. }
  7777. // Prevent re-triggering of the same event, since we already bubbled it above
  7778. jQuery.event.triggered = type;
  7779. if ( event.isPropagationStopped() ) {
  7780. lastElement.addEventListener( type, stopPropagationCallback );
  7781. }
  7782. elem[ type ]();
  7783. if ( event.isPropagationStopped() ) {
  7784. lastElement.removeEventListener( type, stopPropagationCallback );
  7785. }
  7786. jQuery.event.triggered = undefined;
  7787. if ( tmp ) {
  7788. elem[ ontype ] = tmp;
  7789. }
  7790. }
  7791. }
  7792. }
  7793. return event.result;
  7794. },
  7795. // Piggyback on a donor event to simulate a different one
  7796. // Used only for `focus(in | out)` events
  7797. simulate: function( type, elem, event ) {
  7798. var e = jQuery.extend(
  7799. new jQuery.Event(),
  7800. event,
  7801. {
  7802. type: type,
  7803. isSimulated: true
  7804. }
  7805. );
  7806. jQuery.event.trigger( e, null, elem );
  7807. }
  7808. } );
  7809. jQuery.fn.extend( {
  7810. trigger: function( type, data ) {
  7811. return this.each( function() {
  7812. jQuery.event.trigger( type, data, this );
  7813. } );
  7814. },
  7815. triggerHandler: function( type, data ) {
  7816. var elem = this[ 0 ];
  7817. if ( elem ) {
  7818. return jQuery.event.trigger( type, data, elem, true );
  7819. }
  7820. }
  7821. } );
  7822. // Support: Firefox <=44
  7823. // Firefox doesn't have focus(in | out) events
  7824. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  7825. //
  7826. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  7827. // focus(in | out) events fire after focus & blur events,
  7828. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  7829. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  7830. if ( !support.focusin ) {
  7831. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  7832. // Attach a single capturing handler on the document while someone wants focusin/focusout
  7833. var handler = function( event ) {
  7834. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  7835. };
  7836. jQuery.event.special[ fix ] = {
  7837. setup: function() {
  7838. var doc = this.ownerDocument || this,
  7839. attaches = dataPriv.access( doc, fix );
  7840. if ( !attaches ) {
  7841. doc.addEventListener( orig, handler, true );
  7842. }
  7843. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  7844. },
  7845. teardown: function() {
  7846. var doc = this.ownerDocument || this,
  7847. attaches = dataPriv.access( doc, fix ) - 1;
  7848. if ( !attaches ) {
  7849. doc.removeEventListener( orig, handler, true );
  7850. dataPriv.remove( doc, fix );
  7851. } else {
  7852. dataPriv.access( doc, fix, attaches );
  7853. }
  7854. }
  7855. };
  7856. } );
  7857. }
  7858. var location = window.location;
  7859. var nonce = Date.now();
  7860. var rquery = ( /\?/ );
  7861. // Cross-browser xml parsing
  7862. jQuery.parseXML = function( data ) {
  7863. var xml;
  7864. if ( !data || typeof data !== "string" ) {
  7865. return null;
  7866. }
  7867. // Support: IE 9 - 11 only
  7868. // IE throws on parseFromString with invalid input.
  7869. try {
  7870. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  7871. } catch ( e ) {
  7872. xml = undefined;
  7873. }
  7874. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  7875. jQuery.error( "Invalid XML: " + data );
  7876. }
  7877. return xml;
  7878. };
  7879. var
  7880. rbracket = /\[\]$/,
  7881. rCRLF = /\r?\n/g,
  7882. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  7883. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  7884. function buildParams( prefix, obj, traditional, add ) {
  7885. var name;
  7886. if ( Array.isArray( obj ) ) {
  7887. // Serialize array item.
  7888. jQuery.each( obj, function( i, v ) {
  7889. if ( traditional || rbracket.test( prefix ) ) {
  7890. // Treat each array item as a scalar.
  7891. add( prefix, v );
  7892. } else {
  7893. // Item is non-scalar (array or object), encode its numeric index.
  7894. buildParams(
  7895. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  7896. v,
  7897. traditional,
  7898. add
  7899. );
  7900. }
  7901. } );
  7902. } else if ( !traditional && toType( obj ) === "object" ) {
  7903. // Serialize object item.
  7904. for ( name in obj ) {
  7905. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  7906. }
  7907. } else {
  7908. // Serialize scalar item.
  7909. add( prefix, obj );
  7910. }
  7911. }
  7912. // Serialize an array of form elements or a set of
  7913. // key/values into a query string
  7914. jQuery.param = function( a, traditional ) {
  7915. var prefix,
  7916. s = [],
  7917. add = function( key, valueOrFunction ) {
  7918. // If value is a function, invoke it and use its return value
  7919. var value = isFunction( valueOrFunction ) ?
  7920. valueOrFunction() :
  7921. valueOrFunction;
  7922. s[ s.length ] = encodeURIComponent( key ) + "=" +
  7923. encodeURIComponent( value == null ? "" : value );
  7924. };
  7925. if ( a == null ) {
  7926. return "";
  7927. }
  7928. // If an array was passed in, assume that it is an array of form elements.
  7929. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  7930. // Serialize the form elements
  7931. jQuery.each( a, function() {
  7932. add( this.name, this.value );
  7933. } );
  7934. } else {
  7935. // If traditional, encode the "old" way (the way 1.3.2 or older
  7936. // did it), otherwise encode params recursively.
  7937. for ( prefix in a ) {
  7938. buildParams( prefix, a[ prefix ], traditional, add );
  7939. }
  7940. }
  7941. // Return the resulting serialization
  7942. return s.join( "&" );
  7943. };
  7944. jQuery.fn.extend( {
  7945. serialize: function() {
  7946. return jQuery.param( this.serializeArray() );
  7947. },
  7948. serializeArray: function() {
  7949. return this.map( function() {
  7950. // Can add propHook for "elements" to filter or add form elements
  7951. var elements = jQuery.prop( this, "elements" );
  7952. return elements ? jQuery.makeArray( elements ) : this;
  7953. } )
  7954. .filter( function() {
  7955. var type = this.type;
  7956. // Use .is( ":disabled" ) so that fieldset[disabled] works
  7957. return this.name && !jQuery( this ).is( ":disabled" ) &&
  7958. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  7959. ( this.checked || !rcheckableType.test( type ) );
  7960. } )
  7961. .map( function( i, elem ) {
  7962. var val = jQuery( this ).val();
  7963. if ( val == null ) {
  7964. return null;
  7965. }
  7966. if ( Array.isArray( val ) ) {
  7967. return jQuery.map( val, function( val ) {
  7968. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7969. } );
  7970. }
  7971. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7972. } ).get();
  7973. }
  7974. } );
  7975. var
  7976. r20 = /%20/g,
  7977. rhash = /#.*$/,
  7978. rantiCache = /([?&])_=[^&]*/,
  7979. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  7980. // #7653, #8125, #8152: local protocol detection
  7981. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  7982. rnoContent = /^(?:GET|HEAD)$/,
  7983. rprotocol = /^\/\//,
  7984. /* Prefilters
  7985. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  7986. * 2) These are called:
  7987. * - BEFORE asking for a transport
  7988. * - AFTER param serialization (s.data is a string if s.processData is true)
  7989. * 3) key is the dataType
  7990. * 4) the catchall symbol "*" can be used
  7991. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  7992. */
  7993. prefilters = {},
  7994. /* Transports bindings
  7995. * 1) key is the dataType
  7996. * 2) the catchall symbol "*" can be used
  7997. * 3) selection will start with transport dataType and THEN go to "*" if needed
  7998. */
  7999. transports = {},
  8000. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  8001. allTypes = "*/".concat( "*" ),
  8002. // Anchor tag for parsing the document origin
  8003. originAnchor = document.createElement( "a" );
  8004. originAnchor.href = location.href;
  8005. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  8006. function addToPrefiltersOrTransports( structure ) {
  8007. // dataTypeExpression is optional and defaults to "*"
  8008. return function( dataTypeExpression, func ) {
  8009. if ( typeof dataTypeExpression !== "string" ) {
  8010. func = dataTypeExpression;
  8011. dataTypeExpression = "*";
  8012. }
  8013. var dataType,
  8014. i = 0,
  8015. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  8016. if ( isFunction( func ) ) {
  8017. // For each dataType in the dataTypeExpression
  8018. while ( ( dataType = dataTypes[ i++ ] ) ) {
  8019. // Prepend if requested
  8020. if ( dataType[ 0 ] === "+" ) {
  8021. dataType = dataType.slice( 1 ) || "*";
  8022. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  8023. // Otherwise append
  8024. } else {
  8025. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  8026. }
  8027. }
  8028. }
  8029. };
  8030. }
  8031. // Base inspection function for prefilters and transports
  8032. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  8033. var inspected = {},
  8034. seekingTransport = ( structure === transports );
  8035. function inspect( dataType ) {
  8036. var selected;
  8037. inspected[ dataType ] = true;
  8038. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  8039. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  8040. if ( typeof dataTypeOrTransport === "string" &&
  8041. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  8042. options.dataTypes.unshift( dataTypeOrTransport );
  8043. inspect( dataTypeOrTransport );
  8044. return false;
  8045. } else if ( seekingTransport ) {
  8046. return !( selected = dataTypeOrTransport );
  8047. }
  8048. } );
  8049. return selected;
  8050. }
  8051. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  8052. }
  8053. // A special extend for ajax options
  8054. // that takes "flat" options (not to be deep extended)
  8055. // Fixes #9887
  8056. function ajaxExtend( target, src ) {
  8057. var key, deep,
  8058. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  8059. for ( key in src ) {
  8060. if ( src[ key ] !== undefined ) {
  8061. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  8062. }
  8063. }
  8064. if ( deep ) {
  8065. jQuery.extend( true, target, deep );
  8066. }
  8067. return target;
  8068. }
  8069. /* Handles responses to an ajax request:
  8070. * - finds the right dataType (mediates between content-type and expected dataType)
  8071. * - returns the corresponding response
  8072. */
  8073. function ajaxHandleResponses( s, jqXHR, responses ) {
  8074. var ct, type, finalDataType, firstDataType,
  8075. contents = s.contents,
  8076. dataTypes = s.dataTypes;
  8077. // Remove auto dataType and get content-type in the process
  8078. while ( dataTypes[ 0 ] === "*" ) {
  8079. dataTypes.shift();
  8080. if ( ct === undefined ) {
  8081. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  8082. }
  8083. }
  8084. // Check if we're dealing with a known content-type
  8085. if ( ct ) {
  8086. for ( type in contents ) {
  8087. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  8088. dataTypes.unshift( type );
  8089. break;
  8090. }
  8091. }
  8092. }
  8093. // Check to see if we have a response for the expected dataType
  8094. if ( dataTypes[ 0 ] in responses ) {
  8095. finalDataType = dataTypes[ 0 ];
  8096. } else {
  8097. // Try convertible dataTypes
  8098. for ( type in responses ) {
  8099. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  8100. finalDataType = type;
  8101. break;
  8102. }
  8103. if ( !firstDataType ) {
  8104. firstDataType = type;
  8105. }
  8106. }
  8107. // Or just use first one
  8108. finalDataType = finalDataType || firstDataType;
  8109. }
  8110. // If we found a dataType
  8111. // We add the dataType to the list if needed
  8112. // and return the corresponding response
  8113. if ( finalDataType ) {
  8114. if ( finalDataType !== dataTypes[ 0 ] ) {
  8115. dataTypes.unshift( finalDataType );
  8116. }
  8117. return responses[ finalDataType ];
  8118. }
  8119. }
  8120. /* Chain conversions given the request and the original response
  8121. * Also sets the responseXXX fields on the jqXHR instance
  8122. */
  8123. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  8124. var conv2, current, conv, tmp, prev,
  8125. converters = {},
  8126. // Work with a copy of dataTypes in case we need to modify it for conversion
  8127. dataTypes = s.dataTypes.slice();
  8128. // Create converters map with lowercased keys
  8129. if ( dataTypes[ 1 ] ) {
  8130. for ( conv in s.converters ) {
  8131. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  8132. }
  8133. }
  8134. current = dataTypes.shift();
  8135. // Convert to each sequential dataType
  8136. while ( current ) {
  8137. if ( s.responseFields[ current ] ) {
  8138. jqXHR[ s.responseFields[ current ] ] = response;
  8139. }
  8140. // Apply the dataFilter if provided
  8141. if ( !prev && isSuccess && s.dataFilter ) {
  8142. response = s.dataFilter( response, s.dataType );
  8143. }
  8144. prev = current;
  8145. current = dataTypes.shift();
  8146. if ( current ) {
  8147. // There's only work to do if current dataType is non-auto
  8148. if ( current === "*" ) {
  8149. current = prev;
  8150. // Convert response if prev dataType is non-auto and differs from current
  8151. } else if ( prev !== "*" && prev !== current ) {
  8152. // Seek a direct converter
  8153. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  8154. // If none found, seek a pair
  8155. if ( !conv ) {
  8156. for ( conv2 in converters ) {
  8157. // If conv2 outputs current
  8158. tmp = conv2.split( " " );
  8159. if ( tmp[ 1 ] === current ) {
  8160. // If prev can be converted to accepted input
  8161. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  8162. converters[ "* " + tmp[ 0 ] ];
  8163. if ( conv ) {
  8164. // Condense equivalence converters
  8165. if ( conv === true ) {
  8166. conv = converters[ conv2 ];
  8167. // Otherwise, insert the intermediate dataType
  8168. } else if ( converters[ conv2 ] !== true ) {
  8169. current = tmp[ 0 ];
  8170. dataTypes.unshift( tmp[ 1 ] );
  8171. }
  8172. break;
  8173. }
  8174. }
  8175. }
  8176. }
  8177. // Apply converter (if not an equivalence)
  8178. if ( conv !== true ) {
  8179. // Unless errors are allowed to bubble, catch and return them
  8180. if ( conv && s.throws ) {
  8181. response = conv( response );
  8182. } else {
  8183. try {
  8184. response = conv( response );
  8185. } catch ( e ) {
  8186. return {
  8187. state: "parsererror",
  8188. error: conv ? e : "No conversion from " + prev + " to " + current
  8189. };
  8190. }
  8191. }
  8192. }
  8193. }
  8194. }
  8195. }
  8196. return { state: "success", data: response };
  8197. }
  8198. jQuery.extend( {
  8199. // Counter for holding the number of active queries
  8200. active: 0,
  8201. // Last-Modified header cache for next request
  8202. lastModified: {},
  8203. etag: {},
  8204. ajaxSettings: {
  8205. url: location.href,
  8206. type: "GET",
  8207. isLocal: rlocalProtocol.test( location.protocol ),
  8208. global: true,
  8209. processData: true,
  8210. async: true,
  8211. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  8212. /*
  8213. timeout: 0,
  8214. data: null,
  8215. dataType: null,
  8216. username: null,
  8217. password: null,
  8218. cache: null,
  8219. throws: false,
  8220. traditional: false,
  8221. headers: {},
  8222. */
  8223. accepts: {
  8224. "*": allTypes,
  8225. text: "text/plain",
  8226. html: "text/html",
  8227. xml: "application/xml, text/xml",
  8228. json: "application/json, text/javascript"
  8229. },
  8230. contents: {
  8231. xml: /\bxml\b/,
  8232. html: /\bhtml/,
  8233. json: /\bjson\b/
  8234. },
  8235. responseFields: {
  8236. xml: "responseXML",
  8237. text: "responseText",
  8238. json: "responseJSON"
  8239. },
  8240. // Data converters
  8241. // Keys separate source (or catchall "*") and destination types with a single space
  8242. converters: {
  8243. // Convert anything to text
  8244. "* text": String,
  8245. // Text to html (true = no transformation)
  8246. "text html": true,
  8247. // Evaluate text as a json expression
  8248. "text json": JSON.parse,
  8249. // Parse text as xml
  8250. "text xml": jQuery.parseXML
  8251. },
  8252. // For options that shouldn't be deep extended:
  8253. // you can add your own custom options here if
  8254. // and when you create one that shouldn't be
  8255. // deep extended (see ajaxExtend)
  8256. flatOptions: {
  8257. url: true,
  8258. context: true
  8259. }
  8260. },
  8261. // Creates a full fledged settings object into target
  8262. // with both ajaxSettings and settings fields.
  8263. // If target is omitted, writes into ajaxSettings.
  8264. ajaxSetup: function( target, settings ) {
  8265. return settings ?
  8266. // Building a settings object
  8267. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  8268. // Extending ajaxSettings
  8269. ajaxExtend( jQuery.ajaxSettings, target );
  8270. },
  8271. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  8272. ajaxTransport: addToPrefiltersOrTransports( transports ),
  8273. // Main method
  8274. ajax: function( url, options ) {
  8275. // If url is an object, simulate pre-1.5 signature
  8276. if ( typeof url === "object" ) {
  8277. options = url;
  8278. url = undefined;
  8279. }
  8280. // Force options to be an object
  8281. options = options || {};
  8282. var transport,
  8283. // URL without anti-cache param
  8284. cacheURL,
  8285. // Response headers
  8286. responseHeadersString,
  8287. responseHeaders,
  8288. // timeout handle
  8289. timeoutTimer,
  8290. // Url cleanup var
  8291. urlAnchor,
  8292. // Request state (becomes false upon send and true upon completion)
  8293. completed,
  8294. // To know if global events are to be dispatched
  8295. fireGlobals,
  8296. // Loop variable
  8297. i,
  8298. // uncached part of the url
  8299. uncached,
  8300. // Create the final options object
  8301. s = jQuery.ajaxSetup( {}, options ),
  8302. // Callbacks context
  8303. callbackContext = s.context || s,
  8304. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  8305. globalEventContext = s.context &&
  8306. ( callbackContext.nodeType || callbackContext.jquery ) ?
  8307. jQuery( callbackContext ) :
  8308. jQuery.event,
  8309. // Deferreds
  8310. deferred = jQuery.Deferred(),
  8311. completeDeferred = jQuery.Callbacks( "once memory" ),
  8312. // Status-dependent callbacks
  8313. statusCode = s.statusCode || {},
  8314. // Headers (they are sent all at once)
  8315. requestHeaders = {},
  8316. requestHeadersNames = {},
  8317. // Default abort message
  8318. strAbort = "canceled",
  8319. // Fake xhr
  8320. jqXHR = {
  8321. readyState: 0,
  8322. // Builds headers hashtable if needed
  8323. getResponseHeader: function( key ) {
  8324. var match;
  8325. if ( completed ) {
  8326. if ( !responseHeaders ) {
  8327. responseHeaders = {};
  8328. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  8329. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  8330. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  8331. .concat( match[ 2 ] );
  8332. }
  8333. }
  8334. match = responseHeaders[ key.toLowerCase() + " " ];
  8335. }
  8336. return match == null ? null : match.join( ", " );
  8337. },
  8338. // Raw string
  8339. getAllResponseHeaders: function() {
  8340. return completed ? responseHeadersString : null;
  8341. },
  8342. // Caches the header
  8343. setRequestHeader: function( name, value ) {
  8344. if ( completed == null ) {
  8345. name = requestHeadersNames[ name.toLowerCase() ] =
  8346. requestHeadersNames[ name.toLowerCase() ] || name;
  8347. requestHeaders[ name ] = value;
  8348. }
  8349. return this;
  8350. },
  8351. // Overrides response content-type header
  8352. overrideMimeType: function( type ) {
  8353. if ( completed == null ) {
  8354. s.mimeType = type;
  8355. }
  8356. return this;
  8357. },
  8358. // Status-dependent callbacks
  8359. statusCode: function( map ) {
  8360. var code;
  8361. if ( map ) {
  8362. if ( completed ) {
  8363. // Execute the appropriate callbacks
  8364. jqXHR.always( map[ jqXHR.status ] );
  8365. } else {
  8366. // Lazy-add the new callbacks in a way that preserves old ones
  8367. for ( code in map ) {
  8368. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  8369. }
  8370. }
  8371. }
  8372. return this;
  8373. },
  8374. // Cancel the request
  8375. abort: function( statusText ) {
  8376. var finalText = statusText || strAbort;
  8377. if ( transport ) {
  8378. transport.abort( finalText );
  8379. }
  8380. done( 0, finalText );
  8381. return this;
  8382. }
  8383. };
  8384. // Attach deferreds
  8385. deferred.promise( jqXHR );
  8386. // Add protocol if not provided (prefilters might expect it)
  8387. // Handle falsy url in the settings object (#10093: consistency with old signature)
  8388. // We also use the url parameter if available
  8389. s.url = ( ( url || s.url || location.href ) + "" )
  8390. .replace( rprotocol, location.protocol + "//" );
  8391. // Alias method option to type as per ticket #12004
  8392. s.type = options.method || options.type || s.method || s.type;
  8393. // Extract dataTypes list
  8394. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  8395. // A cross-domain request is in order when the origin doesn't match the current origin.
  8396. if ( s.crossDomain == null ) {
  8397. urlAnchor = document.createElement( "a" );
  8398. // Support: IE <=8 - 11, Edge 12 - 15
  8399. // IE throws exception on accessing the href property if url is malformed,
  8400. // e.g. http://example.com:80x/
  8401. try {
  8402. urlAnchor.href = s.url;
  8403. // Support: IE <=8 - 11 only
  8404. // Anchor's host property isn't correctly set when s.url is relative
  8405. urlAnchor.href = urlAnchor.href;
  8406. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  8407. urlAnchor.protocol + "//" + urlAnchor.host;
  8408. } catch ( e ) {
  8409. // If there is an error parsing the URL, assume it is crossDomain,
  8410. // it can be rejected by the transport if it is invalid
  8411. s.crossDomain = true;
  8412. }
  8413. }
  8414. // Convert data if not already a string
  8415. if ( s.data && s.processData && typeof s.data !== "string" ) {
  8416. s.data = jQuery.param( s.data, s.traditional );
  8417. }
  8418. // Apply prefilters
  8419. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  8420. // If request was aborted inside a prefilter, stop there
  8421. if ( completed ) {
  8422. return jqXHR;
  8423. }
  8424. // We can fire global events as of now if asked to
  8425. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  8426. fireGlobals = jQuery.event && s.global;
  8427. // Watch for a new set of requests
  8428. if ( fireGlobals && jQuery.active++ === 0 ) {
  8429. jQuery.event.trigger( "ajaxStart" );
  8430. }
  8431. // Uppercase the type
  8432. s.type = s.type.toUpperCase();
  8433. // Determine if request has content
  8434. s.hasContent = !rnoContent.test( s.type );
  8435. // Save the URL in case we're toying with the If-Modified-Since
  8436. // and/or If-None-Match header later on
  8437. // Remove hash to simplify url manipulation
  8438. cacheURL = s.url.replace( rhash, "" );
  8439. // More options handling for requests with no content
  8440. if ( !s.hasContent ) {
  8441. // Remember the hash so we can put it back
  8442. uncached = s.url.slice( cacheURL.length );
  8443. // If data is available and should be processed, append data to url
  8444. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  8445. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  8446. // #9682: remove data so that it's not used in an eventual retry
  8447. delete s.data;
  8448. }
  8449. // Add or update anti-cache param if needed
  8450. if ( s.cache === false ) {
  8451. cacheURL = cacheURL.replace( rantiCache, "$1" );
  8452. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  8453. }
  8454. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  8455. s.url = cacheURL + uncached;
  8456. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  8457. } else if ( s.data && s.processData &&
  8458. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  8459. s.data = s.data.replace( r20, "+" );
  8460. }
  8461. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8462. if ( s.ifModified ) {
  8463. if ( jQuery.lastModified[ cacheURL ] ) {
  8464. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  8465. }
  8466. if ( jQuery.etag[ cacheURL ] ) {
  8467. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  8468. }
  8469. }
  8470. // Set the correct header, if data is being sent
  8471. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  8472. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  8473. }
  8474. // Set the Accepts header for the server, depending on the dataType
  8475. jqXHR.setRequestHeader(
  8476. "Accept",
  8477. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  8478. s.accepts[ s.dataTypes[ 0 ] ] +
  8479. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  8480. s.accepts[ "*" ]
  8481. );
  8482. // Check for headers option
  8483. for ( i in s.headers ) {
  8484. jqXHR.setRequestHeader( i, s.headers[ i ] );
  8485. }
  8486. // Allow custom headers/mimetypes and early abort
  8487. if ( s.beforeSend &&
  8488. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  8489. // Abort if not done already and return
  8490. return jqXHR.abort();
  8491. }
  8492. // Aborting is no longer a cancellation
  8493. strAbort = "abort";
  8494. // Install callbacks on deferreds
  8495. completeDeferred.add( s.complete );
  8496. jqXHR.done( s.success );
  8497. jqXHR.fail( s.error );
  8498. // Get transport
  8499. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  8500. // If no transport, we auto-abort
  8501. if ( !transport ) {
  8502. done( -1, "No Transport" );
  8503. } else {
  8504. jqXHR.readyState = 1;
  8505. // Send global event
  8506. if ( fireGlobals ) {
  8507. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  8508. }
  8509. // If request was aborted inside ajaxSend, stop there
  8510. if ( completed ) {
  8511. return jqXHR;
  8512. }
  8513. // Timeout
  8514. if ( s.async && s.timeout > 0 ) {
  8515. timeoutTimer = window.setTimeout( function() {
  8516. jqXHR.abort( "timeout" );
  8517. }, s.timeout );
  8518. }
  8519. try {
  8520. completed = false;
  8521. transport.send( requestHeaders, done );
  8522. } catch ( e ) {
  8523. // Rethrow post-completion exceptions
  8524. if ( completed ) {
  8525. throw e;
  8526. }
  8527. // Propagate others as results
  8528. done( -1, e );
  8529. }
  8530. }
  8531. // Callback for when everything is done
  8532. function done( status, nativeStatusText, responses, headers ) {
  8533. var isSuccess, success, error, response, modified,
  8534. statusText = nativeStatusText;
  8535. // Ignore repeat invocations
  8536. if ( completed ) {
  8537. return;
  8538. }
  8539. completed = true;
  8540. // Clear timeout if it exists
  8541. if ( timeoutTimer ) {
  8542. window.clearTimeout( timeoutTimer );
  8543. }
  8544. // Dereference transport for early garbage collection
  8545. // (no matter how long the jqXHR object will be used)
  8546. transport = undefined;
  8547. // Cache response headers
  8548. responseHeadersString = headers || "";
  8549. // Set readyState
  8550. jqXHR.readyState = status > 0 ? 4 : 0;
  8551. // Determine if successful
  8552. isSuccess = status >= 200 && status < 300 || status === 304;
  8553. // Get response data
  8554. if ( responses ) {
  8555. response = ajaxHandleResponses( s, jqXHR, responses );
  8556. }
  8557. // Convert no matter what (that way responseXXX fields are always set)
  8558. response = ajaxConvert( s, response, jqXHR, isSuccess );
  8559. // If successful, handle type chaining
  8560. if ( isSuccess ) {
  8561. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8562. if ( s.ifModified ) {
  8563. modified = jqXHR.getResponseHeader( "Last-Modified" );
  8564. if ( modified ) {
  8565. jQuery.lastModified[ cacheURL ] = modified;
  8566. }
  8567. modified = jqXHR.getResponseHeader( "etag" );
  8568. if ( modified ) {
  8569. jQuery.etag[ cacheURL ] = modified;
  8570. }
  8571. }
  8572. // if no content
  8573. if ( status === 204 || s.type === "HEAD" ) {
  8574. statusText = "nocontent";
  8575. // if not modified
  8576. } else if ( status === 304 ) {
  8577. statusText = "notmodified";
  8578. // If we have data, let's convert it
  8579. } else {
  8580. statusText = response.state;
  8581. success = response.data;
  8582. error = response.error;
  8583. isSuccess = !error;
  8584. }
  8585. } else {
  8586. // Extract error from statusText and normalize for non-aborts
  8587. error = statusText;
  8588. if ( status || !statusText ) {
  8589. statusText = "error";
  8590. if ( status < 0 ) {
  8591. status = 0;
  8592. }
  8593. }
  8594. }
  8595. // Set data for the fake xhr object
  8596. jqXHR.status = status;
  8597. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  8598. // Success/Error
  8599. if ( isSuccess ) {
  8600. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  8601. } else {
  8602. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  8603. }
  8604. // Status-dependent callbacks
  8605. jqXHR.statusCode( statusCode );
  8606. statusCode = undefined;
  8607. if ( fireGlobals ) {
  8608. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  8609. [ jqXHR, s, isSuccess ? success : error ] );
  8610. }
  8611. // Complete
  8612. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  8613. if ( fireGlobals ) {
  8614. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  8615. // Handle the global AJAX counter
  8616. if ( !( --jQuery.active ) ) {
  8617. jQuery.event.trigger( "ajaxStop" );
  8618. }
  8619. }
  8620. }
  8621. return jqXHR;
  8622. },
  8623. getJSON: function( url, data, callback ) {
  8624. return jQuery.get( url, data, callback, "json" );
  8625. },
  8626. getScript: function( url, callback ) {
  8627. return jQuery.get( url, undefined, callback, "script" );
  8628. }
  8629. } );
  8630. jQuery.each( [ "get", "post" ], function( i, method ) {
  8631. jQuery[ method ] = function( url, data, callback, type ) {
  8632. // Shift arguments if data argument was omitted
  8633. if ( isFunction( data ) ) {
  8634. type = type || callback;
  8635. callback = data;
  8636. data = undefined;
  8637. }
  8638. // The url can be an options object (which then must have .url)
  8639. return jQuery.ajax( jQuery.extend( {
  8640. url: url,
  8641. type: method,
  8642. dataType: type,
  8643. data: data,
  8644. success: callback
  8645. }, jQuery.isPlainObject( url ) && url ) );
  8646. };
  8647. } );
  8648. jQuery._evalUrl = function( url, options ) {
  8649. return jQuery.ajax( {
  8650. url: url,
  8651. // Make this explicit, since user can override this through ajaxSetup (#11264)
  8652. type: "GET",
  8653. dataType: "script",
  8654. cache: true,
  8655. async: false,
  8656. global: false,
  8657. // Only evaluate the response if it is successful (gh-4126)
  8658. // dataFilter is not invoked for failure responses, so using it instead
  8659. // of the default converter is kludgy but it works.
  8660. converters: {
  8661. "text script": function() {}
  8662. },
  8663. dataFilter: function( response ) {
  8664. jQuery.globalEval( response, options );
  8665. }
  8666. } );
  8667. };
  8668. jQuery.fn.extend( {
  8669. wrapAll: function( html ) {
  8670. var wrap;
  8671. if ( this[ 0 ] ) {
  8672. if ( isFunction( html ) ) {
  8673. html = html.call( this[ 0 ] );
  8674. }
  8675. // The elements to wrap the target around
  8676. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8677. if ( this[ 0 ].parentNode ) {
  8678. wrap.insertBefore( this[ 0 ] );
  8679. }
  8680. wrap.map( function() {
  8681. var elem = this;
  8682. while ( elem.firstElementChild ) {
  8683. elem = elem.firstElementChild;
  8684. }
  8685. return elem;
  8686. } ).append( this );
  8687. }
  8688. return this;
  8689. },
  8690. wrapInner: function( html ) {
  8691. if ( isFunction( html ) ) {
  8692. return this.each( function( i ) {
  8693. jQuery( this ).wrapInner( html.call( this, i ) );
  8694. } );
  8695. }
  8696. return this.each( function() {
  8697. var self = jQuery( this ),
  8698. contents = self.contents();
  8699. if ( contents.length ) {
  8700. contents.wrapAll( html );
  8701. } else {
  8702. self.append( html );
  8703. }
  8704. } );
  8705. },
  8706. wrap: function( html ) {
  8707. var htmlIsFunction = isFunction( html );
  8708. return this.each( function( i ) {
  8709. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  8710. } );
  8711. },
  8712. unwrap: function( selector ) {
  8713. this.parent( selector ).not( "body" ).each( function() {
  8714. jQuery( this ).replaceWith( this.childNodes );
  8715. } );
  8716. return this;
  8717. }
  8718. } );
  8719. jQuery.expr.pseudos.hidden = function( elem ) {
  8720. return !jQuery.expr.pseudos.visible( elem );
  8721. };
  8722. jQuery.expr.pseudos.visible = function( elem ) {
  8723. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  8724. };
  8725. jQuery.ajaxSettings.xhr = function() {
  8726. try {
  8727. return new window.XMLHttpRequest();
  8728. } catch ( e ) {}
  8729. };
  8730. var xhrSuccessStatus = {
  8731. // File protocol always yields status code 0, assume 200
  8732. 0: 200,
  8733. // Support: IE <=9 only
  8734. // #1450: sometimes IE returns 1223 when it should be 204
  8735. 1223: 204
  8736. },
  8737. xhrSupported = jQuery.ajaxSettings.xhr();
  8738. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  8739. support.ajax = xhrSupported = !!xhrSupported;
  8740. jQuery.ajaxTransport( function( options ) {
  8741. var callback, errorCallback;
  8742. // Cross domain only allowed if supported through XMLHttpRequest
  8743. if ( support.cors || xhrSupported && !options.crossDomain ) {
  8744. return {
  8745. send: function( headers, complete ) {
  8746. var i,
  8747. xhr = options.xhr();
  8748. xhr.open(
  8749. options.type,
  8750. options.url,
  8751. options.async,
  8752. options.username,
  8753. options.password
  8754. );
  8755. // Apply custom fields if provided
  8756. if ( options.xhrFields ) {
  8757. for ( i in options.xhrFields ) {
  8758. xhr[ i ] = options.xhrFields[ i ];
  8759. }
  8760. }
  8761. // Override mime type if needed
  8762. if ( options.mimeType && xhr.overrideMimeType ) {
  8763. xhr.overrideMimeType( options.mimeType );
  8764. }
  8765. // X-Requested-With header
  8766. // For cross-domain requests, seeing as conditions for a preflight are
  8767. // akin to a jigsaw puzzle, we simply never set it to be sure.
  8768. // (it can always be set on a per-request basis or even using ajaxSetup)
  8769. // For same-domain requests, won't change header if already provided.
  8770. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  8771. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  8772. }
  8773. // Set headers
  8774. for ( i in headers ) {
  8775. xhr.setRequestHeader( i, headers[ i ] );
  8776. }
  8777. // Callback
  8778. callback = function( type ) {
  8779. return function() {
  8780. if ( callback ) {
  8781. callback = errorCallback = xhr.onload =
  8782. xhr.onerror = xhr.onabort = xhr.ontimeout =
  8783. xhr.onreadystatechange = null;
  8784. if ( type === "abort" ) {
  8785. xhr.abort();
  8786. } else if ( type === "error" ) {
  8787. // Support: IE <=9 only
  8788. // On a manual native abort, IE9 throws
  8789. // errors on any property access that is not readyState
  8790. if ( typeof xhr.status !== "number" ) {
  8791. complete( 0, "error" );
  8792. } else {
  8793. complete(
  8794. // File: protocol always yields status 0; see #8605, #14207
  8795. xhr.status,
  8796. xhr.statusText
  8797. );
  8798. }
  8799. } else {
  8800. complete(
  8801. xhrSuccessStatus[ xhr.status ] || xhr.status,
  8802. xhr.statusText,
  8803. // Support: IE <=9 only
  8804. // IE9 has no XHR2 but throws on binary (trac-11426)
  8805. // For XHR2 non-text, let the caller handle it (gh-2498)
  8806. ( xhr.responseType || "text" ) !== "text" ||
  8807. typeof xhr.responseText !== "string" ?
  8808. { binary: xhr.response } :
  8809. { text: xhr.responseText },
  8810. xhr.getAllResponseHeaders()
  8811. );
  8812. }
  8813. }
  8814. };
  8815. };
  8816. // Listen to events
  8817. xhr.onload = callback();
  8818. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  8819. // Support: IE 9 only
  8820. // Use onreadystatechange to replace onabort
  8821. // to handle uncaught aborts
  8822. if ( xhr.onabort !== undefined ) {
  8823. xhr.onabort = errorCallback;
  8824. } else {
  8825. xhr.onreadystatechange = function() {
  8826. // Check readyState before timeout as it changes
  8827. if ( xhr.readyState === 4 ) {
  8828. // Allow onerror to be called first,
  8829. // but that will not handle a native abort
  8830. // Also, save errorCallback to a variable
  8831. // as xhr.onerror cannot be accessed
  8832. window.setTimeout( function() {
  8833. if ( callback ) {
  8834. errorCallback();
  8835. }
  8836. } );
  8837. }
  8838. };
  8839. }
  8840. // Create the abort callback
  8841. callback = callback( "abort" );
  8842. try {
  8843. // Do send the request (this may raise an exception)
  8844. xhr.send( options.hasContent && options.data || null );
  8845. } catch ( e ) {
  8846. // #14683: Only rethrow if this hasn't been notified as an error yet
  8847. if ( callback ) {
  8848. throw e;
  8849. }
  8850. }
  8851. },
  8852. abort: function() {
  8853. if ( callback ) {
  8854. callback();
  8855. }
  8856. }
  8857. };
  8858. }
  8859. } );
  8860. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  8861. jQuery.ajaxPrefilter( function( s ) {
  8862. if ( s.crossDomain ) {
  8863. s.contents.script = false;
  8864. }
  8865. } );
  8866. // Install script dataType
  8867. jQuery.ajaxSetup( {
  8868. accepts: {
  8869. script: "text/javascript, application/javascript, " +
  8870. "application/ecmascript, application/x-ecmascript"
  8871. },
  8872. contents: {
  8873. script: /\b(?:java|ecma)script\b/
  8874. },
  8875. converters: {
  8876. "text script": function( text ) {
  8877. jQuery.globalEval( text );
  8878. return text;
  8879. }
  8880. }
  8881. } );
  8882. // Handle cache's special case and crossDomain
  8883. jQuery.ajaxPrefilter( "script", function( s ) {
  8884. if ( s.cache === undefined ) {
  8885. s.cache = false;
  8886. }
  8887. if ( s.crossDomain ) {
  8888. s.type = "GET";
  8889. }
  8890. } );
  8891. // Bind script tag hack transport
  8892. jQuery.ajaxTransport( "script", function( s ) {
  8893. // This transport only deals with cross domain or forced-by-attrs requests
  8894. if ( s.crossDomain || s.scriptAttrs ) {
  8895. var script, callback;
  8896. return {
  8897. send: function( _, complete ) {
  8898. script = jQuery( "<script>" )
  8899. .attr( s.scriptAttrs || {} )
  8900. .prop( { charset: s.scriptCharset, src: s.url } )
  8901. .on( "load error", callback = function( evt ) {
  8902. script.remove();
  8903. callback = null;
  8904. if ( evt ) {
  8905. complete( evt.type === "error" ? 404 : 200, evt.type );
  8906. }
  8907. } );
  8908. // Use native DOM manipulation to avoid our domManip AJAX trickery
  8909. document.head.appendChild( script[ 0 ] );
  8910. },
  8911. abort: function() {
  8912. if ( callback ) {
  8913. callback();
  8914. }
  8915. }
  8916. };
  8917. }
  8918. } );
  8919. var oldCallbacks = [],
  8920. rjsonp = /(=)\?(?=&|$)|\?\?/;
  8921. // Default jsonp settings
  8922. jQuery.ajaxSetup( {
  8923. jsonp: "callback",
  8924. jsonpCallback: function() {
  8925. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  8926. this[ callback ] = true;
  8927. return callback;
  8928. }
  8929. } );
  8930. // Detect, normalize options and install callbacks for jsonp requests
  8931. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  8932. var callbackName, overwritten, responseContainer,
  8933. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  8934. "url" :
  8935. typeof s.data === "string" &&
  8936. ( s.contentType || "" )
  8937. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  8938. rjsonp.test( s.data ) && "data"
  8939. );
  8940. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  8941. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  8942. // Get callback name, remembering preexisting value associated with it
  8943. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  8944. s.jsonpCallback() :
  8945. s.jsonpCallback;
  8946. // Insert callback into url or form data
  8947. if ( jsonProp ) {
  8948. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  8949. } else if ( s.jsonp !== false ) {
  8950. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  8951. }
  8952. // Use data converter to retrieve json after script execution
  8953. s.converters[ "script json" ] = function() {
  8954. if ( !responseContainer ) {
  8955. jQuery.error( callbackName + " was not called" );
  8956. }
  8957. return responseContainer[ 0 ];
  8958. };
  8959. // Force json dataType
  8960. s.dataTypes[ 0 ] = "json";
  8961. // Install callback
  8962. overwritten = window[ callbackName ];
  8963. window[ callbackName ] = function() {
  8964. responseContainer = arguments;
  8965. };
  8966. // Clean-up function (fires after converters)
  8967. jqXHR.always( function() {
  8968. // If previous value didn't exist - remove it
  8969. if ( overwritten === undefined ) {
  8970. jQuery( window ).removeProp( callbackName );
  8971. // Otherwise restore preexisting value
  8972. } else {
  8973. window[ callbackName ] = overwritten;
  8974. }
  8975. // Save back as free
  8976. if ( s[ callbackName ] ) {
  8977. // Make sure that re-using the options doesn't screw things around
  8978. s.jsonpCallback = originalSettings.jsonpCallback;
  8979. // Save the callback name for future use
  8980. oldCallbacks.push( callbackName );
  8981. }
  8982. // Call if it was a function and we have a response
  8983. if ( responseContainer && isFunction( overwritten ) ) {
  8984. overwritten( responseContainer[ 0 ] );
  8985. }
  8986. responseContainer = overwritten = undefined;
  8987. } );
  8988. // Delegate to script
  8989. return "script";
  8990. }
  8991. } );
  8992. // Support: Safari 8 only
  8993. // In Safari 8 documents created via document.implementation.createHTMLDocument
  8994. // collapse sibling forms: the second one becomes a child of the first one.
  8995. // Because of that, this security measure has to be disabled in Safari 8.
  8996. // https://bugs.webkit.org/show_bug.cgi?id=137337
  8997. support.createHTMLDocument = ( function() {
  8998. var body = document.implementation.createHTMLDocument( "" ).body;
  8999. body.innerHTML = "<form></form><form></form>";
  9000. return body.childNodes.length === 2;
  9001. } )();
  9002. // Argument "data" should be string of html
  9003. // context (optional): If specified, the fragment will be created in this context,
  9004. // defaults to document
  9005. // keepScripts (optional): If true, will include scripts passed in the html string
  9006. jQuery.parseHTML = function( data, context, keepScripts ) {
  9007. if ( typeof data !== "string" ) {
  9008. return [];
  9009. }
  9010. if ( typeof context === "boolean" ) {
  9011. keepScripts = context;
  9012. context = false;
  9013. }
  9014. var base, parsed, scripts;
  9015. if ( !context ) {
  9016. // Stop scripts or inline event handlers from being executed immediately
  9017. // by using document.implementation
  9018. if ( support.createHTMLDocument ) {
  9019. context = document.implementation.createHTMLDocument( "" );
  9020. // Set the base href for the created document
  9021. // so any parsed elements with URLs
  9022. // are based on the document's URL (gh-2965)
  9023. base = context.createElement( "base" );
  9024. base.href = document.location.href;
  9025. context.head.appendChild( base );
  9026. } else {
  9027. context = document;
  9028. }
  9029. }
  9030. parsed = rsingleTag.exec( data );
  9031. scripts = !keepScripts && [];
  9032. // Single tag
  9033. if ( parsed ) {
  9034. return [ context.createElement( parsed[ 1 ] ) ];
  9035. }
  9036. parsed = buildFragment( [ data ], context, scripts );
  9037. if ( scripts && scripts.length ) {
  9038. jQuery( scripts ).remove();
  9039. }
  9040. return jQuery.merge( [], parsed.childNodes );
  9041. };
  9042. /**
  9043. * Load a url into a page
  9044. */
  9045. jQuery.fn.load = function( url, params, callback ) {
  9046. var selector, type, response,
  9047. self = this,
  9048. off = url.indexOf( " " );
  9049. if ( off > -1 ) {
  9050. selector = stripAndCollapse( url.slice( off ) );
  9051. url = url.slice( 0, off );
  9052. }
  9053. // If it's a function
  9054. if ( isFunction( params ) ) {
  9055. // We assume that it's the callback
  9056. callback = params;
  9057. params = undefined;
  9058. // Otherwise, build a param string
  9059. } else if ( params && typeof params === "object" ) {
  9060. type = "POST";
  9061. }
  9062. // If we have elements to modify, make the request
  9063. if ( self.length > 0 ) {
  9064. jQuery.ajax( {
  9065. url: url,
  9066. // If "type" variable is undefined, then "GET" method will be used.
  9067. // Make value of this field explicit since
  9068. // user can override it through ajaxSetup method
  9069. type: type || "GET",
  9070. dataType: "html",
  9071. data: params
  9072. } ).done( function( responseText ) {
  9073. // Save response for use in complete callback
  9074. response = arguments;
  9075. self.html( selector ?
  9076. // If a selector was specified, locate the right elements in a dummy div
  9077. // Exclude scripts to avoid IE 'Permission Denied' errors
  9078. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  9079. // Otherwise use the full result
  9080. responseText );
  9081. // If the request succeeds, this function gets "data", "status", "jqXHR"
  9082. // but they are ignored because response was set above.
  9083. // If it fails, this function gets "jqXHR", "status", "error"
  9084. } ).always( callback && function( jqXHR, status ) {
  9085. self.each( function() {
  9086. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  9087. } );
  9088. } );
  9089. }
  9090. return this;
  9091. };
  9092. // Attach a bunch of functions for handling common AJAX events
  9093. jQuery.each( [
  9094. "ajaxStart",
  9095. "ajaxStop",
  9096. "ajaxComplete",
  9097. "ajaxError",
  9098. "ajaxSuccess",
  9099. "ajaxSend"
  9100. ], function( i, type ) {
  9101. jQuery.fn[ type ] = function( fn ) {
  9102. return this.on( type, fn );
  9103. };
  9104. } );
  9105. jQuery.expr.pseudos.animated = function( elem ) {
  9106. return jQuery.grep( jQuery.timers, function( fn ) {
  9107. return elem === fn.elem;
  9108. } ).length;
  9109. };
  9110. jQuery.offset = {
  9111. setOffset: function( elem, options, i ) {
  9112. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  9113. position = jQuery.css( elem, "position" ),
  9114. curElem = jQuery( elem ),
  9115. props = {};
  9116. // Set position first, in-case top/left are set even on static elem
  9117. if ( position === "static" ) {
  9118. elem.style.position = "relative";
  9119. }
  9120. curOffset = curElem.offset();
  9121. curCSSTop = jQuery.css( elem, "top" );
  9122. curCSSLeft = jQuery.css( elem, "left" );
  9123. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  9124. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  9125. // Need to be able to calculate position if either
  9126. // top or left is auto and position is either absolute or fixed
  9127. if ( calculatePosition ) {
  9128. curPosition = curElem.position();
  9129. curTop = curPosition.top;
  9130. curLeft = curPosition.left;
  9131. } else {
  9132. curTop = parseFloat( curCSSTop ) || 0;
  9133. curLeft = parseFloat( curCSSLeft ) || 0;
  9134. }
  9135. if ( isFunction( options ) ) {
  9136. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  9137. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  9138. }
  9139. if ( options.top != null ) {
  9140. props.top = ( options.top - curOffset.top ) + curTop;
  9141. }
  9142. if ( options.left != null ) {
  9143. props.left = ( options.left - curOffset.left ) + curLeft;
  9144. }
  9145. if ( "using" in options ) {
  9146. options.using.call( elem, props );
  9147. } else {
  9148. curElem.css( props );
  9149. }
  9150. }
  9151. };
  9152. jQuery.fn.extend( {
  9153. // offset() relates an element's border box to the document origin
  9154. offset: function( options ) {
  9155. // Preserve chaining for setter
  9156. if ( arguments.length ) {
  9157. return options === undefined ?
  9158. this :
  9159. this.each( function( i ) {
  9160. jQuery.offset.setOffset( this, options, i );
  9161. } );
  9162. }
  9163. var rect, win,
  9164. elem = this[ 0 ];
  9165. if ( !elem ) {
  9166. return;
  9167. }
  9168. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  9169. // Support: IE <=11 only
  9170. // Running getBoundingClientRect on a
  9171. // disconnected node in IE throws an error
  9172. if ( !elem.getClientRects().length ) {
  9173. return { top: 0, left: 0 };
  9174. }
  9175. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  9176. rect = elem.getBoundingClientRect();
  9177. win = elem.ownerDocument.defaultView;
  9178. return {
  9179. top: rect.top + win.pageYOffset,
  9180. left: rect.left + win.pageXOffset
  9181. };
  9182. },
  9183. // position() relates an element's margin box to its offset parent's padding box
  9184. // This corresponds to the behavior of CSS absolute positioning
  9185. position: function() {
  9186. if ( !this[ 0 ] ) {
  9187. return;
  9188. }
  9189. var offsetParent, offset, doc,
  9190. elem = this[ 0 ],
  9191. parentOffset = { top: 0, left: 0 };
  9192. // position:fixed elements are offset from the viewport, which itself always has zero offset
  9193. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  9194. // Assume position:fixed implies availability of getBoundingClientRect
  9195. offset = elem.getBoundingClientRect();
  9196. } else {
  9197. offset = this.offset();
  9198. // Account for the *real* offset parent, which can be the document or its root element
  9199. // when a statically positioned element is identified
  9200. doc = elem.ownerDocument;
  9201. offsetParent = elem.offsetParent || doc.documentElement;
  9202. while ( offsetParent &&
  9203. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  9204. jQuery.css( offsetParent, "position" ) === "static" ) {
  9205. offsetParent = offsetParent.parentNode;
  9206. }
  9207. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  9208. // Incorporate borders into its offset, since they are outside its content origin
  9209. parentOffset = jQuery( offsetParent ).offset();
  9210. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  9211. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  9212. }
  9213. }
  9214. // Subtract parent offsets and element margins
  9215. return {
  9216. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  9217. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  9218. };
  9219. },
  9220. // This method will return documentElement in the following cases:
  9221. // 1) For the element inside the iframe without offsetParent, this method will return
  9222. // documentElement of the parent window
  9223. // 2) For the hidden or detached element
  9224. // 3) For body or html element, i.e. in case of the html node - it will return itself
  9225. //
  9226. // but those exceptions were never presented as a real life use-cases
  9227. // and might be considered as more preferable results.
  9228. //
  9229. // This logic, however, is not guaranteed and can change at any point in the future
  9230. offsetParent: function() {
  9231. return this.map( function() {
  9232. var offsetParent = this.offsetParent;
  9233. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  9234. offsetParent = offsetParent.offsetParent;
  9235. }
  9236. return offsetParent || documentElement;
  9237. } );
  9238. }
  9239. } );
  9240. // Create scrollLeft and scrollTop methods
  9241. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  9242. var top = "pageYOffset" === prop;
  9243. jQuery.fn[ method ] = function( val ) {
  9244. return access( this, function( elem, method, val ) {
  9245. // Coalesce documents and windows
  9246. var win;
  9247. if ( isWindow( elem ) ) {
  9248. win = elem;
  9249. } else if ( elem.nodeType === 9 ) {
  9250. win = elem.defaultView;
  9251. }
  9252. if ( val === undefined ) {
  9253. return win ? win[ prop ] : elem[ method ];
  9254. }
  9255. if ( win ) {
  9256. win.scrollTo(
  9257. !top ? val : win.pageXOffset,
  9258. top ? val : win.pageYOffset
  9259. );
  9260. } else {
  9261. elem[ method ] = val;
  9262. }
  9263. }, method, val, arguments.length );
  9264. };
  9265. } );
  9266. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  9267. // Add the top/left cssHooks using jQuery.fn.position
  9268. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  9269. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  9270. // getComputedStyle returns percent when specified for top/left/bottom/right;
  9271. // rather than make the css module depend on the offset module, just check for it here
  9272. jQuery.each( [ "top", "left" ], function( i, prop ) {
  9273. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  9274. function( elem, computed ) {
  9275. if ( computed ) {
  9276. computed = curCSS( elem, prop );
  9277. // If curCSS returns percentage, fallback to offset
  9278. return rnumnonpx.test( computed ) ?
  9279. jQuery( elem ).position()[ prop ] + "px" :
  9280. computed;
  9281. }
  9282. }
  9283. );
  9284. } );
  9285. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  9286. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  9287. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  9288. function( defaultExtra, funcName ) {
  9289. // Margin is only for outerHeight, outerWidth
  9290. jQuery.fn[ funcName ] = function( margin, value ) {
  9291. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  9292. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  9293. return access( this, function( elem, type, value ) {
  9294. var doc;
  9295. if ( isWindow( elem ) ) {
  9296. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  9297. return funcName.indexOf( "outer" ) === 0 ?
  9298. elem[ "inner" + name ] :
  9299. elem.document.documentElement[ "client" + name ];
  9300. }
  9301. // Get document width or height
  9302. if ( elem.nodeType === 9 ) {
  9303. doc = elem.documentElement;
  9304. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  9305. // whichever is greatest
  9306. return Math.max(
  9307. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  9308. elem.body[ "offset" + name ], doc[ "offset" + name ],
  9309. doc[ "client" + name ]
  9310. );
  9311. }
  9312. return value === undefined ?
  9313. // Get width or height on the element, requesting but not forcing parseFloat
  9314. jQuery.css( elem, type, extra ) :
  9315. // Set width or height on the element
  9316. jQuery.style( elem, type, value, extra );
  9317. }, type, chainable ? margin : undefined, chainable );
  9318. };
  9319. } );
  9320. } );
  9321. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  9322. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  9323. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  9324. function( i, name ) {
  9325. // Handle event binding
  9326. jQuery.fn[ name ] = function( data, fn ) {
  9327. return arguments.length > 0 ?
  9328. this.on( name, null, data, fn ) :
  9329. this.trigger( name );
  9330. };
  9331. } );
  9332. jQuery.fn.extend( {
  9333. hover: function( fnOver, fnOut ) {
  9334. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  9335. }
  9336. } );
  9337. jQuery.fn.extend( {
  9338. bind: function( types, data, fn ) {
  9339. return this.on( types, null, data, fn );
  9340. },
  9341. unbind: function( types, fn ) {
  9342. return this.off( types, null, fn );
  9343. },
  9344. delegate: function( selector, types, data, fn ) {
  9345. return this.on( types, selector, data, fn );
  9346. },
  9347. undelegate: function( selector, types, fn ) {
  9348. // ( namespace ) or ( selector, types [, fn] )
  9349. return arguments.length === 1 ?
  9350. this.off( selector, "**" ) :
  9351. this.off( types, selector || "**", fn );
  9352. }
  9353. } );
  9354. // Bind a function to a context, optionally partially applying any
  9355. // arguments.
  9356. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  9357. // However, it is not slated for removal any time soon
  9358. jQuery.proxy = function( fn, context ) {
  9359. var tmp, args, proxy;
  9360. if ( typeof context === "string" ) {
  9361. tmp = fn[ context ];
  9362. context = fn;
  9363. fn = tmp;
  9364. }
  9365. // Quick check to determine if target is callable, in the spec
  9366. // this throws a TypeError, but we will just return undefined.
  9367. if ( !isFunction( fn ) ) {
  9368. return undefined;
  9369. }
  9370. // Simulated bind
  9371. args = slice.call( arguments, 2 );
  9372. proxy = function() {
  9373. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  9374. };
  9375. // Set the guid of unique handler to the same of original handler, so it can be removed
  9376. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  9377. return proxy;
  9378. };
  9379. jQuery.holdReady = function( hold ) {
  9380. if ( hold ) {
  9381. jQuery.readyWait++;
  9382. } else {
  9383. jQuery.ready( true );
  9384. }
  9385. };
  9386. jQuery.isArray = Array.isArray;
  9387. jQuery.parseJSON = JSON.parse;
  9388. jQuery.nodeName = nodeName;
  9389. jQuery.isFunction = isFunction;
  9390. jQuery.isWindow = isWindow;
  9391. jQuery.camelCase = camelCase;
  9392. jQuery.type = toType;
  9393. jQuery.now = Date.now;
  9394. jQuery.isNumeric = function( obj ) {
  9395. // As of jQuery 3.0, isNumeric is limited to
  9396. // strings and numbers (primitives or objects)
  9397. // that can be coerced to finite numbers (gh-2662)
  9398. var type = jQuery.type( obj );
  9399. return ( type === "number" || type === "string" ) &&
  9400. // parseFloat NaNs numeric-cast false positives ("")
  9401. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  9402. // subtraction forces infinities to NaN
  9403. !isNaN( obj - parseFloat( obj ) );
  9404. };
  9405. // Register as a named AMD module, since jQuery can be concatenated with other
  9406. // files that may use define, but not via a proper concatenation script that
  9407. // understands anonymous AMD modules. A named AMD is safest and most robust
  9408. // way to register. Lowercase jquery is used because AMD module names are
  9409. // derived from file names, and jQuery is normally delivered in a lowercase
  9410. // file name. Do this after creating the global so that if an AMD module wants
  9411. // to call noConflict to hide this version of jQuery, it will work.
  9412. // Note that for maximum portability, libraries that are not jQuery should
  9413. // declare themselves as anonymous modules, and avoid setting a global if an
  9414. // AMD loader is present. jQuery is a special case. For more information, see
  9415. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  9416. if ( typeof define === "function" && define.amd ) {
  9417. define( "jquery", [], function() {
  9418. return jQuery;
  9419. } );
  9420. }
  9421. var
  9422. // Map over jQuery in case of overwrite
  9423. _jQuery = window.jQuery,
  9424. // Map over the $ in case of overwrite
  9425. _$ = window.$;
  9426. jQuery.noConflict = function( deep ) {
  9427. if ( window.$ === jQuery ) {
  9428. window.$ = _$;
  9429. }
  9430. if ( deep && window.jQuery === jQuery ) {
  9431. window.jQuery = _jQuery;
  9432. }
  9433. return jQuery;
  9434. };
  9435. // Expose jQuery and $ identifiers, even in AMD
  9436. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  9437. // and CommonJS for browser emulators (#13566)
  9438. if ( !noGlobal ) {
  9439. window.jQuery = window.$ = jQuery;
  9440. }
  9441. return jQuery;
  9442. } );
  9443. /*! jQuery UI - v1.11.4 - 2016-03-02
  9444. * http://jqueryui.com
  9445. * Includes: core.js, widget.js, mouse.js, draggable.js, droppable.js, sortable.js, effect.js, effect-slide.js
  9446. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  9447. (function( factory ) {
  9448. if ( typeof define === "function" && define.amd ) {
  9449. // AMD. Register as an anonymous module.
  9450. define([ "jquery" ], factory );
  9451. } else {
  9452. // Browser globals
  9453. factory( jQuery );
  9454. }
  9455. }(function( $ ) {
  9456. /*!
  9457. * jQuery UI Core 1.11.4
  9458. * http://jqueryui.com
  9459. *
  9460. * Copyright jQuery Foundation and other contributors
  9461. * Released under the MIT license.
  9462. * http://jquery.org/license
  9463. *
  9464. * http://api.jqueryui.com/category/ui-core/
  9465. */
  9466. // $.ui might exist from components with no dependencies, e.g., $.ui.position
  9467. $.ui = $.ui || {};
  9468. $.extend( $.ui, {
  9469. version: "1.11.4",
  9470. keyCode: {
  9471. BACKSPACE: 8,
  9472. COMMA: 188,
  9473. DELETE: 46,
  9474. DOWN: 40,
  9475. END: 35,
  9476. ENTER: 13,
  9477. ESCAPE: 27,
  9478. HOME: 36,
  9479. LEFT: 37,
  9480. PAGE_DOWN: 34,
  9481. PAGE_UP: 33,
  9482. PERIOD: 190,
  9483. RIGHT: 39,
  9484. SPACE: 32,
  9485. TAB: 9,
  9486. UP: 38
  9487. }
  9488. });
  9489. // plugins
  9490. $.fn.extend({
  9491. scrollParent: function( includeHidden ) {
  9492. var position = this.css( "position" ),
  9493. excludeStaticParent = position === "absolute",
  9494. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  9495. scrollParent = this.parents().filter( function() {
  9496. var parent = $( this );
  9497. if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  9498. return false;
  9499. }
  9500. return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
  9501. }).eq( 0 );
  9502. return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
  9503. },
  9504. uniqueId: (function() {
  9505. var uuid = 0;
  9506. return function() {
  9507. return this.each(function() {
  9508. if ( !this.id ) {
  9509. this.id = "ui-id-" + ( ++uuid );
  9510. }
  9511. });
  9512. };
  9513. })(),
  9514. removeUniqueId: function() {
  9515. return this.each(function() {
  9516. if ( /^ui-id-\d+$/.test( this.id ) ) {
  9517. $( this ).removeAttr( "id" );
  9518. }
  9519. });
  9520. }
  9521. });
  9522. // selectors
  9523. function focusable( element, isTabIndexNotNaN ) {
  9524. var map, mapName, img,
  9525. nodeName = element.nodeName.toLowerCase();
  9526. if ( "area" === nodeName ) {
  9527. map = element.parentNode;
  9528. mapName = map.name;
  9529. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  9530. return false;
  9531. }
  9532. img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
  9533. return !!img && visible( img );
  9534. }
  9535. return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
  9536. !element.disabled :
  9537. "a" === nodeName ?
  9538. element.href || isTabIndexNotNaN :
  9539. isTabIndexNotNaN) &&
  9540. // the element and all of its ancestors must be visible
  9541. visible( element );
  9542. }
  9543. function visible( element ) {
  9544. return $.expr.filters.visible( element ) &&
  9545. !$( element ).parents().addBack().filter(function() {
  9546. return $.css( this, "visibility" ) === "hidden";
  9547. }).length;
  9548. }
  9549. $.extend( $.expr[ ":" ], {
  9550. data: $.expr.createPseudo ?
  9551. $.expr.createPseudo(function( dataName ) {
  9552. return function( elem ) {
  9553. return !!$.data( elem, dataName );
  9554. };
  9555. }) :
  9556. // support: jQuery <1.8
  9557. function( elem, i, match ) {
  9558. return !!$.data( elem, match[ 3 ] );
  9559. },
  9560. focusable: function( element ) {
  9561. return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
  9562. },
  9563. tabbable: function( element ) {
  9564. var tabIndex = $.attr( element, "tabindex" ),
  9565. isTabIndexNaN = isNaN( tabIndex );
  9566. return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
  9567. }
  9568. });
  9569. // support: jQuery <1.8
  9570. if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
  9571. $.each( [ "Width", "Height" ], function( i, name ) {
  9572. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  9573. type = name.toLowerCase(),
  9574. orig = {
  9575. innerWidth: $.fn.innerWidth,
  9576. innerHeight: $.fn.innerHeight,
  9577. outerWidth: $.fn.outerWidth,
  9578. outerHeight: $.fn.outerHeight
  9579. };
  9580. function reduce( elem, size, border, margin ) {
  9581. $.each( side, function() {
  9582. size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
  9583. if ( border ) {
  9584. size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
  9585. }
  9586. if ( margin ) {
  9587. size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
  9588. }
  9589. });
  9590. return size;
  9591. }
  9592. $.fn[ "inner" + name ] = function( size ) {
  9593. if ( size === undefined ) {
  9594. return orig[ "inner" + name ].call( this );
  9595. }
  9596. return this.each(function() {
  9597. $( this ).css( type, reduce( this, size ) + "px" );
  9598. });
  9599. };
  9600. $.fn[ "outer" + name] = function( size, margin ) {
  9601. if ( typeof size !== "number" ) {
  9602. return orig[ "outer" + name ].call( this, size );
  9603. }
  9604. return this.each(function() {
  9605. $( this).css( type, reduce( this, size, true, margin ) + "px" );
  9606. });
  9607. };
  9608. });
  9609. }
  9610. // support: jQuery <1.8
  9611. if ( !$.fn.addBack ) {
  9612. $.fn.addBack = function( selector ) {
  9613. return this.add( selector == null ?
  9614. this.prevObject : this.prevObject.filter( selector )
  9615. );
  9616. };
  9617. }
  9618. // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
  9619. if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
  9620. $.fn.removeData = (function( removeData ) {
  9621. return function( key ) {
  9622. if ( arguments.length ) {
  9623. return removeData.call( this, $.camelCase( key ) );
  9624. } else {
  9625. return removeData.call( this );
  9626. }
  9627. };
  9628. })( $.fn.removeData );
  9629. }
  9630. // deprecated
  9631. $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  9632. $.fn.extend({
  9633. focus: (function( orig ) {
  9634. return function( delay, fn ) {
  9635. return typeof delay === "number" ?
  9636. this.each(function() {
  9637. var elem = this;
  9638. setTimeout(function() {
  9639. $( elem ).focus();
  9640. if ( fn ) {
  9641. fn.call( elem );
  9642. }
  9643. }, delay );
  9644. }) :
  9645. orig.apply( this, arguments );
  9646. };
  9647. })( $.fn.focus ),
  9648. disableSelection: (function() {
  9649. var eventType = "onselectstart" in document.createElement( "div" ) ?
  9650. "selectstart" :
  9651. "mousedown";
  9652. return function() {
  9653. return this.bind( eventType + ".ui-disableSelection", function( event ) {
  9654. event.preventDefault();
  9655. });
  9656. };
  9657. })(),
  9658. enableSelection: function() {
  9659. return this.unbind( ".ui-disableSelection" );
  9660. },
  9661. zIndex: function( zIndex ) {
  9662. if ( zIndex !== undefined ) {
  9663. return this.css( "zIndex", zIndex );
  9664. }
  9665. if ( this.length ) {
  9666. var elem = $( this[ 0 ] ), position, value;
  9667. while ( elem.length && elem[ 0 ] !== document ) {
  9668. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  9669. // This makes behavior of this function consistent across browsers
  9670. // WebKit always returns auto if the element is positioned
  9671. position = elem.css( "position" );
  9672. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  9673. // IE returns 0 when zIndex is not specified
  9674. // other browsers return a string
  9675. // we ignore the case of nested elements with an explicit value of 0
  9676. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  9677. value = parseInt( elem.css( "zIndex" ), 10 );
  9678. if ( !isNaN( value ) && value !== 0 ) {
  9679. return value;
  9680. }
  9681. }
  9682. elem = elem.parent();
  9683. }
  9684. }
  9685. return 0;
  9686. }
  9687. });
  9688. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  9689. $.ui.plugin = {
  9690. add: function( module, option, set ) {
  9691. var i,
  9692. proto = $.ui[ module ].prototype;
  9693. for ( i in set ) {
  9694. proto.plugins[ i ] = proto.plugins[ i ] || [];
  9695. proto.plugins[ i ].push( [ option, set[ i ] ] );
  9696. }
  9697. },
  9698. call: function( instance, name, args, allowDisconnected ) {
  9699. var i,
  9700. set = instance.plugins[ name ];
  9701. if ( !set ) {
  9702. return;
  9703. }
  9704. if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
  9705. return;
  9706. }
  9707. for ( i = 0; i < set.length; i++ ) {
  9708. if ( instance.options[ set[ i ][ 0 ] ] ) {
  9709. set[ i ][ 1 ].apply( instance.element, args );
  9710. }
  9711. }
  9712. }
  9713. };
  9714. /*!
  9715. * jQuery UI Widget 1.11.4
  9716. * http://jqueryui.com
  9717. *
  9718. * Copyright jQuery Foundation and other contributors
  9719. * Released under the MIT license.
  9720. * http://jquery.org/license
  9721. *
  9722. * http://api.jqueryui.com/jQuery.widget/
  9723. */
  9724. var widget_uuid = 0,
  9725. widget_slice = Array.prototype.slice;
  9726. $.cleanData = (function( orig ) {
  9727. return function( elems ) {
  9728. var events, elem, i;
  9729. for ( i = 0; (elem = elems[i]) != null; i++ ) {
  9730. try {
  9731. // Only trigger remove when necessary to save time
  9732. events = $._data( elem, "events" );
  9733. if ( events && events.remove ) {
  9734. $( elem ).triggerHandler( "remove" );
  9735. }
  9736. // http://bugs.jquery.com/ticket/8235
  9737. } catch ( e ) {}
  9738. }
  9739. orig( elems );
  9740. };
  9741. })( $.cleanData );
  9742. $.widget = function( name, base, prototype ) {
  9743. var fullName, existingConstructor, constructor, basePrototype,
  9744. // proxiedPrototype allows the provided prototype to remain unmodified
  9745. // so that it can be used as a mixin for multiple widgets (#8876)
  9746. proxiedPrototype = {},
  9747. namespace = name.split( "." )[ 0 ];
  9748. name = name.split( "." )[ 1 ];
  9749. fullName = namespace + "-" + name;
  9750. if ( !prototype ) {
  9751. prototype = base;
  9752. base = $.Widget;
  9753. }
  9754. // create selector for plugin
  9755. $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
  9756. return !!$.data( elem, fullName );
  9757. };
  9758. $[ namespace ] = $[ namespace ] || {};
  9759. existingConstructor = $[ namespace ][ name ];
  9760. constructor = $[ namespace ][ name ] = function( options, element ) {
  9761. // allow instantiation without "new" keyword
  9762. if ( !this._createWidget ) {
  9763. return new constructor( options, element );
  9764. }
  9765. // allow instantiation without initializing for simple inheritance
  9766. // must use "new" keyword (the code above always passes args)
  9767. if ( arguments.length ) {
  9768. this._createWidget( options, element );
  9769. }
  9770. };
  9771. // extend with the existing constructor to carry over any static properties
  9772. $.extend( constructor, existingConstructor, {
  9773. version: prototype.version,
  9774. // copy the object used to create the prototype in case we need to
  9775. // redefine the widget later
  9776. _proto: $.extend( {}, prototype ),
  9777. // track widgets that inherit from this widget in case this widget is
  9778. // redefined after a widget inherits from it
  9779. _childConstructors: []
  9780. });
  9781. basePrototype = new base();
  9782. // we need to make the options hash a property directly on the new instance
  9783. // otherwise we'll modify the options hash on the prototype that we're
  9784. // inheriting from
  9785. basePrototype.options = $.widget.extend( {}, basePrototype.options );
  9786. $.each( prototype, function( prop, value ) {
  9787. if ( !$.isFunction( value ) ) {
  9788. proxiedPrototype[ prop ] = value;
  9789. return;
  9790. }
  9791. proxiedPrototype[ prop ] = (function() {
  9792. var _super = function() {
  9793. return base.prototype[ prop ].apply( this, arguments );
  9794. },
  9795. _superApply = function( args ) {
  9796. return base.prototype[ prop ].apply( this, args );
  9797. };
  9798. return function() {
  9799. var __super = this._super,
  9800. __superApply = this._superApply,
  9801. returnValue;
  9802. this._super = _super;
  9803. this._superApply = _superApply;
  9804. returnValue = value.apply( this, arguments );
  9805. this._super = __super;
  9806. this._superApply = __superApply;
  9807. return returnValue;
  9808. };
  9809. })();
  9810. });
  9811. constructor.prototype = $.widget.extend( basePrototype, {
  9812. // TODO: remove support for widgetEventPrefix
  9813. // always use the name + a colon as the prefix, e.g., draggable:start
  9814. // don't prefix for widgets that aren't DOM-based
  9815. widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
  9816. }, proxiedPrototype, {
  9817. constructor: constructor,
  9818. namespace: namespace,
  9819. widgetName: name,
  9820. widgetFullName: fullName
  9821. });
  9822. // If this widget is being redefined then we need to find all widgets that
  9823. // are inheriting from it and redefine all of them so that they inherit from
  9824. // the new version of this widget. We're essentially trying to replace one
  9825. // level in the prototype chain.
  9826. if ( existingConstructor ) {
  9827. $.each( existingConstructor._childConstructors, function( i, child ) {
  9828. var childPrototype = child.prototype;
  9829. // redefine the child widget using the same prototype that was
  9830. // originally used, but inherit from the new version of the base
  9831. $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
  9832. });
  9833. // remove the list of existing child constructors from the old constructor
  9834. // so the old child constructors can be garbage collected
  9835. delete existingConstructor._childConstructors;
  9836. } else {
  9837. base._childConstructors.push( constructor );
  9838. }
  9839. $.widget.bridge( name, constructor );
  9840. return constructor;
  9841. };
  9842. $.widget.extend = function( target ) {
  9843. var input = widget_slice.call( arguments, 1 ),
  9844. inputIndex = 0,
  9845. inputLength = input.length,
  9846. key,
  9847. value;
  9848. for ( ; inputIndex < inputLength; inputIndex++ ) {
  9849. for ( key in input[ inputIndex ] ) {
  9850. value = input[ inputIndex ][ key ];
  9851. if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
  9852. // Clone objects
  9853. if ( $.isPlainObject( value ) ) {
  9854. target[ key ] = $.isPlainObject( target[ key ] ) ?
  9855. $.widget.extend( {}, target[ key ], value ) :
  9856. // Don't extend strings, arrays, etc. with objects
  9857. $.widget.extend( {}, value );
  9858. // Copy everything else by reference
  9859. } else {
  9860. target[ key ] = value;
  9861. }
  9862. }
  9863. }
  9864. }
  9865. return target;
  9866. };
  9867. $.widget.bridge = function( name, object ) {
  9868. var fullName = object.prototype.widgetFullName || name;
  9869. $.fn[ name ] = function( options ) {
  9870. var isMethodCall = typeof options === "string",
  9871. args = widget_slice.call( arguments, 1 ),
  9872. returnValue = this;
  9873. if ( isMethodCall ) {
  9874. this.each(function() {
  9875. var methodValue,
  9876. instance = $.data( this, fullName );
  9877. if ( options === "instance" ) {
  9878. returnValue = instance;
  9879. return false;
  9880. }
  9881. if ( !instance ) {
  9882. return $.error( "cannot call methods on " + name + " prior to initialization; " +
  9883. "attempted to call method '" + options + "'" );
  9884. }
  9885. if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
  9886. return $.error( "no such method '" + options + "' for " + name + " widget instance" );
  9887. }
  9888. methodValue = instance[ options ].apply( instance, args );
  9889. if ( methodValue !== instance && methodValue !== undefined ) {
  9890. returnValue = methodValue && methodValue.jquery ?
  9891. returnValue.pushStack( methodValue.get() ) :
  9892. methodValue;
  9893. return false;
  9894. }
  9895. });
  9896. } else {
  9897. // Allow multiple hashes to be passed on init
  9898. if ( args.length ) {
  9899. options = $.widget.extend.apply( null, [ options ].concat(args) );
  9900. }
  9901. this.each(function() {
  9902. var instance = $.data( this, fullName );
  9903. if ( instance ) {
  9904. instance.option( options || {} );
  9905. if ( instance._init ) {
  9906. instance._init();
  9907. }
  9908. } else {
  9909. $.data( this, fullName, new object( options, this ) );
  9910. }
  9911. });
  9912. }
  9913. return returnValue;
  9914. };
  9915. };
  9916. $.Widget = function( /* options, element */ ) {};
  9917. $.Widget._childConstructors = [];
  9918. $.Widget.prototype = {
  9919. widgetName: "widget",
  9920. widgetEventPrefix: "",
  9921. defaultElement: "<div>",
  9922. options: {
  9923. disabled: false,
  9924. // callbacks
  9925. create: null
  9926. },
  9927. _createWidget: function( options, element ) {
  9928. element = $( element || this.defaultElement || this )[ 0 ];
  9929. this.element = $( element );
  9930. this.uuid = widget_uuid++;
  9931. this.eventNamespace = "." + this.widgetName + this.uuid;
  9932. this.bindings = $();
  9933. this.hoverable = $();
  9934. this.focusable = $();
  9935. if ( element !== this ) {
  9936. $.data( element, this.widgetFullName, this );
  9937. this._on( true, this.element, {
  9938. remove: function( event ) {
  9939. if ( event.target === element ) {
  9940. this.destroy();
  9941. }
  9942. }
  9943. });
  9944. this.document = $( element.style ?
  9945. // element within the document
  9946. element.ownerDocument :
  9947. // element is window or document
  9948. element.document || element );
  9949. this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
  9950. }
  9951. this.options = $.widget.extend( {},
  9952. this.options,
  9953. this._getCreateOptions(),
  9954. options );
  9955. this._create();
  9956. this._trigger( "create", null, this._getCreateEventData() );
  9957. this._init();
  9958. },
  9959. _getCreateOptions: $.noop,
  9960. _getCreateEventData: $.noop,
  9961. _create: $.noop,
  9962. _init: $.noop,
  9963. destroy: function() {
  9964. this._destroy();
  9965. // we can probably remove the unbind calls in 2.0
  9966. // all event bindings should go through this._on()
  9967. this.element
  9968. .unbind( this.eventNamespace )
  9969. .removeData( this.widgetFullName )
  9970. // support: jquery <1.6.3
  9971. // http://bugs.jquery.com/ticket/9413
  9972. .removeData( $.camelCase( this.widgetFullName ) );
  9973. this.widget()
  9974. .unbind( this.eventNamespace )
  9975. .removeAttr( "aria-disabled" )
  9976. .removeClass(
  9977. this.widgetFullName + "-disabled " +
  9978. "ui-state-disabled" );
  9979. // clean up events and states
  9980. this.bindings.unbind( this.eventNamespace );
  9981. this.hoverable.removeClass( "ui-state-hover" );
  9982. this.focusable.removeClass( "ui-state-focus" );
  9983. },
  9984. _destroy: $.noop,
  9985. widget: function() {
  9986. return this.element;
  9987. },
  9988. option: function( key, value ) {
  9989. var options = key,
  9990. parts,
  9991. curOption,
  9992. i;
  9993. if ( arguments.length === 0 ) {
  9994. // don't return a reference to the internal hash
  9995. return $.widget.extend( {}, this.options );
  9996. }
  9997. if ( typeof key === "string" ) {
  9998. // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  9999. options = {};
  10000. parts = key.split( "." );
  10001. key = parts.shift();
  10002. if ( parts.length ) {
  10003. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  10004. for ( i = 0; i < parts.length - 1; i++ ) {
  10005. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  10006. curOption = curOption[ parts[ i ] ];
  10007. }
  10008. key = parts.pop();
  10009. if ( arguments.length === 1 ) {
  10010. return curOption[ key ] === undefined ? null : curOption[ key ];
  10011. }
  10012. curOption[ key ] = value;
  10013. } else {
  10014. if ( arguments.length === 1 ) {
  10015. return this.options[ key ] === undefined ? null : this.options[ key ];
  10016. }
  10017. options[ key ] = value;
  10018. }
  10019. }
  10020. this._setOptions( options );
  10021. return this;
  10022. },
  10023. _setOptions: function( options ) {
  10024. var key;
  10025. for ( key in options ) {
  10026. this._setOption( key, options[ key ] );
  10027. }
  10028. return this;
  10029. },
  10030. _setOption: function( key, value ) {
  10031. this.options[ key ] = value;
  10032. if ( key === "disabled" ) {
  10033. this.widget()
  10034. .toggleClass( this.widgetFullName + "-disabled", !!value );
  10035. // If the widget is becoming disabled, then nothing is interactive
  10036. if ( value ) {
  10037. this.hoverable.removeClass( "ui-state-hover" );
  10038. this.focusable.removeClass( "ui-state-focus" );
  10039. }
  10040. }
  10041. return this;
  10042. },
  10043. enable: function() {
  10044. return this._setOptions({ disabled: false });
  10045. },
  10046. disable: function() {
  10047. return this._setOptions({ disabled: true });
  10048. },
  10049. _on: function( suppressDisabledCheck, element, handlers ) {
  10050. var delegateElement,
  10051. instance = this;
  10052. // no suppressDisabledCheck flag, shuffle arguments
  10053. if ( typeof suppressDisabledCheck !== "boolean" ) {
  10054. handlers = element;
  10055. element = suppressDisabledCheck;
  10056. suppressDisabledCheck = false;
  10057. }
  10058. // no element argument, shuffle and use this.element
  10059. if ( !handlers ) {
  10060. handlers = element;
  10061. element = this.element;
  10062. delegateElement = this.widget();
  10063. } else {
  10064. element = delegateElement = $( element );
  10065. this.bindings = this.bindings.add( element );
  10066. }
  10067. $.each( handlers, function( event, handler ) {
  10068. function handlerProxy() {
  10069. // allow widgets to customize the disabled handling
  10070. // - disabled as an array instead of boolean
  10071. // - disabled class as method for disabling individual parts
  10072. if ( !suppressDisabledCheck &&
  10073. ( instance.options.disabled === true ||
  10074. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  10075. return;
  10076. }
  10077. return ( typeof handler === "string" ? instance[ handler ] : handler )
  10078. .apply( instance, arguments );
  10079. }
  10080. // copy the guid so direct unbinding works
  10081. if ( typeof handler !== "string" ) {
  10082. handlerProxy.guid = handler.guid =
  10083. handler.guid || handlerProxy.guid || $.guid++;
  10084. }
  10085. var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
  10086. eventName = match[1] + instance.eventNamespace,
  10087. selector = match[2];
  10088. if ( selector ) {
  10089. delegateElement.delegate( selector, eventName, handlerProxy );
  10090. } else {
  10091. element.bind( eventName, handlerProxy );
  10092. }
  10093. });
  10094. },
  10095. _off: function( element, eventName ) {
  10096. eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
  10097. this.eventNamespace;
  10098. element.unbind( eventName ).undelegate( eventName );
  10099. // Clear the stack to avoid memory leaks (#10056)
  10100. this.bindings = $( this.bindings.not( element ).get() );
  10101. this.focusable = $( this.focusable.not( element ).get() );
  10102. this.hoverable = $( this.hoverable.not( element ).get() );
  10103. },
  10104. _delay: function( handler, delay ) {
  10105. function handlerProxy() {
  10106. return ( typeof handler === "string" ? instance[ handler ] : handler )
  10107. .apply( instance, arguments );
  10108. }
  10109. var instance = this;
  10110. return setTimeout( handlerProxy, delay || 0 );
  10111. },
  10112. _hoverable: function( element ) {
  10113. this.hoverable = this.hoverable.add( element );
  10114. this._on( element, {
  10115. mouseenter: function( event ) {
  10116. $( event.currentTarget ).addClass( "ui-state-hover" );
  10117. },
  10118. mouseleave: function( event ) {
  10119. $( event.currentTarget ).removeClass( "ui-state-hover" );
  10120. }
  10121. });
  10122. },
  10123. _focusable: function( element ) {
  10124. this.focusable = this.focusable.add( element );
  10125. this._on( element, {
  10126. focusin: function( event ) {
  10127. $( event.currentTarget ).addClass( "ui-state-focus" );
  10128. },
  10129. focusout: function( event ) {
  10130. $( event.currentTarget ).removeClass( "ui-state-focus" );
  10131. }
  10132. });
  10133. },
  10134. _trigger: function( type, event, data ) {
  10135. var prop, orig,
  10136. callback = this.options[ type ];
  10137. data = data || {};
  10138. event = $.Event( event );
  10139. event.type = ( type === this.widgetEventPrefix ?
  10140. type :
  10141. this.widgetEventPrefix + type ).toLowerCase();
  10142. // the original event may come from any element
  10143. // so we need to reset the target on the new event
  10144. event.target = this.element[ 0 ];
  10145. // copy original event properties over to the new event
  10146. orig = event.originalEvent;
  10147. if ( orig ) {
  10148. for ( prop in orig ) {
  10149. if ( !( prop in event ) ) {
  10150. event[ prop ] = orig[ prop ];
  10151. }
  10152. }
  10153. }
  10154. this.element.trigger( event, data );
  10155. return !( $.isFunction( callback ) &&
  10156. callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
  10157. event.isDefaultPrevented() );
  10158. }
  10159. };
  10160. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  10161. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  10162. if ( typeof options === "string" ) {
  10163. options = { effect: options };
  10164. }
  10165. var hasOptions,
  10166. effectName = !options ?
  10167. method :
  10168. options === true || typeof options === "number" ?
  10169. defaultEffect :
  10170. options.effect || defaultEffect;
  10171. options = options || {};
  10172. if ( typeof options === "number" ) {
  10173. options = { duration: options };
  10174. }
  10175. hasOptions = !$.isEmptyObject( options );
  10176. options.complete = callback;
  10177. if ( options.delay ) {
  10178. element.delay( options.delay );
  10179. }
  10180. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  10181. element[ method ]( options );
  10182. } else if ( effectName !== method && element[ effectName ] ) {
  10183. element[ effectName ]( options.duration, options.easing, callback );
  10184. } else {
  10185. element.queue(function( next ) {
  10186. $( this )[ method ]();
  10187. if ( callback ) {
  10188. callback.call( element[ 0 ] );
  10189. }
  10190. next();
  10191. });
  10192. }
  10193. };
  10194. });
  10195. var widget = $.widget;
  10196. /*!
  10197. * jQuery UI Mouse 1.11.4
  10198. * http://jqueryui.com
  10199. *
  10200. * Copyright jQuery Foundation and other contributors
  10201. * Released under the MIT license.
  10202. * http://jquery.org/license
  10203. *
  10204. * http://api.jqueryui.com/mouse/
  10205. */
  10206. var mouseHandled = false;
  10207. $( document ).mouseup( function() {
  10208. mouseHandled = false;
  10209. });
  10210. var mouse = $.widget("ui.mouse", {
  10211. version: "1.11.4",
  10212. options: {
  10213. cancel: "input,textarea,button,select,option",
  10214. distance: 1,
  10215. delay: 0
  10216. },
  10217. _mouseInit: function() {
  10218. var that = this;
  10219. this.element
  10220. .bind("mousedown." + this.widgetName, function(event) {
  10221. return that._mouseDown(event);
  10222. })
  10223. .bind("click." + this.widgetName, function(event) {
  10224. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  10225. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  10226. event.stopImmediatePropagation();
  10227. return false;
  10228. }
  10229. });
  10230. this.started = false;
  10231. },
  10232. // TODO: make sure destroying one instance of mouse doesn't mess with
  10233. // other instances of mouse
  10234. _mouseDestroy: function() {
  10235. this.element.unbind("." + this.widgetName);
  10236. if ( this._mouseMoveDelegate ) {
  10237. this.document
  10238. .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
  10239. .unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
  10240. }
  10241. },
  10242. _mouseDown: function(event) {
  10243. // don't let more than one widget handle mouseStart
  10244. if ( mouseHandled ) {
  10245. return;
  10246. }
  10247. this._mouseMoved = false;
  10248. // we may have missed mouseup (out of window)
  10249. (this._mouseStarted && this._mouseUp(event));
  10250. this._mouseDownEvent = event;
  10251. var that = this,
  10252. btnIsLeft = (event.which === 1),
  10253. // event.target.nodeName works around a bug in IE 8 with
  10254. // disabled inputs (#7620)
  10255. elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
  10256. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  10257. return true;
  10258. }
  10259. this.mouseDelayMet = !this.options.delay;
  10260. if (!this.mouseDelayMet) {
  10261. this._mouseDelayTimer = setTimeout(function() {
  10262. that.mouseDelayMet = true;
  10263. }, this.options.delay);
  10264. }
  10265. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  10266. this._mouseStarted = (this._mouseStart(event) !== false);
  10267. if (!this._mouseStarted) {
  10268. event.preventDefault();
  10269. return true;
  10270. }
  10271. }
  10272. // Click event may never have fired (Gecko & Opera)
  10273. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  10274. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  10275. }
  10276. // these delegates are required to keep context
  10277. this._mouseMoveDelegate = function(event) {
  10278. return that._mouseMove(event);
  10279. };
  10280. this._mouseUpDelegate = function(event) {
  10281. return that._mouseUp(event);
  10282. };
  10283. this.document
  10284. .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  10285. .bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  10286. event.preventDefault();
  10287. mouseHandled = true;
  10288. return true;
  10289. },
  10290. _mouseMove: function(event) {
  10291. // Only check for mouseups outside the document if you've moved inside the document
  10292. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  10293. // fire a mousemove event if content is placed under the cursor. See #7778
  10294. // Support: IE <9
  10295. if ( this._mouseMoved ) {
  10296. // IE mouseup check - mouseup happened when mouse was out of window
  10297. if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
  10298. return this._mouseUp(event);
  10299. // Iframe mouseup check - mouseup occurred in another document
  10300. } else if ( !event.which ) {
  10301. return this._mouseUp( event );
  10302. }
  10303. }
  10304. if ( event.which || event.button ) {
  10305. this._mouseMoved = true;
  10306. }
  10307. if (this._mouseStarted) {
  10308. this._mouseDrag(event);
  10309. return event.preventDefault();
  10310. }
  10311. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  10312. this._mouseStarted =
  10313. (this._mouseStart(this._mouseDownEvent, event) !== false);
  10314. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  10315. }
  10316. return !this._mouseStarted;
  10317. },
  10318. _mouseUp: function(event) {
  10319. this.document
  10320. .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  10321. .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  10322. if (this._mouseStarted) {
  10323. this._mouseStarted = false;
  10324. if (event.target === this._mouseDownEvent.target) {
  10325. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  10326. }
  10327. this._mouseStop(event);
  10328. }
  10329. mouseHandled = false;
  10330. return false;
  10331. },
  10332. _mouseDistanceMet: function(event) {
  10333. return (Math.max(
  10334. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  10335. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  10336. ) >= this.options.distance
  10337. );
  10338. },
  10339. _mouseDelayMet: function(/* event */) {
  10340. return this.mouseDelayMet;
  10341. },
  10342. // These are placeholder methods, to be overriden by extending plugin
  10343. _mouseStart: function(/* event */) {},
  10344. _mouseDrag: function(/* event */) {},
  10345. _mouseStop: function(/* event */) {},
  10346. _mouseCapture: function(/* event */) { return true; }
  10347. });
  10348. /*!
  10349. * jQuery UI Draggable 1.11.4
  10350. * http://jqueryui.com
  10351. *
  10352. * Copyright jQuery Foundation and other contributors
  10353. * Released under the MIT license.
  10354. * http://jquery.org/license
  10355. *
  10356. * http://api.jqueryui.com/draggable/
  10357. */
  10358. $.widget("ui.draggable", $.ui.mouse, {
  10359. version: "1.11.4",
  10360. widgetEventPrefix: "drag",
  10361. options: {
  10362. addClasses: true,
  10363. appendTo: "parent",
  10364. axis: false,
  10365. connectToSortable: false,
  10366. containment: false,
  10367. cursor: "auto",
  10368. cursorAt: false,
  10369. grid: false,
  10370. handle: false,
  10371. helper: "original",
  10372. iframeFix: false,
  10373. opacity: false,
  10374. refreshPositions: false,
  10375. revert: false,
  10376. revertDuration: 500,
  10377. scope: "default",
  10378. scroll: true,
  10379. scrollSensitivity: 20,
  10380. scrollSpeed: 20,
  10381. snap: false,
  10382. snapMode: "both",
  10383. snapTolerance: 20,
  10384. stack: false,
  10385. zIndex: false,
  10386. // callbacks
  10387. drag: null,
  10388. start: null,
  10389. stop: null
  10390. },
  10391. _create: function() {
  10392. if ( this.options.helper === "original" ) {
  10393. this._setPositionRelative();
  10394. }
  10395. if (this.options.addClasses){
  10396. this.element.addClass("ui-draggable");
  10397. }
  10398. if (this.options.disabled){
  10399. this.element.addClass("ui-draggable-disabled");
  10400. }
  10401. this._setHandleClassName();
  10402. this._mouseInit();
  10403. },
  10404. _setOption: function( key, value ) {
  10405. this._super( key, value );
  10406. if ( key === "handle" ) {
  10407. this._removeHandleClassName();
  10408. this._setHandleClassName();
  10409. }
  10410. },
  10411. _destroy: function() {
  10412. if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
  10413. this.destroyOnClear = true;
  10414. return;
  10415. }
  10416. this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
  10417. this._removeHandleClassName();
  10418. this._mouseDestroy();
  10419. },
  10420. _mouseCapture: function(event) {
  10421. var o = this.options;
  10422. this._blurActiveElement( event );
  10423. // among others, prevent a drag on a resizable-handle
  10424. if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
  10425. return false;
  10426. }
  10427. //Quit if we're not on a valid handle
  10428. this.handle = this._getHandle(event);
  10429. if (!this.handle) {
  10430. return false;
  10431. }
  10432. this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
  10433. return true;
  10434. },
  10435. _blockFrames: function( selector ) {
  10436. this.iframeBlocks = this.document.find( selector ).map(function() {
  10437. var iframe = $( this );
  10438. return $( "<div>" )
  10439. .css( "position", "absolute" )
  10440. .appendTo( iframe.parent() )
  10441. .outerWidth( iframe.outerWidth() )
  10442. .outerHeight( iframe.outerHeight() )
  10443. .offset( iframe.offset() )[ 0 ];
  10444. });
  10445. },
  10446. _unblockFrames: function() {
  10447. if ( this.iframeBlocks ) {
  10448. this.iframeBlocks.remove();
  10449. delete this.iframeBlocks;
  10450. }
  10451. },
  10452. _blurActiveElement: function( event ) {
  10453. var document = this.document[ 0 ];
  10454. // Only need to blur if the event occurred on the draggable itself, see #10527
  10455. if ( !this.handleElement.is( event.target ) ) {
  10456. return;
  10457. }
  10458. // support: IE9
  10459. // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  10460. try {
  10461. // Support: IE9, IE10
  10462. // If the <body> is blurred, IE will switch windows, see #9520
  10463. if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
  10464. // Blur any element that currently has focus, see #4261
  10465. $( document.activeElement ).blur();
  10466. }
  10467. } catch ( error ) {}
  10468. },
  10469. _mouseStart: function(event) {
  10470. var o = this.options;
  10471. //Create and append the visible helper
  10472. this.helper = this._createHelper(event);
  10473. this.helper.addClass("ui-draggable-dragging");
  10474. //Cache the helper size
  10475. this._cacheHelperProportions();
  10476. //If ddmanager is used for droppables, set the global draggable
  10477. if ($.ui.ddmanager) {
  10478. $.ui.ddmanager.current = this;
  10479. }
  10480. /*
  10481. * - Position generation -
  10482. * This block generates everything position related - it's the core of draggables.
  10483. */
  10484. //Cache the margins of the original element
  10485. this._cacheMargins();
  10486. //Store the helper's css position
  10487. this.cssPosition = this.helper.css( "position" );
  10488. this.scrollParent = this.helper.scrollParent( true );
  10489. this.offsetParent = this.helper.offsetParent();
  10490. this.hasFixedAncestor = this.helper.parents().filter(function() {
  10491. return $( this ).css( "position" ) === "fixed";
  10492. }).length > 0;
  10493. //The element's absolute position on the page minus margins
  10494. this.positionAbs = this.element.offset();
  10495. this._refreshOffsets( event );
  10496. //Generate the original position
  10497. this.originalPosition = this.position = this._generatePosition( event, false );
  10498. this.originalPageX = event.pageX;
  10499. this.originalPageY = event.pageY;
  10500. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  10501. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  10502. //Set a containment if given in the options
  10503. this._setContainment();
  10504. //Trigger event + callbacks
  10505. if (this._trigger("start", event) === false) {
  10506. this._clear();
  10507. return false;
  10508. }
  10509. //Recache the helper size
  10510. this._cacheHelperProportions();
  10511. //Prepare the droppable offsets
  10512. if ($.ui.ddmanager && !o.dropBehaviour) {
  10513. $.ui.ddmanager.prepareOffsets(this, event);
  10514. }
  10515. // Reset helper's right/bottom css if they're set and set explicit width/height instead
  10516. // as this prevents resizing of elements with right/bottom set (see #7772)
  10517. this._normalizeRightBottom();
  10518. this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  10519. //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
  10520. if ( $.ui.ddmanager ) {
  10521. $.ui.ddmanager.dragStart(this, event);
  10522. }
  10523. return true;
  10524. },
  10525. _refreshOffsets: function( event ) {
  10526. this.offset = {
  10527. top: this.positionAbs.top - this.margins.top,
  10528. left: this.positionAbs.left - this.margins.left,
  10529. scroll: false,
  10530. parent: this._getParentOffset(),
  10531. relative: this._getRelativeOffset()
  10532. };
  10533. this.offset.click = {
  10534. left: event.pageX - this.offset.left,
  10535. top: event.pageY - this.offset.top
  10536. };
  10537. },
  10538. _mouseDrag: function(event, noPropagation) {
  10539. // reset any necessary cached properties (see #5009)
  10540. if ( this.hasFixedAncestor ) {
  10541. this.offset.parent = this._getParentOffset();
  10542. }
  10543. //Compute the helpers position
  10544. this.position = this._generatePosition( event, true );
  10545. this.positionAbs = this._convertPositionTo("absolute");
  10546. //Call plugins and callbacks and use the resulting position if something is returned
  10547. if (!noPropagation) {
  10548. var ui = this._uiHash();
  10549. if (this._trigger("drag", event, ui) === false) {
  10550. this._mouseUp({});
  10551. return false;
  10552. }
  10553. this.position = ui.position;
  10554. }
  10555. this.helper[ 0 ].style.left = this.position.left + "px";
  10556. this.helper[ 0 ].style.top = this.position.top + "px";
  10557. if ($.ui.ddmanager) {
  10558. $.ui.ddmanager.drag(this, event);
  10559. }
  10560. return false;
  10561. },
  10562. _mouseStop: function(event) {
  10563. //If we are using droppables, inform the manager about the drop
  10564. var that = this,
  10565. dropped = false;
  10566. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  10567. dropped = $.ui.ddmanager.drop(this, event);
  10568. }
  10569. //if a drop comes from outside (a sortable)
  10570. if (this.dropped) {
  10571. dropped = this.dropped;
  10572. this.dropped = false;
  10573. }
  10574. if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
  10575. $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  10576. if (that._trigger("stop", event) !== false) {
  10577. that._clear();
  10578. }
  10579. });
  10580. } else {
  10581. if (this._trigger("stop", event) !== false) {
  10582. this._clear();
  10583. }
  10584. }
  10585. return false;
  10586. },
  10587. _mouseUp: function( event ) {
  10588. this._unblockFrames();
  10589. //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
  10590. if ( $.ui.ddmanager ) {
  10591. $.ui.ddmanager.dragStop(this, event);
  10592. }
  10593. // Only need to focus if the event occurred on the draggable itself, see #10527
  10594. if ( this.handleElement.is( event.target ) ) {
  10595. // The interaction is over; whether or not the click resulted in a drag, focus the element
  10596. this.element.focus();
  10597. }
  10598. return $.ui.mouse.prototype._mouseUp.call(this, event);
  10599. },
  10600. cancel: function() {
  10601. if (this.helper.is(".ui-draggable-dragging")) {
  10602. this._mouseUp({});
  10603. } else {
  10604. this._clear();
  10605. }
  10606. return this;
  10607. },
  10608. _getHandle: function(event) {
  10609. return this.options.handle ?
  10610. !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
  10611. true;
  10612. },
  10613. _setHandleClassName: function() {
  10614. this.handleElement = this.options.handle ?
  10615. this.element.find( this.options.handle ) : this.element;
  10616. this.handleElement.addClass( "ui-draggable-handle" );
  10617. },
  10618. _removeHandleClassName: function() {
  10619. this.handleElement.removeClass( "ui-draggable-handle" );
  10620. },
  10621. _createHelper: function(event) {
  10622. var o = this.options,
  10623. helperIsFunction = $.isFunction( o.helper ),
  10624. helper = helperIsFunction ?
  10625. $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
  10626. ( o.helper === "clone" ?
  10627. this.element.clone().removeAttr( "id" ) :
  10628. this.element );
  10629. if (!helper.parents("body").length) {
  10630. helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
  10631. }
  10632. // http://bugs.jqueryui.com/ticket/9446
  10633. // a helper function can return the original element
  10634. // which wouldn't have been set to relative in _create
  10635. if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
  10636. this._setPositionRelative();
  10637. }
  10638. if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
  10639. helper.css("position", "absolute");
  10640. }
  10641. return helper;
  10642. },
  10643. _setPositionRelative: function() {
  10644. if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
  10645. this.element[ 0 ].style.position = "relative";
  10646. }
  10647. },
  10648. _adjustOffsetFromHelper: function(obj) {
  10649. if (typeof obj === "string") {
  10650. obj = obj.split(" ");
  10651. }
  10652. if ($.isArray(obj)) {
  10653. obj = { left: +obj[0], top: +obj[1] || 0 };
  10654. }
  10655. if ("left" in obj) {
  10656. this.offset.click.left = obj.left + this.margins.left;
  10657. }
  10658. if ("right" in obj) {
  10659. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  10660. }
  10661. if ("top" in obj) {
  10662. this.offset.click.top = obj.top + this.margins.top;
  10663. }
  10664. if ("bottom" in obj) {
  10665. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  10666. }
  10667. },
  10668. _isRootNode: function( element ) {
  10669. return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
  10670. },
  10671. _getParentOffset: function() {
  10672. //Get the offsetParent and cache its position
  10673. var po = this.offsetParent.offset(),
  10674. document = this.document[ 0 ];
  10675. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  10676. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  10677. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  10678. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  10679. if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  10680. po.left += this.scrollParent.scrollLeft();
  10681. po.top += this.scrollParent.scrollTop();
  10682. }
  10683. if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
  10684. po = { top: 0, left: 0 };
  10685. }
  10686. return {
  10687. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
  10688. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
  10689. };
  10690. },
  10691. _getRelativeOffset: function() {
  10692. if ( this.cssPosition !== "relative" ) {
  10693. return { top: 0, left: 0 };
  10694. }
  10695. var p = this.element.position(),
  10696. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  10697. return {
  10698. top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
  10699. left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
  10700. };
  10701. },
  10702. _cacheMargins: function() {
  10703. this.margins = {
  10704. left: (parseInt(this.element.css("marginLeft"), 10) || 0),
  10705. top: (parseInt(this.element.css("marginTop"), 10) || 0),
  10706. right: (parseInt(this.element.css("marginRight"), 10) || 0),
  10707. bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
  10708. };
  10709. },
  10710. _cacheHelperProportions: function() {
  10711. this.helperProportions = {
  10712. width: this.helper.outerWidth(),
  10713. height: this.helper.outerHeight()
  10714. };
  10715. },
  10716. _setContainment: function() {
  10717. var isUserScrollable, c, ce,
  10718. o = this.options,
  10719. document = this.document[ 0 ];
  10720. this.relativeContainer = null;
  10721. if ( !o.containment ) {
  10722. this.containment = null;
  10723. return;
  10724. }
  10725. if ( o.containment === "window" ) {
  10726. this.containment = [
  10727. $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
  10728. $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
  10729. $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
  10730. $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
  10731. ];
  10732. return;
  10733. }
  10734. if ( o.containment === "document") {
  10735. this.containment = [
  10736. 0,
  10737. 0,
  10738. $( document ).width() - this.helperProportions.width - this.margins.left,
  10739. ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
  10740. ];
  10741. return;
  10742. }
  10743. if ( o.containment.constructor === Array ) {
  10744. this.containment = o.containment;
  10745. return;
  10746. }
  10747. if ( o.containment === "parent" ) {
  10748. o.containment = this.helper[ 0 ].parentNode;
  10749. }
  10750. c = $( o.containment );
  10751. ce = c[ 0 ];
  10752. if ( !ce ) {
  10753. return;
  10754. }
  10755. isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
  10756. this.containment = [
  10757. ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
  10758. ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
  10759. ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  10760. ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
  10761. ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
  10762. this.helperProportions.width -
  10763. this.margins.left -
  10764. this.margins.right,
  10765. ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  10766. ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
  10767. ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
  10768. this.helperProportions.height -
  10769. this.margins.top -
  10770. this.margins.bottom
  10771. ];
  10772. this.relativeContainer = c;
  10773. },
  10774. _convertPositionTo: function(d, pos) {
  10775. if (!pos) {
  10776. pos = this.position;
  10777. }
  10778. var mod = d === "absolute" ? 1 : -1,
  10779. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  10780. return {
  10781. top: (
  10782. pos.top + // The absolute mouse position
  10783. this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  10784. this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
  10785. ( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
  10786. ),
  10787. left: (
  10788. pos.left + // The absolute mouse position
  10789. this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  10790. this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
  10791. ( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
  10792. )
  10793. };
  10794. },
  10795. _generatePosition: function( event, constrainPosition ) {
  10796. var containment, co, top, left,
  10797. o = this.options,
  10798. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
  10799. pageX = event.pageX,
  10800. pageY = event.pageY;
  10801. // Cache the scroll
  10802. if ( !scrollIsRootNode || !this.offset.scroll ) {
  10803. this.offset.scroll = {
  10804. top: this.scrollParent.scrollTop(),
  10805. left: this.scrollParent.scrollLeft()
  10806. };
  10807. }
  10808. /*
  10809. * - Position constraining -
  10810. * Constrain the position to a mix of grid, containment.
  10811. */
  10812. // If we are not dragging yet, we won't check for options
  10813. if ( constrainPosition ) {
  10814. if ( this.containment ) {
  10815. if ( this.relativeContainer ){
  10816. co = this.relativeContainer.offset();
  10817. containment = [
  10818. this.containment[ 0 ] + co.left,
  10819. this.containment[ 1 ] + co.top,
  10820. this.containment[ 2 ] + co.left,
  10821. this.containment[ 3 ] + co.top
  10822. ];
  10823. } else {
  10824. containment = this.containment;
  10825. }
  10826. if (event.pageX - this.offset.click.left < containment[0]) {
  10827. pageX = containment[0] + this.offset.click.left;
  10828. }
  10829. if (event.pageY - this.offset.click.top < containment[1]) {
  10830. pageY = containment[1] + this.offset.click.top;
  10831. }
  10832. if (event.pageX - this.offset.click.left > containment[2]) {
  10833. pageX = containment[2] + this.offset.click.left;
  10834. }
  10835. if (event.pageY - this.offset.click.top > containment[3]) {
  10836. pageY = containment[3] + this.offset.click.top;
  10837. }
  10838. }
  10839. if (o.grid) {
  10840. //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
  10841. top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
  10842. pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  10843. left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
  10844. pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  10845. }
  10846. if ( o.axis === "y" ) {
  10847. pageX = this.originalPageX;
  10848. }
  10849. if ( o.axis === "x" ) {
  10850. pageY = this.originalPageY;
  10851. }
  10852. }
  10853. return {
  10854. top: (
  10855. pageY - // The absolute mouse position
  10856. this.offset.click.top - // Click offset (relative to the element)
  10857. this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
  10858. this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
  10859. ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
  10860. ),
  10861. left: (
  10862. pageX - // The absolute mouse position
  10863. this.offset.click.left - // Click offset (relative to the element)
  10864. this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
  10865. this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
  10866. ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
  10867. )
  10868. };
  10869. },
  10870. _clear: function() {
  10871. this.helper.removeClass("ui-draggable-dragging");
  10872. if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
  10873. this.helper.remove();
  10874. }
  10875. this.helper = null;
  10876. this.cancelHelperRemoval = false;
  10877. if ( this.destroyOnClear ) {
  10878. this.destroy();
  10879. }
  10880. },
  10881. _normalizeRightBottom: function() {
  10882. if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
  10883. this.helper.width( this.helper.width() );
  10884. this.helper.css( "right", "auto" );
  10885. }
  10886. if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
  10887. this.helper.height( this.helper.height() );
  10888. this.helper.css( "bottom", "auto" );
  10889. }
  10890. },
  10891. // From now on bulk stuff - mainly helpers
  10892. _trigger: function( type, event, ui ) {
  10893. ui = ui || this._uiHash();
  10894. $.ui.plugin.call( this, type, [ event, ui, this ], true );
  10895. // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  10896. if ( /^(drag|start|stop)/.test( type ) ) {
  10897. this.positionAbs = this._convertPositionTo( "absolute" );
  10898. ui.offset = this.positionAbs;
  10899. }
  10900. return $.Widget.prototype._trigger.call( this, type, event, ui );
  10901. },
  10902. plugins: {},
  10903. _uiHash: function() {
  10904. return {
  10905. helper: this.helper,
  10906. position: this.position,
  10907. originalPosition: this.originalPosition,
  10908. offset: this.positionAbs
  10909. };
  10910. }
  10911. });
  10912. $.ui.plugin.add( "draggable", "connectToSortable", {
  10913. start: function( event, ui, draggable ) {
  10914. var uiSortable = $.extend( {}, ui, {
  10915. item: draggable.element
  10916. });
  10917. draggable.sortables = [];
  10918. $( draggable.options.connectToSortable ).each(function() {
  10919. var sortable = $( this ).sortable( "instance" );
  10920. if ( sortable && !sortable.options.disabled ) {
  10921. draggable.sortables.push( sortable );
  10922. // refreshPositions is called at drag start to refresh the containerCache
  10923. // which is used in drag. This ensures it's initialized and synchronized
  10924. // with any changes that might have happened on the page since initialization.
  10925. sortable.refreshPositions();
  10926. sortable._trigger("activate", event, uiSortable);
  10927. }
  10928. });
  10929. },
  10930. stop: function( event, ui, draggable ) {
  10931. var uiSortable = $.extend( {}, ui, {
  10932. item: draggable.element
  10933. });
  10934. draggable.cancelHelperRemoval = false;
  10935. $.each( draggable.sortables, function() {
  10936. var sortable = this;
  10937. if ( sortable.isOver ) {
  10938. sortable.isOver = 0;
  10939. // Allow this sortable to handle removing the helper
  10940. draggable.cancelHelperRemoval = true;
  10941. sortable.cancelHelperRemoval = false;
  10942. // Use _storedCSS To restore properties in the sortable,
  10943. // as this also handles revert (#9675) since the draggable
  10944. // may have modified them in unexpected ways (#8809)
  10945. sortable._storedCSS = {
  10946. position: sortable.placeholder.css( "position" ),
  10947. top: sortable.placeholder.css( "top" ),
  10948. left: sortable.placeholder.css( "left" )
  10949. };
  10950. sortable._mouseStop(event);
  10951. // Once drag has ended, the sortable should return to using
  10952. // its original helper, not the shared helper from draggable
  10953. sortable.options.helper = sortable.options._helper;
  10954. } else {
  10955. // Prevent this Sortable from removing the helper.
  10956. // However, don't set the draggable to remove the helper
  10957. // either as another connected Sortable may yet handle the removal.
  10958. sortable.cancelHelperRemoval = true;
  10959. sortable._trigger( "deactivate", event, uiSortable );
  10960. }
  10961. });
  10962. },
  10963. drag: function( event, ui, draggable ) {
  10964. $.each( draggable.sortables, function() {
  10965. var innermostIntersecting = false,
  10966. sortable = this;
  10967. // Copy over variables that sortable's _intersectsWith uses
  10968. sortable.positionAbs = draggable.positionAbs;
  10969. sortable.helperProportions = draggable.helperProportions;
  10970. sortable.offset.click = draggable.offset.click;
  10971. if ( sortable._intersectsWith( sortable.containerCache ) ) {
  10972. innermostIntersecting = true;
  10973. $.each( draggable.sortables, function() {
  10974. // Copy over variables that sortable's _intersectsWith uses
  10975. this.positionAbs = draggable.positionAbs;
  10976. this.helperProportions = draggable.helperProportions;
  10977. this.offset.click = draggable.offset.click;
  10978. if ( this !== sortable &&
  10979. this._intersectsWith( this.containerCache ) &&
  10980. $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
  10981. innermostIntersecting = false;
  10982. }
  10983. return innermostIntersecting;
  10984. });
  10985. }
  10986. if ( innermostIntersecting ) {
  10987. // If it intersects, we use a little isOver variable and set it once,
  10988. // so that the move-in stuff gets fired only once.
  10989. if ( !sortable.isOver ) {
  10990. sortable.isOver = 1;
  10991. // Store draggable's parent in case we need to reappend to it later.
  10992. draggable._parent = ui.helper.parent();
  10993. sortable.currentItem = ui.helper
  10994. .appendTo( sortable.element )
  10995. .data( "ui-sortable-item", true );
  10996. // Store helper option to later restore it
  10997. sortable.options._helper = sortable.options.helper;
  10998. sortable.options.helper = function() {
  10999. return ui.helper[ 0 ];
  11000. };
  11001. // Fire the start events of the sortable with our passed browser event,
  11002. // and our own helper (so it doesn't create a new one)
  11003. event.target = sortable.currentItem[ 0 ];
  11004. sortable._mouseCapture( event, true );
  11005. sortable._mouseStart( event, true, true );
  11006. // Because the browser event is way off the new appended portlet,
  11007. // modify necessary variables to reflect the changes
  11008. sortable.offset.click.top = draggable.offset.click.top;
  11009. sortable.offset.click.left = draggable.offset.click.left;
  11010. sortable.offset.parent.left -= draggable.offset.parent.left -
  11011. sortable.offset.parent.left;
  11012. sortable.offset.parent.top -= draggable.offset.parent.top -
  11013. sortable.offset.parent.top;
  11014. draggable._trigger( "toSortable", event );
  11015. // Inform draggable that the helper is in a valid drop zone,
  11016. // used solely in the revert option to handle "valid/invalid".
  11017. draggable.dropped = sortable.element;
  11018. // Need to refreshPositions of all sortables in the case that
  11019. // adding to one sortable changes the location of the other sortables (#9675)
  11020. $.each( draggable.sortables, function() {
  11021. this.refreshPositions();
  11022. });
  11023. // hack so receive/update callbacks work (mostly)
  11024. draggable.currentItem = draggable.element;
  11025. sortable.fromOutside = draggable;
  11026. }
  11027. if ( sortable.currentItem ) {
  11028. sortable._mouseDrag( event );
  11029. // Copy the sortable's position because the draggable's can potentially reflect
  11030. // a relative position, while sortable is always absolute, which the dragged
  11031. // element has now become. (#8809)
  11032. ui.position = sortable.position;
  11033. }
  11034. } else {
  11035. // If it doesn't intersect with the sortable, and it intersected before,
  11036. // we fake the drag stop of the sortable, but make sure it doesn't remove
  11037. // the helper by using cancelHelperRemoval.
  11038. if ( sortable.isOver ) {
  11039. sortable.isOver = 0;
  11040. sortable.cancelHelperRemoval = true;
  11041. // Calling sortable's mouseStop would trigger a revert,
  11042. // so revert must be temporarily false until after mouseStop is called.
  11043. sortable.options._revert = sortable.options.revert;
  11044. sortable.options.revert = false;
  11045. sortable._trigger( "out", event, sortable._uiHash( sortable ) );
  11046. sortable._mouseStop( event, true );
  11047. // restore sortable behaviors that were modfied
  11048. // when the draggable entered the sortable area (#9481)
  11049. sortable.options.revert = sortable.options._revert;
  11050. sortable.options.helper = sortable.options._helper;
  11051. if ( sortable.placeholder ) {
  11052. sortable.placeholder.remove();
  11053. }
  11054. // Restore and recalculate the draggable's offset considering the sortable
  11055. // may have modified them in unexpected ways. (#8809, #10669)
  11056. ui.helper.appendTo( draggable._parent );
  11057. draggable._refreshOffsets( event );
  11058. ui.position = draggable._generatePosition( event, true );
  11059. draggable._trigger( "fromSortable", event );
  11060. // Inform draggable that the helper is no longer in a valid drop zone
  11061. draggable.dropped = false;
  11062. // Need to refreshPositions of all sortables just in case removing
  11063. // from one sortable changes the location of other sortables (#9675)
  11064. $.each( draggable.sortables, function() {
  11065. this.refreshPositions();
  11066. });
  11067. }
  11068. }
  11069. });
  11070. }
  11071. });
  11072. $.ui.plugin.add("draggable", "cursor", {
  11073. start: function( event, ui, instance ) {
  11074. var t = $( "body" ),
  11075. o = instance.options;
  11076. if (t.css("cursor")) {
  11077. o._cursor = t.css("cursor");
  11078. }
  11079. t.css("cursor", o.cursor);
  11080. },
  11081. stop: function( event, ui, instance ) {
  11082. var o = instance.options;
  11083. if (o._cursor) {
  11084. $("body").css("cursor", o._cursor);
  11085. }
  11086. }
  11087. });
  11088. $.ui.plugin.add("draggable", "opacity", {
  11089. start: function( event, ui, instance ) {
  11090. var t = $( ui.helper ),
  11091. o = instance.options;
  11092. if (t.css("opacity")) {
  11093. o._opacity = t.css("opacity");
  11094. }
  11095. t.css("opacity", o.opacity);
  11096. },
  11097. stop: function( event, ui, instance ) {
  11098. var o = instance.options;
  11099. if (o._opacity) {
  11100. $(ui.helper).css("opacity", o._opacity);
  11101. }
  11102. }
  11103. });
  11104. $.ui.plugin.add("draggable", "scroll", {
  11105. start: function( event, ui, i ) {
  11106. if ( !i.scrollParentNotHidden ) {
  11107. i.scrollParentNotHidden = i.helper.scrollParent( false );
  11108. }
  11109. if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
  11110. i.overflowOffset = i.scrollParentNotHidden.offset();
  11111. }
  11112. },
  11113. drag: function( event, ui, i ) {
  11114. var o = i.options,
  11115. scrolled = false,
  11116. scrollParent = i.scrollParentNotHidden[ 0 ],
  11117. document = i.document[ 0 ];
  11118. if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
  11119. if ( !o.axis || o.axis !== "x" ) {
  11120. if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
  11121. scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  11122. } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
  11123. scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  11124. }
  11125. }
  11126. if ( !o.axis || o.axis !== "y" ) {
  11127. if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
  11128. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  11129. } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
  11130. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  11131. }
  11132. }
  11133. } else {
  11134. if (!o.axis || o.axis !== "x") {
  11135. if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
  11136. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  11137. } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
  11138. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  11139. }
  11140. }
  11141. if (!o.axis || o.axis !== "y") {
  11142. if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
  11143. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  11144. } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
  11145. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  11146. }
  11147. }
  11148. }
  11149. if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  11150. $.ui.ddmanager.prepareOffsets(i, event);
  11151. }
  11152. }
  11153. });
  11154. $.ui.plugin.add("draggable", "snap", {
  11155. start: function( event, ui, i ) {
  11156. var o = i.options;
  11157. i.snapElements = [];
  11158. $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
  11159. var $t = $(this),
  11160. $o = $t.offset();
  11161. if (this !== i.element[0]) {
  11162. i.snapElements.push({
  11163. item: this,
  11164. width: $t.outerWidth(), height: $t.outerHeight(),
  11165. top: $o.top, left: $o.left
  11166. });
  11167. }
  11168. });
  11169. },
  11170. drag: function( event, ui, inst ) {
  11171. var ts, bs, ls, rs, l, r, t, b, i, first,
  11172. o = inst.options,
  11173. d = o.snapTolerance,
  11174. x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  11175. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  11176. for (i = inst.snapElements.length - 1; i >= 0; i--){
  11177. l = inst.snapElements[i].left - inst.margins.left;
  11178. r = l + inst.snapElements[i].width;
  11179. t = inst.snapElements[i].top - inst.margins.top;
  11180. b = t + inst.snapElements[i].height;
  11181. if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
  11182. if (inst.snapElements[i].snapping) {
  11183. (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  11184. }
  11185. inst.snapElements[i].snapping = false;
  11186. continue;
  11187. }
  11188. if (o.snapMode !== "inner") {
  11189. ts = Math.abs(t - y2) <= d;
  11190. bs = Math.abs(b - y1) <= d;
  11191. ls = Math.abs(l - x2) <= d;
  11192. rs = Math.abs(r - x1) <= d;
  11193. if (ts) {
  11194. ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
  11195. }
  11196. if (bs) {
  11197. ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
  11198. }
  11199. if (ls) {
  11200. ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
  11201. }
  11202. if (rs) {
  11203. ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
  11204. }
  11205. }
  11206. first = (ts || bs || ls || rs);
  11207. if (o.snapMode !== "outer") {
  11208. ts = Math.abs(t - y1) <= d;
  11209. bs = Math.abs(b - y2) <= d;
  11210. ls = Math.abs(l - x1) <= d;
  11211. rs = Math.abs(r - x2) <= d;
  11212. if (ts) {
  11213. ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
  11214. }
  11215. if (bs) {
  11216. ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
  11217. }
  11218. if (ls) {
  11219. ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
  11220. }
  11221. if (rs) {
  11222. ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
  11223. }
  11224. }
  11225. if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
  11226. (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  11227. }
  11228. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  11229. }
  11230. }
  11231. });
  11232. $.ui.plugin.add("draggable", "stack", {
  11233. start: function( event, ui, instance ) {
  11234. var min,
  11235. o = instance.options,
  11236. group = $.makeArray($(o.stack)).sort(function(a, b) {
  11237. return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
  11238. });
  11239. if (!group.length) { return; }
  11240. min = parseInt($(group[0]).css("zIndex"), 10) || 0;
  11241. $(group).each(function(i) {
  11242. $(this).css("zIndex", min + i);
  11243. });
  11244. this.css("zIndex", (min + group.length));
  11245. }
  11246. });
  11247. $.ui.plugin.add("draggable", "zIndex", {
  11248. start: function( event, ui, instance ) {
  11249. var t = $( ui.helper ),
  11250. o = instance.options;
  11251. if (t.css("zIndex")) {
  11252. o._zIndex = t.css("zIndex");
  11253. }
  11254. t.css("zIndex", o.zIndex);
  11255. },
  11256. stop: function( event, ui, instance ) {
  11257. var o = instance.options;
  11258. if (o._zIndex) {
  11259. $(ui.helper).css("zIndex", o._zIndex);
  11260. }
  11261. }
  11262. });
  11263. var draggable = $.ui.draggable;
  11264. /*!
  11265. * jQuery UI Droppable 1.11.4
  11266. * http://jqueryui.com
  11267. *
  11268. * Copyright jQuery Foundation and other contributors
  11269. * Released under the MIT license.
  11270. * http://jquery.org/license
  11271. *
  11272. * http://api.jqueryui.com/droppable/
  11273. */
  11274. $.widget( "ui.droppable", {
  11275. version: "1.11.4",
  11276. widgetEventPrefix: "drop",
  11277. options: {
  11278. accept: "*",
  11279. activeClass: false,
  11280. addClasses: true,
  11281. greedy: false,
  11282. hoverClass: false,
  11283. scope: "default",
  11284. tolerance: "intersect",
  11285. // callbacks
  11286. activate: null,
  11287. deactivate: null,
  11288. drop: null,
  11289. out: null,
  11290. over: null
  11291. },
  11292. _create: function() {
  11293. var proportions,
  11294. o = this.options,
  11295. accept = o.accept;
  11296. this.isover = false;
  11297. this.isout = true;
  11298. this.accept = $.isFunction( accept ) ? accept : function( d ) {
  11299. return d.is( accept );
  11300. };
  11301. this.proportions = function( /* valueToWrite */ ) {
  11302. if ( arguments.length ) {
  11303. // Store the droppable's proportions
  11304. proportions = arguments[ 0 ];
  11305. } else {
  11306. // Retrieve or derive the droppable's proportions
  11307. return proportions ?
  11308. proportions :
  11309. proportions = {
  11310. width: this.element[ 0 ].offsetWidth,
  11311. height: this.element[ 0 ].offsetHeight
  11312. };
  11313. }
  11314. };
  11315. this._addToManager( o.scope );
  11316. o.addClasses && this.element.addClass( "ui-droppable" );
  11317. },
  11318. _addToManager: function( scope ) {
  11319. // Add the reference and positions to the manager
  11320. $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
  11321. $.ui.ddmanager.droppables[ scope ].push( this );
  11322. },
  11323. _splice: function( drop ) {
  11324. var i = 0;
  11325. for ( ; i < drop.length; i++ ) {
  11326. if ( drop[ i ] === this ) {
  11327. drop.splice( i, 1 );
  11328. }
  11329. }
  11330. },
  11331. _destroy: function() {
  11332. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  11333. this._splice( drop );
  11334. this.element.removeClass( "ui-droppable ui-droppable-disabled" );
  11335. },
  11336. _setOption: function( key, value ) {
  11337. if ( key === "accept" ) {
  11338. this.accept = $.isFunction( value ) ? value : function( d ) {
  11339. return d.is( value );
  11340. };
  11341. } else if ( key === "scope" ) {
  11342. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  11343. this._splice( drop );
  11344. this._addToManager( value );
  11345. }
  11346. this._super( key, value );
  11347. },
  11348. _activate: function( event ) {
  11349. var draggable = $.ui.ddmanager.current;
  11350. if ( this.options.activeClass ) {
  11351. this.element.addClass( this.options.activeClass );
  11352. }
  11353. if ( draggable ){
  11354. this._trigger( "activate", event, this.ui( draggable ) );
  11355. }
  11356. },
  11357. _deactivate: function( event ) {
  11358. var draggable = $.ui.ddmanager.current;
  11359. if ( this.options.activeClass ) {
  11360. this.element.removeClass( this.options.activeClass );
  11361. }
  11362. if ( draggable ){
  11363. this._trigger( "deactivate", event, this.ui( draggable ) );
  11364. }
  11365. },
  11366. _over: function( event ) {
  11367. var draggable = $.ui.ddmanager.current;
  11368. // Bail if draggable and droppable are same element
  11369. if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  11370. return;
  11371. }
  11372. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  11373. if ( this.options.hoverClass ) {
  11374. this.element.addClass( this.options.hoverClass );
  11375. }
  11376. this._trigger( "over", event, this.ui( draggable ) );
  11377. }
  11378. },
  11379. _out: function( event ) {
  11380. var draggable = $.ui.ddmanager.current;
  11381. // Bail if draggable and droppable are same element
  11382. if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  11383. return;
  11384. }
  11385. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  11386. if ( this.options.hoverClass ) {
  11387. this.element.removeClass( this.options.hoverClass );
  11388. }
  11389. this._trigger( "out", event, this.ui( draggable ) );
  11390. }
  11391. },
  11392. _drop: function( event, custom ) {
  11393. var draggable = custom || $.ui.ddmanager.current,
  11394. childrenIntersection = false;
  11395. // Bail if draggable and droppable are same element
  11396. if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  11397. return false;
  11398. }
  11399. this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
  11400. var inst = $( this ).droppable( "instance" );
  11401. if (
  11402. inst.options.greedy &&
  11403. !inst.options.disabled &&
  11404. inst.options.scope === draggable.options.scope &&
  11405. inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
  11406. $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
  11407. ) { childrenIntersection = true; return false; }
  11408. });
  11409. if ( childrenIntersection ) {
  11410. return false;
  11411. }
  11412. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  11413. if ( this.options.activeClass ) {
  11414. this.element.removeClass( this.options.activeClass );
  11415. }
  11416. if ( this.options.hoverClass ) {
  11417. this.element.removeClass( this.options.hoverClass );
  11418. }
  11419. this._trigger( "drop", event, this.ui( draggable ) );
  11420. return this.element;
  11421. }
  11422. return false;
  11423. },
  11424. ui: function( c ) {
  11425. return {
  11426. draggable: ( c.currentItem || c.element ),
  11427. helper: c.helper,
  11428. position: c.position,
  11429. offset: c.positionAbs
  11430. };
  11431. }
  11432. });
  11433. $.ui.intersect = (function() {
  11434. function isOverAxis( x, reference, size ) {
  11435. return ( x >= reference ) && ( x < ( reference + size ) );
  11436. }
  11437. return function( draggable, droppable, toleranceMode, event ) {
  11438. if ( !droppable.offset ) {
  11439. return false;
  11440. }
  11441. var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
  11442. y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
  11443. x2 = x1 + draggable.helperProportions.width,
  11444. y2 = y1 + draggable.helperProportions.height,
  11445. l = droppable.offset.left,
  11446. t = droppable.offset.top,
  11447. r = l + droppable.proportions().width,
  11448. b = t + droppable.proportions().height;
  11449. switch ( toleranceMode ) {
  11450. case "fit":
  11451. return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
  11452. case "intersect":
  11453. return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
  11454. x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
  11455. t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
  11456. y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
  11457. case "pointer":
  11458. return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
  11459. case "touch":
  11460. return (
  11461. ( y1 >= t && y1 <= b ) || // Top edge touching
  11462. ( y2 >= t && y2 <= b ) || // Bottom edge touching
  11463. ( y1 < t && y2 > b ) // Surrounded vertically
  11464. ) && (
  11465. ( x1 >= l && x1 <= r ) || // Left edge touching
  11466. ( x2 >= l && x2 <= r ) || // Right edge touching
  11467. ( x1 < l && x2 > r ) // Surrounded horizontally
  11468. );
  11469. default:
  11470. return false;
  11471. }
  11472. };
  11473. })();
  11474. /*
  11475. This manager tracks offsets of draggables and droppables
  11476. */
  11477. $.ui.ddmanager = {
  11478. current: null,
  11479. droppables: { "default": [] },
  11480. prepareOffsets: function( t, event ) {
  11481. var i, j,
  11482. m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
  11483. type = event ? event.type : null, // workaround for #2317
  11484. list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
  11485. droppablesLoop: for ( i = 0; i < m.length; i++ ) {
  11486. // No disabled and non-accepted
  11487. if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
  11488. continue;
  11489. }
  11490. // Filter out elements in the current dragged item
  11491. for ( j = 0; j < list.length; j++ ) {
  11492. if ( list[ j ] === m[ i ].element[ 0 ] ) {
  11493. m[ i ].proportions().height = 0;
  11494. continue droppablesLoop;
  11495. }
  11496. }
  11497. m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
  11498. if ( !m[ i ].visible ) {
  11499. continue;
  11500. }
  11501. // Activate the droppable if used directly from draggables
  11502. if ( type === "mousedown" ) {
  11503. m[ i ]._activate.call( m[ i ], event );
  11504. }
  11505. m[ i ].offset = m[ i ].element.offset();
  11506. m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
  11507. }
  11508. },
  11509. drop: function( draggable, event ) {
  11510. var dropped = false;
  11511. // Create a copy of the droppables in case the list changes during the drop (#9116)
  11512. $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
  11513. if ( !this.options ) {
  11514. return;
  11515. }
  11516. if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
  11517. dropped = this._drop.call( this, event ) || dropped;
  11518. }
  11519. if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  11520. this.isout = true;
  11521. this.isover = false;
  11522. this._deactivate.call( this, event );
  11523. }
  11524. });
  11525. return dropped;
  11526. },
  11527. dragStart: function( draggable, event ) {
  11528. // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
  11529. draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
  11530. if ( !draggable.options.refreshPositions ) {
  11531. $.ui.ddmanager.prepareOffsets( draggable, event );
  11532. }
  11533. });
  11534. },
  11535. drag: function( draggable, event ) {
  11536. // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
  11537. if ( draggable.options.refreshPositions ) {
  11538. $.ui.ddmanager.prepareOffsets( draggable, event );
  11539. }
  11540. // Run through all droppables and check their positions based on specific tolerance options
  11541. $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
  11542. if ( this.options.disabled || this.greedyChild || !this.visible ) {
  11543. return;
  11544. }
  11545. var parentInstance, scope, parent,
  11546. intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
  11547. c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
  11548. if ( !c ) {
  11549. return;
  11550. }
  11551. if ( this.options.greedy ) {
  11552. // find droppable parents with same scope
  11553. scope = this.options.scope;
  11554. parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
  11555. return $( this ).droppable( "instance" ).options.scope === scope;
  11556. });
  11557. if ( parent.length ) {
  11558. parentInstance = $( parent[ 0 ] ).droppable( "instance" );
  11559. parentInstance.greedyChild = ( c === "isover" );
  11560. }
  11561. }
  11562. // we just moved into a greedy child
  11563. if ( parentInstance && c === "isover" ) {
  11564. parentInstance.isover = false;
  11565. parentInstance.isout = true;
  11566. parentInstance._out.call( parentInstance, event );
  11567. }
  11568. this[ c ] = true;
  11569. this[c === "isout" ? "isover" : "isout"] = false;
  11570. this[c === "isover" ? "_over" : "_out"].call( this, event );
  11571. // we just moved out of a greedy child
  11572. if ( parentInstance && c === "isout" ) {
  11573. parentInstance.isout = false;
  11574. parentInstance.isover = true;
  11575. parentInstance._over.call( parentInstance, event );
  11576. }
  11577. });
  11578. },
  11579. dragStop: function( draggable, event ) {
  11580. draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
  11581. // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
  11582. if ( !draggable.options.refreshPositions ) {
  11583. $.ui.ddmanager.prepareOffsets( draggable, event );
  11584. }
  11585. }
  11586. };
  11587. var droppable = $.ui.droppable;
  11588. /*!
  11589. * jQuery UI Sortable 1.11.4
  11590. * http://jqueryui.com
  11591. *
  11592. * Copyright jQuery Foundation and other contributors
  11593. * Released under the MIT license.
  11594. * http://jquery.org/license
  11595. *
  11596. * http://api.jqueryui.com/sortable/
  11597. */
  11598. var sortable = $.widget("ui.sortable", $.ui.mouse, {
  11599. version: "1.11.4",
  11600. widgetEventPrefix: "sort",
  11601. ready: false,
  11602. options: {
  11603. appendTo: "parent",
  11604. axis: false,
  11605. connectWith: false,
  11606. containment: false,
  11607. cursor: "auto",
  11608. cursorAt: false,
  11609. dropOnEmpty: true,
  11610. forcePlaceholderSize: false,
  11611. forceHelperSize: false,
  11612. grid: false,
  11613. handle: false,
  11614. helper: "original",
  11615. items: "> *",
  11616. opacity: false,
  11617. placeholder: false,
  11618. revert: false,
  11619. scroll: true,
  11620. scrollSensitivity: 20,
  11621. scrollSpeed: 20,
  11622. scope: "default",
  11623. tolerance: "intersect",
  11624. zIndex: 1000,
  11625. // callbacks
  11626. activate: null,
  11627. beforeStop: null,
  11628. change: null,
  11629. deactivate: null,
  11630. out: null,
  11631. over: null,
  11632. receive: null,
  11633. remove: null,
  11634. sort: null,
  11635. start: null,
  11636. stop: null,
  11637. update: null
  11638. },
  11639. _isOverAxis: function( x, reference, size ) {
  11640. return ( x >= reference ) && ( x < ( reference + size ) );
  11641. },
  11642. _isFloating: function( item ) {
  11643. return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
  11644. },
  11645. _create: function() {
  11646. this.containerCache = {};
  11647. this.element.addClass("ui-sortable");
  11648. //Get the items
  11649. this.refresh();
  11650. //Let's determine the parent's offset
  11651. this.offset = this.element.offset();
  11652. //Initialize mouse events for interaction
  11653. this._mouseInit();
  11654. this._setHandleClassName();
  11655. //We're ready to go
  11656. this.ready = true;
  11657. },
  11658. _setOption: function( key, value ) {
  11659. this._super( key, value );
  11660. if ( key === "handle" ) {
  11661. this._setHandleClassName();
  11662. }
  11663. },
  11664. _setHandleClassName: function() {
  11665. this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
  11666. $.each( this.items, function() {
  11667. ( this.instance.options.handle ?
  11668. this.item.find( this.instance.options.handle ) : this.item )
  11669. .addClass( "ui-sortable-handle" );
  11670. });
  11671. },
  11672. _destroy: function() {
  11673. this.element
  11674. .removeClass( "ui-sortable ui-sortable-disabled" )
  11675. .find( ".ui-sortable-handle" )
  11676. .removeClass( "ui-sortable-handle" );
  11677. this._mouseDestroy();
  11678. for ( var i = this.items.length - 1; i >= 0; i-- ) {
  11679. this.items[i].item.removeData(this.widgetName + "-item");
  11680. }
  11681. return this;
  11682. },
  11683. _mouseCapture: function(event, overrideHandle) {
  11684. var currentItem = null,
  11685. validHandle = false,
  11686. that = this;
  11687. if (this.reverting) {
  11688. return false;
  11689. }
  11690. if(this.options.disabled || this.options.type === "static") {
  11691. return false;
  11692. }
  11693. //We have to refresh the items data once first
  11694. this._refreshItems(event);
  11695. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  11696. $(event.target).parents().each(function() {
  11697. if($.data(this, that.widgetName + "-item") === that) {
  11698. currentItem = $(this);
  11699. return false;
  11700. }
  11701. });
  11702. if($.data(event.target, that.widgetName + "-item") === that) {
  11703. currentItem = $(event.target);
  11704. }
  11705. if(!currentItem) {
  11706. return false;
  11707. }
  11708. if(this.options.handle && !overrideHandle) {
  11709. $(this.options.handle, currentItem).find("*").addBack().each(function() {
  11710. if(this === event.target) {
  11711. validHandle = true;
  11712. }
  11713. });
  11714. if(!validHandle) {
  11715. return false;
  11716. }
  11717. }
  11718. this.currentItem = currentItem;
  11719. this._removeCurrentsFromItems();
  11720. return true;
  11721. },
  11722. _mouseStart: function(event, overrideHandle, noActivation) {
  11723. var i, body,
  11724. o = this.options;
  11725. this.currentContainer = this;
  11726. //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  11727. this.refreshPositions();
  11728. //Create and append the visible helper
  11729. this.helper = this._createHelper(event);
  11730. //Cache the helper size
  11731. this._cacheHelperProportions();
  11732. /*
  11733. * - Position generation -
  11734. * This block generates everything position related - it's the core of draggables.
  11735. */
  11736. //Cache the margins of the original element
  11737. this._cacheMargins();
  11738. //Get the next scrolling parent
  11739. this.scrollParent = this.helper.scrollParent();
  11740. //The element's absolute position on the page minus margins
  11741. this.offset = this.currentItem.offset();
  11742. this.offset = {
  11743. top: this.offset.top - this.margins.top,
  11744. left: this.offset.left - this.margins.left
  11745. };
  11746. $.extend(this.offset, {
  11747. click: { //Where the click happened, relative to the element
  11748. left: event.pageX - this.offset.left,
  11749. top: event.pageY - this.offset.top
  11750. },
  11751. parent: this._getParentOffset(),
  11752. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  11753. });
  11754. // Only after we got the offset, we can change the helper's position to absolute
  11755. // TODO: Still need to figure out a way to make relative sorting possible
  11756. this.helper.css("position", "absolute");
  11757. this.cssPosition = this.helper.css("position");
  11758. //Generate the original position
  11759. this.originalPosition = this._generatePosition(event);
  11760. this.originalPageX = event.pageX;
  11761. this.originalPageY = event.pageY;
  11762. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  11763. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  11764. //Cache the former DOM position
  11765. this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  11766. //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
  11767. if(this.helper[0] !== this.currentItem[0]) {
  11768. this.currentItem.hide();
  11769. }
  11770. //Create the placeholder
  11771. this._createPlaceholder();
  11772. //Set a containment if given in the options
  11773. if(o.containment) {
  11774. this._setContainment();
  11775. }
  11776. if( o.cursor && o.cursor !== "auto" ) { // cursor option
  11777. body = this.document.find( "body" );
  11778. // support: IE
  11779. this.storedCursor = body.css( "cursor" );
  11780. body.css( "cursor", o.cursor );
  11781. this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
  11782. }
  11783. if(o.opacity) { // opacity option
  11784. if (this.helper.css("opacity")) {
  11785. this._storedOpacity = this.helper.css("opacity");
  11786. }
  11787. this.helper.css("opacity", o.opacity);
  11788. }
  11789. if(o.zIndex) { // zIndex option
  11790. if (this.helper.css("zIndex")) {
  11791. this._storedZIndex = this.helper.css("zIndex");
  11792. }
  11793. this.helper.css("zIndex", o.zIndex);
  11794. }
  11795. //Prepare scrolling
  11796. if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  11797. this.overflowOffset = this.scrollParent.offset();
  11798. }
  11799. //Call callbacks
  11800. this._trigger("start", event, this._uiHash());
  11801. //Recache the helper size
  11802. if(!this._preserveHelperProportions) {
  11803. this._cacheHelperProportions();
  11804. }
  11805. //Post "activate" events to possible containers
  11806. if( !noActivation ) {
  11807. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  11808. this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  11809. }
  11810. }
  11811. //Prepare possible droppables
  11812. if($.ui.ddmanager) {
  11813. $.ui.ddmanager.current = this;
  11814. }
  11815. if ($.ui.ddmanager && !o.dropBehaviour) {
  11816. $.ui.ddmanager.prepareOffsets(this, event);
  11817. }
  11818. this.dragging = true;
  11819. this.helper.addClass("ui-sortable-helper");
  11820. this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  11821. return true;
  11822. },
  11823. _mouseDrag: function(event) {
  11824. var i, item, itemElement, intersection,
  11825. o = this.options,
  11826. scrolled = false;
  11827. //Compute the helpers position
  11828. this.position = this._generatePosition(event);
  11829. this.positionAbs = this._convertPositionTo("absolute");
  11830. if (!this.lastPositionAbs) {
  11831. this.lastPositionAbs = this.positionAbs;
  11832. }
  11833. //Do scrolling
  11834. if(this.options.scroll) {
  11835. if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  11836. if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
  11837. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  11838. } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
  11839. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  11840. }
  11841. if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
  11842. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  11843. } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
  11844. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  11845. }
  11846. } else {
  11847. if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
  11848. scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
  11849. } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
  11850. scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
  11851. }
  11852. if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
  11853. scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
  11854. } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
  11855. scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
  11856. }
  11857. }
  11858. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  11859. $.ui.ddmanager.prepareOffsets(this, event);
  11860. }
  11861. }
  11862. //Regenerate the absolute position used for position checks
  11863. this.positionAbs = this._convertPositionTo("absolute");
  11864. //Set the helper position
  11865. if(!this.options.axis || this.options.axis !== "y") {
  11866. this.helper[0].style.left = this.position.left+"px";
  11867. }
  11868. if(!this.options.axis || this.options.axis !== "x") {
  11869. this.helper[0].style.top = this.position.top+"px";
  11870. }
  11871. //Rearrange
  11872. for (i = this.items.length - 1; i >= 0; i--) {
  11873. //Cache variables and intersection, continue if no intersection
  11874. item = this.items[i];
  11875. itemElement = item.item[0];
  11876. intersection = this._intersectsWithPointer(item);
  11877. if (!intersection) {
  11878. continue;
  11879. }
  11880. // Only put the placeholder inside the current Container, skip all
  11881. // items from other containers. This works because when moving
  11882. // an item from one container to another the
  11883. // currentContainer is switched before the placeholder is moved.
  11884. //
  11885. // Without this, moving items in "sub-sortables" can cause
  11886. // the placeholder to jitter between the outer and inner container.
  11887. if (item.instance !== this.currentContainer) {
  11888. continue;
  11889. }
  11890. // cannot intersect with itself
  11891. // no useless actions that have been done before
  11892. // no action if the item moved is the parent of the item checked
  11893. if (itemElement !== this.currentItem[0] &&
  11894. this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
  11895. !$.contains(this.placeholder[0], itemElement) &&
  11896. (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
  11897. ) {
  11898. this.direction = intersection === 1 ? "down" : "up";
  11899. if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
  11900. this._rearrange(event, item);
  11901. } else {
  11902. break;
  11903. }
  11904. this._trigger("change", event, this._uiHash());
  11905. break;
  11906. }
  11907. }
  11908. //Post events to containers
  11909. this._contactContainers(event);
  11910. //Interconnect with droppables
  11911. if($.ui.ddmanager) {
  11912. $.ui.ddmanager.drag(this, event);
  11913. }
  11914. //Call callbacks
  11915. this._trigger("sort", event, this._uiHash());
  11916. this.lastPositionAbs = this.positionAbs;
  11917. return false;
  11918. },
  11919. _mouseStop: function(event, noPropagation) {
  11920. if(!event) {
  11921. return;
  11922. }
  11923. //If we are using droppables, inform the manager about the drop
  11924. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  11925. $.ui.ddmanager.drop(this, event);
  11926. }
  11927. if(this.options.revert) {
  11928. var that = this,
  11929. cur = this.placeholder.offset(),
  11930. axis = this.options.axis,
  11931. animation = {};
  11932. if ( !axis || axis === "x" ) {
  11933. animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
  11934. }
  11935. if ( !axis || axis === "y" ) {
  11936. animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
  11937. }
  11938. this.reverting = true;
  11939. $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
  11940. that._clear(event);
  11941. });
  11942. } else {
  11943. this._clear(event, noPropagation);
  11944. }
  11945. return false;
  11946. },
  11947. cancel: function() {
  11948. if(this.dragging) {
  11949. this._mouseUp({ target: null });
  11950. if(this.options.helper === "original") {
  11951. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  11952. } else {
  11953. this.currentItem.show();
  11954. }
  11955. //Post deactivating events to containers
  11956. for (var i = this.containers.length - 1; i >= 0; i--){
  11957. this.containers[i]._trigger("deactivate", null, this._uiHash(this));
  11958. if(this.containers[i].containerCache.over) {
  11959. this.containers[i]._trigger("out", null, this._uiHash(this));
  11960. this.containers[i].containerCache.over = 0;
  11961. }
  11962. }
  11963. }
  11964. if (this.placeholder) {
  11965. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  11966. if(this.placeholder[0].parentNode) {
  11967. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  11968. }
  11969. if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
  11970. this.helper.remove();
  11971. }
  11972. $.extend(this, {
  11973. helper: null,
  11974. dragging: false,
  11975. reverting: false,
  11976. _noFinalSort: null
  11977. });
  11978. if(this.domPosition.prev) {
  11979. $(this.domPosition.prev).after(this.currentItem);
  11980. } else {
  11981. $(this.domPosition.parent).prepend(this.currentItem);
  11982. }
  11983. }
  11984. return this;
  11985. },
  11986. serialize: function(o) {
  11987. var items = this._getItemsAsjQuery(o && o.connected),
  11988. str = [];
  11989. o = o || {};
  11990. $(items).each(function() {
  11991. var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
  11992. if (res) {
  11993. str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
  11994. }
  11995. });
  11996. if(!str.length && o.key) {
  11997. str.push(o.key + "=");
  11998. }
  11999. return str.join("&");
  12000. },
  12001. toArray: function(o) {
  12002. var items = this._getItemsAsjQuery(o && o.connected),
  12003. ret = [];
  12004. o = o || {};
  12005. items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
  12006. return ret;
  12007. },
  12008. /* Be careful with the following core functions */
  12009. _intersectsWith: function(item) {
  12010. var x1 = this.positionAbs.left,
  12011. x2 = x1 + this.helperProportions.width,
  12012. y1 = this.positionAbs.top,
  12013. y2 = y1 + this.helperProportions.height,
  12014. l = item.left,
  12015. r = l + item.width,
  12016. t = item.top,
  12017. b = t + item.height,
  12018. dyClick = this.offset.click.top,
  12019. dxClick = this.offset.click.left,
  12020. isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
  12021. isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
  12022. isOverElement = isOverElementHeight && isOverElementWidth;
  12023. if ( this.options.tolerance === "pointer" ||
  12024. this.options.forcePointerForContainers ||
  12025. (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
  12026. ) {
  12027. return isOverElement;
  12028. } else {
  12029. return (l < x1 + (this.helperProportions.width / 2) && // Right Half
  12030. x2 - (this.helperProportions.width / 2) < r && // Left Half
  12031. t < y1 + (this.helperProportions.height / 2) && // Bottom Half
  12032. y2 - (this.helperProportions.height / 2) < b ); // Top Half
  12033. }
  12034. },
  12035. _intersectsWithPointer: function(item) {
  12036. var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  12037. isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  12038. isOverElement = isOverElementHeight && isOverElementWidth,
  12039. verticalDirection = this._getDragVerticalDirection(),
  12040. horizontalDirection = this._getDragHorizontalDirection();
  12041. if (!isOverElement) {
  12042. return false;
  12043. }
  12044. return this.floating ?
  12045. ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
  12046. : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
  12047. },
  12048. _intersectsWithSides: function(item) {
  12049. var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  12050. isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  12051. verticalDirection = this._getDragVerticalDirection(),
  12052. horizontalDirection = this._getDragHorizontalDirection();
  12053. if (this.floating && horizontalDirection) {
  12054. return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
  12055. } else {
  12056. return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
  12057. }
  12058. },
  12059. _getDragVerticalDirection: function() {
  12060. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  12061. return delta !== 0 && (delta > 0 ? "down" : "up");
  12062. },
  12063. _getDragHorizontalDirection: function() {
  12064. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  12065. return delta !== 0 && (delta > 0 ? "right" : "left");
  12066. },
  12067. refresh: function(event) {
  12068. this._refreshItems(event);
  12069. this._setHandleClassName();
  12070. this.refreshPositions();
  12071. return this;
  12072. },
  12073. _connectWith: function() {
  12074. var options = this.options;
  12075. return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
  12076. },
  12077. _getItemsAsjQuery: function(connected) {
  12078. var i, j, cur, inst,
  12079. items = [],
  12080. queries = [],
  12081. connectWith = this._connectWith();
  12082. if(connectWith && connected) {
  12083. for (i = connectWith.length - 1; i >= 0; i--){
  12084. cur = $(connectWith[i], this.document[0]);
  12085. for ( j = cur.length - 1; j >= 0; j--){
  12086. inst = $.data(cur[j], this.widgetFullName);
  12087. if(inst && inst !== this && !inst.options.disabled) {
  12088. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
  12089. }
  12090. }
  12091. }
  12092. }
  12093. queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
  12094. function addItems() {
  12095. items.push( this );
  12096. }
  12097. for (i = queries.length - 1; i >= 0; i--){
  12098. queries[i][0].each( addItems );
  12099. }
  12100. return $(items);
  12101. },
  12102. _removeCurrentsFromItems: function() {
  12103. var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
  12104. this.items = $.grep(this.items, function (item) {
  12105. for (var j=0; j < list.length; j++) {
  12106. if(list[j] === item.item[0]) {
  12107. return false;
  12108. }
  12109. }
  12110. return true;
  12111. });
  12112. },
  12113. _refreshItems: function(event) {
  12114. this.items = [];
  12115. this.containers = [this];
  12116. var i, j, cur, inst, targetData, _queries, item, queriesLength,
  12117. items = this.items,
  12118. queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
  12119. connectWith = this._connectWith();
  12120. if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
  12121. for (i = connectWith.length - 1; i >= 0; i--){
  12122. cur = $(connectWith[i], this.document[0]);
  12123. for (j = cur.length - 1; j >= 0; j--){
  12124. inst = $.data(cur[j], this.widgetFullName);
  12125. if(inst && inst !== this && !inst.options.disabled) {
  12126. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  12127. this.containers.push(inst);
  12128. }
  12129. }
  12130. }
  12131. }
  12132. for (i = queries.length - 1; i >= 0; i--) {
  12133. targetData = queries[i][1];
  12134. _queries = queries[i][0];
  12135. for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  12136. item = $(_queries[j]);
  12137. item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
  12138. items.push({
  12139. item: item,
  12140. instance: targetData,
  12141. width: 0, height: 0,
  12142. left: 0, top: 0
  12143. });
  12144. }
  12145. }
  12146. },
  12147. refreshPositions: function(fast) {
  12148. // Determine whether items are being displayed horizontally
  12149. this.floating = this.items.length ?
  12150. this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  12151. false;
  12152. //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  12153. if(this.offsetParent && this.helper) {
  12154. this.offset.parent = this._getParentOffset();
  12155. }
  12156. var i, item, t, p;
  12157. for (i = this.items.length - 1; i >= 0; i--){
  12158. item = this.items[i];
  12159. //We ignore calculating positions of all connected containers when we're not over them
  12160. if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
  12161. continue;
  12162. }
  12163. t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  12164. if (!fast) {
  12165. item.width = t.outerWidth();
  12166. item.height = t.outerHeight();
  12167. }
  12168. p = t.offset();
  12169. item.left = p.left;
  12170. item.top = p.top;
  12171. }
  12172. if(this.options.custom && this.options.custom.refreshContainers) {
  12173. this.options.custom.refreshContainers.call(this);
  12174. } else {
  12175. for (i = this.containers.length - 1; i >= 0; i--){
  12176. p = this.containers[i].element.offset();
  12177. this.containers[i].containerCache.left = p.left;
  12178. this.containers[i].containerCache.top = p.top;
  12179. this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  12180. this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  12181. }
  12182. }
  12183. return this;
  12184. },
  12185. _createPlaceholder: function(that) {
  12186. that = that || this;
  12187. var className,
  12188. o = that.options;
  12189. if(!o.placeholder || o.placeholder.constructor === String) {
  12190. className = o.placeholder;
  12191. o.placeholder = {
  12192. element: function() {
  12193. var nodeName = that.currentItem[0].nodeName.toLowerCase(),
  12194. element = $( "<" + nodeName + ">", that.document[0] )
  12195. .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
  12196. .removeClass("ui-sortable-helper");
  12197. if ( nodeName === "tbody" ) {
  12198. that._createTrPlaceholder(
  12199. that.currentItem.find( "tr" ).eq( 0 ),
  12200. $( "<tr>", that.document[ 0 ] ).appendTo( element )
  12201. );
  12202. } else if ( nodeName === "tr" ) {
  12203. that._createTrPlaceholder( that.currentItem, element );
  12204. } else if ( nodeName === "img" ) {
  12205. element.attr( "src", that.currentItem.attr( "src" ) );
  12206. }
  12207. if ( !className ) {
  12208. element.css( "visibility", "hidden" );
  12209. }
  12210. return element;
  12211. },
  12212. update: function(container, p) {
  12213. // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  12214. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  12215. if(className && !o.forcePlaceholderSize) {
  12216. return;
  12217. }
  12218. //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
  12219. if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
  12220. if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
  12221. }
  12222. };
  12223. }
  12224. //Create the placeholder
  12225. that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
  12226. //Append it after the actual current item
  12227. that.currentItem.after(that.placeholder);
  12228. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  12229. o.placeholder.update(that, that.placeholder);
  12230. },
  12231. _createTrPlaceholder: function( sourceTr, targetTr ) {
  12232. var that = this;
  12233. sourceTr.children().each(function() {
  12234. $( "<td>&#160;</td>", that.document[ 0 ] )
  12235. .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  12236. .appendTo( targetTr );
  12237. });
  12238. },
  12239. _contactContainers: function(event) {
  12240. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
  12241. innermostContainer = null,
  12242. innermostIndex = null;
  12243. // get innermost container that intersects with item
  12244. for (i = this.containers.length - 1; i >= 0; i--) {
  12245. // never consider a container that's located within the item itself
  12246. if($.contains(this.currentItem[0], this.containers[i].element[0])) {
  12247. continue;
  12248. }
  12249. if(this._intersectsWith(this.containers[i].containerCache)) {
  12250. // if we've already found a container and it's more "inner" than this, then continue
  12251. if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
  12252. continue;
  12253. }
  12254. innermostContainer = this.containers[i];
  12255. innermostIndex = i;
  12256. } else {
  12257. // container doesn't intersect. trigger "out" event if necessary
  12258. if(this.containers[i].containerCache.over) {
  12259. this.containers[i]._trigger("out", event, this._uiHash(this));
  12260. this.containers[i].containerCache.over = 0;
  12261. }
  12262. }
  12263. }
  12264. // if no intersecting containers found, return
  12265. if(!innermostContainer) {
  12266. return;
  12267. }
  12268. // move the item into the container if it's not there already
  12269. if(this.containers.length === 1) {
  12270. if (!this.containers[innermostIndex].containerCache.over) {
  12271. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  12272. this.containers[innermostIndex].containerCache.over = 1;
  12273. }
  12274. } else {
  12275. //When entering a new container, we will find the item with the least distance and append our item near it
  12276. dist = 10000;
  12277. itemWithLeastDistance = null;
  12278. floating = innermostContainer.floating || this._isFloating(this.currentItem);
  12279. posProperty = floating ? "left" : "top";
  12280. sizeProperty = floating ? "width" : "height";
  12281. axis = floating ? "clientX" : "clientY";
  12282. for (j = this.items.length - 1; j >= 0; j--) {
  12283. if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
  12284. continue;
  12285. }
  12286. if(this.items[j].item[0] === this.currentItem[0]) {
  12287. continue;
  12288. }
  12289. cur = this.items[j].item.offset()[posProperty];
  12290. nearBottom = false;
  12291. if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  12292. nearBottom = true;
  12293. }
  12294. if ( Math.abs( event[ axis ] - cur ) < dist ) {
  12295. dist = Math.abs( event[ axis ] - cur );
  12296. itemWithLeastDistance = this.items[ j ];
  12297. this.direction = nearBottom ? "up": "down";
  12298. }
  12299. }
  12300. //Check if dropOnEmpty is enabled
  12301. if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
  12302. return;
  12303. }
  12304. if(this.currentContainer === this.containers[innermostIndex]) {
  12305. if ( !this.currentContainer.containerCache.over ) {
  12306. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  12307. this.currentContainer.containerCache.over = 1;
  12308. }
  12309. return;
  12310. }
  12311. itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
  12312. this._trigger("change", event, this._uiHash());
  12313. this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  12314. this.currentContainer = this.containers[innermostIndex];
  12315. //Update the placeholder
  12316. this.options.placeholder.update(this.currentContainer, this.placeholder);
  12317. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  12318. this.containers[innermostIndex].containerCache.over = 1;
  12319. }
  12320. },
  12321. _createHelper: function(event) {
  12322. var o = this.options,
  12323. helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
  12324. //Add the helper to the DOM if that didn't happen already
  12325. if(!helper.parents("body").length) {
  12326. $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  12327. }
  12328. if(helper[0] === this.currentItem[0]) {
  12329. this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
  12330. }
  12331. if(!helper[0].style.width || o.forceHelperSize) {
  12332. helper.width(this.currentItem.width());
  12333. }
  12334. if(!helper[0].style.height || o.forceHelperSize) {
  12335. helper.height(this.currentItem.height());
  12336. }
  12337. return helper;
  12338. },
  12339. _adjustOffsetFromHelper: function(obj) {
  12340. if (typeof obj === "string") {
  12341. obj = obj.split(" ");
  12342. }
  12343. if ($.isArray(obj)) {
  12344. obj = {left: +obj[0], top: +obj[1] || 0};
  12345. }
  12346. if ("left" in obj) {
  12347. this.offset.click.left = obj.left + this.margins.left;
  12348. }
  12349. if ("right" in obj) {
  12350. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  12351. }
  12352. if ("top" in obj) {
  12353. this.offset.click.top = obj.top + this.margins.top;
  12354. }
  12355. if ("bottom" in obj) {
  12356. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  12357. }
  12358. },
  12359. _getParentOffset: function() {
  12360. //Get the offsetParent and cache its position
  12361. this.offsetParent = this.helper.offsetParent();
  12362. var po = this.offsetParent.offset();
  12363. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  12364. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  12365. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  12366. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  12367. if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  12368. po.left += this.scrollParent.scrollLeft();
  12369. po.top += this.scrollParent.scrollTop();
  12370. }
  12371. // This needs to be actually done for all browsers, since pageX/pageY includes this information
  12372. // with an ugly IE fix
  12373. if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
  12374. po = { top: 0, left: 0 };
  12375. }
  12376. return {
  12377. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  12378. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  12379. };
  12380. },
  12381. _getRelativeOffset: function() {
  12382. if(this.cssPosition === "relative") {
  12383. var p = this.currentItem.position();
  12384. return {
  12385. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  12386. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  12387. };
  12388. } else {
  12389. return { top: 0, left: 0 };
  12390. }
  12391. },
  12392. _cacheMargins: function() {
  12393. this.margins = {
  12394. left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  12395. top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  12396. };
  12397. },
  12398. _cacheHelperProportions: function() {
  12399. this.helperProportions = {
  12400. width: this.helper.outerWidth(),
  12401. height: this.helper.outerHeight()
  12402. };
  12403. },
  12404. _setContainment: function() {
  12405. var ce, co, over,
  12406. o = this.options;
  12407. if(o.containment === "parent") {
  12408. o.containment = this.helper[0].parentNode;
  12409. }
  12410. if(o.containment === "document" || o.containment === "window") {
  12411. this.containment = [
  12412. 0 - this.offset.relative.left - this.offset.parent.left,
  12413. 0 - this.offset.relative.top - this.offset.parent.top,
  12414. o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
  12415. (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  12416. ];
  12417. }
  12418. if(!(/^(document|window|parent)$/).test(o.containment)) {
  12419. ce = $(o.containment)[0];
  12420. co = $(o.containment).offset();
  12421. over = ($(ce).css("overflow") !== "hidden");
  12422. this.containment = [
  12423. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  12424. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  12425. co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
  12426. co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
  12427. ];
  12428. }
  12429. },
  12430. _convertPositionTo: function(d, pos) {
  12431. if(!pos) {
  12432. pos = this.position;
  12433. }
  12434. var mod = d === "absolute" ? 1 : -1,
  12435. scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
  12436. scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  12437. return {
  12438. top: (
  12439. pos.top + // The absolute mouse position
  12440. this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  12441. this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
  12442. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  12443. ),
  12444. left: (
  12445. pos.left + // The absolute mouse position
  12446. this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  12447. this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
  12448. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  12449. )
  12450. };
  12451. },
  12452. _generatePosition: function(event) {
  12453. var top, left,
  12454. o = this.options,
  12455. pageX = event.pageX,
  12456. pageY = event.pageY,
  12457. scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  12458. // This is another very weird special case that only happens for relative elements:
  12459. // 1. If the css position is relative
  12460. // 2. and the scroll parent is the document or similar to the offset parent
  12461. // we have to refresh the relative offset during the scroll so there are no jumps
  12462. if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
  12463. this.offset.relative = this._getRelativeOffset();
  12464. }
  12465. /*
  12466. * - Position constraining -
  12467. * Constrain the position to a mix of grid, containment.
  12468. */
  12469. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  12470. if(this.containment) {
  12471. if(event.pageX - this.offset.click.left < this.containment[0]) {
  12472. pageX = this.containment[0] + this.offset.click.left;
  12473. }
  12474. if(event.pageY - this.offset.click.top < this.containment[1]) {
  12475. pageY = this.containment[1] + this.offset.click.top;
  12476. }
  12477. if(event.pageX - this.offset.click.left > this.containment[2]) {
  12478. pageX = this.containment[2] + this.offset.click.left;
  12479. }
  12480. if(event.pageY - this.offset.click.top > this.containment[3]) {
  12481. pageY = this.containment[3] + this.offset.click.top;
  12482. }
  12483. }
  12484. if(o.grid) {
  12485. top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  12486. pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  12487. left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  12488. pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  12489. }
  12490. }
  12491. return {
  12492. top: (
  12493. pageY - // The absolute mouse position
  12494. this.offset.click.top - // Click offset (relative to the element)
  12495. this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
  12496. this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
  12497. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  12498. ),
  12499. left: (
  12500. pageX - // The absolute mouse position
  12501. this.offset.click.left - // Click offset (relative to the element)
  12502. this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
  12503. this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
  12504. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  12505. )
  12506. };
  12507. },
  12508. _rearrange: function(event, i, a, hardRefresh) {
  12509. a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
  12510. //Various things done here to improve the performance:
  12511. // 1. we create a setTimeout, that calls refreshPositions
  12512. // 2. on the instance, we have a counter variable, that get's higher after every append
  12513. // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  12514. // 4. this lets only the last addition to the timeout stack through
  12515. this.counter = this.counter ? ++this.counter : 1;
  12516. var counter = this.counter;
  12517. this._delay(function() {
  12518. if(counter === this.counter) {
  12519. this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  12520. }
  12521. });
  12522. },
  12523. _clear: function(event, noPropagation) {
  12524. this.reverting = false;
  12525. // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  12526. // everything else normalized again
  12527. var i,
  12528. delayedTriggers = [];
  12529. // We first have to update the dom position of the actual currentItem
  12530. // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  12531. if(!this._noFinalSort && this.currentItem.parent().length) {
  12532. this.placeholder.before(this.currentItem);
  12533. }
  12534. this._noFinalSort = null;
  12535. if(this.helper[0] === this.currentItem[0]) {
  12536. for(i in this._storedCSS) {
  12537. if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
  12538. this._storedCSS[i] = "";
  12539. }
  12540. }
  12541. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  12542. } else {
  12543. this.currentItem.show();
  12544. }
  12545. if(this.fromOutside && !noPropagation) {
  12546. delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  12547. }
  12548. if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
  12549. delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
  12550. }
  12551. // Check if the items Container has Changed and trigger appropriate
  12552. // events.
  12553. if (this !== this.currentContainer) {
  12554. if(!noPropagation) {
  12555. delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  12556. delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
  12557. delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
  12558. }
  12559. }
  12560. //Post events to containers
  12561. function delayEvent( type, instance, container ) {
  12562. return function( event ) {
  12563. container._trigger( type, event, instance._uiHash( instance ) );
  12564. };
  12565. }
  12566. for (i = this.containers.length - 1; i >= 0; i--){
  12567. if (!noPropagation) {
  12568. delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  12569. }
  12570. if(this.containers[i].containerCache.over) {
  12571. delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  12572. this.containers[i].containerCache.over = 0;
  12573. }
  12574. }
  12575. //Do what was originally in plugins
  12576. if ( this.storedCursor ) {
  12577. this.document.find( "body" ).css( "cursor", this.storedCursor );
  12578. this.storedStylesheet.remove();
  12579. }
  12580. if(this._storedOpacity) {
  12581. this.helper.css("opacity", this._storedOpacity);
  12582. }
  12583. if(this._storedZIndex) {
  12584. this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
  12585. }
  12586. this.dragging = false;
  12587. if(!noPropagation) {
  12588. this._trigger("beforeStop", event, this._uiHash());
  12589. }
  12590. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  12591. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  12592. if ( !this.cancelHelperRemoval ) {
  12593. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  12594. this.helper.remove();
  12595. }
  12596. this.helper = null;
  12597. }
  12598. if(!noPropagation) {
  12599. for (i=0; i < delayedTriggers.length; i++) {
  12600. delayedTriggers[i].call(this, event);
  12601. } //Trigger all delayed events
  12602. this._trigger("stop", event, this._uiHash());
  12603. }
  12604. this.fromOutside = false;
  12605. return !this.cancelHelperRemoval;
  12606. },
  12607. _trigger: function() {
  12608. if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  12609. this.cancel();
  12610. }
  12611. },
  12612. _uiHash: function(_inst) {
  12613. var inst = _inst || this;
  12614. return {
  12615. helper: inst.helper,
  12616. placeholder: inst.placeholder || $([]),
  12617. position: inst.position,
  12618. originalPosition: inst.originalPosition,
  12619. offset: inst.positionAbs,
  12620. item: inst.currentItem,
  12621. sender: _inst ? _inst.element : null
  12622. };
  12623. }
  12624. });
  12625. /*!
  12626. * jQuery UI Effects 1.11.4
  12627. * http://jqueryui.com
  12628. *
  12629. * Copyright jQuery Foundation and other contributors
  12630. * Released under the MIT license.
  12631. * http://jquery.org/license
  12632. *
  12633. * http://api.jqueryui.com/category/effects-core/
  12634. */
  12635. var dataSpace = "ui-effects-",
  12636. // Create a local jQuery because jQuery Color relies on it and the
  12637. // global may not exist with AMD and a custom build (#10199)
  12638. jQuery = $;
  12639. $.effects = {
  12640. effect: {}
  12641. };
  12642. /*!
  12643. * jQuery Color Animations v2.1.2
  12644. * https://github.com/jquery/jquery-color
  12645. *
  12646. * Copyright 2014 jQuery Foundation and other contributors
  12647. * Released under the MIT license.
  12648. * http://jquery.org/license
  12649. *
  12650. * Date: Wed Jan 16 08:47:09 2013 -0600
  12651. */
  12652. (function( jQuery, undefined ) {
  12653. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  12654. // plusequals test for += 100 -= 100
  12655. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  12656. // a set of RE's that can match strings and generate color tuples.
  12657. stringParsers = [ {
  12658. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  12659. parse: function( execResult ) {
  12660. return [
  12661. execResult[ 1 ],
  12662. execResult[ 2 ],
  12663. execResult[ 3 ],
  12664. execResult[ 4 ]
  12665. ];
  12666. }
  12667. }, {
  12668. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  12669. parse: function( execResult ) {
  12670. return [
  12671. execResult[ 1 ] * 2.55,
  12672. execResult[ 2 ] * 2.55,
  12673. execResult[ 3 ] * 2.55,
  12674. execResult[ 4 ]
  12675. ];
  12676. }
  12677. }, {
  12678. // this regex ignores A-F because it's compared against an already lowercased string
  12679. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  12680. parse: function( execResult ) {
  12681. return [
  12682. parseInt( execResult[ 1 ], 16 ),
  12683. parseInt( execResult[ 2 ], 16 ),
  12684. parseInt( execResult[ 3 ], 16 )
  12685. ];
  12686. }
  12687. }, {
  12688. // this regex ignores A-F because it's compared against an already lowercased string
  12689. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  12690. parse: function( execResult ) {
  12691. return [
  12692. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  12693. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  12694. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  12695. ];
  12696. }
  12697. }, {
  12698. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  12699. space: "hsla",
  12700. parse: function( execResult ) {
  12701. return [
  12702. execResult[ 1 ],
  12703. execResult[ 2 ] / 100,
  12704. execResult[ 3 ] / 100,
  12705. execResult[ 4 ]
  12706. ];
  12707. }
  12708. } ],
  12709. // jQuery.Color( )
  12710. color = jQuery.Color = function( color, green, blue, alpha ) {
  12711. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  12712. },
  12713. spaces = {
  12714. rgba: {
  12715. props: {
  12716. red: {
  12717. idx: 0,
  12718. type: "byte"
  12719. },
  12720. green: {
  12721. idx: 1,
  12722. type: "byte"
  12723. },
  12724. blue: {
  12725. idx: 2,
  12726. type: "byte"
  12727. }
  12728. }
  12729. },
  12730. hsla: {
  12731. props: {
  12732. hue: {
  12733. idx: 0,
  12734. type: "degrees"
  12735. },
  12736. saturation: {
  12737. idx: 1,
  12738. type: "percent"
  12739. },
  12740. lightness: {
  12741. idx: 2,
  12742. type: "percent"
  12743. }
  12744. }
  12745. }
  12746. },
  12747. propTypes = {
  12748. "byte": {
  12749. floor: true,
  12750. max: 255
  12751. },
  12752. "percent": {
  12753. max: 1
  12754. },
  12755. "degrees": {
  12756. mod: 360,
  12757. floor: true
  12758. }
  12759. },
  12760. support = color.support = {},
  12761. // element for support tests
  12762. supportElem = jQuery( "<p>" )[ 0 ],
  12763. // colors = jQuery.Color.names
  12764. colors,
  12765. // local aliases of functions called often
  12766. each = jQuery.each;
  12767. // determine rgba support immediately
  12768. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  12769. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  12770. // define cache name and alpha properties
  12771. // for rgba and hsla spaces
  12772. each( spaces, function( spaceName, space ) {
  12773. space.cache = "_" + spaceName;
  12774. space.props.alpha = {
  12775. idx: 3,
  12776. type: "percent",
  12777. def: 1
  12778. };
  12779. });
  12780. function clamp( value, prop, allowEmpty ) {
  12781. var type = propTypes[ prop.type ] || {};
  12782. if ( value == null ) {
  12783. return (allowEmpty || !prop.def) ? null : prop.def;
  12784. }
  12785. // ~~ is an short way of doing floor for positive numbers
  12786. value = type.floor ? ~~value : parseFloat( value );
  12787. // IE will pass in empty strings as value for alpha,
  12788. // which will hit this case
  12789. if ( isNaN( value ) ) {
  12790. return prop.def;
  12791. }
  12792. if ( type.mod ) {
  12793. // we add mod before modding to make sure that negatives values
  12794. // get converted properly: -10 -> 350
  12795. return (value + type.mod) % type.mod;
  12796. }
  12797. // for now all property types without mod have min and max
  12798. return 0 > value ? 0 : type.max < value ? type.max : value;
  12799. }
  12800. function stringParse( string ) {
  12801. var inst = color(),
  12802. rgba = inst._rgba = [];
  12803. string = string.toLowerCase();
  12804. each( stringParsers, function( i, parser ) {
  12805. var parsed,
  12806. match = parser.re.exec( string ),
  12807. values = match && parser.parse( match ),
  12808. spaceName = parser.space || "rgba";
  12809. if ( values ) {
  12810. parsed = inst[ spaceName ]( values );
  12811. // if this was an rgba parse the assignment might happen twice
  12812. // oh well....
  12813. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  12814. rgba = inst._rgba = parsed._rgba;
  12815. // exit each( stringParsers ) here because we matched
  12816. return false;
  12817. }
  12818. });
  12819. // Found a stringParser that handled it
  12820. if ( rgba.length ) {
  12821. // if this came from a parsed string, force "transparent" when alpha is 0
  12822. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  12823. if ( rgba.join() === "0,0,0,0" ) {
  12824. jQuery.extend( rgba, colors.transparent );
  12825. }
  12826. return inst;
  12827. }
  12828. // named colors
  12829. return colors[ string ];
  12830. }
  12831. color.fn = jQuery.extend( color.prototype, {
  12832. parse: function( red, green, blue, alpha ) {
  12833. if ( red === undefined ) {
  12834. this._rgba = [ null, null, null, null ];
  12835. return this;
  12836. }
  12837. if ( red.jquery || red.nodeType ) {
  12838. red = jQuery( red ).css( green );
  12839. green = undefined;
  12840. }
  12841. var inst = this,
  12842. type = jQuery.type( red ),
  12843. rgba = this._rgba = [];
  12844. // more than 1 argument specified - assume ( red, green, blue, alpha )
  12845. if ( green !== undefined ) {
  12846. red = [ red, green, blue, alpha ];
  12847. type = "array";
  12848. }
  12849. if ( type === "string" ) {
  12850. return this.parse( stringParse( red ) || colors._default );
  12851. }
  12852. if ( type === "array" ) {
  12853. each( spaces.rgba.props, function( key, prop ) {
  12854. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  12855. });
  12856. return this;
  12857. }
  12858. if ( type === "object" ) {
  12859. if ( red instanceof color ) {
  12860. each( spaces, function( spaceName, space ) {
  12861. if ( red[ space.cache ] ) {
  12862. inst[ space.cache ] = red[ space.cache ].slice();
  12863. }
  12864. });
  12865. } else {
  12866. each( spaces, function( spaceName, space ) {
  12867. var cache = space.cache;
  12868. each( space.props, function( key, prop ) {
  12869. // if the cache doesn't exist, and we know how to convert
  12870. if ( !inst[ cache ] && space.to ) {
  12871. // if the value was null, we don't need to copy it
  12872. // if the key was alpha, we don't need to copy it either
  12873. if ( key === "alpha" || red[ key ] == null ) {
  12874. return;
  12875. }
  12876. inst[ cache ] = space.to( inst._rgba );
  12877. }
  12878. // this is the only case where we allow nulls for ALL properties.
  12879. // call clamp with alwaysAllowEmpty
  12880. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  12881. });
  12882. // everything defined but alpha?
  12883. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  12884. // use the default of 1
  12885. inst[ cache ][ 3 ] = 1;
  12886. if ( space.from ) {
  12887. inst._rgba = space.from( inst[ cache ] );
  12888. }
  12889. }
  12890. });
  12891. }
  12892. return this;
  12893. }
  12894. },
  12895. is: function( compare ) {
  12896. var is = color( compare ),
  12897. same = true,
  12898. inst = this;
  12899. each( spaces, function( _, space ) {
  12900. var localCache,
  12901. isCache = is[ space.cache ];
  12902. if (isCache) {
  12903. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  12904. each( space.props, function( _, prop ) {
  12905. if ( isCache[ prop.idx ] != null ) {
  12906. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  12907. return same;
  12908. }
  12909. });
  12910. }
  12911. return same;
  12912. });
  12913. return same;
  12914. },
  12915. _space: function() {
  12916. var used = [],
  12917. inst = this;
  12918. each( spaces, function( spaceName, space ) {
  12919. if ( inst[ space.cache ] ) {
  12920. used.push( spaceName );
  12921. }
  12922. });
  12923. return used.pop();
  12924. },
  12925. transition: function( other, distance ) {
  12926. var end = color( other ),
  12927. spaceName = end._space(),
  12928. space = spaces[ spaceName ],
  12929. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  12930. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  12931. result = start.slice();
  12932. end = end[ space.cache ];
  12933. each( space.props, function( key, prop ) {
  12934. var index = prop.idx,
  12935. startValue = start[ index ],
  12936. endValue = end[ index ],
  12937. type = propTypes[ prop.type ] || {};
  12938. // if null, don't override start value
  12939. if ( endValue === null ) {
  12940. return;
  12941. }
  12942. // if null - use end
  12943. if ( startValue === null ) {
  12944. result[ index ] = endValue;
  12945. } else {
  12946. if ( type.mod ) {
  12947. if ( endValue - startValue > type.mod / 2 ) {
  12948. startValue += type.mod;
  12949. } else if ( startValue - endValue > type.mod / 2 ) {
  12950. startValue -= type.mod;
  12951. }
  12952. }
  12953. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  12954. }
  12955. });
  12956. return this[ spaceName ]( result );
  12957. },
  12958. blend: function( opaque ) {
  12959. // if we are already opaque - return ourself
  12960. if ( this._rgba[ 3 ] === 1 ) {
  12961. return this;
  12962. }
  12963. var rgb = this._rgba.slice(),
  12964. a = rgb.pop(),
  12965. blend = color( opaque )._rgba;
  12966. return color( jQuery.map( rgb, function( v, i ) {
  12967. return ( 1 - a ) * blend[ i ] + a * v;
  12968. }));
  12969. },
  12970. toRgbaString: function() {
  12971. var prefix = "rgba(",
  12972. rgba = jQuery.map( this._rgba, function( v, i ) {
  12973. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  12974. });
  12975. if ( rgba[ 3 ] === 1 ) {
  12976. rgba.pop();
  12977. prefix = "rgb(";
  12978. }
  12979. return prefix + rgba.join() + ")";
  12980. },
  12981. toHslaString: function() {
  12982. var prefix = "hsla(",
  12983. hsla = jQuery.map( this.hsla(), function( v, i ) {
  12984. if ( v == null ) {
  12985. v = i > 2 ? 1 : 0;
  12986. }
  12987. // catch 1 and 2
  12988. if ( i && i < 3 ) {
  12989. v = Math.round( v * 100 ) + "%";
  12990. }
  12991. return v;
  12992. });
  12993. if ( hsla[ 3 ] === 1 ) {
  12994. hsla.pop();
  12995. prefix = "hsl(";
  12996. }
  12997. return prefix + hsla.join() + ")";
  12998. },
  12999. toHexString: function( includeAlpha ) {
  13000. var rgba = this._rgba.slice(),
  13001. alpha = rgba.pop();
  13002. if ( includeAlpha ) {
  13003. rgba.push( ~~( alpha * 255 ) );
  13004. }
  13005. return "#" + jQuery.map( rgba, function( v ) {
  13006. // default to 0 when nulls exist
  13007. v = ( v || 0 ).toString( 16 );
  13008. return v.length === 1 ? "0" + v : v;
  13009. }).join("");
  13010. },
  13011. toString: function() {
  13012. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  13013. }
  13014. });
  13015. color.fn.parse.prototype = color.fn;
  13016. // hsla conversions adapted from:
  13017. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  13018. function hue2rgb( p, q, h ) {
  13019. h = ( h + 1 ) % 1;
  13020. if ( h * 6 < 1 ) {
  13021. return p + ( q - p ) * h * 6;
  13022. }
  13023. if ( h * 2 < 1) {
  13024. return q;
  13025. }
  13026. if ( h * 3 < 2 ) {
  13027. return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  13028. }
  13029. return p;
  13030. }
  13031. spaces.hsla.to = function( rgba ) {
  13032. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  13033. return [ null, null, null, rgba[ 3 ] ];
  13034. }
  13035. var r = rgba[ 0 ] / 255,
  13036. g = rgba[ 1 ] / 255,
  13037. b = rgba[ 2 ] / 255,
  13038. a = rgba[ 3 ],
  13039. max = Math.max( r, g, b ),
  13040. min = Math.min( r, g, b ),
  13041. diff = max - min,
  13042. add = max + min,
  13043. l = add * 0.5,
  13044. h, s;
  13045. if ( min === max ) {
  13046. h = 0;
  13047. } else if ( r === max ) {
  13048. h = ( 60 * ( g - b ) / diff ) + 360;
  13049. } else if ( g === max ) {
  13050. h = ( 60 * ( b - r ) / diff ) + 120;
  13051. } else {
  13052. h = ( 60 * ( r - g ) / diff ) + 240;
  13053. }
  13054. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  13055. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  13056. if ( diff === 0 ) {
  13057. s = 0;
  13058. } else if ( l <= 0.5 ) {
  13059. s = diff / add;
  13060. } else {
  13061. s = diff / ( 2 - add );
  13062. }
  13063. return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  13064. };
  13065. spaces.hsla.from = function( hsla ) {
  13066. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  13067. return [ null, null, null, hsla[ 3 ] ];
  13068. }
  13069. var h = hsla[ 0 ] / 360,
  13070. s = hsla[ 1 ],
  13071. l = hsla[ 2 ],
  13072. a = hsla[ 3 ],
  13073. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  13074. p = 2 * l - q;
  13075. return [
  13076. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  13077. Math.round( hue2rgb( p, q, h ) * 255 ),
  13078. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  13079. a
  13080. ];
  13081. };
  13082. each( spaces, function( spaceName, space ) {
  13083. var props = space.props,
  13084. cache = space.cache,
  13085. to = space.to,
  13086. from = space.from;
  13087. // makes rgba() and hsla()
  13088. color.fn[ spaceName ] = function( value ) {
  13089. // generate a cache for this space if it doesn't exist
  13090. if ( to && !this[ cache ] ) {
  13091. this[ cache ] = to( this._rgba );
  13092. }
  13093. if ( value === undefined ) {
  13094. return this[ cache ].slice();
  13095. }
  13096. var ret,
  13097. type = jQuery.type( value ),
  13098. arr = ( type === "array" || type === "object" ) ? value : arguments,
  13099. local = this[ cache ].slice();
  13100. each( props, function( key, prop ) {
  13101. var val = arr[ type === "object" ? key : prop.idx ];
  13102. if ( val == null ) {
  13103. val = local[ prop.idx ];
  13104. }
  13105. local[ prop.idx ] = clamp( val, prop );
  13106. });
  13107. if ( from ) {
  13108. ret = color( from( local ) );
  13109. ret[ cache ] = local;
  13110. return ret;
  13111. } else {
  13112. return color( local );
  13113. }
  13114. };
  13115. // makes red() green() blue() alpha() hue() saturation() lightness()
  13116. each( props, function( key, prop ) {
  13117. // alpha is included in more than one space
  13118. if ( color.fn[ key ] ) {
  13119. return;
  13120. }
  13121. color.fn[ key ] = function( value ) {
  13122. var vtype = jQuery.type( value ),
  13123. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  13124. local = this[ fn ](),
  13125. cur = local[ prop.idx ],
  13126. match;
  13127. if ( vtype === "undefined" ) {
  13128. return cur;
  13129. }
  13130. if ( vtype === "function" ) {
  13131. value = value.call( this, cur );
  13132. vtype = jQuery.type( value );
  13133. }
  13134. if ( value == null && prop.empty ) {
  13135. return this;
  13136. }
  13137. if ( vtype === "string" ) {
  13138. match = rplusequals.exec( value );
  13139. if ( match ) {
  13140. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  13141. }
  13142. }
  13143. local[ prop.idx ] = value;
  13144. return this[ fn ]( local );
  13145. };
  13146. });
  13147. });
  13148. // add cssHook and .fx.step function for each named hook.
  13149. // accept a space separated string of properties
  13150. color.hook = function( hook ) {
  13151. var hooks = hook.split( " " );
  13152. each( hooks, function( i, hook ) {
  13153. jQuery.cssHooks[ hook ] = {
  13154. set: function( elem, value ) {
  13155. var parsed, curElem,
  13156. backgroundColor = "";
  13157. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  13158. value = color( parsed || value );
  13159. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  13160. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  13161. while (
  13162. (backgroundColor === "" || backgroundColor === "transparent") &&
  13163. curElem && curElem.style
  13164. ) {
  13165. try {
  13166. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  13167. curElem = curElem.parentNode;
  13168. } catch ( e ) {
  13169. }
  13170. }
  13171. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  13172. backgroundColor :
  13173. "_default" );
  13174. }
  13175. value = value.toRgbaString();
  13176. }
  13177. try {
  13178. elem.style[ hook ] = value;
  13179. } catch ( e ) {
  13180. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  13181. }
  13182. }
  13183. };
  13184. jQuery.fx.step[ hook ] = function( fx ) {
  13185. if ( !fx.colorInit ) {
  13186. fx.start = color( fx.elem, hook );
  13187. fx.end = color( fx.end );
  13188. fx.colorInit = true;
  13189. }
  13190. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  13191. };
  13192. });
  13193. };
  13194. color.hook( stepHooks );
  13195. jQuery.cssHooks.borderColor = {
  13196. expand: function( value ) {
  13197. var expanded = {};
  13198. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  13199. expanded[ "border" + part + "Color" ] = value;
  13200. });
  13201. return expanded;
  13202. }
  13203. };
  13204. // Basic color names only.
  13205. // Usage of any of the other color names requires adding yourself or including
  13206. // jquery.color.svg-names.js.
  13207. colors = jQuery.Color.names = {
  13208. // 4.1. Basic color keywords
  13209. aqua: "#00ffff",
  13210. black: "#000000",
  13211. blue: "#0000ff",
  13212. fuchsia: "#ff00ff",
  13213. gray: "#808080",
  13214. green: "#008000",
  13215. lime: "#00ff00",
  13216. maroon: "#800000",
  13217. navy: "#000080",
  13218. olive: "#808000",
  13219. purple: "#800080",
  13220. red: "#ff0000",
  13221. silver: "#c0c0c0",
  13222. teal: "#008080",
  13223. white: "#ffffff",
  13224. yellow: "#ffff00",
  13225. // 4.2.3. "transparent" color keyword
  13226. transparent: [ null, null, null, 0 ],
  13227. _default: "#ffffff"
  13228. };
  13229. })( jQuery );
  13230. /******************************************************************************/
  13231. /****************************** CLASS ANIMATIONS ******************************/
  13232. /******************************************************************************/
  13233. (function() {
  13234. var classAnimationActions = [ "add", "remove", "toggle" ],
  13235. shorthandStyles = {
  13236. border: 1,
  13237. borderBottom: 1,
  13238. borderColor: 1,
  13239. borderLeft: 1,
  13240. borderRight: 1,
  13241. borderTop: 1,
  13242. borderWidth: 1,
  13243. margin: 1,
  13244. padding: 1
  13245. };
  13246. $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
  13247. $.fx.step[ prop ] = function( fx ) {
  13248. if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  13249. jQuery.style( fx.elem, prop, fx.end );
  13250. fx.setAttr = true;
  13251. }
  13252. };
  13253. });
  13254. function getElementStyles( elem ) {
  13255. var key, len,
  13256. style = elem.ownerDocument.defaultView ?
  13257. elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  13258. elem.currentStyle,
  13259. styles = {};
  13260. if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  13261. len = style.length;
  13262. while ( len-- ) {
  13263. key = style[ len ];
  13264. if ( typeof style[ key ] === "string" ) {
  13265. styles[ $.camelCase( key ) ] = style[ key ];
  13266. }
  13267. }
  13268. // support: Opera, IE <9
  13269. } else {
  13270. for ( key in style ) {
  13271. if ( typeof style[ key ] === "string" ) {
  13272. styles[ key ] = style[ key ];
  13273. }
  13274. }
  13275. }
  13276. return styles;
  13277. }
  13278. function styleDifference( oldStyle, newStyle ) {
  13279. var diff = {},
  13280. name, value;
  13281. for ( name in newStyle ) {
  13282. value = newStyle[ name ];
  13283. if ( oldStyle[ name ] !== value ) {
  13284. if ( !shorthandStyles[ name ] ) {
  13285. if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  13286. diff[ name ] = value;
  13287. }
  13288. }
  13289. }
  13290. }
  13291. return diff;
  13292. }
  13293. // support: jQuery <1.8
  13294. if ( !$.fn.addBack ) {
  13295. $.fn.addBack = function( selector ) {
  13296. return this.add( selector == null ?
  13297. this.prevObject : this.prevObject.filter( selector )
  13298. );
  13299. };
  13300. }
  13301. $.effects.animateClass = function( value, duration, easing, callback ) {
  13302. var o = $.speed( duration, easing, callback );
  13303. return this.queue( function() {
  13304. var animated = $( this ),
  13305. baseClass = animated.attr( "class" ) || "",
  13306. applyClassChange,
  13307. allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  13308. // map the animated objects to store the original styles.
  13309. allAnimations = allAnimations.map(function() {
  13310. var el = $( this );
  13311. return {
  13312. el: el,
  13313. start: getElementStyles( this )
  13314. };
  13315. });
  13316. // apply class change
  13317. applyClassChange = function() {
  13318. $.each( classAnimationActions, function(i, action) {
  13319. if ( value[ action ] ) {
  13320. animated[ action + "Class" ]( value[ action ] );
  13321. }
  13322. });
  13323. };
  13324. applyClassChange();
  13325. // map all animated objects again - calculate new styles and diff
  13326. allAnimations = allAnimations.map(function() {
  13327. this.end = getElementStyles( this.el[ 0 ] );
  13328. this.diff = styleDifference( this.start, this.end );
  13329. return this;
  13330. });
  13331. // apply original class
  13332. animated.attr( "class", baseClass );
  13333. // map all animated objects again - this time collecting a promise
  13334. allAnimations = allAnimations.map(function() {
  13335. var styleInfo = this,
  13336. dfd = $.Deferred(),
  13337. opts = $.extend({}, o, {
  13338. queue: false,
  13339. complete: function() {
  13340. dfd.resolve( styleInfo );
  13341. }
  13342. });
  13343. this.el.animate( this.diff, opts );
  13344. return dfd.promise();
  13345. });
  13346. // once all animations have completed:
  13347. $.when.apply( $, allAnimations.get() ).done(function() {
  13348. // set the final class
  13349. applyClassChange();
  13350. // for each animated element,
  13351. // clear all css properties that were animated
  13352. $.each( arguments, function() {
  13353. var el = this.el;
  13354. $.each( this.diff, function(key) {
  13355. el.css( key, "" );
  13356. });
  13357. });
  13358. // this is guarnteed to be there if you use jQuery.speed()
  13359. // it also handles dequeuing the next anim...
  13360. o.complete.call( animated[ 0 ] );
  13361. });
  13362. });
  13363. };
  13364. $.fn.extend({
  13365. addClass: (function( orig ) {
  13366. return function( classNames, speed, easing, callback ) {
  13367. return speed ?
  13368. $.effects.animateClass.call( this,
  13369. { add: classNames }, speed, easing, callback ) :
  13370. orig.apply( this, arguments );
  13371. };
  13372. })( $.fn.addClass ),
  13373. removeClass: (function( orig ) {
  13374. return function( classNames, speed, easing, callback ) {
  13375. return arguments.length > 1 ?
  13376. $.effects.animateClass.call( this,
  13377. { remove: classNames }, speed, easing, callback ) :
  13378. orig.apply( this, arguments );
  13379. };
  13380. })( $.fn.removeClass ),
  13381. toggleClass: (function( orig ) {
  13382. return function( classNames, force, speed, easing, callback ) {
  13383. if ( typeof force === "boolean" || force === undefined ) {
  13384. if ( !speed ) {
  13385. // without speed parameter
  13386. return orig.apply( this, arguments );
  13387. } else {
  13388. return $.effects.animateClass.call( this,
  13389. (force ? { add: classNames } : { remove: classNames }),
  13390. speed, easing, callback );
  13391. }
  13392. } else {
  13393. // without force parameter
  13394. return $.effects.animateClass.call( this,
  13395. { toggle: classNames }, force, speed, easing );
  13396. }
  13397. };
  13398. })( $.fn.toggleClass ),
  13399. switchClass: function( remove, add, speed, easing, callback) {
  13400. return $.effects.animateClass.call( this, {
  13401. add: add,
  13402. remove: remove
  13403. }, speed, easing, callback );
  13404. }
  13405. });
  13406. })();
  13407. /******************************************************************************/
  13408. /*********************************** EFFECTS **********************************/
  13409. /******************************************************************************/
  13410. (function() {
  13411. $.extend( $.effects, {
  13412. version: "1.11.4",
  13413. // Saves a set of properties in a data storage
  13414. save: function( element, set ) {
  13415. for ( var i = 0; i < set.length; i++ ) {
  13416. if ( set[ i ] !== null ) {
  13417. element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  13418. }
  13419. }
  13420. },
  13421. // Restores a set of previously saved properties from a data storage
  13422. restore: function( element, set ) {
  13423. var val, i;
  13424. for ( i = 0; i < set.length; i++ ) {
  13425. if ( set[ i ] !== null ) {
  13426. val = element.data( dataSpace + set[ i ] );
  13427. // support: jQuery 1.6.2
  13428. // http://bugs.jquery.com/ticket/9917
  13429. // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
  13430. // We can't differentiate between "" and 0 here, so we just assume
  13431. // empty string since it's likely to be a more common value...
  13432. if ( val === undefined ) {
  13433. val = "";
  13434. }
  13435. element.css( set[ i ], val );
  13436. }
  13437. }
  13438. },
  13439. setMode: function( el, mode ) {
  13440. if (mode === "toggle") {
  13441. mode = el.is( ":hidden" ) ? "show" : "hide";
  13442. }
  13443. return mode;
  13444. },
  13445. // Translates a [top,left] array into a baseline value
  13446. // this should be a little more flexible in the future to handle a string & hash
  13447. getBaseline: function( origin, original ) {
  13448. var y, x;
  13449. switch ( origin[ 0 ] ) {
  13450. case "top": y = 0; break;
  13451. case "middle": y = 0.5; break;
  13452. case "bottom": y = 1; break;
  13453. default: y = origin[ 0 ] / original.height;
  13454. }
  13455. switch ( origin[ 1 ] ) {
  13456. case "left": x = 0; break;
  13457. case "center": x = 0.5; break;
  13458. case "right": x = 1; break;
  13459. default: x = origin[ 1 ] / original.width;
  13460. }
  13461. return {
  13462. x: x,
  13463. y: y
  13464. };
  13465. },
  13466. // Wraps the element around a wrapper that copies position properties
  13467. createWrapper: function( element ) {
  13468. // if the element is already wrapped, return it
  13469. if ( element.parent().is( ".ui-effects-wrapper" )) {
  13470. return element.parent();
  13471. }
  13472. // wrap the element
  13473. var props = {
  13474. width: element.outerWidth(true),
  13475. height: element.outerHeight(true),
  13476. "float": element.css( "float" )
  13477. },
  13478. wrapper = $( "<div></div>" )
  13479. .addClass( "ui-effects-wrapper" )
  13480. .css({
  13481. fontSize: "100%",
  13482. background: "transparent",
  13483. border: "none",
  13484. margin: 0,
  13485. padding: 0
  13486. }),
  13487. // Store the size in case width/height are defined in % - Fixes #5245
  13488. size = {
  13489. width: element.width(),
  13490. height: element.height()
  13491. },
  13492. active = document.activeElement;
  13493. // support: Firefox
  13494. // Firefox incorrectly exposes anonymous content
  13495. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  13496. try {
  13497. active.id;
  13498. } catch ( e ) {
  13499. active = document.body;
  13500. }
  13501. element.wrap( wrapper );
  13502. // Fixes #7595 - Elements lose focus when wrapped.
  13503. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  13504. $( active ).focus();
  13505. }
  13506. wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
  13507. // transfer positioning properties to the wrapper
  13508. if ( element.css( "position" ) === "static" ) {
  13509. wrapper.css({ position: "relative" });
  13510. element.css({ position: "relative" });
  13511. } else {
  13512. $.extend( props, {
  13513. position: element.css( "position" ),
  13514. zIndex: element.css( "z-index" )
  13515. });
  13516. $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
  13517. props[ pos ] = element.css( pos );
  13518. if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  13519. props[ pos ] = "auto";
  13520. }
  13521. });
  13522. element.css({
  13523. position: "relative",
  13524. top: 0,
  13525. left: 0,
  13526. right: "auto",
  13527. bottom: "auto"
  13528. });
  13529. }
  13530. element.css(size);
  13531. return wrapper.css( props ).show();
  13532. },
  13533. removeWrapper: function( element ) {
  13534. var active = document.activeElement;
  13535. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  13536. element.parent().replaceWith( element );
  13537. // Fixes #7595 - Elements lose focus when wrapped.
  13538. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  13539. $( active ).focus();
  13540. }
  13541. }
  13542. return element;
  13543. },
  13544. setTransition: function( element, list, factor, value ) {
  13545. value = value || {};
  13546. $.each( list, function( i, x ) {
  13547. var unit = element.cssUnit( x );
  13548. if ( unit[ 0 ] > 0 ) {
  13549. value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  13550. }
  13551. });
  13552. return value;
  13553. }
  13554. });
  13555. // return an effect options object for the given parameters:
  13556. function _normalizeArguments( effect, options, speed, callback ) {
  13557. // allow passing all options as the first parameter
  13558. if ( $.isPlainObject( effect ) ) {
  13559. options = effect;
  13560. effect = effect.effect;
  13561. }
  13562. // convert to an object
  13563. effect = { effect: effect };
  13564. // catch (effect, null, ...)
  13565. if ( options == null ) {
  13566. options = {};
  13567. }
  13568. // catch (effect, callback)
  13569. if ( $.isFunction( options ) ) {
  13570. callback = options;
  13571. speed = null;
  13572. options = {};
  13573. }
  13574. // catch (effect, speed, ?)
  13575. if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  13576. callback = speed;
  13577. speed = options;
  13578. options = {};
  13579. }
  13580. // catch (effect, options, callback)
  13581. if ( $.isFunction( speed ) ) {
  13582. callback = speed;
  13583. speed = null;
  13584. }
  13585. // add options to effect
  13586. if ( options ) {
  13587. $.extend( effect, options );
  13588. }
  13589. speed = speed || options.duration;
  13590. effect.duration = $.fx.off ? 0 :
  13591. typeof speed === "number" ? speed :
  13592. speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  13593. $.fx.speeds._default;
  13594. effect.complete = callback || options.complete;
  13595. return effect;
  13596. }
  13597. function standardAnimationOption( option ) {
  13598. // Valid standard speeds (nothing, number, named speed)
  13599. if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  13600. return true;
  13601. }
  13602. // Invalid strings - treat as "normal" speed
  13603. if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  13604. return true;
  13605. }
  13606. // Complete callback
  13607. if ( $.isFunction( option ) ) {
  13608. return true;
  13609. }
  13610. // Options hash (but not naming an effect)
  13611. if ( typeof option === "object" && !option.effect ) {
  13612. return true;
  13613. }
  13614. // Didn't match any standard API
  13615. return false;
  13616. }
  13617. $.fn.extend({
  13618. effect: function( /* effect, options, speed, callback */ ) {
  13619. var args = _normalizeArguments.apply( this, arguments ),
  13620. mode = args.mode,
  13621. queue = args.queue,
  13622. effectMethod = $.effects.effect[ args.effect ];
  13623. if ( $.fx.off || !effectMethod ) {
  13624. // delegate to the original method (e.g., .show()) if possible
  13625. if ( mode ) {
  13626. return this[ mode ]( args.duration, args.complete );
  13627. } else {
  13628. return this.each( function() {
  13629. if ( args.complete ) {
  13630. args.complete.call( this );
  13631. }
  13632. });
  13633. }
  13634. }
  13635. function run( next ) {
  13636. var elem = $( this ),
  13637. complete = args.complete,
  13638. mode = args.mode;
  13639. function done() {
  13640. if ( $.isFunction( complete ) ) {
  13641. complete.call( elem[0] );
  13642. }
  13643. if ( $.isFunction( next ) ) {
  13644. next();
  13645. }
  13646. }
  13647. // If the element already has the correct final state, delegate to
  13648. // the core methods so the internal tracking of "olddisplay" works.
  13649. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  13650. elem[ mode ]();
  13651. done();
  13652. } else {
  13653. effectMethod.call( elem[0], args, done );
  13654. }
  13655. }
  13656. return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
  13657. },
  13658. show: (function( orig ) {
  13659. return function( option ) {
  13660. if ( standardAnimationOption( option ) ) {
  13661. return orig.apply( this, arguments );
  13662. } else {
  13663. var args = _normalizeArguments.apply( this, arguments );
  13664. args.mode = "show";
  13665. return this.effect.call( this, args );
  13666. }
  13667. };
  13668. })( $.fn.show ),
  13669. hide: (function( orig ) {
  13670. return function( option ) {
  13671. if ( standardAnimationOption( option ) ) {
  13672. return orig.apply( this, arguments );
  13673. } else {
  13674. var args = _normalizeArguments.apply( this, arguments );
  13675. args.mode = "hide";
  13676. return this.effect.call( this, args );
  13677. }
  13678. };
  13679. })( $.fn.hide ),
  13680. toggle: (function( orig ) {
  13681. return function( option ) {
  13682. if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  13683. return orig.apply( this, arguments );
  13684. } else {
  13685. var args = _normalizeArguments.apply( this, arguments );
  13686. args.mode = "toggle";
  13687. return this.effect.call( this, args );
  13688. }
  13689. };
  13690. })( $.fn.toggle ),
  13691. // helper functions
  13692. cssUnit: function(key) {
  13693. var style = this.css( key ),
  13694. val = [];
  13695. $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  13696. if ( style.indexOf( unit ) > 0 ) {
  13697. val = [ parseFloat( style ), unit ];
  13698. }
  13699. });
  13700. return val;
  13701. }
  13702. });
  13703. })();
  13704. /******************************************************************************/
  13705. /*********************************** EASING ***********************************/
  13706. /******************************************************************************/
  13707. (function() {
  13708. // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  13709. var baseEasings = {};
  13710. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  13711. baseEasings[ name ] = function( p ) {
  13712. return Math.pow( p, i + 2 );
  13713. };
  13714. });
  13715. $.extend( baseEasings, {
  13716. Sine: function( p ) {
  13717. return 1 - Math.cos( p * Math.PI / 2 );
  13718. },
  13719. Circ: function( p ) {
  13720. return 1 - Math.sqrt( 1 - p * p );
  13721. },
  13722. Elastic: function( p ) {
  13723. return p === 0 || p === 1 ? p :
  13724. -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
  13725. },
  13726. Back: function( p ) {
  13727. return p * p * ( 3 * p - 2 );
  13728. },
  13729. Bounce: function( p ) {
  13730. var pow2,
  13731. bounce = 4;
  13732. while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  13733. return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  13734. }
  13735. });
  13736. $.each( baseEasings, function( name, easeIn ) {
  13737. $.easing[ "easeIn" + name ] = easeIn;
  13738. $.easing[ "easeOut" + name ] = function( p ) {
  13739. return 1 - easeIn( 1 - p );
  13740. };
  13741. $.easing[ "easeInOut" + name ] = function( p ) {
  13742. return p < 0.5 ?
  13743. easeIn( p * 2 ) / 2 :
  13744. 1 - easeIn( p * -2 + 2 ) / 2;
  13745. };
  13746. });
  13747. })();
  13748. var effect = $.effects;
  13749. /*!
  13750. * jQuery UI Effects Slide 1.11.4
  13751. * http://jqueryui.com
  13752. *
  13753. * Copyright jQuery Foundation and other contributors
  13754. * Released under the MIT license.
  13755. * http://jquery.org/license
  13756. *
  13757. * http://api.jqueryui.com/slide-effect/
  13758. */
  13759. /*var effectSlide = $.effects.effect.slide = function( o, done ) {
  13760. // Create element
  13761. var el = $( this ),
  13762. props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
  13763. mode = $.effects.setMode( el, o.mode || "show" ),
  13764. show = mode === "show",
  13765. direction = o.direction || "left",
  13766. ref = (direction === "up" || direction === "down") ? "top" : "left",
  13767. positiveMotion = (direction === "up" || direction === "left"),
  13768. distance,
  13769. animation = {};
  13770. // Adjust
  13771. $.effects.save( el, props );
  13772. el.show();
  13773. distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
  13774. $.effects.createWrapper( el ).css({
  13775. overflow: "hidden"
  13776. });
  13777. if ( show ) {
  13778. el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
  13779. }
  13780. // Animation
  13781. animation[ ref ] = ( show ?
  13782. ( positiveMotion ? "+=" : "-=") :
  13783. ( positiveMotion ? "-=" : "+=")) +
  13784. distance;
  13785. // Animate
  13786. el.animate( animation, {
  13787. queue: false,
  13788. duration: o.duration,
  13789. easing: o.easing,
  13790. complete: function() {
  13791. if ( mode === "hide" ) {
  13792. el.hide();
  13793. }
  13794. $.effects.restore( el, props );
  13795. $.effects.removeWrapper( el );
  13796. done();
  13797. }
  13798. });
  13799. };
  13800. */
  13801. }));
  13802. /**!
  13803. * @fileOverview Kickass library to create and place poppers near their reference elements.
  13804. * @version 1.16.1
  13805. * @license
  13806. * Copyright (c) 2016 Federico Zivolo and contributors
  13807. *
  13808. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13809. * of this software and associated documentation files (the "Software"), to deal
  13810. * in the Software without restriction, including without limitation the rights
  13811. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13812. * copies of the Software, and to permit persons to whom the Software is
  13813. * furnished to do so, subject to the following conditions:
  13814. *
  13815. * The above copyright notice and this permission notice shall be included in all
  13816. * copies or substantial portions of the Software.
  13817. *
  13818. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13819. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13820. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13821. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13822. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13823. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  13824. * SOFTWARE.
  13825. */
  13826. (function (global, factory) {
  13827. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  13828. typeof define === 'function' && define.amd ? define(factory) :
  13829. (global.Popper = factory());
  13830. }(this, (function () { 'use strict';
  13831. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  13832. var timeoutDuration = function () {
  13833. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  13834. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  13835. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  13836. return 1;
  13837. }
  13838. }
  13839. return 0;
  13840. }();
  13841. function microtaskDebounce(fn) {
  13842. var called = false;
  13843. return function () {
  13844. if (called) {
  13845. return;
  13846. }
  13847. called = true;
  13848. window.Promise.resolve().then(function () {
  13849. called = false;
  13850. fn();
  13851. });
  13852. };
  13853. }
  13854. function taskDebounce(fn) {
  13855. var scheduled = false;
  13856. return function () {
  13857. if (!scheduled) {
  13858. scheduled = true;
  13859. setTimeout(function () {
  13860. scheduled = false;
  13861. fn();
  13862. }, timeoutDuration);
  13863. }
  13864. };
  13865. }
  13866. var supportsMicroTasks = isBrowser && window.Promise;
  13867. /**
  13868. * Create a debounced version of a method, that's asynchronously deferred
  13869. * but called in the minimum time possible.
  13870. *
  13871. * @method
  13872. * @memberof Popper.Utils
  13873. * @argument {Function} fn
  13874. * @returns {Function}
  13875. */
  13876. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  13877. /**
  13878. * Check if the given variable is a function
  13879. * @method
  13880. * @memberof Popper.Utils
  13881. * @argument {Any} functionToCheck - variable to check
  13882. * @returns {Boolean} answer to: is a function?
  13883. */
  13884. function isFunction(functionToCheck) {
  13885. var getType = {};
  13886. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  13887. }
  13888. /**
  13889. * Get CSS computed property of the given element
  13890. * @method
  13891. * @memberof Popper.Utils
  13892. * @argument {Eement} element
  13893. * @argument {String} property
  13894. */
  13895. function getStyleComputedProperty(element, property) {
  13896. if (element.nodeType !== 1) {
  13897. return [];
  13898. }
  13899. // NOTE: 1 DOM access here
  13900. var window = element.ownerDocument.defaultView;
  13901. var css = window.getComputedStyle(element, null);
  13902. return property ? css[property] : css;
  13903. }
  13904. /**
  13905. * Returns the parentNode or the host of the element
  13906. * @method
  13907. * @memberof Popper.Utils
  13908. * @argument {Element} element
  13909. * @returns {Element} parent
  13910. */
  13911. function getParentNode(element) {
  13912. if (element.nodeName === 'HTML') {
  13913. return element;
  13914. }
  13915. return element.parentNode || element.host;
  13916. }
  13917. /**
  13918. * Returns the scrolling parent of the given element
  13919. * @method
  13920. * @memberof Popper.Utils
  13921. * @argument {Element} element
  13922. * @returns {Element} scroll parent
  13923. */
  13924. function getScrollParent(element) {
  13925. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  13926. if (!element) {
  13927. return document.body;
  13928. }
  13929. switch (element.nodeName) {
  13930. case 'HTML':
  13931. case 'BODY':
  13932. return element.ownerDocument.body;
  13933. case '#document':
  13934. return element.body;
  13935. }
  13936. // Firefox want us to check `-x` and `-y` variations as well
  13937. var _getStyleComputedProp = getStyleComputedProperty(element),
  13938. overflow = _getStyleComputedProp.overflow,
  13939. overflowX = _getStyleComputedProp.overflowX,
  13940. overflowY = _getStyleComputedProp.overflowY;
  13941. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  13942. return element;
  13943. }
  13944. return getScrollParent(getParentNode(element));
  13945. }
  13946. /**
  13947. * Returns the reference node of the reference object, or the reference object itself.
  13948. * @method
  13949. * @memberof Popper.Utils
  13950. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  13951. * @returns {Element} parent
  13952. */
  13953. function getReferenceNode(reference) {
  13954. return reference && reference.referenceNode ? reference.referenceNode : reference;
  13955. }
  13956. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  13957. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  13958. /**
  13959. * Determines if the browser is Internet Explorer
  13960. * @method
  13961. * @memberof Popper.Utils
  13962. * @param {Number} version to check
  13963. * @returns {Boolean} isIE
  13964. */
  13965. function isIE(version) {
  13966. if (version === 11) {
  13967. return isIE11;
  13968. }
  13969. if (version === 10) {
  13970. return isIE10;
  13971. }
  13972. return isIE11 || isIE10;
  13973. }
  13974. /**
  13975. * Returns the offset parent of the given element
  13976. * @method
  13977. * @memberof Popper.Utils
  13978. * @argument {Element} element
  13979. * @returns {Element} offset parent
  13980. */
  13981. function getOffsetParent(element) {
  13982. if (!element) {
  13983. return document.documentElement;
  13984. }
  13985. var noOffsetParent = isIE(10) ? document.body : null;
  13986. // NOTE: 1 DOM access here
  13987. var offsetParent = element.offsetParent || null;
  13988. // Skip hidden elements which don't have an offsetParent
  13989. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  13990. offsetParent = (element = element.nextElementSibling).offsetParent;
  13991. }
  13992. var nodeName = offsetParent && offsetParent.nodeName;
  13993. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  13994. return element ? element.ownerDocument.documentElement : document.documentElement;
  13995. }
  13996. // .offsetParent will return the closest TH, TD or TABLE in case
  13997. // no offsetParent is present, I hate this job...
  13998. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  13999. return getOffsetParent(offsetParent);
  14000. }
  14001. return offsetParent;
  14002. }
  14003. function isOffsetContainer(element) {
  14004. var nodeName = element.nodeName;
  14005. if (nodeName === 'BODY') {
  14006. return false;
  14007. }
  14008. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  14009. }
  14010. /**
  14011. * Finds the root node (document, shadowDOM root) of the given element
  14012. * @method
  14013. * @memberof Popper.Utils
  14014. * @argument {Element} node
  14015. * @returns {Element} root node
  14016. */
  14017. function getRoot(node) {
  14018. if (node.parentNode !== null) {
  14019. return getRoot(node.parentNode);
  14020. }
  14021. return node;
  14022. }
  14023. /**
  14024. * Finds the offset parent common to the two provided nodes
  14025. * @method
  14026. * @memberof Popper.Utils
  14027. * @argument {Element} element1
  14028. * @argument {Element} element2
  14029. * @returns {Element} common offset parent
  14030. */
  14031. function findCommonOffsetParent(element1, element2) {
  14032. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  14033. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  14034. return document.documentElement;
  14035. }
  14036. // Here we make sure to give as "start" the element that comes first in the DOM
  14037. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  14038. var start = order ? element1 : element2;
  14039. var end = order ? element2 : element1;
  14040. // Get common ancestor container
  14041. var range = document.createRange();
  14042. range.setStart(start, 0);
  14043. range.setEnd(end, 0);
  14044. var commonAncestorContainer = range.commonAncestorContainer;
  14045. // Both nodes are inside #document
  14046. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  14047. if (isOffsetContainer(commonAncestorContainer)) {
  14048. return commonAncestorContainer;
  14049. }
  14050. return getOffsetParent(commonAncestorContainer);
  14051. }
  14052. // one of the nodes is inside shadowDOM, find which one
  14053. var element1root = getRoot(element1);
  14054. if (element1root.host) {
  14055. return findCommonOffsetParent(element1root.host, element2);
  14056. } else {
  14057. return findCommonOffsetParent(element1, getRoot(element2).host);
  14058. }
  14059. }
  14060. /**
  14061. * Gets the scroll value of the given element in the given side (top and left)
  14062. * @method
  14063. * @memberof Popper.Utils
  14064. * @argument {Element} element
  14065. * @argument {String} side `top` or `left`
  14066. * @returns {number} amount of scrolled pixels
  14067. */
  14068. function getScroll(element) {
  14069. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  14070. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  14071. var nodeName = element.nodeName;
  14072. if (nodeName === 'BODY' || nodeName === 'HTML') {
  14073. var html = element.ownerDocument.documentElement;
  14074. var scrollingElement = element.ownerDocument.scrollingElement || html;
  14075. return scrollingElement[upperSide];
  14076. }
  14077. return element[upperSide];
  14078. }
  14079. /*
  14080. * Sum or subtract the element scroll values (left and top) from a given rect object
  14081. * @method
  14082. * @memberof Popper.Utils
  14083. * @param {Object} rect - Rect object you want to change
  14084. * @param {HTMLElement} element - The element from the function reads the scroll values
  14085. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  14086. * @return {Object} rect - The modifier rect object
  14087. */
  14088. function includeScroll(rect, element) {
  14089. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  14090. var scrollTop = getScroll(element, 'top');
  14091. var scrollLeft = getScroll(element, 'left');
  14092. var modifier = subtract ? -1 : 1;
  14093. rect.top += scrollTop * modifier;
  14094. rect.bottom += scrollTop * modifier;
  14095. rect.left += scrollLeft * modifier;
  14096. rect.right += scrollLeft * modifier;
  14097. return rect;
  14098. }
  14099. /*
  14100. * Helper to detect borders of a given element
  14101. * @method
  14102. * @memberof Popper.Utils
  14103. * @param {CSSStyleDeclaration} styles
  14104. * Result of `getStyleComputedProperty` on the given element
  14105. * @param {String} axis - `x` or `y`
  14106. * @return {number} borders - The borders size of the given axis
  14107. */
  14108. function getBordersSize(styles, axis) {
  14109. var sideA = axis === 'x' ? 'Left' : 'Top';
  14110. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  14111. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  14112. }
  14113. function getSize(axis, body, html, computedStyle) {
  14114. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  14115. }
  14116. function getWindowSizes(document) {
  14117. var body = document.body;
  14118. var html = document.documentElement;
  14119. var computedStyle = isIE(10) && getComputedStyle(html);
  14120. return {
  14121. height: getSize('Height', body, html, computedStyle),
  14122. width: getSize('Width', body, html, computedStyle)
  14123. };
  14124. }
  14125. var classCallCheck = function (instance, Constructor) {
  14126. if (!(instance instanceof Constructor)) {
  14127. throw new TypeError("Cannot call a class as a function");
  14128. }
  14129. };
  14130. var createClass = function () {
  14131. function defineProperties(target, props) {
  14132. for (var i = 0; i < props.length; i++) {
  14133. var descriptor = props[i];
  14134. descriptor.enumerable = descriptor.enumerable || false;
  14135. descriptor.configurable = true;
  14136. if ("value" in descriptor) descriptor.writable = true;
  14137. Object.defineProperty(target, descriptor.key, descriptor);
  14138. }
  14139. }
  14140. return function (Constructor, protoProps, staticProps) {
  14141. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  14142. if (staticProps) defineProperties(Constructor, staticProps);
  14143. return Constructor;
  14144. };
  14145. }();
  14146. var defineProperty = function (obj, key, value) {
  14147. if (key in obj) {
  14148. Object.defineProperty(obj, key, {
  14149. value: value,
  14150. enumerable: true,
  14151. configurable: true,
  14152. writable: true
  14153. });
  14154. } else {
  14155. obj[key] = value;
  14156. }
  14157. return obj;
  14158. };
  14159. var _extends = Object.assign || function (target) {
  14160. for (var i = 1; i < arguments.length; i++) {
  14161. var source = arguments[i];
  14162. for (var key in source) {
  14163. if (Object.prototype.hasOwnProperty.call(source, key)) {
  14164. target[key] = source[key];
  14165. }
  14166. }
  14167. }
  14168. return target;
  14169. };
  14170. /**
  14171. * Given element offsets, generate an output similar to getBoundingClientRect
  14172. * @method
  14173. * @memberof Popper.Utils
  14174. * @argument {Object} offsets
  14175. * @returns {Object} ClientRect like output
  14176. */
  14177. function getClientRect(offsets) {
  14178. return _extends({}, offsets, {
  14179. right: offsets.left + offsets.width,
  14180. bottom: offsets.top + offsets.height
  14181. });
  14182. }
  14183. /**
  14184. * Get bounding client rect of given element
  14185. * @method
  14186. * @memberof Popper.Utils
  14187. * @param {HTMLElement} element
  14188. * @return {Object} client rect
  14189. */
  14190. function getBoundingClientRect(element) {
  14191. var rect = {};
  14192. // IE10 10 FIX: Please, don't ask, the element isn't
  14193. // considered in DOM in some circumstances...
  14194. // This isn't reproducible in IE10 compatibility mode of IE11
  14195. try {
  14196. if (isIE(10)) {
  14197. rect = element.getBoundingClientRect();
  14198. var scrollTop = getScroll(element, 'top');
  14199. var scrollLeft = getScroll(element, 'left');
  14200. rect.top += scrollTop;
  14201. rect.left += scrollLeft;
  14202. rect.bottom += scrollTop;
  14203. rect.right += scrollLeft;
  14204. } else {
  14205. rect = element.getBoundingClientRect();
  14206. }
  14207. } catch (e) {}
  14208. var result = {
  14209. left: rect.left,
  14210. top: rect.top,
  14211. width: rect.right - rect.left,
  14212. height: rect.bottom - rect.top
  14213. };
  14214. // subtract scrollbar size from sizes
  14215. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  14216. var width = sizes.width || element.clientWidth || result.width;
  14217. var height = sizes.height || element.clientHeight || result.height;
  14218. var horizScrollbar = element.offsetWidth - width;
  14219. var vertScrollbar = element.offsetHeight - height;
  14220. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  14221. // we make this check conditional for performance reasons
  14222. if (horizScrollbar || vertScrollbar) {
  14223. var styles = getStyleComputedProperty(element);
  14224. horizScrollbar -= getBordersSize(styles, 'x');
  14225. vertScrollbar -= getBordersSize(styles, 'y');
  14226. result.width -= horizScrollbar;
  14227. result.height -= vertScrollbar;
  14228. }
  14229. return getClientRect(result);
  14230. }
  14231. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  14232. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  14233. var isIE10 = isIE(10);
  14234. var isHTML = parent.nodeName === 'HTML';
  14235. var childrenRect = getBoundingClientRect(children);
  14236. var parentRect = getBoundingClientRect(parent);
  14237. var scrollParent = getScrollParent(children);
  14238. var styles = getStyleComputedProperty(parent);
  14239. var borderTopWidth = parseFloat(styles.borderTopWidth);
  14240. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  14241. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  14242. if (fixedPosition && isHTML) {
  14243. parentRect.top = Math.max(parentRect.top, 0);
  14244. parentRect.left = Math.max(parentRect.left, 0);
  14245. }
  14246. var offsets = getClientRect({
  14247. top: childrenRect.top - parentRect.top - borderTopWidth,
  14248. left: childrenRect.left - parentRect.left - borderLeftWidth,
  14249. width: childrenRect.width,
  14250. height: childrenRect.height
  14251. });
  14252. offsets.marginTop = 0;
  14253. offsets.marginLeft = 0;
  14254. // Subtract margins of documentElement in case it's being used as parent
  14255. // we do this only on HTML because it's the only element that behaves
  14256. // differently when margins are applied to it. The margins are included in
  14257. // the box of the documentElement, in the other cases not.
  14258. if (!isIE10 && isHTML) {
  14259. var marginTop = parseFloat(styles.marginTop);
  14260. var marginLeft = parseFloat(styles.marginLeft);
  14261. offsets.top -= borderTopWidth - marginTop;
  14262. offsets.bottom -= borderTopWidth - marginTop;
  14263. offsets.left -= borderLeftWidth - marginLeft;
  14264. offsets.right -= borderLeftWidth - marginLeft;
  14265. // Attach marginTop and marginLeft because in some circumstances we may need them
  14266. offsets.marginTop = marginTop;
  14267. offsets.marginLeft = marginLeft;
  14268. }
  14269. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  14270. offsets = includeScroll(offsets, parent);
  14271. }
  14272. return offsets;
  14273. }
  14274. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  14275. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  14276. var html = element.ownerDocument.documentElement;
  14277. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  14278. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  14279. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  14280. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  14281. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  14282. var offset = {
  14283. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  14284. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  14285. width: width,
  14286. height: height
  14287. };
  14288. return getClientRect(offset);
  14289. }
  14290. /**
  14291. * Check if the given element is fixed or is inside a fixed parent
  14292. * @method
  14293. * @memberof Popper.Utils
  14294. * @argument {Element} element
  14295. * @argument {Element} customContainer
  14296. * @returns {Boolean} answer to "isFixed?"
  14297. */
  14298. function isFixed(element) {
  14299. var nodeName = element.nodeName;
  14300. if (nodeName === 'BODY' || nodeName === 'HTML') {
  14301. return false;
  14302. }
  14303. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  14304. return true;
  14305. }
  14306. var parentNode = getParentNode(element);
  14307. if (!parentNode) {
  14308. return false;
  14309. }
  14310. return isFixed(parentNode);
  14311. }
  14312. /**
  14313. * Finds the first parent of an element that has a transformed property defined
  14314. * @method
  14315. * @memberof Popper.Utils
  14316. * @argument {Element} element
  14317. * @returns {Element} first transformed parent or documentElement
  14318. */
  14319. function getFixedPositionOffsetParent(element) {
  14320. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  14321. if (!element || !element.parentElement || isIE()) {
  14322. return document.documentElement;
  14323. }
  14324. var el = element.parentElement;
  14325. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  14326. el = el.parentElement;
  14327. }
  14328. return el || document.documentElement;
  14329. }
  14330. /**
  14331. * Computed the boundaries limits and return them
  14332. * @method
  14333. * @memberof Popper.Utils
  14334. * @param {HTMLElement} popper
  14335. * @param {HTMLElement} reference
  14336. * @param {number} padding
  14337. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  14338. * @param {Boolean} fixedPosition - Is in fixed position mode
  14339. * @returns {Object} Coordinates of the boundaries
  14340. */
  14341. function getBoundaries(popper, reference, padding, boundariesElement) {
  14342. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  14343. // NOTE: 1 DOM access here
  14344. var boundaries = { top: 0, left: 0 };
  14345. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  14346. // Handle viewport case
  14347. if (boundariesElement === 'viewport') {
  14348. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  14349. } else {
  14350. // Handle other cases based on DOM element used as boundaries
  14351. var boundariesNode = void 0;
  14352. if (boundariesElement === 'scrollParent') {
  14353. boundariesNode = getScrollParent(getParentNode(reference));
  14354. if (boundariesNode.nodeName === 'BODY') {
  14355. boundariesNode = popper.ownerDocument.documentElement;
  14356. }
  14357. } else if (boundariesElement === 'window') {
  14358. boundariesNode = popper.ownerDocument.documentElement;
  14359. } else {
  14360. boundariesNode = boundariesElement;
  14361. }
  14362. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  14363. // In case of HTML, we need a different computation
  14364. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  14365. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  14366. height = _getWindowSizes.height,
  14367. width = _getWindowSizes.width;
  14368. boundaries.top += offsets.top - offsets.marginTop;
  14369. boundaries.bottom = height + offsets.top;
  14370. boundaries.left += offsets.left - offsets.marginLeft;
  14371. boundaries.right = width + offsets.left;
  14372. } else {
  14373. // for all the other DOM elements, this one is good
  14374. boundaries = offsets;
  14375. }
  14376. }
  14377. // Add paddings
  14378. padding = padding || 0;
  14379. var isPaddingNumber = typeof padding === 'number';
  14380. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  14381. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  14382. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  14383. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  14384. return boundaries;
  14385. }
  14386. function getArea(_ref) {
  14387. var width = _ref.width,
  14388. height = _ref.height;
  14389. return width * height;
  14390. }
  14391. /**
  14392. * Utility used to transform the `auto` placement to the placement with more
  14393. * available space.
  14394. * @method
  14395. * @memberof Popper.Utils
  14396. * @argument {Object} data - The data object generated by update method
  14397. * @argument {Object} options - Modifiers configuration and options
  14398. * @returns {Object} The data object, properly modified
  14399. */
  14400. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  14401. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  14402. if (placement.indexOf('auto') === -1) {
  14403. return placement;
  14404. }
  14405. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  14406. var rects = {
  14407. top: {
  14408. width: boundaries.width,
  14409. height: refRect.top - boundaries.top
  14410. },
  14411. right: {
  14412. width: boundaries.right - refRect.right,
  14413. height: boundaries.height
  14414. },
  14415. bottom: {
  14416. width: boundaries.width,
  14417. height: boundaries.bottom - refRect.bottom
  14418. },
  14419. left: {
  14420. width: refRect.left - boundaries.left,
  14421. height: boundaries.height
  14422. }
  14423. };
  14424. var sortedAreas = Object.keys(rects).map(function (key) {
  14425. return _extends({
  14426. key: key
  14427. }, rects[key], {
  14428. area: getArea(rects[key])
  14429. });
  14430. }).sort(function (a, b) {
  14431. return b.area - a.area;
  14432. });
  14433. var filteredAreas = sortedAreas.filter(function (_ref2) {
  14434. var width = _ref2.width,
  14435. height = _ref2.height;
  14436. return width >= popper.clientWidth && height >= popper.clientHeight;
  14437. });
  14438. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  14439. var variation = placement.split('-')[1];
  14440. return computedPlacement + (variation ? '-' + variation : '');
  14441. }
  14442. /**
  14443. * Get offsets to the reference element
  14444. * @method
  14445. * @memberof Popper.Utils
  14446. * @param {Object} state
  14447. * @param {Element} popper - the popper element
  14448. * @param {Element} reference - the reference element (the popper will be relative to this)
  14449. * @param {Element} fixedPosition - is in fixed position mode
  14450. * @returns {Object} An object containing the offsets which will be applied to the popper
  14451. */
  14452. function getReferenceOffsets(state, popper, reference) {
  14453. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  14454. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  14455. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  14456. }
  14457. /**
  14458. * Get the outer sizes of the given element (offset size + margins)
  14459. * @method
  14460. * @memberof Popper.Utils
  14461. * @argument {Element} element
  14462. * @returns {Object} object containing width and height properties
  14463. */
  14464. function getOuterSizes(element) {
  14465. var window = element.ownerDocument.defaultView;
  14466. var styles = window.getComputedStyle(element);
  14467. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  14468. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  14469. var result = {
  14470. width: element.offsetWidth + y,
  14471. height: element.offsetHeight + x
  14472. };
  14473. return result;
  14474. }
  14475. /**
  14476. * Get the opposite placement of the given one
  14477. * @method
  14478. * @memberof Popper.Utils
  14479. * @argument {String} placement
  14480. * @returns {String} flipped placement
  14481. */
  14482. function getOppositePlacement(placement) {
  14483. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  14484. return placement.replace(/left|right|bottom|top/g, function (matched) {
  14485. return hash[matched];
  14486. });
  14487. }
  14488. /**
  14489. * Get offsets to the popper
  14490. * @method
  14491. * @memberof Popper.Utils
  14492. * @param {Object} position - CSS position the Popper will get applied
  14493. * @param {HTMLElement} popper - the popper element
  14494. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  14495. * @param {String} placement - one of the valid placement options
  14496. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  14497. */
  14498. function getPopperOffsets(popper, referenceOffsets, placement) {
  14499. placement = placement.split('-')[0];
  14500. // Get popper node sizes
  14501. var popperRect = getOuterSizes(popper);
  14502. // Add position, width and height to our offsets object
  14503. var popperOffsets = {
  14504. width: popperRect.width,
  14505. height: popperRect.height
  14506. };
  14507. // depending by the popper placement we have to compute its offsets slightly differently
  14508. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  14509. var mainSide = isHoriz ? 'top' : 'left';
  14510. var secondarySide = isHoriz ? 'left' : 'top';
  14511. var measurement = isHoriz ? 'height' : 'width';
  14512. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  14513. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  14514. if (placement === secondarySide) {
  14515. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  14516. } else {
  14517. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  14518. }
  14519. return popperOffsets;
  14520. }
  14521. /**
  14522. * Mimics the `find` method of Array
  14523. * @method
  14524. * @memberof Popper.Utils
  14525. * @argument {Array} arr
  14526. * @argument prop
  14527. * @argument value
  14528. * @returns index or -1
  14529. */
  14530. function find(arr, check) {
  14531. // use native find if supported
  14532. if (Array.prototype.find) {
  14533. return arr.find(check);
  14534. }
  14535. // use `filter` to obtain the same behavior of `find`
  14536. return arr.filter(check)[0];
  14537. }
  14538. /**
  14539. * Return the index of the matching object
  14540. * @method
  14541. * @memberof Popper.Utils
  14542. * @argument {Array} arr
  14543. * @argument prop
  14544. * @argument value
  14545. * @returns index or -1
  14546. */
  14547. function findIndex(arr, prop, value) {
  14548. // use native findIndex if supported
  14549. if (Array.prototype.findIndex) {
  14550. return arr.findIndex(function (cur) {
  14551. return cur[prop] === value;
  14552. });
  14553. }
  14554. // use `find` + `indexOf` if `findIndex` isn't supported
  14555. var match = find(arr, function (obj) {
  14556. return obj[prop] === value;
  14557. });
  14558. return arr.indexOf(match);
  14559. }
  14560. /**
  14561. * Loop trough the list of modifiers and run them in order,
  14562. * each of them will then edit the data object.
  14563. * @method
  14564. * @memberof Popper.Utils
  14565. * @param {dataObject} data
  14566. * @param {Array} modifiers
  14567. * @param {String} ends - Optional modifier name used as stopper
  14568. * @returns {dataObject}
  14569. */
  14570. function runModifiers(modifiers, data, ends) {
  14571. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  14572. modifiersToRun.forEach(function (modifier) {
  14573. if (modifier['function']) {
  14574. // eslint-disable-line dot-notation
  14575. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  14576. }
  14577. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  14578. if (modifier.enabled && isFunction(fn)) {
  14579. // Add properties to offsets to make them a complete clientRect object
  14580. // we do this before each modifier to make sure the previous one doesn't
  14581. // mess with these values
  14582. data.offsets.popper = getClientRect(data.offsets.popper);
  14583. data.offsets.reference = getClientRect(data.offsets.reference);
  14584. data = fn(data, modifier);
  14585. }
  14586. });
  14587. return data;
  14588. }
  14589. /**
  14590. * Updates the position of the popper, computing the new offsets and applying
  14591. * the new style.<br />
  14592. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  14593. * @method
  14594. * @memberof Popper
  14595. */
  14596. function update() {
  14597. // if popper is destroyed, don't perform any further update
  14598. if (this.state.isDestroyed) {
  14599. return;
  14600. }
  14601. var data = {
  14602. instance: this,
  14603. styles: {},
  14604. arrowStyles: {},
  14605. attributes: {},
  14606. flipped: false,
  14607. offsets: {}
  14608. };
  14609. // compute reference element offsets
  14610. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  14611. // compute auto placement, store placement inside the data object,
  14612. // modifiers will be able to edit `placement` if needed
  14613. // and refer to originalPlacement to know the original value
  14614. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  14615. // store the computed placement inside `originalPlacement`
  14616. data.originalPlacement = data.placement;
  14617. data.positionFixed = this.options.positionFixed;
  14618. // compute the popper offsets
  14619. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  14620. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  14621. // run the modifiers
  14622. data = runModifiers(this.modifiers, data);
  14623. // the first `update` will call `onCreate` callback
  14624. // the other ones will call `onUpdate` callback
  14625. if (!this.state.isCreated) {
  14626. this.state.isCreated = true;
  14627. this.options.onCreate(data);
  14628. } else {
  14629. this.options.onUpdate(data);
  14630. }
  14631. }
  14632. /**
  14633. * Helper used to know if the given modifier is enabled.
  14634. * @method
  14635. * @memberof Popper.Utils
  14636. * @returns {Boolean}
  14637. */
  14638. function isModifierEnabled(modifiers, modifierName) {
  14639. return modifiers.some(function (_ref) {
  14640. var name = _ref.name,
  14641. enabled = _ref.enabled;
  14642. return enabled && name === modifierName;
  14643. });
  14644. }
  14645. /**
  14646. * Get the prefixed supported property name
  14647. * @method
  14648. * @memberof Popper.Utils
  14649. * @argument {String} property (camelCase)
  14650. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  14651. */
  14652. function getSupportedPropertyName(property) {
  14653. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  14654. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  14655. for (var i = 0; i < prefixes.length; i++) {
  14656. var prefix = prefixes[i];
  14657. var toCheck = prefix ? '' + prefix + upperProp : property;
  14658. if (typeof document.body.style[toCheck] !== 'undefined') {
  14659. return toCheck;
  14660. }
  14661. }
  14662. return null;
  14663. }
  14664. /**
  14665. * Destroys the popper.
  14666. * @method
  14667. * @memberof Popper
  14668. */
  14669. function destroy() {
  14670. this.state.isDestroyed = true;
  14671. // touch DOM only if `applyStyle` modifier is enabled
  14672. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  14673. this.popper.removeAttribute('x-placement');
  14674. this.popper.style.position = '';
  14675. this.popper.style.top = '';
  14676. this.popper.style.left = '';
  14677. this.popper.style.right = '';
  14678. this.popper.style.bottom = '';
  14679. this.popper.style.willChange = '';
  14680. this.popper.style[getSupportedPropertyName('transform')] = '';
  14681. }
  14682. this.disableEventListeners();
  14683. // remove the popper if user explicitly asked for the deletion on destroy
  14684. // do not use `remove` because IE11 doesn't support it
  14685. if (this.options.removeOnDestroy) {
  14686. this.popper.parentNode.removeChild(this.popper);
  14687. }
  14688. return this;
  14689. }
  14690. /**
  14691. * Get the window associated with the element
  14692. * @argument {Element} element
  14693. * @returns {Window}
  14694. */
  14695. function getWindow(element) {
  14696. var ownerDocument = element.ownerDocument;
  14697. return ownerDocument ? ownerDocument.defaultView : window;
  14698. }
  14699. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  14700. var isBody = scrollParent.nodeName === 'BODY';
  14701. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  14702. target.addEventListener(event, callback, { passive: true });
  14703. if (!isBody) {
  14704. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  14705. }
  14706. scrollParents.push(target);
  14707. }
  14708. /**
  14709. * Setup needed event listeners used to update the popper position
  14710. * @method
  14711. * @memberof Popper.Utils
  14712. * @private
  14713. */
  14714. function setupEventListeners(reference, options, state, updateBound) {
  14715. // Resize event listener on window
  14716. state.updateBound = updateBound;
  14717. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  14718. // Scroll event listener on scroll parents
  14719. var scrollElement = getScrollParent(reference);
  14720. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  14721. state.scrollElement = scrollElement;
  14722. state.eventsEnabled = true;
  14723. return state;
  14724. }
  14725. /**
  14726. * It will add resize/scroll events and start recalculating
  14727. * position of the popper element when they are triggered.
  14728. * @method
  14729. * @memberof Popper
  14730. */
  14731. function enableEventListeners() {
  14732. if (!this.state.eventsEnabled) {
  14733. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  14734. }
  14735. }
  14736. /**
  14737. * Remove event listeners used to update the popper position
  14738. * @method
  14739. * @memberof Popper.Utils
  14740. * @private
  14741. */
  14742. function removeEventListeners(reference, state) {
  14743. // Remove resize event listener on window
  14744. getWindow(reference).removeEventListener('resize', state.updateBound);
  14745. // Remove scroll event listener on scroll parents
  14746. state.scrollParents.forEach(function (target) {
  14747. target.removeEventListener('scroll', state.updateBound);
  14748. });
  14749. // Reset state
  14750. state.updateBound = null;
  14751. state.scrollParents = [];
  14752. state.scrollElement = null;
  14753. state.eventsEnabled = false;
  14754. return state;
  14755. }
  14756. /**
  14757. * It will remove resize/scroll events and won't recalculate popper position
  14758. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  14759. * unless you call `update` method manually.
  14760. * @method
  14761. * @memberof Popper
  14762. */
  14763. function disableEventListeners() {
  14764. if (this.state.eventsEnabled) {
  14765. cancelAnimationFrame(this.scheduleUpdate);
  14766. this.state = removeEventListeners(this.reference, this.state);
  14767. }
  14768. }
  14769. /**
  14770. * Tells if a given input is a number
  14771. * @method
  14772. * @memberof Popper.Utils
  14773. * @param {*} input to check
  14774. * @return {Boolean}
  14775. */
  14776. function isNumeric(n) {
  14777. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  14778. }
  14779. /**
  14780. * Set the style to the given popper
  14781. * @method
  14782. * @memberof Popper.Utils
  14783. * @argument {Element} element - Element to apply the style to
  14784. * @argument {Object} styles
  14785. * Object with a list of properties and values which will be applied to the element
  14786. */
  14787. function setStyles(element, styles) {
  14788. Object.keys(styles).forEach(function (prop) {
  14789. var unit = '';
  14790. // add unit if the value is numeric and is one of the following
  14791. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  14792. unit = 'px';
  14793. }
  14794. element.style[prop] = styles[prop] + unit;
  14795. });
  14796. }
  14797. /**
  14798. * Set the attributes to the given popper
  14799. * @method
  14800. * @memberof Popper.Utils
  14801. * @argument {Element} element - Element to apply the attributes to
  14802. * @argument {Object} styles
  14803. * Object with a list of properties and values which will be applied to the element
  14804. */
  14805. function setAttributes(element, attributes) {
  14806. Object.keys(attributes).forEach(function (prop) {
  14807. var value = attributes[prop];
  14808. if (value !== false) {
  14809. element.setAttribute(prop, attributes[prop]);
  14810. } else {
  14811. element.removeAttribute(prop);
  14812. }
  14813. });
  14814. }
  14815. /**
  14816. * @function
  14817. * @memberof Modifiers
  14818. * @argument {Object} data - The data object generated by `update` method
  14819. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  14820. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  14821. * @argument {Object} options - Modifiers configuration and options
  14822. * @returns {Object} The same data object
  14823. */
  14824. function applyStyle(data) {
  14825. // any property present in `data.styles` will be applied to the popper,
  14826. // in this way we can make the 3rd party modifiers add custom styles to it
  14827. // Be aware, modifiers could override the properties defined in the previous
  14828. // lines of this modifier!
  14829. setStyles(data.instance.popper, data.styles);
  14830. // any property present in `data.attributes` will be applied to the popper,
  14831. // they will be set as HTML attributes of the element
  14832. setAttributes(data.instance.popper, data.attributes);
  14833. // if arrowElement is defined and arrowStyles has some properties
  14834. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  14835. setStyles(data.arrowElement, data.arrowStyles);
  14836. }
  14837. return data;
  14838. }
  14839. /**
  14840. * Set the x-placement attribute before everything else because it could be used
  14841. * to add margins to the popper margins needs to be calculated to get the
  14842. * correct popper offsets.
  14843. * @method
  14844. * @memberof Popper.modifiers
  14845. * @param {HTMLElement} reference - The reference element used to position the popper
  14846. * @param {HTMLElement} popper - The HTML element used as popper
  14847. * @param {Object} options - Popper.js options
  14848. */
  14849. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  14850. // compute reference element offsets
  14851. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  14852. // compute auto placement, store placement inside the data object,
  14853. // modifiers will be able to edit `placement` if needed
  14854. // and refer to originalPlacement to know the original value
  14855. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  14856. popper.setAttribute('x-placement', placement);
  14857. // Apply `position` to popper before anything else because
  14858. // without the position applied we can't guarantee correct computations
  14859. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  14860. return options;
  14861. }
  14862. /**
  14863. * @function
  14864. * @memberof Popper.Utils
  14865. * @argument {Object} data - The data object generated by `update` method
  14866. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  14867. * @returns {Object} The popper's position offsets rounded
  14868. *
  14869. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  14870. * good as it can be within reason.
  14871. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  14872. *
  14873. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  14874. * as well on High DPI screens).
  14875. *
  14876. * Firefox prefers no rounding for positioning and does not have blurriness on
  14877. * high DPI screens.
  14878. *
  14879. * Only horizontal placement and left/right values need to be considered.
  14880. */
  14881. function getRoundedOffsets(data, shouldRound) {
  14882. var _data$offsets = data.offsets,
  14883. popper = _data$offsets.popper,
  14884. reference = _data$offsets.reference;
  14885. var round = Math.round,
  14886. floor = Math.floor;
  14887. var noRound = function noRound(v) {
  14888. return v;
  14889. };
  14890. var referenceWidth = round(reference.width);
  14891. var popperWidth = round(popper.width);
  14892. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  14893. var isVariation = data.placement.indexOf('-') !== -1;
  14894. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  14895. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  14896. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  14897. var verticalToInteger = !shouldRound ? noRound : round;
  14898. return {
  14899. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  14900. top: verticalToInteger(popper.top),
  14901. bottom: verticalToInteger(popper.bottom),
  14902. right: horizontalToInteger(popper.right)
  14903. };
  14904. }
  14905. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  14906. /**
  14907. * @function
  14908. * @memberof Modifiers
  14909. * @argument {Object} data - The data object generated by `update` method
  14910. * @argument {Object} options - Modifiers configuration and options
  14911. * @returns {Object} The data object, properly modified
  14912. */
  14913. function computeStyle(data, options) {
  14914. var x = options.x,
  14915. y = options.y;
  14916. var popper = data.offsets.popper;
  14917. // Remove this legacy support in Popper.js v2
  14918. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  14919. return modifier.name === 'applyStyle';
  14920. }).gpuAcceleration;
  14921. if (legacyGpuAccelerationOption !== undefined) {
  14922. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  14923. }
  14924. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  14925. var offsetParent = getOffsetParent(data.instance.popper);
  14926. var offsetParentRect = getBoundingClientRect(offsetParent);
  14927. // Styles
  14928. var styles = {
  14929. position: popper.position
  14930. };
  14931. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  14932. var sideA = x === 'bottom' ? 'top' : 'bottom';
  14933. var sideB = y === 'right' ? 'left' : 'right';
  14934. // if gpuAcceleration is set to `true` and transform is supported,
  14935. // we use `translate3d` to apply the position to the popper we
  14936. // automatically use the supported prefixed version if needed
  14937. var prefixedProperty = getSupportedPropertyName('transform');
  14938. // now, let's make a step back and look at this code closely (wtf?)
  14939. // If the content of the popper grows once it's been positioned, it
  14940. // may happen that the popper gets misplaced because of the new content
  14941. // overflowing its reference element
  14942. // To avoid this problem, we provide two options (x and y), which allow
  14943. // the consumer to define the offset origin.
  14944. // If we position a popper on top of a reference element, we can set
  14945. // `x` to `top` to make the popper grow towards its top instead of
  14946. // its bottom.
  14947. var left = void 0,
  14948. top = void 0;
  14949. if (sideA === 'bottom') {
  14950. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  14951. // and not the bottom of the html element
  14952. if (offsetParent.nodeName === 'HTML') {
  14953. top = -offsetParent.clientHeight + offsets.bottom;
  14954. } else {
  14955. top = -offsetParentRect.height + offsets.bottom;
  14956. }
  14957. } else {
  14958. top = offsets.top;
  14959. }
  14960. if (sideB === 'right') {
  14961. if (offsetParent.nodeName === 'HTML') {
  14962. left = -offsetParent.clientWidth + offsets.right;
  14963. } else {
  14964. left = -offsetParentRect.width + offsets.right;
  14965. }
  14966. } else {
  14967. left = offsets.left;
  14968. }
  14969. if (gpuAcceleration && prefixedProperty) {
  14970. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  14971. styles[sideA] = 0;
  14972. styles[sideB] = 0;
  14973. styles.willChange = 'transform';
  14974. } else {
  14975. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  14976. var invertTop = sideA === 'bottom' ? -1 : 1;
  14977. var invertLeft = sideB === 'right' ? -1 : 1;
  14978. styles[sideA] = top * invertTop;
  14979. styles[sideB] = left * invertLeft;
  14980. styles.willChange = sideA + ', ' + sideB;
  14981. }
  14982. // Attributes
  14983. var attributes = {
  14984. 'x-placement': data.placement
  14985. };
  14986. // Update `data` attributes, styles and arrowStyles
  14987. data.attributes = _extends({}, attributes, data.attributes);
  14988. data.styles = _extends({}, styles, data.styles);
  14989. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  14990. return data;
  14991. }
  14992. /**
  14993. * Helper used to know if the given modifier depends from another one.<br />
  14994. * It checks if the needed modifier is listed and enabled.
  14995. * @method
  14996. * @memberof Popper.Utils
  14997. * @param {Array} modifiers - list of modifiers
  14998. * @param {String} requestingName - name of requesting modifier
  14999. * @param {String} requestedName - name of requested modifier
  15000. * @returns {Boolean}
  15001. */
  15002. function isModifierRequired(modifiers, requestingName, requestedName) {
  15003. var requesting = find(modifiers, function (_ref) {
  15004. var name = _ref.name;
  15005. return name === requestingName;
  15006. });
  15007. var isRequired = !!requesting && modifiers.some(function (modifier) {
  15008. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  15009. });
  15010. if (!isRequired) {
  15011. var _requesting = '`' + requestingName + '`';
  15012. var requested = '`' + requestedName + '`';
  15013. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  15014. }
  15015. return isRequired;
  15016. }
  15017. /**
  15018. * @function
  15019. * @memberof Modifiers
  15020. * @argument {Object} data - The data object generated by update method
  15021. * @argument {Object} options - Modifiers configuration and options
  15022. * @returns {Object} The data object, properly modified
  15023. */
  15024. function arrow(data, options) {
  15025. var _data$offsets$arrow;
  15026. // arrow depends on keepTogether in order to work
  15027. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  15028. return data;
  15029. }
  15030. var arrowElement = options.element;
  15031. // if arrowElement is a string, suppose it's a CSS selector
  15032. if (typeof arrowElement === 'string') {
  15033. arrowElement = data.instance.popper.querySelector(arrowElement);
  15034. // if arrowElement is not found, don't run the modifier
  15035. if (!arrowElement) {
  15036. return data;
  15037. }
  15038. } else {
  15039. // if the arrowElement isn't a query selector we must check that the
  15040. // provided DOM node is child of its popper node
  15041. if (!data.instance.popper.contains(arrowElement)) {
  15042. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  15043. return data;
  15044. }
  15045. }
  15046. var placement = data.placement.split('-')[0];
  15047. var _data$offsets = data.offsets,
  15048. popper = _data$offsets.popper,
  15049. reference = _data$offsets.reference;
  15050. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  15051. var len = isVertical ? 'height' : 'width';
  15052. var sideCapitalized = isVertical ? 'Top' : 'Left';
  15053. var side = sideCapitalized.toLowerCase();
  15054. var altSide = isVertical ? 'left' : 'top';
  15055. var opSide = isVertical ? 'bottom' : 'right';
  15056. var arrowElementSize = getOuterSizes(arrowElement)[len];
  15057. //
  15058. // extends keepTogether behavior making sure the popper and its
  15059. // reference have enough pixels in conjunction
  15060. //
  15061. // top/left side
  15062. if (reference[opSide] - arrowElementSize < popper[side]) {
  15063. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  15064. }
  15065. // bottom/right side
  15066. if (reference[side] + arrowElementSize > popper[opSide]) {
  15067. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  15068. }
  15069. data.offsets.popper = getClientRect(data.offsets.popper);
  15070. // compute center of the popper
  15071. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  15072. // Compute the sideValue using the updated popper offsets
  15073. // take popper margin in account because we don't have this info available
  15074. var css = getStyleComputedProperty(data.instance.popper);
  15075. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  15076. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  15077. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  15078. // prevent arrowElement from being placed not contiguously to its popper
  15079. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  15080. data.arrowElement = arrowElement;
  15081. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  15082. return data;
  15083. }
  15084. /**
  15085. * Get the opposite placement variation of the given one
  15086. * @method
  15087. * @memberof Popper.Utils
  15088. * @argument {String} placement variation
  15089. * @returns {String} flipped placement variation
  15090. */
  15091. function getOppositeVariation(variation) {
  15092. if (variation === 'end') {
  15093. return 'start';
  15094. } else if (variation === 'start') {
  15095. return 'end';
  15096. }
  15097. return variation;
  15098. }
  15099. /**
  15100. * List of accepted placements to use as values of the `placement` option.<br />
  15101. * Valid placements are:
  15102. * - `auto`
  15103. * - `top`
  15104. * - `right`
  15105. * - `bottom`
  15106. * - `left`
  15107. *
  15108. * Each placement can have a variation from this list:
  15109. * - `-start`
  15110. * - `-end`
  15111. *
  15112. * Variations are interpreted easily if you think of them as the left to right
  15113. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  15114. * is right.<br />
  15115. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  15116. *
  15117. * Some valid examples are:
  15118. * - `top-end` (on top of reference, right aligned)
  15119. * - `right-start` (on right of reference, top aligned)
  15120. * - `bottom` (on bottom, centered)
  15121. * - `auto-end` (on the side with more space available, alignment depends by placement)
  15122. *
  15123. * @static
  15124. * @type {Array}
  15125. * @enum {String}
  15126. * @readonly
  15127. * @method placements
  15128. * @memberof Popper
  15129. */
  15130. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  15131. // Get rid of `auto` `auto-start` and `auto-end`
  15132. var validPlacements = placements.slice(3);
  15133. /**
  15134. * Given an initial placement, returns all the subsequent placements
  15135. * clockwise (or counter-clockwise).
  15136. *
  15137. * @method
  15138. * @memberof Popper.Utils
  15139. * @argument {String} placement - A valid placement (it accepts variations)
  15140. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  15141. * @returns {Array} placements including their variations
  15142. */
  15143. function clockwise(placement) {
  15144. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  15145. var index = validPlacements.indexOf(placement);
  15146. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  15147. return counter ? arr.reverse() : arr;
  15148. }
  15149. var BEHAVIORS = {
  15150. FLIP: 'flip',
  15151. CLOCKWISE: 'clockwise',
  15152. COUNTERCLOCKWISE: 'counterclockwise'
  15153. };
  15154. /**
  15155. * @function
  15156. * @memberof Modifiers
  15157. * @argument {Object} data - The data object generated by update method
  15158. * @argument {Object} options - Modifiers configuration and options
  15159. * @returns {Object} The data object, properly modified
  15160. */
  15161. function flip(data, options) {
  15162. // if `inner` modifier is enabled, we can't use the `flip` modifier
  15163. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  15164. return data;
  15165. }
  15166. if (data.flipped && data.placement === data.originalPlacement) {
  15167. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  15168. return data;
  15169. }
  15170. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  15171. var placement = data.placement.split('-')[0];
  15172. var placementOpposite = getOppositePlacement(placement);
  15173. var variation = data.placement.split('-')[1] || '';
  15174. var flipOrder = [];
  15175. switch (options.behavior) {
  15176. case BEHAVIORS.FLIP:
  15177. flipOrder = [placement, placementOpposite];
  15178. break;
  15179. case BEHAVIORS.CLOCKWISE:
  15180. flipOrder = clockwise(placement);
  15181. break;
  15182. case BEHAVIORS.COUNTERCLOCKWISE:
  15183. flipOrder = clockwise(placement, true);
  15184. break;
  15185. default:
  15186. flipOrder = options.behavior;
  15187. }
  15188. flipOrder.forEach(function (step, index) {
  15189. if (placement !== step || flipOrder.length === index + 1) {
  15190. return data;
  15191. }
  15192. placement = data.placement.split('-')[0];
  15193. placementOpposite = getOppositePlacement(placement);
  15194. var popperOffsets = data.offsets.popper;
  15195. var refOffsets = data.offsets.reference;
  15196. // using floor because the reference offsets may contain decimals we are not going to consider here
  15197. var floor = Math.floor;
  15198. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  15199. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  15200. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  15201. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  15202. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  15203. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  15204. // flip the variation if required
  15205. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  15206. // flips variation if reference element overflows boundaries
  15207. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  15208. // flips variation if popper content overflows boundaries
  15209. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  15210. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  15211. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  15212. // this boolean to detect any flip loop
  15213. data.flipped = true;
  15214. if (overlapsRef || overflowsBoundaries) {
  15215. placement = flipOrder[index + 1];
  15216. }
  15217. if (flippedVariation) {
  15218. variation = getOppositeVariation(variation);
  15219. }
  15220. data.placement = placement + (variation ? '-' + variation : '');
  15221. // this object contains `position`, we want to preserve it along with
  15222. // any additional property we may add in the future
  15223. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  15224. data = runModifiers(data.instance.modifiers, data, 'flip');
  15225. }
  15226. });
  15227. return data;
  15228. }
  15229. /**
  15230. * @function
  15231. * @memberof Modifiers
  15232. * @argument {Object} data - The data object generated by update method
  15233. * @argument {Object} options - Modifiers configuration and options
  15234. * @returns {Object} The data object, properly modified
  15235. */
  15236. function keepTogether(data) {
  15237. var _data$offsets = data.offsets,
  15238. popper = _data$offsets.popper,
  15239. reference = _data$offsets.reference;
  15240. var placement = data.placement.split('-')[0];
  15241. var floor = Math.floor;
  15242. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  15243. var side = isVertical ? 'right' : 'bottom';
  15244. var opSide = isVertical ? 'left' : 'top';
  15245. var measurement = isVertical ? 'width' : 'height';
  15246. if (popper[side] < floor(reference[opSide])) {
  15247. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  15248. }
  15249. if (popper[opSide] > floor(reference[side])) {
  15250. data.offsets.popper[opSide] = floor(reference[side]);
  15251. }
  15252. return data;
  15253. }
  15254. /**
  15255. * Converts a string containing value + unit into a px value number
  15256. * @function
  15257. * @memberof {modifiers~offset}
  15258. * @private
  15259. * @argument {String} str - Value + unit string
  15260. * @argument {String} measurement - `height` or `width`
  15261. * @argument {Object} popperOffsets
  15262. * @argument {Object} referenceOffsets
  15263. * @returns {Number|String}
  15264. * Value in pixels, or original string if no values were extracted
  15265. */
  15266. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  15267. // separate value from unit
  15268. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  15269. var value = +split[1];
  15270. var unit = split[2];
  15271. // If it's not a number it's an operator, I guess
  15272. if (!value) {
  15273. return str;
  15274. }
  15275. if (unit.indexOf('%') === 0) {
  15276. var element = void 0;
  15277. switch (unit) {
  15278. case '%p':
  15279. element = popperOffsets;
  15280. break;
  15281. case '%':
  15282. case '%r':
  15283. default:
  15284. element = referenceOffsets;
  15285. }
  15286. var rect = getClientRect(element);
  15287. return rect[measurement] / 100 * value;
  15288. } else if (unit === 'vh' || unit === 'vw') {
  15289. // if is a vh or vw, we calculate the size based on the viewport
  15290. var size = void 0;
  15291. if (unit === 'vh') {
  15292. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  15293. } else {
  15294. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  15295. }
  15296. return size / 100 * value;
  15297. } else {
  15298. // if is an explicit pixel unit, we get rid of the unit and keep the value
  15299. // if is an implicit unit, it's px, and we return just the value
  15300. return value;
  15301. }
  15302. }
  15303. /**
  15304. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  15305. * @function
  15306. * @memberof {modifiers~offset}
  15307. * @private
  15308. * @argument {String} offset
  15309. * @argument {Object} popperOffsets
  15310. * @argument {Object} referenceOffsets
  15311. * @argument {String} basePlacement
  15312. * @returns {Array} a two cells array with x and y offsets in numbers
  15313. */
  15314. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  15315. var offsets = [0, 0];
  15316. // Use height if placement is left or right and index is 0 otherwise use width
  15317. // in this way the first offset will use an axis and the second one
  15318. // will use the other one
  15319. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  15320. // Split the offset string to obtain a list of values and operands
  15321. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  15322. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  15323. return frag.trim();
  15324. });
  15325. // Detect if the offset string contains a pair of values or a single one
  15326. // they could be separated by comma or space
  15327. var divider = fragments.indexOf(find(fragments, function (frag) {
  15328. return frag.search(/,|\s/) !== -1;
  15329. }));
  15330. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  15331. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  15332. }
  15333. // If divider is found, we divide the list of values and operands to divide
  15334. // them by ofset X and Y.
  15335. var splitRegex = /\s*,\s*|\s+/;
  15336. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  15337. // Convert the values with units to absolute pixels to allow our computations
  15338. ops = ops.map(function (op, index) {
  15339. // Most of the units rely on the orientation of the popper
  15340. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  15341. var mergeWithPrevious = false;
  15342. return op
  15343. // This aggregates any `+` or `-` sign that aren't considered operators
  15344. // e.g.: 10 + +5 => [10, +, +5]
  15345. .reduce(function (a, b) {
  15346. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  15347. a[a.length - 1] = b;
  15348. mergeWithPrevious = true;
  15349. return a;
  15350. } else if (mergeWithPrevious) {
  15351. a[a.length - 1] += b;
  15352. mergeWithPrevious = false;
  15353. return a;
  15354. } else {
  15355. return a.concat(b);
  15356. }
  15357. }, [])
  15358. // Here we convert the string values into number values (in px)
  15359. .map(function (str) {
  15360. return toValue(str, measurement, popperOffsets, referenceOffsets);
  15361. });
  15362. });
  15363. // Loop trough the offsets arrays and execute the operations
  15364. ops.forEach(function (op, index) {
  15365. op.forEach(function (frag, index2) {
  15366. if (isNumeric(frag)) {
  15367. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  15368. }
  15369. });
  15370. });
  15371. return offsets;
  15372. }
  15373. /**
  15374. * @function
  15375. * @memberof Modifiers
  15376. * @argument {Object} data - The data object generated by update method
  15377. * @argument {Object} options - Modifiers configuration and options
  15378. * @argument {Number|String} options.offset=0
  15379. * The offset value as described in the modifier description
  15380. * @returns {Object} The data object, properly modified
  15381. */
  15382. function offset(data, _ref) {
  15383. var offset = _ref.offset;
  15384. var placement = data.placement,
  15385. _data$offsets = data.offsets,
  15386. popper = _data$offsets.popper,
  15387. reference = _data$offsets.reference;
  15388. var basePlacement = placement.split('-')[0];
  15389. var offsets = void 0;
  15390. if (isNumeric(+offset)) {
  15391. offsets = [+offset, 0];
  15392. } else {
  15393. offsets = parseOffset(offset, popper, reference, basePlacement);
  15394. }
  15395. if (basePlacement === 'left') {
  15396. popper.top += offsets[0];
  15397. popper.left -= offsets[1];
  15398. } else if (basePlacement === 'right') {
  15399. popper.top += offsets[0];
  15400. popper.left += offsets[1];
  15401. } else if (basePlacement === 'top') {
  15402. popper.left += offsets[0];
  15403. popper.top -= offsets[1];
  15404. } else if (basePlacement === 'bottom') {
  15405. popper.left += offsets[0];
  15406. popper.top += offsets[1];
  15407. }
  15408. data.popper = popper;
  15409. return data;
  15410. }
  15411. /**
  15412. * @function
  15413. * @memberof Modifiers
  15414. * @argument {Object} data - The data object generated by `update` method
  15415. * @argument {Object} options - Modifiers configuration and options
  15416. * @returns {Object} The data object, properly modified
  15417. */
  15418. function preventOverflow(data, options) {
  15419. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  15420. // If offsetParent is the reference element, we really want to
  15421. // go one step up and use the next offsetParent as reference to
  15422. // avoid to make this modifier completely useless and look like broken
  15423. if (data.instance.reference === boundariesElement) {
  15424. boundariesElement = getOffsetParent(boundariesElement);
  15425. }
  15426. // NOTE: DOM access here
  15427. // resets the popper's position so that the document size can be calculated excluding
  15428. // the size of the popper element itself
  15429. var transformProp = getSupportedPropertyName('transform');
  15430. var popperStyles = data.instance.popper.style; // assignment to help minification
  15431. var top = popperStyles.top,
  15432. left = popperStyles.left,
  15433. transform = popperStyles[transformProp];
  15434. popperStyles.top = '';
  15435. popperStyles.left = '';
  15436. popperStyles[transformProp] = '';
  15437. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  15438. // NOTE: DOM access here
  15439. // restores the original style properties after the offsets have been computed
  15440. popperStyles.top = top;
  15441. popperStyles.left = left;
  15442. popperStyles[transformProp] = transform;
  15443. options.boundaries = boundaries;
  15444. var order = options.priority;
  15445. var popper = data.offsets.popper;
  15446. var check = {
  15447. primary: function primary(placement) {
  15448. var value = popper[placement];
  15449. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  15450. value = Math.max(popper[placement], boundaries[placement]);
  15451. }
  15452. return defineProperty({}, placement, value);
  15453. },
  15454. secondary: function secondary(placement) {
  15455. var mainSide = placement === 'right' ? 'left' : 'top';
  15456. var value = popper[mainSide];
  15457. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  15458. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  15459. }
  15460. return defineProperty({}, mainSide, value);
  15461. }
  15462. };
  15463. order.forEach(function (placement) {
  15464. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  15465. popper = _extends({}, popper, check[side](placement));
  15466. });
  15467. data.offsets.popper = popper;
  15468. return data;
  15469. }
  15470. /**
  15471. * @function
  15472. * @memberof Modifiers
  15473. * @argument {Object} data - The data object generated by `update` method
  15474. * @argument {Object} options - Modifiers configuration and options
  15475. * @returns {Object} The data object, properly modified
  15476. */
  15477. function shift(data) {
  15478. var placement = data.placement;
  15479. var basePlacement = placement.split('-')[0];
  15480. var shiftvariation = placement.split('-')[1];
  15481. // if shift shiftvariation is specified, run the modifier
  15482. if (shiftvariation) {
  15483. var _data$offsets = data.offsets,
  15484. reference = _data$offsets.reference,
  15485. popper = _data$offsets.popper;
  15486. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  15487. var side = isVertical ? 'left' : 'top';
  15488. var measurement = isVertical ? 'width' : 'height';
  15489. var shiftOffsets = {
  15490. start: defineProperty({}, side, reference[side]),
  15491. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  15492. };
  15493. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  15494. }
  15495. return data;
  15496. }
  15497. /**
  15498. * @function
  15499. * @memberof Modifiers
  15500. * @argument {Object} data - The data object generated by update method
  15501. * @argument {Object} options - Modifiers configuration and options
  15502. * @returns {Object} The data object, properly modified
  15503. */
  15504. function hide(data) {
  15505. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  15506. return data;
  15507. }
  15508. var refRect = data.offsets.reference;
  15509. var bound = find(data.instance.modifiers, function (modifier) {
  15510. return modifier.name === 'preventOverflow';
  15511. }).boundaries;
  15512. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  15513. // Avoid unnecessary DOM access if visibility hasn't changed
  15514. if (data.hide === true) {
  15515. return data;
  15516. }
  15517. data.hide = true;
  15518. data.attributes['x-out-of-boundaries'] = '';
  15519. } else {
  15520. // Avoid unnecessary DOM access if visibility hasn't changed
  15521. if (data.hide === false) {
  15522. return data;
  15523. }
  15524. data.hide = false;
  15525. data.attributes['x-out-of-boundaries'] = false;
  15526. }
  15527. return data;
  15528. }
  15529. /**
  15530. * @function
  15531. * @memberof Modifiers
  15532. * @argument {Object} data - The data object generated by `update` method
  15533. * @argument {Object} options - Modifiers configuration and options
  15534. * @returns {Object} The data object, properly modified
  15535. */
  15536. function inner(data) {
  15537. var placement = data.placement;
  15538. var basePlacement = placement.split('-')[0];
  15539. var _data$offsets = data.offsets,
  15540. popper = _data$offsets.popper,
  15541. reference = _data$offsets.reference;
  15542. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  15543. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  15544. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  15545. data.placement = getOppositePlacement(placement);
  15546. data.offsets.popper = getClientRect(popper);
  15547. return data;
  15548. }
  15549. /**
  15550. * Modifier function, each modifier can have a function of this type assigned
  15551. * to its `fn` property.<br />
  15552. * These functions will be called on each update, this means that you must
  15553. * make sure they are performant enough to avoid performance bottlenecks.
  15554. *
  15555. * @function ModifierFn
  15556. * @argument {dataObject} data - The data object generated by `update` method
  15557. * @argument {Object} options - Modifiers configuration and options
  15558. * @returns {dataObject} The data object, properly modified
  15559. */
  15560. /**
  15561. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  15562. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  15563. * needed by the library.
  15564. *
  15565. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  15566. * All the other properties are configurations that could be tweaked.
  15567. * @namespace modifiers
  15568. */
  15569. var modifiers = {
  15570. /**
  15571. * Modifier used to shift the popper on the start or end of its reference
  15572. * element.<br />
  15573. * It will read the variation of the `placement` property.<br />
  15574. * It can be one either `-end` or `-start`.
  15575. * @memberof modifiers
  15576. * @inner
  15577. */
  15578. shift: {
  15579. /** @prop {number} order=100 - Index used to define the order of execution */
  15580. order: 100,
  15581. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15582. enabled: true,
  15583. /** @prop {ModifierFn} */
  15584. fn: shift
  15585. },
  15586. /**
  15587. * The `offset` modifier can shift your popper on both its axis.
  15588. *
  15589. * It accepts the following units:
  15590. * - `px` or unit-less, interpreted as pixels
  15591. * - `%` or `%r`, percentage relative to the length of the reference element
  15592. * - `%p`, percentage relative to the length of the popper element
  15593. * - `vw`, CSS viewport width unit
  15594. * - `vh`, CSS viewport height unit
  15595. *
  15596. * For length is intended the main axis relative to the placement of the popper.<br />
  15597. * This means that if the placement is `top` or `bottom`, the length will be the
  15598. * `width`. In case of `left` or `right`, it will be the `height`.
  15599. *
  15600. * You can provide a single value (as `Number` or `String`), or a pair of values
  15601. * as `String` divided by a comma or one (or more) white spaces.<br />
  15602. * The latter is a deprecated method because it leads to confusion and will be
  15603. * removed in v2.<br />
  15604. * Additionally, it accepts additions and subtractions between different units.
  15605. * Note that multiplications and divisions aren't supported.
  15606. *
  15607. * Valid examples are:
  15608. * ```
  15609. * 10
  15610. * '10%'
  15611. * '10, 10'
  15612. * '10%, 10'
  15613. * '10 + 10%'
  15614. * '10 - 5vh + 3%'
  15615. * '-10px + 5vh, 5px - 6%'
  15616. * ```
  15617. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  15618. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  15619. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  15620. *
  15621. * @memberof modifiers
  15622. * @inner
  15623. */
  15624. offset: {
  15625. /** @prop {number} order=200 - Index used to define the order of execution */
  15626. order: 200,
  15627. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15628. enabled: true,
  15629. /** @prop {ModifierFn} */
  15630. fn: offset,
  15631. /** @prop {Number|String} offset=0
  15632. * The offset value as described in the modifier description
  15633. */
  15634. offset: 0
  15635. },
  15636. /**
  15637. * Modifier used to prevent the popper from being positioned outside the boundary.
  15638. *
  15639. * A scenario exists where the reference itself is not within the boundaries.<br />
  15640. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  15641. * In this case we need to decide whether the popper should either:
  15642. *
  15643. * - detach from the reference and remain "trapped" in the boundaries, or
  15644. * - if it should ignore the boundary and "escape with its reference"
  15645. *
  15646. * When `escapeWithReference` is set to`true` and reference is completely
  15647. * outside its boundaries, the popper will overflow (or completely leave)
  15648. * the boundaries in order to remain attached to the edge of the reference.
  15649. *
  15650. * @memberof modifiers
  15651. * @inner
  15652. */
  15653. preventOverflow: {
  15654. /** @prop {number} order=300 - Index used to define the order of execution */
  15655. order: 300,
  15656. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15657. enabled: true,
  15658. /** @prop {ModifierFn} */
  15659. fn: preventOverflow,
  15660. /**
  15661. * @prop {Array} [priority=['left','right','top','bottom']]
  15662. * Popper will try to prevent overflow following these priorities by default,
  15663. * then, it could overflow on the left and on top of the `boundariesElement`
  15664. */
  15665. priority: ['left', 'right', 'top', 'bottom'],
  15666. /**
  15667. * @prop {number} padding=5
  15668. * Amount of pixel used to define a minimum distance between the boundaries
  15669. * and the popper. This makes sure the popper always has a little padding
  15670. * between the edges of its container
  15671. */
  15672. padding: 5,
  15673. /**
  15674. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  15675. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  15676. * `viewport` or any DOM element.
  15677. */
  15678. boundariesElement: 'scrollParent'
  15679. },
  15680. /**
  15681. * Modifier used to make sure the reference and its popper stay near each other
  15682. * without leaving any gap between the two. Especially useful when the arrow is
  15683. * enabled and you want to ensure that it points to its reference element.
  15684. * It cares only about the first axis. You can still have poppers with margin
  15685. * between the popper and its reference element.
  15686. * @memberof modifiers
  15687. * @inner
  15688. */
  15689. keepTogether: {
  15690. /** @prop {number} order=400 - Index used to define the order of execution */
  15691. order: 400,
  15692. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15693. enabled: true,
  15694. /** @prop {ModifierFn} */
  15695. fn: keepTogether
  15696. },
  15697. /**
  15698. * This modifier is used to move the `arrowElement` of the popper to make
  15699. * sure it is positioned between the reference element and its popper element.
  15700. * It will read the outer size of the `arrowElement` node to detect how many
  15701. * pixels of conjunction are needed.
  15702. *
  15703. * It has no effect if no `arrowElement` is provided.
  15704. * @memberof modifiers
  15705. * @inner
  15706. */
  15707. arrow: {
  15708. /** @prop {number} order=500 - Index used to define the order of execution */
  15709. order: 500,
  15710. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15711. enabled: true,
  15712. /** @prop {ModifierFn} */
  15713. fn: arrow,
  15714. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  15715. element: '[x-arrow]'
  15716. },
  15717. /**
  15718. * Modifier used to flip the popper's placement when it starts to overlap its
  15719. * reference element.
  15720. *
  15721. * Requires the `preventOverflow` modifier before it in order to work.
  15722. *
  15723. * **NOTE:** this modifier will interrupt the current update cycle and will
  15724. * restart it if it detects the need to flip the placement.
  15725. * @memberof modifiers
  15726. * @inner
  15727. */
  15728. flip: {
  15729. /** @prop {number} order=600 - Index used to define the order of execution */
  15730. order: 600,
  15731. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15732. enabled: true,
  15733. /** @prop {ModifierFn} */
  15734. fn: flip,
  15735. /**
  15736. * @prop {String|Array} behavior='flip'
  15737. * The behavior used to change the popper's placement. It can be one of
  15738. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  15739. * placements (with optional variations)
  15740. */
  15741. behavior: 'flip',
  15742. /**
  15743. * @prop {number} padding=5
  15744. * The popper will flip if it hits the edges of the `boundariesElement`
  15745. */
  15746. padding: 5,
  15747. /**
  15748. * @prop {String|HTMLElement} boundariesElement='viewport'
  15749. * The element which will define the boundaries of the popper position.
  15750. * The popper will never be placed outside of the defined boundaries
  15751. * (except if `keepTogether` is enabled)
  15752. */
  15753. boundariesElement: 'viewport',
  15754. /**
  15755. * @prop {Boolean} flipVariations=false
  15756. * The popper will switch placement variation between `-start` and `-end` when
  15757. * the reference element overlaps its boundaries.
  15758. *
  15759. * The original placement should have a set variation.
  15760. */
  15761. flipVariations: false,
  15762. /**
  15763. * @prop {Boolean} flipVariationsByContent=false
  15764. * The popper will switch placement variation between `-start` and `-end` when
  15765. * the popper element overlaps its reference boundaries.
  15766. *
  15767. * The original placement should have a set variation.
  15768. */
  15769. flipVariationsByContent: false
  15770. },
  15771. /**
  15772. * Modifier used to make the popper flow toward the inner of the reference element.
  15773. * By default, when this modifier is disabled, the popper will be placed outside
  15774. * the reference element.
  15775. * @memberof modifiers
  15776. * @inner
  15777. */
  15778. inner: {
  15779. /** @prop {number} order=700 - Index used to define the order of execution */
  15780. order: 700,
  15781. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  15782. enabled: false,
  15783. /** @prop {ModifierFn} */
  15784. fn: inner
  15785. },
  15786. /**
  15787. * Modifier used to hide the popper when its reference element is outside of the
  15788. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  15789. * be used to hide with a CSS selector the popper when its reference is
  15790. * out of boundaries.
  15791. *
  15792. * Requires the `preventOverflow` modifier before it in order to work.
  15793. * @memberof modifiers
  15794. * @inner
  15795. */
  15796. hide: {
  15797. /** @prop {number} order=800 - Index used to define the order of execution */
  15798. order: 800,
  15799. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15800. enabled: true,
  15801. /** @prop {ModifierFn} */
  15802. fn: hide
  15803. },
  15804. /**
  15805. * Computes the style that will be applied to the popper element to gets
  15806. * properly positioned.
  15807. *
  15808. * Note that this modifier will not touch the DOM, it just prepares the styles
  15809. * so that `applyStyle` modifier can apply it. This separation is useful
  15810. * in case you need to replace `applyStyle` with a custom implementation.
  15811. *
  15812. * This modifier has `850` as `order` value to maintain backward compatibility
  15813. * with previous versions of Popper.js. Expect the modifiers ordering method
  15814. * to change in future major versions of the library.
  15815. *
  15816. * @memberof modifiers
  15817. * @inner
  15818. */
  15819. computeStyle: {
  15820. /** @prop {number} order=850 - Index used to define the order of execution */
  15821. order: 850,
  15822. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15823. enabled: true,
  15824. /** @prop {ModifierFn} */
  15825. fn: computeStyle,
  15826. /**
  15827. * @prop {Boolean} gpuAcceleration=true
  15828. * If true, it uses the CSS 3D transformation to position the popper.
  15829. * Otherwise, it will use the `top` and `left` properties
  15830. */
  15831. gpuAcceleration: true,
  15832. /**
  15833. * @prop {string} [x='bottom']
  15834. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  15835. * Change this if your popper should grow in a direction different from `bottom`
  15836. */
  15837. x: 'bottom',
  15838. /**
  15839. * @prop {string} [x='left']
  15840. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  15841. * Change this if your popper should grow in a direction different from `right`
  15842. */
  15843. y: 'right'
  15844. },
  15845. /**
  15846. * Applies the computed styles to the popper element.
  15847. *
  15848. * All the DOM manipulations are limited to this modifier. This is useful in case
  15849. * you want to integrate Popper.js inside a framework or view library and you
  15850. * want to delegate all the DOM manipulations to it.
  15851. *
  15852. * Note that if you disable this modifier, you must make sure the popper element
  15853. * has its position set to `absolute` before Popper.js can do its work!
  15854. *
  15855. * Just disable this modifier and define your own to achieve the desired effect.
  15856. *
  15857. * @memberof modifiers
  15858. * @inner
  15859. */
  15860. applyStyle: {
  15861. /** @prop {number} order=900 - Index used to define the order of execution */
  15862. order: 900,
  15863. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15864. enabled: true,
  15865. /** @prop {ModifierFn} */
  15866. fn: applyStyle,
  15867. /** @prop {Function} */
  15868. onLoad: applyStyleOnLoad,
  15869. /**
  15870. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  15871. * @prop {Boolean} gpuAcceleration=true
  15872. * If true, it uses the CSS 3D transformation to position the popper.
  15873. * Otherwise, it will use the `top` and `left` properties
  15874. */
  15875. gpuAcceleration: undefined
  15876. }
  15877. };
  15878. /**
  15879. * The `dataObject` is an object containing all the information used by Popper.js.
  15880. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  15881. * @name dataObject
  15882. * @property {Object} data.instance The Popper.js instance
  15883. * @property {String} data.placement Placement applied to popper
  15884. * @property {String} data.originalPlacement Placement originally defined on init
  15885. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  15886. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  15887. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  15888. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  15889. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  15890. * @property {Object} data.boundaries Offsets of the popper boundaries
  15891. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  15892. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  15893. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  15894. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  15895. */
  15896. /**
  15897. * Default options provided to Popper.js constructor.<br />
  15898. * These can be overridden using the `options` argument of Popper.js.<br />
  15899. * To override an option, simply pass an object with the same
  15900. * structure of the `options` object, as the 3rd argument. For example:
  15901. * ```
  15902. * new Popper(ref, pop, {
  15903. * modifiers: {
  15904. * preventOverflow: { enabled: false }
  15905. * }
  15906. * })
  15907. * ```
  15908. * @type {Object}
  15909. * @static
  15910. * @memberof Popper
  15911. */
  15912. var Defaults = {
  15913. /**
  15914. * Popper's placement.
  15915. * @prop {Popper.placements} placement='bottom'
  15916. */
  15917. placement: 'bottom',
  15918. /**
  15919. * Set this to true if you want popper to position it self in 'fixed' mode
  15920. * @prop {Boolean} positionFixed=false
  15921. */
  15922. positionFixed: false,
  15923. /**
  15924. * Whether events (resize, scroll) are initially enabled.
  15925. * @prop {Boolean} eventsEnabled=true
  15926. */
  15927. eventsEnabled: true,
  15928. /**
  15929. * Set to true if you want to automatically remove the popper when
  15930. * you call the `destroy` method.
  15931. * @prop {Boolean} removeOnDestroy=false
  15932. */
  15933. removeOnDestroy: false,
  15934. /**
  15935. * Callback called when the popper is created.<br />
  15936. * By default, it is set to no-op.<br />
  15937. * Access Popper.js instance with `data.instance`.
  15938. * @prop {onCreate}
  15939. */
  15940. onCreate: function onCreate() {},
  15941. /**
  15942. * Callback called when the popper is updated. This callback is not called
  15943. * on the initialization/creation of the popper, but only on subsequent
  15944. * updates.<br />
  15945. * By default, it is set to no-op.<br />
  15946. * Access Popper.js instance with `data.instance`.
  15947. * @prop {onUpdate}
  15948. */
  15949. onUpdate: function onUpdate() {},
  15950. /**
  15951. * List of modifiers used to modify the offsets before they are applied to the popper.
  15952. * They provide most of the functionalities of Popper.js.
  15953. * @prop {modifiers}
  15954. */
  15955. modifiers: modifiers
  15956. };
  15957. /**
  15958. * @callback onCreate
  15959. * @param {dataObject} data
  15960. */
  15961. /**
  15962. * @callback onUpdate
  15963. * @param {dataObject} data
  15964. */
  15965. // Utils
  15966. // Methods
  15967. var Popper = function () {
  15968. /**
  15969. * Creates a new Popper.js instance.
  15970. * @class Popper
  15971. * @param {Element|referenceObject} reference - The reference element used to position the popper
  15972. * @param {Element} popper - The HTML / XML element used as the popper
  15973. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  15974. * @return {Object} instance - The generated Popper.js instance
  15975. */
  15976. function Popper(reference, popper) {
  15977. var _this = this;
  15978. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  15979. classCallCheck(this, Popper);
  15980. this.scheduleUpdate = function () {
  15981. return requestAnimationFrame(_this.update);
  15982. };
  15983. // make update() debounced, so that it only runs at most once-per-tick
  15984. this.update = debounce(this.update.bind(this));
  15985. // with {} we create a new object with the options inside it
  15986. this.options = _extends({}, Popper.Defaults, options);
  15987. // init state
  15988. this.state = {
  15989. isDestroyed: false,
  15990. isCreated: false,
  15991. scrollParents: []
  15992. };
  15993. // get reference and popper elements (allow jQuery wrappers)
  15994. this.reference = reference && reference.jquery ? reference[0] : reference;
  15995. this.popper = popper && popper.jquery ? popper[0] : popper;
  15996. // Deep merge modifiers options
  15997. this.options.modifiers = {};
  15998. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  15999. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  16000. });
  16001. // Refactoring modifiers' list (Object => Array)
  16002. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  16003. return _extends({
  16004. name: name
  16005. }, _this.options.modifiers[name]);
  16006. })
  16007. // sort the modifiers by order
  16008. .sort(function (a, b) {
  16009. return a.order - b.order;
  16010. });
  16011. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  16012. // such code is executed in the same order of its modifier
  16013. // they could add new properties to their options configuration
  16014. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  16015. this.modifiers.forEach(function (modifierOptions) {
  16016. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  16017. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  16018. }
  16019. });
  16020. // fire the first update to position the popper in the right place
  16021. this.update();
  16022. var eventsEnabled = this.options.eventsEnabled;
  16023. if (eventsEnabled) {
  16024. // setup event listeners, they will take care of update the position in specific situations
  16025. this.enableEventListeners();
  16026. }
  16027. this.state.eventsEnabled = eventsEnabled;
  16028. }
  16029. // We can't use class properties because they don't get listed in the
  16030. // class prototype and break stuff like Sinon stubs
  16031. createClass(Popper, [{
  16032. key: 'update',
  16033. value: function update$$1() {
  16034. return update.call(this);
  16035. }
  16036. }, {
  16037. key: 'destroy',
  16038. value: function destroy$$1() {
  16039. return destroy.call(this);
  16040. }
  16041. }, {
  16042. key: 'enableEventListeners',
  16043. value: function enableEventListeners$$1() {
  16044. return enableEventListeners.call(this);
  16045. }
  16046. }, {
  16047. key: 'disableEventListeners',
  16048. value: function disableEventListeners$$1() {
  16049. return disableEventListeners.call(this);
  16050. }
  16051. /**
  16052. * Schedules an update. It will run on the next UI update available.
  16053. * @method scheduleUpdate
  16054. * @memberof Popper
  16055. */
  16056. /**
  16057. * Collection of utilities useful when writing custom modifiers.
  16058. * Starting from version 1.7, this method is available only if you
  16059. * include `popper-utils.js` before `popper.js`.
  16060. *
  16061. * **DEPRECATION**: This way to access PopperUtils is deprecated
  16062. * and will be removed in v2! Use the PopperUtils module directly instead.
  16063. * Due to the high instability of the methods contained in Utils, we can't
  16064. * guarantee them to follow semver. Use them at your own risk!
  16065. * @static
  16066. * @private
  16067. * @type {Object}
  16068. * @deprecated since version 1.8
  16069. * @member Utils
  16070. * @memberof Popper
  16071. */
  16072. }]);
  16073. return Popper;
  16074. }();
  16075. /**
  16076. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  16077. * and lets you use it as replacement of a real DOM node.<br />
  16078. * You can use this method to position a popper relatively to a set of coordinates
  16079. * in case you don't have a DOM node to use as reference.
  16080. *
  16081. * ```
  16082. * new Popper(referenceObject, popperNode);
  16083. * ```
  16084. *
  16085. * NB: This feature isn't supported in Internet Explorer 10.
  16086. * @name referenceObject
  16087. * @property {Function} data.getBoundingClientRect
  16088. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  16089. * @property {number} data.clientWidth
  16090. * An ES6 getter that will return the width of the virtual reference element.
  16091. * @property {number} data.clientHeight
  16092. * An ES6 getter that will return the height of the virtual reference element.
  16093. */
  16094. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  16095. Popper.placements = placements;
  16096. Popper.Defaults = Defaults;
  16097. return Popper;
  16098. })));
  16099. //# sourceMappingURL=popper.js.map
  16100. /*!
  16101. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  16102. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  16103. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  16104. */
  16105. (function (global, factory) {
  16106. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
  16107. typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
  16108. (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper));
  16109. }(this, (function (exports, $, Popper) { 'use strict';
  16110. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  16111. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  16112. function _defineProperties(target, props) {
  16113. for (var i = 0; i < props.length; i++) {
  16114. var descriptor = props[i];
  16115. descriptor.enumerable = descriptor.enumerable || false;
  16116. descriptor.configurable = true;
  16117. if ("value" in descriptor) descriptor.writable = true;
  16118. Object.defineProperty(target, descriptor.key, descriptor);
  16119. }
  16120. }
  16121. function _createClass(Constructor, protoProps, staticProps) {
  16122. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  16123. if (staticProps) _defineProperties(Constructor, staticProps);
  16124. return Constructor;
  16125. }
  16126. function _defineProperty(obj, key, value) {
  16127. if (key in obj) {
  16128. Object.defineProperty(obj, key, {
  16129. value: value,
  16130. enumerable: true,
  16131. configurable: true,
  16132. writable: true
  16133. });
  16134. } else {
  16135. obj[key] = value;
  16136. }
  16137. return obj;
  16138. }
  16139. function ownKeys(object, enumerableOnly) {
  16140. var keys = Object.keys(object);
  16141. if (Object.getOwnPropertySymbols) {
  16142. var symbols = Object.getOwnPropertySymbols(object);
  16143. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  16144. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  16145. });
  16146. keys.push.apply(keys, symbols);
  16147. }
  16148. return keys;
  16149. }
  16150. function _objectSpread2(target) {
  16151. for (var i = 1; i < arguments.length; i++) {
  16152. var source = arguments[i] != null ? arguments[i] : {};
  16153. if (i % 2) {
  16154. ownKeys(Object(source), true).forEach(function (key) {
  16155. _defineProperty(target, key, source[key]);
  16156. });
  16157. } else if (Object.getOwnPropertyDescriptors) {
  16158. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  16159. } else {
  16160. ownKeys(Object(source)).forEach(function (key) {
  16161. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  16162. });
  16163. }
  16164. }
  16165. return target;
  16166. }
  16167. function _inheritsLoose(subClass, superClass) {
  16168. subClass.prototype = Object.create(superClass.prototype);
  16169. subClass.prototype.constructor = subClass;
  16170. subClass.__proto__ = superClass;
  16171. }
  16172. /**
  16173. * --------------------------------------------------------------------------
  16174. * Bootstrap (v4.4.1): util.js
  16175. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  16176. * --------------------------------------------------------------------------
  16177. */
  16178. /**
  16179. * ------------------------------------------------------------------------
  16180. * Private TransitionEnd Helpers
  16181. * ------------------------------------------------------------------------
  16182. */
  16183. var TRANSITION_END = 'transitionend';
  16184. var MAX_UID = 1000000;
  16185. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  16186. function toType(obj) {
  16187. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  16188. }
  16189. function getSpecialTransitionEndEvent() {
  16190. return {
  16191. bindType: TRANSITION_END,
  16192. delegateType: TRANSITION_END,
  16193. handle: function handle(event) {
  16194. if ($(event.target).is(this)) {
  16195. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  16196. }
  16197. return undefined; // eslint-disable-line no-undefined
  16198. }
  16199. };
  16200. }
  16201. function transitionEndEmulator(duration) {
  16202. var _this = this;
  16203. var called = false;
  16204. $(this).one(Util.TRANSITION_END, function () {
  16205. called = true;
  16206. });
  16207. setTimeout(function () {
  16208. if (!called) {
  16209. Util.triggerTransitionEnd(_this);
  16210. }
  16211. }, duration);
  16212. return this;
  16213. }
  16214. function setTransitionEndSupport() {
  16215. $.fn.emulateTransitionEnd = transitionEndEmulator;
  16216. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  16217. }
  16218. /**
  16219. * --------------------------------------------------------------------------
  16220. * Public Util Api
  16221. * --------------------------------------------------------------------------
  16222. */
  16223. var Util = {
  16224. TRANSITION_END: 'bsTransitionEnd',
  16225. getUID: function getUID(prefix) {
  16226. do {
  16227. // eslint-disable-next-line no-bitwise
  16228. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  16229. } while (document.getElementById(prefix));
  16230. return prefix;
  16231. },
  16232. getSelectorFromElement: function getSelectorFromElement(element) {
  16233. var selector = element.getAttribute('data-target');
  16234. if (!selector || selector === '#') {
  16235. var hrefAttr = element.getAttribute('href');
  16236. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  16237. }
  16238. try {
  16239. return document.querySelector(selector) ? selector : null;
  16240. } catch (err) {
  16241. return null;
  16242. }
  16243. },
  16244. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  16245. if (!element) {
  16246. return 0;
  16247. } // Get transition-duration of the element
  16248. var transitionDuration = $(element).css('transition-duration');
  16249. var transitionDelay = $(element).css('transition-delay');
  16250. var floatTransitionDuration = parseFloat(transitionDuration);
  16251. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  16252. if (!floatTransitionDuration && !floatTransitionDelay) {
  16253. return 0;
  16254. } // If multiple durations are defined, take the first
  16255. transitionDuration = transitionDuration.split(',')[0];
  16256. transitionDelay = transitionDelay.split(',')[0];
  16257. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  16258. },
  16259. reflow: function reflow(element) {
  16260. return element.offsetHeight;
  16261. },
  16262. triggerTransitionEnd: function triggerTransitionEnd(element) {
  16263. $(element).trigger(TRANSITION_END);
  16264. },
  16265. // TODO: Remove in v5
  16266. supportsTransitionEnd: function supportsTransitionEnd() {
  16267. return Boolean(TRANSITION_END);
  16268. },
  16269. isElement: function isElement(obj) {
  16270. return (obj[0] || obj).nodeType;
  16271. },
  16272. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  16273. for (var property in configTypes) {
  16274. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  16275. var expectedTypes = configTypes[property];
  16276. var value = config[property];
  16277. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  16278. if (!new RegExp(expectedTypes).test(valueType)) {
  16279. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  16280. }
  16281. }
  16282. }
  16283. },
  16284. findShadowRoot: function findShadowRoot(element) {
  16285. if (!document.documentElement.attachShadow) {
  16286. return null;
  16287. } // Can find the shadow root otherwise it'll return the document
  16288. if (typeof element.getRootNode === 'function') {
  16289. var root = element.getRootNode();
  16290. return root instanceof ShadowRoot ? root : null;
  16291. }
  16292. if (element instanceof ShadowRoot) {
  16293. return element;
  16294. } // when we don't find a shadow root
  16295. if (!element.parentNode) {
  16296. return null;
  16297. }
  16298. return Util.findShadowRoot(element.parentNode);
  16299. },
  16300. jQueryDetection: function jQueryDetection() {
  16301. if (typeof $ === 'undefined') {
  16302. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  16303. }
  16304. var version = $.fn.jquery.split(' ')[0].split('.');
  16305. var minMajor = 1;
  16306. var ltMajor = 2;
  16307. var minMinor = 9;
  16308. var minPatch = 1;
  16309. var maxMajor = 4;
  16310. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  16311. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  16312. }
  16313. }
  16314. };
  16315. Util.jQueryDetection();
  16316. setTransitionEndSupport();
  16317. /**
  16318. * ------------------------------------------------------------------------
  16319. * Constants
  16320. * ------------------------------------------------------------------------
  16321. */
  16322. var NAME = 'alert';
  16323. var VERSION = '4.4.1';
  16324. var DATA_KEY = 'bs.alert';
  16325. var EVENT_KEY = "." + DATA_KEY;
  16326. var DATA_API_KEY = '.data-api';
  16327. var JQUERY_NO_CONFLICT = $.fn[NAME];
  16328. var Selector = {
  16329. DISMISS: '[data-dismiss="alert"]'
  16330. };
  16331. var Event = {
  16332. CLOSE: "close" + EVENT_KEY,
  16333. CLOSED: "closed" + EVENT_KEY,
  16334. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  16335. };
  16336. var ClassName = {
  16337. ALERT: 'alert',
  16338. FADE: 'fade',
  16339. SHOW: 'show'
  16340. };
  16341. /**
  16342. * ------------------------------------------------------------------------
  16343. * Class Definition
  16344. * ------------------------------------------------------------------------
  16345. */
  16346. var Alert =
  16347. /*#__PURE__*/
  16348. function () {
  16349. function Alert(element) {
  16350. this._element = element;
  16351. } // Getters
  16352. var _proto = Alert.prototype;
  16353. // Public
  16354. _proto.close = function close(element) {
  16355. var rootElement = this._element;
  16356. if (element) {
  16357. rootElement = this._getRootElement(element);
  16358. }
  16359. var customEvent = this._triggerCloseEvent(rootElement);
  16360. if (customEvent.isDefaultPrevented()) {
  16361. return;
  16362. }
  16363. this._removeElement(rootElement);
  16364. };
  16365. _proto.dispose = function dispose() {
  16366. $.removeData(this._element, DATA_KEY);
  16367. this._element = null;
  16368. } // Private
  16369. ;
  16370. _proto._getRootElement = function _getRootElement(element) {
  16371. var selector = Util.getSelectorFromElement(element);
  16372. var parent = false;
  16373. if (selector) {
  16374. parent = document.querySelector(selector);
  16375. }
  16376. if (!parent) {
  16377. parent = $(element).closest("." + ClassName.ALERT)[0];
  16378. }
  16379. return parent;
  16380. };
  16381. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  16382. var closeEvent = $.Event(Event.CLOSE);
  16383. $(element).trigger(closeEvent);
  16384. return closeEvent;
  16385. };
  16386. _proto._removeElement = function _removeElement(element) {
  16387. var _this = this;
  16388. $(element).removeClass(ClassName.SHOW);
  16389. if (!$(element).hasClass(ClassName.FADE)) {
  16390. this._destroyElement(element);
  16391. return;
  16392. }
  16393. var transitionDuration = Util.getTransitionDurationFromElement(element);
  16394. $(element).one(Util.TRANSITION_END, function (event) {
  16395. return _this._destroyElement(element, event);
  16396. }).emulateTransitionEnd(transitionDuration);
  16397. };
  16398. _proto._destroyElement = function _destroyElement(element) {
  16399. $(element).detach().trigger(Event.CLOSED).remove();
  16400. } // Static
  16401. ;
  16402. Alert._jQueryInterface = function _jQueryInterface(config) {
  16403. return this.each(function () {
  16404. var $element = $(this);
  16405. var data = $element.data(DATA_KEY);
  16406. if (!data) {
  16407. data = new Alert(this);
  16408. $element.data(DATA_KEY, data);
  16409. }
  16410. if (config === 'close') {
  16411. data[config](this);
  16412. }
  16413. });
  16414. };
  16415. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  16416. return function (event) {
  16417. if (event) {
  16418. event.preventDefault();
  16419. }
  16420. alertInstance.close(this);
  16421. };
  16422. };
  16423. _createClass(Alert, null, [{
  16424. key: "VERSION",
  16425. get: function get() {
  16426. return VERSION;
  16427. }
  16428. }]);
  16429. return Alert;
  16430. }();
  16431. /**
  16432. * ------------------------------------------------------------------------
  16433. * Data Api implementation
  16434. * ------------------------------------------------------------------------
  16435. */
  16436. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  16437. /**
  16438. * ------------------------------------------------------------------------
  16439. * jQuery
  16440. * ------------------------------------------------------------------------
  16441. */
  16442. $.fn[NAME] = Alert._jQueryInterface;
  16443. $.fn[NAME].Constructor = Alert;
  16444. $.fn[NAME].noConflict = function () {
  16445. $.fn[NAME] = JQUERY_NO_CONFLICT;
  16446. return Alert._jQueryInterface;
  16447. };
  16448. /**
  16449. * ------------------------------------------------------------------------
  16450. * Constants
  16451. * ------------------------------------------------------------------------
  16452. */
  16453. var NAME$1 = 'button';
  16454. var VERSION$1 = '4.4.1';
  16455. var DATA_KEY$1 = 'bs.button';
  16456. var EVENT_KEY$1 = "." + DATA_KEY$1;
  16457. var DATA_API_KEY$1 = '.data-api';
  16458. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  16459. var ClassName$1 = {
  16460. ACTIVE: 'active',
  16461. BUTTON: 'btn',
  16462. FOCUS: 'focus'
  16463. };
  16464. var Selector$1 = {
  16465. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  16466. DATA_TOGGLES: '[data-toggle="buttons"]',
  16467. DATA_TOGGLE: '[data-toggle="button"]',
  16468. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  16469. INPUT: 'input:not([type="hidden"])',
  16470. ACTIVE: '.active',
  16471. BUTTON: '.btn'
  16472. };
  16473. var Event$1 = {
  16474. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  16475. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  16476. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  16477. };
  16478. /**
  16479. * ------------------------------------------------------------------------
  16480. * Class Definition
  16481. * ------------------------------------------------------------------------
  16482. */
  16483. var Button =
  16484. /*#__PURE__*/
  16485. function () {
  16486. function Button(element) {
  16487. this._element = element;
  16488. } // Getters
  16489. var _proto = Button.prototype;
  16490. // Public
  16491. _proto.toggle = function toggle() {
  16492. var triggerChangeEvent = true;
  16493. var addAriaPressed = true;
  16494. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  16495. if (rootElement) {
  16496. var input = this._element.querySelector(Selector$1.INPUT);
  16497. if (input) {
  16498. if (input.type === 'radio') {
  16499. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  16500. triggerChangeEvent = false;
  16501. } else {
  16502. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  16503. if (activeElement) {
  16504. $(activeElement).removeClass(ClassName$1.ACTIVE);
  16505. }
  16506. }
  16507. } else if (input.type === 'checkbox') {
  16508. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  16509. triggerChangeEvent = false;
  16510. }
  16511. } else {
  16512. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  16513. triggerChangeEvent = false;
  16514. }
  16515. if (triggerChangeEvent) {
  16516. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  16517. $(input).trigger('change');
  16518. }
  16519. input.focus();
  16520. addAriaPressed = false;
  16521. }
  16522. }
  16523. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  16524. if (addAriaPressed) {
  16525. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  16526. }
  16527. if (triggerChangeEvent) {
  16528. $(this._element).toggleClass(ClassName$1.ACTIVE);
  16529. }
  16530. }
  16531. };
  16532. _proto.dispose = function dispose() {
  16533. $.removeData(this._element, DATA_KEY$1);
  16534. this._element = null;
  16535. } // Static
  16536. ;
  16537. Button._jQueryInterface = function _jQueryInterface(config) {
  16538. return this.each(function () {
  16539. var data = $(this).data(DATA_KEY$1);
  16540. if (!data) {
  16541. data = new Button(this);
  16542. $(this).data(DATA_KEY$1, data);
  16543. }
  16544. if (config === 'toggle') {
  16545. data[config]();
  16546. }
  16547. });
  16548. };
  16549. _createClass(Button, null, [{
  16550. key: "VERSION",
  16551. get: function get() {
  16552. return VERSION$1;
  16553. }
  16554. }]);
  16555. return Button;
  16556. }();
  16557. /**
  16558. * ------------------------------------------------------------------------
  16559. * Data Api implementation
  16560. * ------------------------------------------------------------------------
  16561. */
  16562. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  16563. var button = event.target;
  16564. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  16565. button = $(button).closest(Selector$1.BUTTON)[0];
  16566. }
  16567. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  16568. event.preventDefault(); // work around Firefox bug #1540995
  16569. } else {
  16570. var inputBtn = button.querySelector(Selector$1.INPUT);
  16571. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  16572. event.preventDefault(); // work around Firefox bug #1540995
  16573. return;
  16574. }
  16575. Button._jQueryInterface.call($(button), 'toggle');
  16576. }
  16577. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  16578. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  16579. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  16580. });
  16581. $(window).on(Event$1.LOAD_DATA_API, function () {
  16582. // ensure correct active class is set to match the controls' actual values/states
  16583. // find all checkboxes/readio buttons inside data-toggle groups
  16584. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  16585. for (var i = 0, len = buttons.length; i < len; i++) {
  16586. var button = buttons[i];
  16587. var input = button.querySelector(Selector$1.INPUT);
  16588. if (input.checked || input.hasAttribute('checked')) {
  16589. button.classList.add(ClassName$1.ACTIVE);
  16590. } else {
  16591. button.classList.remove(ClassName$1.ACTIVE);
  16592. }
  16593. } // find all button toggles
  16594. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  16595. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  16596. var _button = buttons[_i];
  16597. if (_button.getAttribute('aria-pressed') === 'true') {
  16598. _button.classList.add(ClassName$1.ACTIVE);
  16599. } else {
  16600. _button.classList.remove(ClassName$1.ACTIVE);
  16601. }
  16602. }
  16603. });
  16604. /**
  16605. * ------------------------------------------------------------------------
  16606. * jQuery
  16607. * ------------------------------------------------------------------------
  16608. */
  16609. $.fn[NAME$1] = Button._jQueryInterface;
  16610. $.fn[NAME$1].Constructor = Button;
  16611. $.fn[NAME$1].noConflict = function () {
  16612. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  16613. return Button._jQueryInterface;
  16614. };
  16615. /**
  16616. * ------------------------------------------------------------------------
  16617. * Constants
  16618. * ------------------------------------------------------------------------
  16619. */
  16620. var NAME$2 = 'carousel';
  16621. var VERSION$2 = '4.4.1';
  16622. var DATA_KEY$2 = 'bs.carousel';
  16623. var EVENT_KEY$2 = "." + DATA_KEY$2;
  16624. var DATA_API_KEY$2 = '.data-api';
  16625. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  16626. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  16627. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  16628. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  16629. var SWIPE_THRESHOLD = 40;
  16630. var Default = {
  16631. interval: 5000,
  16632. keyboard: true,
  16633. slide: false,
  16634. pause: 'hover',
  16635. wrap: true,
  16636. touch: true
  16637. };
  16638. var DefaultType = {
  16639. interval: '(number|boolean)',
  16640. keyboard: 'boolean',
  16641. slide: '(boolean|string)',
  16642. pause: '(string|boolean)',
  16643. wrap: 'boolean',
  16644. touch: 'boolean'
  16645. };
  16646. var Direction = {
  16647. NEXT: 'next',
  16648. PREV: 'prev',
  16649. LEFT: 'left',
  16650. RIGHT: 'right'
  16651. };
  16652. var Event$2 = {
  16653. SLIDE: "slide" + EVENT_KEY$2,
  16654. SLID: "slid" + EVENT_KEY$2,
  16655. KEYDOWN: "keydown" + EVENT_KEY$2,
  16656. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  16657. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  16658. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  16659. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  16660. TOUCHEND: "touchend" + EVENT_KEY$2,
  16661. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  16662. POINTERUP: "pointerup" + EVENT_KEY$2,
  16663. DRAG_START: "dragstart" + EVENT_KEY$2,
  16664. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  16665. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  16666. };
  16667. var ClassName$2 = {
  16668. CAROUSEL: 'carousel',
  16669. ACTIVE: 'active',
  16670. SLIDE: 'slide',
  16671. RIGHT: 'carousel-item-right',
  16672. LEFT: 'carousel-item-left',
  16673. NEXT: 'carousel-item-next',
  16674. PREV: 'carousel-item-prev',
  16675. ITEM: 'carousel-item',
  16676. POINTER_EVENT: 'pointer-event'
  16677. };
  16678. var Selector$2 = {
  16679. ACTIVE: '.active',
  16680. ACTIVE_ITEM: '.active.carousel-item',
  16681. ITEM: '.carousel-item',
  16682. ITEM_IMG: '.carousel-item img',
  16683. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  16684. INDICATORS: '.carousel-indicators',
  16685. DATA_SLIDE: '[data-slide], [data-slide-to]',
  16686. DATA_RIDE: '[data-ride="carousel"]'
  16687. };
  16688. var PointerType = {
  16689. TOUCH: 'touch',
  16690. PEN: 'pen'
  16691. };
  16692. /**
  16693. * ------------------------------------------------------------------------
  16694. * Class Definition
  16695. * ------------------------------------------------------------------------
  16696. */
  16697. var Carousel =
  16698. /*#__PURE__*/
  16699. function () {
  16700. function Carousel(element, config) {
  16701. this._items = null;
  16702. this._interval = null;
  16703. this._activeElement = null;
  16704. this._isPaused = false;
  16705. this._isSliding = false;
  16706. this.touchTimeout = null;
  16707. this.touchStartX = 0;
  16708. this.touchDeltaX = 0;
  16709. this._config = this._getConfig(config);
  16710. this._element = element;
  16711. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  16712. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  16713. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  16714. this._addEventListeners();
  16715. } // Getters
  16716. var _proto = Carousel.prototype;
  16717. // Public
  16718. _proto.next = function next() {
  16719. if (!this._isSliding) {
  16720. this._slide(Direction.NEXT);
  16721. }
  16722. };
  16723. _proto.nextWhenVisible = function nextWhenVisible() {
  16724. // Don't call next when the page isn't visible
  16725. // or the carousel or its parent isn't visible
  16726. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  16727. this.next();
  16728. }
  16729. };
  16730. _proto.prev = function prev() {
  16731. if (!this._isSliding) {
  16732. this._slide(Direction.PREV);
  16733. }
  16734. };
  16735. _proto.pause = function pause(event) {
  16736. if (!event) {
  16737. this._isPaused = true;
  16738. }
  16739. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  16740. Util.triggerTransitionEnd(this._element);
  16741. this.cycle(true);
  16742. }
  16743. clearInterval(this._interval);
  16744. this._interval = null;
  16745. };
  16746. _proto.cycle = function cycle(event) {
  16747. if (!event) {
  16748. this._isPaused = false;
  16749. }
  16750. if (this._interval) {
  16751. clearInterval(this._interval);
  16752. this._interval = null;
  16753. }
  16754. if (this._config.interval && !this._isPaused) {
  16755. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  16756. }
  16757. };
  16758. _proto.to = function to(index) {
  16759. var _this = this;
  16760. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  16761. var activeIndex = this._getItemIndex(this._activeElement);
  16762. if (index > this._items.length - 1 || index < 0) {
  16763. return;
  16764. }
  16765. if (this._isSliding) {
  16766. $(this._element).one(Event$2.SLID, function () {
  16767. return _this.to(index);
  16768. });
  16769. return;
  16770. }
  16771. if (activeIndex === index) {
  16772. this.pause();
  16773. this.cycle();
  16774. return;
  16775. }
  16776. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  16777. this._slide(direction, this._items[index]);
  16778. };
  16779. _proto.dispose = function dispose() {
  16780. $(this._element).off(EVENT_KEY$2);
  16781. $.removeData(this._element, DATA_KEY$2);
  16782. this._items = null;
  16783. this._config = null;
  16784. this._element = null;
  16785. this._interval = null;
  16786. this._isPaused = null;
  16787. this._isSliding = null;
  16788. this._activeElement = null;
  16789. this._indicatorsElement = null;
  16790. } // Private
  16791. ;
  16792. _proto._getConfig = function _getConfig(config) {
  16793. config = _objectSpread2({}, Default, {}, config);
  16794. Util.typeCheckConfig(NAME$2, config, DefaultType);
  16795. return config;
  16796. };
  16797. _proto._handleSwipe = function _handleSwipe() {
  16798. var absDeltax = Math.abs(this.touchDeltaX);
  16799. if (absDeltax <= SWIPE_THRESHOLD) {
  16800. return;
  16801. }
  16802. var direction = absDeltax / this.touchDeltaX;
  16803. this.touchDeltaX = 0; // swipe left
  16804. if (direction > 0) {
  16805. this.prev();
  16806. } // swipe right
  16807. if (direction < 0) {
  16808. this.next();
  16809. }
  16810. };
  16811. _proto._addEventListeners = function _addEventListeners() {
  16812. var _this2 = this;
  16813. if (this._config.keyboard) {
  16814. $(this._element).on(Event$2.KEYDOWN, function (event) {
  16815. return _this2._keydown(event);
  16816. });
  16817. }
  16818. if (this._config.pause === 'hover') {
  16819. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  16820. return _this2.pause(event);
  16821. }).on(Event$2.MOUSELEAVE, function (event) {
  16822. return _this2.cycle(event);
  16823. });
  16824. }
  16825. if (this._config.touch) {
  16826. this._addTouchEventListeners();
  16827. }
  16828. };
  16829. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  16830. var _this3 = this;
  16831. if (!this._touchSupported) {
  16832. return;
  16833. }
  16834. var start = function start(event) {
  16835. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  16836. _this3.touchStartX = event.originalEvent.clientX;
  16837. } else if (!_this3._pointerEvent) {
  16838. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  16839. }
  16840. };
  16841. var move = function move(event) {
  16842. // ensure swiping with one touch and not pinching
  16843. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  16844. _this3.touchDeltaX = 0;
  16845. } else {
  16846. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  16847. }
  16848. };
  16849. var end = function end(event) {
  16850. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  16851. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  16852. }
  16853. _this3._handleSwipe();
  16854. if (_this3._config.pause === 'hover') {
  16855. // If it's a touch-enabled device, mouseenter/leave are fired as
  16856. // part of the mouse compatibility events on first tap - the carousel
  16857. // would stop cycling until user tapped out of it;
  16858. // here, we listen for touchend, explicitly pause the carousel
  16859. // (as if it's the second time we tap on it, mouseenter compat event
  16860. // is NOT fired) and after a timeout (to allow for mouse compatibility
  16861. // events to fire) we explicitly restart cycling
  16862. _this3.pause();
  16863. if (_this3.touchTimeout) {
  16864. clearTimeout(_this3.touchTimeout);
  16865. }
  16866. _this3.touchTimeout = setTimeout(function (event) {
  16867. return _this3.cycle(event);
  16868. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  16869. }
  16870. };
  16871. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  16872. return e.preventDefault();
  16873. });
  16874. if (this._pointerEvent) {
  16875. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  16876. return start(event);
  16877. });
  16878. $(this._element).on(Event$2.POINTERUP, function (event) {
  16879. return end(event);
  16880. });
  16881. this._element.classList.add(ClassName$2.POINTER_EVENT);
  16882. } else {
  16883. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  16884. return start(event);
  16885. });
  16886. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  16887. return move(event);
  16888. });
  16889. $(this._element).on(Event$2.TOUCHEND, function (event) {
  16890. return end(event);
  16891. });
  16892. }
  16893. };
  16894. _proto._keydown = function _keydown(event) {
  16895. if (/input|textarea/i.test(event.target.tagName)) {
  16896. return;
  16897. }
  16898. switch (event.which) {
  16899. case ARROW_LEFT_KEYCODE:
  16900. event.preventDefault();
  16901. this.prev();
  16902. break;
  16903. case ARROW_RIGHT_KEYCODE:
  16904. event.preventDefault();
  16905. this.next();
  16906. break;
  16907. }
  16908. };
  16909. _proto._getItemIndex = function _getItemIndex(element) {
  16910. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  16911. return this._items.indexOf(element);
  16912. };
  16913. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  16914. var isNextDirection = direction === Direction.NEXT;
  16915. var isPrevDirection = direction === Direction.PREV;
  16916. var activeIndex = this._getItemIndex(activeElement);
  16917. var lastItemIndex = this._items.length - 1;
  16918. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  16919. if (isGoingToWrap && !this._config.wrap) {
  16920. return activeElement;
  16921. }
  16922. var delta = direction === Direction.PREV ? -1 : 1;
  16923. var itemIndex = (activeIndex + delta) % this._items.length;
  16924. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  16925. };
  16926. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  16927. var targetIndex = this._getItemIndex(relatedTarget);
  16928. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  16929. var slideEvent = $.Event(Event$2.SLIDE, {
  16930. relatedTarget: relatedTarget,
  16931. direction: eventDirectionName,
  16932. from: fromIndex,
  16933. to: targetIndex
  16934. });
  16935. $(this._element).trigger(slideEvent);
  16936. return slideEvent;
  16937. };
  16938. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  16939. if (this._indicatorsElement) {
  16940. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  16941. $(indicators).removeClass(ClassName$2.ACTIVE);
  16942. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  16943. if (nextIndicator) {
  16944. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  16945. }
  16946. }
  16947. };
  16948. _proto._slide = function _slide(direction, element) {
  16949. var _this4 = this;
  16950. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  16951. var activeElementIndex = this._getItemIndex(activeElement);
  16952. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  16953. var nextElementIndex = this._getItemIndex(nextElement);
  16954. var isCycling = Boolean(this._interval);
  16955. var directionalClassName;
  16956. var orderClassName;
  16957. var eventDirectionName;
  16958. if (direction === Direction.NEXT) {
  16959. directionalClassName = ClassName$2.LEFT;
  16960. orderClassName = ClassName$2.NEXT;
  16961. eventDirectionName = Direction.LEFT;
  16962. } else {
  16963. directionalClassName = ClassName$2.RIGHT;
  16964. orderClassName = ClassName$2.PREV;
  16965. eventDirectionName = Direction.RIGHT;
  16966. }
  16967. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  16968. this._isSliding = false;
  16969. return;
  16970. }
  16971. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  16972. if (slideEvent.isDefaultPrevented()) {
  16973. return;
  16974. }
  16975. if (!activeElement || !nextElement) {
  16976. // Some weirdness is happening, so we bail
  16977. return;
  16978. }
  16979. this._isSliding = true;
  16980. if (isCycling) {
  16981. this.pause();
  16982. }
  16983. this._setActiveIndicatorElement(nextElement);
  16984. var slidEvent = $.Event(Event$2.SLID, {
  16985. relatedTarget: nextElement,
  16986. direction: eventDirectionName,
  16987. from: activeElementIndex,
  16988. to: nextElementIndex
  16989. });
  16990. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  16991. $(nextElement).addClass(orderClassName);
  16992. Util.reflow(nextElement);
  16993. $(activeElement).addClass(directionalClassName);
  16994. $(nextElement).addClass(directionalClassName);
  16995. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  16996. if (nextElementInterval) {
  16997. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  16998. this._config.interval = nextElementInterval;
  16999. } else {
  17000. this._config.interval = this._config.defaultInterval || this._config.interval;
  17001. }
  17002. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  17003. $(activeElement).one(Util.TRANSITION_END, function () {
  17004. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  17005. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  17006. _this4._isSliding = false;
  17007. setTimeout(function () {
  17008. return $(_this4._element).trigger(slidEvent);
  17009. }, 0);
  17010. }).emulateTransitionEnd(transitionDuration);
  17011. } else {
  17012. $(activeElement).removeClass(ClassName$2.ACTIVE);
  17013. $(nextElement).addClass(ClassName$2.ACTIVE);
  17014. this._isSliding = false;
  17015. $(this._element).trigger(slidEvent);
  17016. }
  17017. if (isCycling) {
  17018. this.cycle();
  17019. }
  17020. } // Static
  17021. ;
  17022. Carousel._jQueryInterface = function _jQueryInterface(config) {
  17023. return this.each(function () {
  17024. var data = $(this).data(DATA_KEY$2);
  17025. var _config = _objectSpread2({}, Default, {}, $(this).data());
  17026. if (typeof config === 'object') {
  17027. _config = _objectSpread2({}, _config, {}, config);
  17028. }
  17029. var action = typeof config === 'string' ? config : _config.slide;
  17030. if (!data) {
  17031. data = new Carousel(this, _config);
  17032. $(this).data(DATA_KEY$2, data);
  17033. }
  17034. if (typeof config === 'number') {
  17035. data.to(config);
  17036. } else if (typeof action === 'string') {
  17037. if (typeof data[action] === 'undefined') {
  17038. throw new TypeError("No method named \"" + action + "\"");
  17039. }
  17040. data[action]();
  17041. } else if (_config.interval && _config.ride) {
  17042. data.pause();
  17043. data.cycle();
  17044. }
  17045. });
  17046. };
  17047. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  17048. var selector = Util.getSelectorFromElement(this);
  17049. if (!selector) {
  17050. return;
  17051. }
  17052. var target = $(selector)[0];
  17053. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  17054. return;
  17055. }
  17056. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  17057. var slideIndex = this.getAttribute('data-slide-to');
  17058. if (slideIndex) {
  17059. config.interval = false;
  17060. }
  17061. Carousel._jQueryInterface.call($(target), config);
  17062. if (slideIndex) {
  17063. $(target).data(DATA_KEY$2).to(slideIndex);
  17064. }
  17065. event.preventDefault();
  17066. };
  17067. _createClass(Carousel, null, [{
  17068. key: "VERSION",
  17069. get: function get() {
  17070. return VERSION$2;
  17071. }
  17072. }, {
  17073. key: "Default",
  17074. get: function get() {
  17075. return Default;
  17076. }
  17077. }]);
  17078. return Carousel;
  17079. }();
  17080. /**
  17081. * ------------------------------------------------------------------------
  17082. * Data Api implementation
  17083. * ------------------------------------------------------------------------
  17084. */
  17085. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  17086. $(window).on(Event$2.LOAD_DATA_API, function () {
  17087. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  17088. for (var i = 0, len = carousels.length; i < len; i++) {
  17089. var $carousel = $(carousels[i]);
  17090. Carousel._jQueryInterface.call($carousel, $carousel.data());
  17091. }
  17092. });
  17093. /**
  17094. * ------------------------------------------------------------------------
  17095. * jQuery
  17096. * ------------------------------------------------------------------------
  17097. */
  17098. $.fn[NAME$2] = Carousel._jQueryInterface;
  17099. $.fn[NAME$2].Constructor = Carousel;
  17100. $.fn[NAME$2].noConflict = function () {
  17101. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  17102. return Carousel._jQueryInterface;
  17103. };
  17104. /**
  17105. * ------------------------------------------------------------------------
  17106. * Constants
  17107. * ------------------------------------------------------------------------
  17108. */
  17109. var NAME$3 = 'collapse';
  17110. var VERSION$3 = '4.4.1';
  17111. var DATA_KEY$3 = 'bs.collapse';
  17112. var EVENT_KEY$3 = "." + DATA_KEY$3;
  17113. var DATA_API_KEY$3 = '.data-api';
  17114. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  17115. var Default$1 = {
  17116. toggle: true,
  17117. parent: ''
  17118. };
  17119. var DefaultType$1 = {
  17120. toggle: 'boolean',
  17121. parent: '(string|element)'
  17122. };
  17123. var Event$3 = {
  17124. SHOW: "show" + EVENT_KEY$3,
  17125. SHOWN: "shown" + EVENT_KEY$3,
  17126. HIDE: "hide" + EVENT_KEY$3,
  17127. HIDDEN: "hidden" + EVENT_KEY$3,
  17128. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  17129. };
  17130. var ClassName$3 = {
  17131. SHOW: 'show',
  17132. COLLAPSE: 'collapse',
  17133. COLLAPSING: 'collapsing',
  17134. COLLAPSED: 'collapsed'
  17135. };
  17136. var Dimension = {
  17137. WIDTH: 'width',
  17138. HEIGHT: 'height'
  17139. };
  17140. var Selector$3 = {
  17141. ACTIVES: '.show, .collapsing',
  17142. DATA_TOGGLE: '[data-toggle="collapse"]'
  17143. };
  17144. /**
  17145. * ------------------------------------------------------------------------
  17146. * Class Definition
  17147. * ------------------------------------------------------------------------
  17148. */
  17149. var Collapse =
  17150. /*#__PURE__*/
  17151. function () {
  17152. function Collapse(element, config) {
  17153. this._isTransitioning = false;
  17154. this._element = element;
  17155. this._config = this._getConfig(config);
  17156. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  17157. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  17158. for (var i = 0, len = toggleList.length; i < len; i++) {
  17159. var elem = toggleList[i];
  17160. var selector = Util.getSelectorFromElement(elem);
  17161. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  17162. return foundElem === element;
  17163. });
  17164. if (selector !== null && filterElement.length > 0) {
  17165. this._selector = selector;
  17166. this._triggerArray.push(elem);
  17167. }
  17168. }
  17169. this._parent = this._config.parent ? this._getParent() : null;
  17170. if (!this._config.parent) {
  17171. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  17172. }
  17173. if (this._config.toggle) {
  17174. this.toggle();
  17175. }
  17176. } // Getters
  17177. var _proto = Collapse.prototype;
  17178. // Public
  17179. _proto.toggle = function toggle() {
  17180. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  17181. this.hide();
  17182. } else {
  17183. this.show();
  17184. }
  17185. };
  17186. _proto.show = function show() {
  17187. var _this = this;
  17188. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  17189. return;
  17190. }
  17191. var actives;
  17192. var activesData;
  17193. if (this._parent) {
  17194. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  17195. if (typeof _this._config.parent === 'string') {
  17196. return elem.getAttribute('data-parent') === _this._config.parent;
  17197. }
  17198. return elem.classList.contains(ClassName$3.COLLAPSE);
  17199. });
  17200. if (actives.length === 0) {
  17201. actives = null;
  17202. }
  17203. }
  17204. if (actives) {
  17205. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  17206. if (activesData && activesData._isTransitioning) {
  17207. return;
  17208. }
  17209. }
  17210. var startEvent = $.Event(Event$3.SHOW);
  17211. $(this._element).trigger(startEvent);
  17212. if (startEvent.isDefaultPrevented()) {
  17213. return;
  17214. }
  17215. if (actives) {
  17216. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  17217. if (!activesData) {
  17218. $(actives).data(DATA_KEY$3, null);
  17219. }
  17220. }
  17221. var dimension = this._getDimension();
  17222. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  17223. this._element.style[dimension] = 0;
  17224. if (this._triggerArray.length) {
  17225. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  17226. }
  17227. this.setTransitioning(true);
  17228. var complete = function complete() {
  17229. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  17230. _this._element.style[dimension] = '';
  17231. _this.setTransitioning(false);
  17232. $(_this._element).trigger(Event$3.SHOWN);
  17233. };
  17234. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  17235. var scrollSize = "scroll" + capitalizedDimension;
  17236. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  17237. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  17238. this._element.style[dimension] = this._element[scrollSize] + "px";
  17239. };
  17240. _proto.hide = function hide() {
  17241. var _this2 = this;
  17242. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  17243. return;
  17244. }
  17245. var startEvent = $.Event(Event$3.HIDE);
  17246. $(this._element).trigger(startEvent);
  17247. if (startEvent.isDefaultPrevented()) {
  17248. return;
  17249. }
  17250. var dimension = this._getDimension();
  17251. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  17252. Util.reflow(this._element);
  17253. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  17254. var triggerArrayLength = this._triggerArray.length;
  17255. if (triggerArrayLength > 0) {
  17256. for (var i = 0; i < triggerArrayLength; i++) {
  17257. var trigger = this._triggerArray[i];
  17258. var selector = Util.getSelectorFromElement(trigger);
  17259. if (selector !== null) {
  17260. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  17261. if (!$elem.hasClass(ClassName$3.SHOW)) {
  17262. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  17263. }
  17264. }
  17265. }
  17266. }
  17267. this.setTransitioning(true);
  17268. var complete = function complete() {
  17269. _this2.setTransitioning(false);
  17270. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  17271. };
  17272. this._element.style[dimension] = '';
  17273. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  17274. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  17275. };
  17276. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  17277. this._isTransitioning = isTransitioning;
  17278. };
  17279. _proto.dispose = function dispose() {
  17280. $.removeData(this._element, DATA_KEY$3);
  17281. this._config = null;
  17282. this._parent = null;
  17283. this._element = null;
  17284. this._triggerArray = null;
  17285. this._isTransitioning = null;
  17286. } // Private
  17287. ;
  17288. _proto._getConfig = function _getConfig(config) {
  17289. config = _objectSpread2({}, Default$1, {}, config);
  17290. config.toggle = Boolean(config.toggle); // Coerce string values
  17291. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  17292. return config;
  17293. };
  17294. _proto._getDimension = function _getDimension() {
  17295. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  17296. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  17297. };
  17298. _proto._getParent = function _getParent() {
  17299. var _this3 = this;
  17300. var parent;
  17301. if (Util.isElement(this._config.parent)) {
  17302. parent = this._config.parent; // It's a jQuery object
  17303. if (typeof this._config.parent.jquery !== 'undefined') {
  17304. parent = this._config.parent[0];
  17305. }
  17306. } else {
  17307. parent = document.querySelector(this._config.parent);
  17308. }
  17309. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  17310. var children = [].slice.call(parent.querySelectorAll(selector));
  17311. $(children).each(function (i, element) {
  17312. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  17313. });
  17314. return parent;
  17315. };
  17316. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  17317. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  17318. if (triggerArray.length) {
  17319. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  17320. }
  17321. } // Static
  17322. ;
  17323. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  17324. var selector = Util.getSelectorFromElement(element);
  17325. return selector ? document.querySelector(selector) : null;
  17326. };
  17327. Collapse._jQueryInterface = function _jQueryInterface(config) {
  17328. return this.each(function () {
  17329. var $this = $(this);
  17330. var data = $this.data(DATA_KEY$3);
  17331. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  17332. if (!data && _config.toggle && /show|hide/.test(config)) {
  17333. _config.toggle = false;
  17334. }
  17335. if (!data) {
  17336. data = new Collapse(this, _config);
  17337. $this.data(DATA_KEY$3, data);
  17338. }
  17339. if (typeof config === 'string') {
  17340. if (typeof data[config] === 'undefined') {
  17341. throw new TypeError("No method named \"" + config + "\"");
  17342. }
  17343. data[config]();
  17344. }
  17345. });
  17346. };
  17347. _createClass(Collapse, null, [{
  17348. key: "VERSION",
  17349. get: function get() {
  17350. return VERSION$3;
  17351. }
  17352. }, {
  17353. key: "Default",
  17354. get: function get() {
  17355. return Default$1;
  17356. }
  17357. }]);
  17358. return Collapse;
  17359. }();
  17360. /**
  17361. * ------------------------------------------------------------------------
  17362. * Data Api implementation
  17363. * ------------------------------------------------------------------------
  17364. */
  17365. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  17366. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  17367. if (event.currentTarget.tagName === 'A') {
  17368. event.preventDefault();
  17369. }
  17370. var $trigger = $(this);
  17371. var selector = Util.getSelectorFromElement(this);
  17372. var selectors = [].slice.call(document.querySelectorAll(selector));
  17373. $(selectors).each(function () {
  17374. var $target = $(this);
  17375. var data = $target.data(DATA_KEY$3);
  17376. var config = data ? 'toggle' : $trigger.data();
  17377. Collapse._jQueryInterface.call($target, config);
  17378. });
  17379. });
  17380. /**
  17381. * ------------------------------------------------------------------------
  17382. * jQuery
  17383. * ------------------------------------------------------------------------
  17384. */
  17385. $.fn[NAME$3] = Collapse._jQueryInterface;
  17386. $.fn[NAME$3].Constructor = Collapse;
  17387. $.fn[NAME$3].noConflict = function () {
  17388. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  17389. return Collapse._jQueryInterface;
  17390. };
  17391. /**
  17392. * ------------------------------------------------------------------------
  17393. * Constants
  17394. * ------------------------------------------------------------------------
  17395. */
  17396. var NAME$4 = 'dropdown';
  17397. var VERSION$4 = '4.4.1';
  17398. var DATA_KEY$4 = 'bs.dropdown';
  17399. var EVENT_KEY$4 = "." + DATA_KEY$4;
  17400. var DATA_API_KEY$4 = '.data-api';
  17401. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  17402. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  17403. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  17404. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  17405. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  17406. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  17407. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  17408. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  17409. var Event$4 = {
  17410. HIDE: "hide" + EVENT_KEY$4,
  17411. HIDDEN: "hidden" + EVENT_KEY$4,
  17412. SHOW: "show" + EVENT_KEY$4,
  17413. SHOWN: "shown" + EVENT_KEY$4,
  17414. CLICK: "click" + EVENT_KEY$4,
  17415. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  17416. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  17417. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  17418. };
  17419. var ClassName$4 = {
  17420. DISABLED: 'disabled',
  17421. SHOW: 'show',
  17422. DROPUP: 'dropup',
  17423. DROPRIGHT: 'dropright',
  17424. DROPLEFT: 'dropleft',
  17425. MENURIGHT: 'dropdown-menu-right',
  17426. MENULEFT: 'dropdown-menu-left',
  17427. POSITION_STATIC: 'position-static'
  17428. };
  17429. var Selector$4 = {
  17430. DATA_TOGGLE: '[data-toggle="dropdown"]',
  17431. FORM_CHILD: '.dropdown form',
  17432. MENU: '.dropdown-menu',
  17433. NAVBAR_NAV: '.navbar-nav',
  17434. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  17435. };
  17436. var AttachmentMap = {
  17437. TOP: 'top-start',
  17438. TOPEND: 'top-end',
  17439. BOTTOM: 'bottom-start',
  17440. BOTTOMEND: 'bottom-end',
  17441. RIGHT: 'right-start',
  17442. RIGHTEND: 'right-end',
  17443. LEFT: 'left-start',
  17444. LEFTEND: 'left-end'
  17445. };
  17446. var Default$2 = {
  17447. offset: 0,
  17448. flip: true,
  17449. boundary: 'scrollParent',
  17450. reference: 'toggle',
  17451. display: 'dynamic',
  17452. popperConfig: null
  17453. };
  17454. var DefaultType$2 = {
  17455. offset: '(number|string|function)',
  17456. flip: 'boolean',
  17457. boundary: '(string|element)',
  17458. reference: '(string|element)',
  17459. display: 'string',
  17460. popperConfig: '(null|object)'
  17461. };
  17462. /**
  17463. * ------------------------------------------------------------------------
  17464. * Class Definition
  17465. * ------------------------------------------------------------------------
  17466. */
  17467. var Dropdown =
  17468. /*#__PURE__*/
  17469. function () {
  17470. function Dropdown(element, config) {
  17471. this._element = element;
  17472. this._popper = null;
  17473. this._config = this._getConfig(config);
  17474. this._menu = this._getMenuElement();
  17475. this._inNavbar = this._detectNavbar();
  17476. this._addEventListeners();
  17477. } // Getters
  17478. var _proto = Dropdown.prototype;
  17479. // Public
  17480. _proto.toggle = function toggle() {
  17481. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  17482. return;
  17483. }
  17484. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  17485. Dropdown._clearMenus();
  17486. if (isActive) {
  17487. return;
  17488. }
  17489. this.show(true);
  17490. };
  17491. _proto.show = function show(usePopper) {
  17492. if (usePopper === void 0) {
  17493. usePopper = false;
  17494. }
  17495. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  17496. return;
  17497. }
  17498. var relatedTarget = {
  17499. relatedTarget: this._element
  17500. };
  17501. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  17502. var parent = Dropdown._getParentFromElement(this._element);
  17503. $(parent).trigger(showEvent);
  17504. if (showEvent.isDefaultPrevented()) {
  17505. return;
  17506. } // Disable totally Popper.js for Dropdown in Navbar
  17507. if (!this._inNavbar && usePopper) {
  17508. /**
  17509. * Check for Popper dependency
  17510. * Popper - https://popper.js.org
  17511. */
  17512. if (typeof Popper === 'undefined') {
  17513. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  17514. }
  17515. var referenceElement = this._element;
  17516. if (this._config.reference === 'parent') {
  17517. referenceElement = parent;
  17518. } else if (Util.isElement(this._config.reference)) {
  17519. referenceElement = this._config.reference; // Check if it's jQuery element
  17520. if (typeof this._config.reference.jquery !== 'undefined') {
  17521. referenceElement = this._config.reference[0];
  17522. }
  17523. } // If boundary is not `scrollParent`, then set position to `static`
  17524. // to allow the menu to "escape" the scroll parent's boundaries
  17525. // https://github.com/twbs/bootstrap/issues/24251
  17526. if (this._config.boundary !== 'scrollParent') {
  17527. $(parent).addClass(ClassName$4.POSITION_STATIC);
  17528. }
  17529. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  17530. } // If this is a touch-enabled device we add extra
  17531. // empty mouseover listeners to the body's immediate children;
  17532. // only needed because of broken event delegation on iOS
  17533. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  17534. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  17535. $(document.body).children().on('mouseover', null, $.noop);
  17536. }
  17537. this._element.focus();
  17538. this._element.setAttribute('aria-expanded', true);
  17539. $(this._menu).toggleClass(ClassName$4.SHOW);
  17540. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  17541. };
  17542. _proto.hide = function hide() {
  17543. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  17544. return;
  17545. }
  17546. var relatedTarget = {
  17547. relatedTarget: this._element
  17548. };
  17549. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  17550. var parent = Dropdown._getParentFromElement(this._element);
  17551. $(parent).trigger(hideEvent);
  17552. if (hideEvent.isDefaultPrevented()) {
  17553. return;
  17554. }
  17555. if (this._popper) {
  17556. this._popper.destroy();
  17557. }
  17558. $(this._menu).toggleClass(ClassName$4.SHOW);
  17559. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  17560. };
  17561. _proto.dispose = function dispose() {
  17562. $.removeData(this._element, DATA_KEY$4);
  17563. $(this._element).off(EVENT_KEY$4);
  17564. this._element = null;
  17565. this._menu = null;
  17566. if (this._popper !== null) {
  17567. this._popper.destroy();
  17568. this._popper = null;
  17569. }
  17570. };
  17571. _proto.update = function update() {
  17572. this._inNavbar = this._detectNavbar();
  17573. if (this._popper !== null) {
  17574. this._popper.scheduleUpdate();
  17575. }
  17576. } // Private
  17577. ;
  17578. _proto._addEventListeners = function _addEventListeners() {
  17579. var _this = this;
  17580. $(this._element).on(Event$4.CLICK, function (event) {
  17581. event.preventDefault();
  17582. event.stopPropagation();
  17583. _this.toggle();
  17584. });
  17585. };
  17586. _proto._getConfig = function _getConfig(config) {
  17587. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  17588. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  17589. return config;
  17590. };
  17591. _proto._getMenuElement = function _getMenuElement() {
  17592. if (!this._menu) {
  17593. var parent = Dropdown._getParentFromElement(this._element);
  17594. if (parent) {
  17595. this._menu = parent.querySelector(Selector$4.MENU);
  17596. }
  17597. }
  17598. return this._menu;
  17599. };
  17600. _proto._getPlacement = function _getPlacement() {
  17601. var $parentDropdown = $(this._element.parentNode);
  17602. var placement = AttachmentMap.BOTTOM; // Handle dropup
  17603. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  17604. placement = AttachmentMap.TOP;
  17605. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  17606. placement = AttachmentMap.TOPEND;
  17607. }
  17608. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  17609. placement = AttachmentMap.RIGHT;
  17610. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  17611. placement = AttachmentMap.LEFT;
  17612. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  17613. placement = AttachmentMap.BOTTOMEND;
  17614. }
  17615. return placement;
  17616. };
  17617. _proto._detectNavbar = function _detectNavbar() {
  17618. return $(this._element).closest('.navbar').length > 0;
  17619. };
  17620. _proto._getOffset = function _getOffset() {
  17621. var _this2 = this;
  17622. var offset = {};
  17623. if (typeof this._config.offset === 'function') {
  17624. offset.fn = function (data) {
  17625. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  17626. return data;
  17627. };
  17628. } else {
  17629. offset.offset = this._config.offset;
  17630. }
  17631. return offset;
  17632. };
  17633. _proto._getPopperConfig = function _getPopperConfig() {
  17634. var popperConfig = {
  17635. placement: this._getPlacement(),
  17636. modifiers: {
  17637. offset: this._getOffset(),
  17638. flip: {
  17639. enabled: this._config.flip
  17640. },
  17641. preventOverflow: {
  17642. boundariesElement: this._config.boundary
  17643. }
  17644. }
  17645. }; // Disable Popper.js if we have a static display
  17646. if (this._config.display === 'static') {
  17647. popperConfig.modifiers.applyStyle = {
  17648. enabled: false
  17649. };
  17650. }
  17651. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  17652. } // Static
  17653. ;
  17654. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  17655. return this.each(function () {
  17656. var data = $(this).data(DATA_KEY$4);
  17657. var _config = typeof config === 'object' ? config : null;
  17658. if (!data) {
  17659. data = new Dropdown(this, _config);
  17660. $(this).data(DATA_KEY$4, data);
  17661. }
  17662. if (typeof config === 'string') {
  17663. if (typeof data[config] === 'undefined') {
  17664. throw new TypeError("No method named \"" + config + "\"");
  17665. }
  17666. data[config]();
  17667. }
  17668. });
  17669. };
  17670. Dropdown._clearMenus = function _clearMenus(event) {
  17671. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  17672. return;
  17673. }
  17674. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  17675. for (var i = 0, len = toggles.length; i < len; i++) {
  17676. var parent = Dropdown._getParentFromElement(toggles[i]);
  17677. var context = $(toggles[i]).data(DATA_KEY$4);
  17678. var relatedTarget = {
  17679. relatedTarget: toggles[i]
  17680. };
  17681. if (event && event.type === 'click') {
  17682. relatedTarget.clickEvent = event;
  17683. }
  17684. if (!context) {
  17685. continue;
  17686. }
  17687. var dropdownMenu = context._menu;
  17688. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  17689. continue;
  17690. }
  17691. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  17692. continue;
  17693. }
  17694. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  17695. $(parent).trigger(hideEvent);
  17696. if (hideEvent.isDefaultPrevented()) {
  17697. continue;
  17698. } // If this is a touch-enabled device we remove the extra
  17699. // empty mouseover listeners we added for iOS support
  17700. if ('ontouchstart' in document.documentElement) {
  17701. $(document.body).children().off('mouseover', null, $.noop);
  17702. }
  17703. toggles[i].setAttribute('aria-expanded', 'false');
  17704. if (context._popper) {
  17705. context._popper.destroy();
  17706. }
  17707. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  17708. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  17709. }
  17710. };
  17711. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  17712. var parent;
  17713. var selector = Util.getSelectorFromElement(element);
  17714. if (selector) {
  17715. parent = document.querySelector(selector);
  17716. }
  17717. return parent || element.parentNode;
  17718. } // eslint-disable-next-line complexity
  17719. ;
  17720. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  17721. // If not input/textarea:
  17722. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  17723. // If input/textarea:
  17724. // - If space key => not a dropdown command
  17725. // - If key is other than escape
  17726. // - If key is not up or down => not a dropdown command
  17727. // - If trigger inside the menu => not a dropdown command
  17728. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  17729. return;
  17730. }
  17731. event.preventDefault();
  17732. event.stopPropagation();
  17733. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  17734. return;
  17735. }
  17736. var parent = Dropdown._getParentFromElement(this);
  17737. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  17738. if (!isActive && event.which === ESCAPE_KEYCODE) {
  17739. return;
  17740. }
  17741. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  17742. if (event.which === ESCAPE_KEYCODE) {
  17743. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  17744. $(toggle).trigger('focus');
  17745. }
  17746. $(this).trigger('click');
  17747. return;
  17748. }
  17749. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  17750. return $(item).is(':visible');
  17751. });
  17752. if (items.length === 0) {
  17753. return;
  17754. }
  17755. var index = items.indexOf(event.target);
  17756. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  17757. // Up
  17758. index--;
  17759. }
  17760. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  17761. // Down
  17762. index++;
  17763. }
  17764. if (index < 0) {
  17765. index = 0;
  17766. }
  17767. items[index].focus();
  17768. };
  17769. _createClass(Dropdown, null, [{
  17770. key: "VERSION",
  17771. get: function get() {
  17772. return VERSION$4;
  17773. }
  17774. }, {
  17775. key: "Default",
  17776. get: function get() {
  17777. return Default$2;
  17778. }
  17779. }, {
  17780. key: "DefaultType",
  17781. get: function get() {
  17782. return DefaultType$2;
  17783. }
  17784. }]);
  17785. return Dropdown;
  17786. }();
  17787. /**
  17788. * ------------------------------------------------------------------------
  17789. * Data Api implementation
  17790. * ------------------------------------------------------------------------
  17791. */
  17792. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  17793. event.preventDefault();
  17794. event.stopPropagation();
  17795. Dropdown._jQueryInterface.call($(this), 'toggle');
  17796. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  17797. e.stopPropagation();
  17798. });
  17799. /**
  17800. * ------------------------------------------------------------------------
  17801. * jQuery
  17802. * ------------------------------------------------------------------------
  17803. */
  17804. $.fn[NAME$4] = Dropdown._jQueryInterface;
  17805. $.fn[NAME$4].Constructor = Dropdown;
  17806. $.fn[NAME$4].noConflict = function () {
  17807. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  17808. return Dropdown._jQueryInterface;
  17809. };
  17810. /**
  17811. * ------------------------------------------------------------------------
  17812. * Constants
  17813. * ------------------------------------------------------------------------
  17814. */
  17815. var NAME$5 = 'modal';
  17816. var VERSION$5 = '4.4.1';
  17817. var DATA_KEY$5 = 'bs.modal';
  17818. var EVENT_KEY$5 = "." + DATA_KEY$5;
  17819. var DATA_API_KEY$5 = '.data-api';
  17820. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  17821. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  17822. var Default$3 = {
  17823. backdrop: true,
  17824. keyboard: true,
  17825. focus: true,
  17826. show: true
  17827. };
  17828. var DefaultType$3 = {
  17829. backdrop: '(boolean|string)',
  17830. keyboard: 'boolean',
  17831. focus: 'boolean',
  17832. show: 'boolean'
  17833. };
  17834. var Event$5 = {
  17835. HIDE: "hide" + EVENT_KEY$5,
  17836. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  17837. HIDDEN: "hidden" + EVENT_KEY$5,
  17838. SHOW: "show" + EVENT_KEY$5,
  17839. SHOWN: "shown" + EVENT_KEY$5,
  17840. FOCUSIN: "focusin" + EVENT_KEY$5,
  17841. RESIZE: "resize" + EVENT_KEY$5,
  17842. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  17843. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  17844. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  17845. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  17846. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  17847. };
  17848. var ClassName$5 = {
  17849. SCROLLABLE: 'modal-dialog-scrollable',
  17850. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  17851. BACKDROP: 'modal-backdrop',
  17852. OPEN: 'modal-open',
  17853. FADE: 'fade',
  17854. SHOW: 'show',
  17855. STATIC: 'modal-static'
  17856. };
  17857. var Selector$5 = {
  17858. DIALOG: '.modal-dialog',
  17859. MODAL_BODY: '.modal-body',
  17860. DATA_TOGGLE: '[data-toggle="modal"]',
  17861. DATA_DISMISS: '[data-dismiss="modal"]',
  17862. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  17863. STICKY_CONTENT: '.sticky-top'
  17864. };
  17865. /**
  17866. * ------------------------------------------------------------------------
  17867. * Class Definition
  17868. * ------------------------------------------------------------------------
  17869. */
  17870. var Modal =
  17871. /*#__PURE__*/
  17872. function () {
  17873. function Modal(element, config) {
  17874. this._config = this._getConfig(config);
  17875. this._element = element;
  17876. this._dialog = element.querySelector(Selector$5.DIALOG);
  17877. this._backdrop = null;
  17878. this._isShown = false;
  17879. this._isBodyOverflowing = false;
  17880. this._ignoreBackdropClick = false;
  17881. this._isTransitioning = false;
  17882. this._scrollbarWidth = 0;
  17883. } // Getters
  17884. var _proto = Modal.prototype;
  17885. // Public
  17886. _proto.toggle = function toggle(relatedTarget) {
  17887. return this._isShown ? this.hide() : this.show(relatedTarget);
  17888. };
  17889. _proto.show = function show(relatedTarget) {
  17890. var _this = this;
  17891. if (this._isShown || this._isTransitioning) {
  17892. return;
  17893. }
  17894. if ($(this._element).hasClass(ClassName$5.FADE)) {
  17895. this._isTransitioning = true;
  17896. }
  17897. var showEvent = $.Event(Event$5.SHOW, {
  17898. relatedTarget: relatedTarget
  17899. });
  17900. $(this._element).trigger(showEvent);
  17901. if (this._isShown || showEvent.isDefaultPrevented()) {
  17902. return;
  17903. }
  17904. this._isShown = true;
  17905. this._checkScrollbar();
  17906. this._setScrollbar();
  17907. this._adjustDialog();
  17908. this._setEscapeEvent();
  17909. this._setResizeEvent();
  17910. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  17911. return _this.hide(event);
  17912. });
  17913. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  17914. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  17915. if ($(event.target).is(_this._element)) {
  17916. _this._ignoreBackdropClick = true;
  17917. }
  17918. });
  17919. });
  17920. this._showBackdrop(function () {
  17921. return _this._showElement(relatedTarget);
  17922. });
  17923. };
  17924. _proto.hide = function hide(event) {
  17925. var _this2 = this;
  17926. if (event) {
  17927. event.preventDefault();
  17928. }
  17929. if (!this._isShown || this._isTransitioning) {
  17930. return;
  17931. }
  17932. var hideEvent = $.Event(Event$5.HIDE);
  17933. $(this._element).trigger(hideEvent);
  17934. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  17935. return;
  17936. }
  17937. this._isShown = false;
  17938. var transition = $(this._element).hasClass(ClassName$5.FADE);
  17939. if (transition) {
  17940. this._isTransitioning = true;
  17941. }
  17942. this._setEscapeEvent();
  17943. this._setResizeEvent();
  17944. $(document).off(Event$5.FOCUSIN);
  17945. $(this._element).removeClass(ClassName$5.SHOW);
  17946. $(this._element).off(Event$5.CLICK_DISMISS);
  17947. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  17948. if (transition) {
  17949. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  17950. $(this._element).one(Util.TRANSITION_END, function (event) {
  17951. return _this2._hideModal(event);
  17952. }).emulateTransitionEnd(transitionDuration);
  17953. } else {
  17954. this._hideModal();
  17955. }
  17956. };
  17957. _proto.dispose = function dispose() {
  17958. [window, this._element, this._dialog].forEach(function (htmlElement) {
  17959. return $(htmlElement).off(EVENT_KEY$5);
  17960. });
  17961. /**
  17962. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  17963. * Do not move `document` in `htmlElements` array
  17964. * It will remove `Event.CLICK_DATA_API` event that should remain
  17965. */
  17966. $(document).off(Event$5.FOCUSIN);
  17967. $.removeData(this._element, DATA_KEY$5);
  17968. this._config = null;
  17969. this._element = null;
  17970. this._dialog = null;
  17971. this._backdrop = null;
  17972. this._isShown = null;
  17973. this._isBodyOverflowing = null;
  17974. this._ignoreBackdropClick = null;
  17975. this._isTransitioning = null;
  17976. this._scrollbarWidth = null;
  17977. };
  17978. _proto.handleUpdate = function handleUpdate() {
  17979. this._adjustDialog();
  17980. } // Private
  17981. ;
  17982. _proto._getConfig = function _getConfig(config) {
  17983. config = _objectSpread2({}, Default$3, {}, config);
  17984. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  17985. return config;
  17986. };
  17987. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  17988. var _this3 = this;
  17989. if (this._config.backdrop === 'static') {
  17990. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  17991. $(this._element).trigger(hideEventPrevented);
  17992. if (hideEventPrevented.defaultPrevented) {
  17993. return;
  17994. }
  17995. this._element.classList.add(ClassName$5.STATIC);
  17996. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  17997. $(this._element).one(Util.TRANSITION_END, function () {
  17998. _this3._element.classList.remove(ClassName$5.STATIC);
  17999. }).emulateTransitionEnd(modalTransitionDuration);
  18000. this._element.focus();
  18001. } else {
  18002. this.hide();
  18003. }
  18004. };
  18005. _proto._showElement = function _showElement(relatedTarget) {
  18006. var _this4 = this;
  18007. var transition = $(this._element).hasClass(ClassName$5.FADE);
  18008. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  18009. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  18010. // Don't move modal's DOM position
  18011. document.body.appendChild(this._element);
  18012. }
  18013. this._element.style.display = 'block';
  18014. this._element.removeAttribute('aria-hidden');
  18015. this._element.setAttribute('aria-modal', true);
  18016. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  18017. modalBody.scrollTop = 0;
  18018. } else {
  18019. this._element.scrollTop = 0;
  18020. }
  18021. if (transition) {
  18022. Util.reflow(this._element);
  18023. }
  18024. $(this._element).addClass(ClassName$5.SHOW);
  18025. if (this._config.focus) {
  18026. this._enforceFocus();
  18027. }
  18028. var shownEvent = $.Event(Event$5.SHOWN, {
  18029. relatedTarget: relatedTarget
  18030. });
  18031. var transitionComplete = function transitionComplete() {
  18032. if (_this4._config.focus) {
  18033. _this4._element.focus();
  18034. }
  18035. _this4._isTransitioning = false;
  18036. $(_this4._element).trigger(shownEvent);
  18037. };
  18038. if (transition) {
  18039. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  18040. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  18041. } else {
  18042. transitionComplete();
  18043. }
  18044. };
  18045. _proto._enforceFocus = function _enforceFocus() {
  18046. var _this5 = this;
  18047. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  18048. .on(Event$5.FOCUSIN, function (event) {
  18049. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  18050. _this5._element.focus();
  18051. }
  18052. });
  18053. };
  18054. _proto._setEscapeEvent = function _setEscapeEvent() {
  18055. var _this6 = this;
  18056. if (this._isShown && this._config.keyboard) {
  18057. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  18058. if (event.which === ESCAPE_KEYCODE$1) {
  18059. _this6._triggerBackdropTransition();
  18060. }
  18061. });
  18062. } else if (!this._isShown) {
  18063. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  18064. }
  18065. };
  18066. _proto._setResizeEvent = function _setResizeEvent() {
  18067. var _this7 = this;
  18068. if (this._isShown) {
  18069. $(window).on(Event$5.RESIZE, function (event) {
  18070. return _this7.handleUpdate(event);
  18071. });
  18072. } else {
  18073. $(window).off(Event$5.RESIZE);
  18074. }
  18075. };
  18076. _proto._hideModal = function _hideModal() {
  18077. var _this8 = this;
  18078. this._element.style.display = 'none';
  18079. this._element.setAttribute('aria-hidden', true);
  18080. this._element.removeAttribute('aria-modal');
  18081. this._isTransitioning = false;
  18082. this._showBackdrop(function () {
  18083. $(document.body).removeClass(ClassName$5.OPEN);
  18084. _this8._resetAdjustments();
  18085. _this8._resetScrollbar();
  18086. $(_this8._element).trigger(Event$5.HIDDEN);
  18087. });
  18088. };
  18089. _proto._removeBackdrop = function _removeBackdrop() {
  18090. if (this._backdrop) {
  18091. $(this._backdrop).remove();
  18092. this._backdrop = null;
  18093. }
  18094. };
  18095. _proto._showBackdrop = function _showBackdrop(callback) {
  18096. var _this9 = this;
  18097. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  18098. if (this._isShown && this._config.backdrop) {
  18099. this._backdrop = document.createElement('div');
  18100. this._backdrop.className = ClassName$5.BACKDROP;
  18101. if (animate) {
  18102. this._backdrop.classList.add(animate);
  18103. }
  18104. $(this._backdrop).appendTo(document.body);
  18105. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  18106. if (_this9._ignoreBackdropClick) {
  18107. _this9._ignoreBackdropClick = false;
  18108. return;
  18109. }
  18110. if (event.target !== event.currentTarget) {
  18111. return;
  18112. }
  18113. _this9._triggerBackdropTransition();
  18114. });
  18115. if (animate) {
  18116. Util.reflow(this._backdrop);
  18117. }
  18118. $(this._backdrop).addClass(ClassName$5.SHOW);
  18119. if (!callback) {
  18120. return;
  18121. }
  18122. if (!animate) {
  18123. callback();
  18124. return;
  18125. }
  18126. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  18127. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  18128. } else if (!this._isShown && this._backdrop) {
  18129. $(this._backdrop).removeClass(ClassName$5.SHOW);
  18130. var callbackRemove = function callbackRemove() {
  18131. _this9._removeBackdrop();
  18132. if (callback) {
  18133. callback();
  18134. }
  18135. };
  18136. if ($(this._element).hasClass(ClassName$5.FADE)) {
  18137. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  18138. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  18139. } else {
  18140. callbackRemove();
  18141. }
  18142. } else if (callback) {
  18143. callback();
  18144. }
  18145. } // ----------------------------------------------------------------------
  18146. // the following methods are used to handle overflowing modals
  18147. // todo (fat): these should probably be refactored out of modal.js
  18148. // ----------------------------------------------------------------------
  18149. ;
  18150. _proto._adjustDialog = function _adjustDialog() {
  18151. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  18152. if (!this._isBodyOverflowing && isModalOverflowing) {
  18153. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  18154. }
  18155. if (this._isBodyOverflowing && !isModalOverflowing) {
  18156. this._element.style.paddingRight = this._scrollbarWidth + "px";
  18157. }
  18158. };
  18159. _proto._resetAdjustments = function _resetAdjustments() {
  18160. this._element.style.paddingLeft = '';
  18161. this._element.style.paddingRight = '';
  18162. };
  18163. _proto._checkScrollbar = function _checkScrollbar() {
  18164. var rect = document.body.getBoundingClientRect();
  18165. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  18166. this._scrollbarWidth = this._getScrollbarWidth();
  18167. };
  18168. _proto._setScrollbar = function _setScrollbar() {
  18169. var _this10 = this;
  18170. if (this._isBodyOverflowing) {
  18171. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  18172. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  18173. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  18174. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  18175. $(fixedContent).each(function (index, element) {
  18176. var actualPadding = element.style.paddingRight;
  18177. var calculatedPadding = $(element).css('padding-right');
  18178. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  18179. }); // Adjust sticky content margin
  18180. $(stickyContent).each(function (index, element) {
  18181. var actualMargin = element.style.marginRight;
  18182. var calculatedMargin = $(element).css('margin-right');
  18183. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  18184. }); // Adjust body padding
  18185. var actualPadding = document.body.style.paddingRight;
  18186. var calculatedPadding = $(document.body).css('padding-right');
  18187. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  18188. }
  18189. $(document.body).addClass(ClassName$5.OPEN);
  18190. };
  18191. _proto._resetScrollbar = function _resetScrollbar() {
  18192. // Restore fixed content padding
  18193. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  18194. $(fixedContent).each(function (index, element) {
  18195. var padding = $(element).data('padding-right');
  18196. $(element).removeData('padding-right');
  18197. element.style.paddingRight = padding ? padding : '';
  18198. }); // Restore sticky content
  18199. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  18200. $(elements).each(function (index, element) {
  18201. var margin = $(element).data('margin-right');
  18202. if (typeof margin !== 'undefined') {
  18203. $(element).css('margin-right', margin).removeData('margin-right');
  18204. }
  18205. }); // Restore body padding
  18206. var padding = $(document.body).data('padding-right');
  18207. $(document.body).removeData('padding-right');
  18208. document.body.style.paddingRight = padding ? padding : '';
  18209. };
  18210. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  18211. // thx d.walsh
  18212. var scrollDiv = document.createElement('div');
  18213. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  18214. document.body.appendChild(scrollDiv);
  18215. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  18216. document.body.removeChild(scrollDiv);
  18217. return scrollbarWidth;
  18218. } // Static
  18219. ;
  18220. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  18221. return this.each(function () {
  18222. var data = $(this).data(DATA_KEY$5);
  18223. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  18224. if (!data) {
  18225. data = new Modal(this, _config);
  18226. $(this).data(DATA_KEY$5, data);
  18227. }
  18228. if (typeof config === 'string') {
  18229. if (typeof data[config] === 'undefined') {
  18230. throw new TypeError("No method named \"" + config + "\"");
  18231. }
  18232. data[config](relatedTarget);
  18233. } else if (_config.show) {
  18234. data.show(relatedTarget);
  18235. }
  18236. });
  18237. };
  18238. _createClass(Modal, null, [{
  18239. key: "VERSION",
  18240. get: function get() {
  18241. return VERSION$5;
  18242. }
  18243. }, {
  18244. key: "Default",
  18245. get: function get() {
  18246. return Default$3;
  18247. }
  18248. }]);
  18249. return Modal;
  18250. }();
  18251. /**
  18252. * ------------------------------------------------------------------------
  18253. * Data Api implementation
  18254. * ------------------------------------------------------------------------
  18255. */
  18256. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  18257. var _this11 = this;
  18258. var target;
  18259. var selector = Util.getSelectorFromElement(this);
  18260. if (selector) {
  18261. target = document.querySelector(selector);
  18262. }
  18263. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  18264. if (this.tagName === 'A' || this.tagName === 'AREA') {
  18265. event.preventDefault();
  18266. }
  18267. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  18268. if (showEvent.isDefaultPrevented()) {
  18269. // Only register focus restorer if modal will actually get shown
  18270. return;
  18271. }
  18272. $target.one(Event$5.HIDDEN, function () {
  18273. if ($(_this11).is(':visible')) {
  18274. _this11.focus();
  18275. }
  18276. });
  18277. });
  18278. Modal._jQueryInterface.call($(target), config, this);
  18279. });
  18280. /**
  18281. * ------------------------------------------------------------------------
  18282. * jQuery
  18283. * ------------------------------------------------------------------------
  18284. */
  18285. $.fn[NAME$5] = Modal._jQueryInterface;
  18286. $.fn[NAME$5].Constructor = Modal;
  18287. $.fn[NAME$5].noConflict = function () {
  18288. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  18289. return Modal._jQueryInterface;
  18290. };
  18291. /**
  18292. * --------------------------------------------------------------------------
  18293. * Bootstrap (v4.4.1): tools/sanitizer.js
  18294. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  18295. * --------------------------------------------------------------------------
  18296. */
  18297. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  18298. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  18299. var DefaultWhitelist = {
  18300. // Global attributes allowed on any supplied element below.
  18301. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  18302. a: ['target', 'href', 'title', 'rel'],
  18303. area: [],
  18304. b: [],
  18305. br: [],
  18306. col: [],
  18307. code: [],
  18308. div: [],
  18309. em: [],
  18310. hr: [],
  18311. h1: [],
  18312. h2: [],
  18313. h3: [],
  18314. h4: [],
  18315. h5: [],
  18316. h6: [],
  18317. i: [],
  18318. img: ['src', 'alt', 'title', 'width', 'height'],
  18319. li: [],
  18320. ol: [],
  18321. p: [],
  18322. pre: [],
  18323. s: [],
  18324. small: [],
  18325. span: [],
  18326. sub: [],
  18327. sup: [],
  18328. strong: [],
  18329. u: [],
  18330. ul: []
  18331. };
  18332. /**
  18333. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  18334. *
  18335. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  18336. */
  18337. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  18338. /**
  18339. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  18340. *
  18341. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  18342. */
  18343. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
  18344. function allowedAttribute(attr, allowedAttributeList) {
  18345. var attrName = attr.nodeName.toLowerCase();
  18346. if (allowedAttributeList.indexOf(attrName) !== -1) {
  18347. if (uriAttrs.indexOf(attrName) !== -1) {
  18348. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  18349. }
  18350. return true;
  18351. }
  18352. var regExp = allowedAttributeList.filter(function (attrRegex) {
  18353. return attrRegex instanceof RegExp;
  18354. }); // Check if a regular expression validates the attribute.
  18355. for (var i = 0, l = regExp.length; i < l; i++) {
  18356. if (attrName.match(regExp[i])) {
  18357. return true;
  18358. }
  18359. }
  18360. return false;
  18361. }
  18362. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  18363. if (unsafeHtml.length === 0) {
  18364. return unsafeHtml;
  18365. }
  18366. if (sanitizeFn && typeof sanitizeFn === 'function') {
  18367. return sanitizeFn(unsafeHtml);
  18368. }
  18369. var domParser = new window.DOMParser();
  18370. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  18371. var whitelistKeys = Object.keys(whiteList);
  18372. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  18373. var _loop = function _loop(i, len) {
  18374. var el = elements[i];
  18375. var elName = el.nodeName.toLowerCase();
  18376. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  18377. el.parentNode.removeChild(el);
  18378. return "continue";
  18379. }
  18380. var attributeList = [].slice.call(el.attributes);
  18381. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  18382. attributeList.forEach(function (attr) {
  18383. if (!allowedAttribute(attr, whitelistedAttributes)) {
  18384. el.removeAttribute(attr.nodeName);
  18385. }
  18386. });
  18387. };
  18388. for (var i = 0, len = elements.length; i < len; i++) {
  18389. var _ret = _loop(i);
  18390. if (_ret === "continue") continue;
  18391. }
  18392. return createdDocument.body.innerHTML;
  18393. }
  18394. /**
  18395. * ------------------------------------------------------------------------
  18396. * Constants
  18397. * ------------------------------------------------------------------------
  18398. */
  18399. var NAME$6 = 'tooltip';
  18400. var VERSION$6 = '4.4.1';
  18401. var DATA_KEY$6 = 'bs.tooltip';
  18402. var EVENT_KEY$6 = "." + DATA_KEY$6;
  18403. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  18404. var CLASS_PREFIX = 'bs-tooltip';
  18405. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  18406. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  18407. var DefaultType$4 = {
  18408. animation: 'boolean',
  18409. template: 'string',
  18410. title: '(string|element|function)',
  18411. trigger: 'string',
  18412. delay: '(number|object)',
  18413. html: 'boolean',
  18414. selector: '(string|boolean)',
  18415. placement: '(string|function)',
  18416. offset: '(number|string|function)',
  18417. container: '(string|element|boolean)',
  18418. fallbackPlacement: '(string|array)',
  18419. boundary: '(string|element)',
  18420. sanitize: 'boolean',
  18421. sanitizeFn: '(null|function)',
  18422. whiteList: 'object',
  18423. popperConfig: '(null|object)'
  18424. };
  18425. var AttachmentMap$1 = {
  18426. AUTO: 'auto',
  18427. TOP: 'top',
  18428. RIGHT: 'right',
  18429. BOTTOM: 'bottom',
  18430. LEFT: 'left'
  18431. };
  18432. var Default$4 = {
  18433. animation: true,
  18434. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  18435. trigger: 'hover focus',
  18436. title: '',
  18437. delay: 0,
  18438. html: false,
  18439. selector: false,
  18440. placement: 'top',
  18441. offset: 0,
  18442. container: false,
  18443. fallbackPlacement: 'flip',
  18444. boundary: 'scrollParent',
  18445. sanitize: true,
  18446. sanitizeFn: null,
  18447. whiteList: DefaultWhitelist,
  18448. popperConfig: null
  18449. };
  18450. var HoverState = {
  18451. SHOW: 'show',
  18452. OUT: 'out'
  18453. };
  18454. var Event$6 = {
  18455. HIDE: "hide" + EVENT_KEY$6,
  18456. HIDDEN: "hidden" + EVENT_KEY$6,
  18457. SHOW: "show" + EVENT_KEY$6,
  18458. SHOWN: "shown" + EVENT_KEY$6,
  18459. INSERTED: "inserted" + EVENT_KEY$6,
  18460. CLICK: "click" + EVENT_KEY$6,
  18461. FOCUSIN: "focusin" + EVENT_KEY$6,
  18462. FOCUSOUT: "focusout" + EVENT_KEY$6,
  18463. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  18464. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  18465. };
  18466. var ClassName$6 = {
  18467. FADE: 'fade',
  18468. SHOW: 'show'
  18469. };
  18470. var Selector$6 = {
  18471. TOOLTIP: '.tooltip',
  18472. TOOLTIP_INNER: '.tooltip-inner',
  18473. ARROW: '.arrow'
  18474. };
  18475. var Trigger = {
  18476. HOVER: 'hover',
  18477. FOCUS: 'focus',
  18478. CLICK: 'click',
  18479. MANUAL: 'manual'
  18480. };
  18481. /**
  18482. * ------------------------------------------------------------------------
  18483. * Class Definition
  18484. * ------------------------------------------------------------------------
  18485. */
  18486. var Tooltip =
  18487. /*#__PURE__*/
  18488. function () {
  18489. function Tooltip(element, config) {
  18490. if (typeof Popper === 'undefined') {
  18491. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  18492. } // private
  18493. this._isEnabled = true;
  18494. this._timeout = 0;
  18495. this._hoverState = '';
  18496. this._activeTrigger = {};
  18497. this._popper = null; // Protected
  18498. this.element = element;
  18499. this.config = this._getConfig(config);
  18500. this.tip = null;
  18501. this._setListeners();
  18502. } // Getters
  18503. var _proto = Tooltip.prototype;
  18504. // Public
  18505. _proto.enable = function enable() {
  18506. this._isEnabled = true;
  18507. };
  18508. _proto.disable = function disable() {
  18509. this._isEnabled = false;
  18510. };
  18511. _proto.toggleEnabled = function toggleEnabled() {
  18512. this._isEnabled = !this._isEnabled;
  18513. };
  18514. _proto.toggle = function toggle(event) {
  18515. if (!this._isEnabled) {
  18516. return;
  18517. }
  18518. if (event) {
  18519. var dataKey = this.constructor.DATA_KEY;
  18520. var context = $(event.currentTarget).data(dataKey);
  18521. if (!context) {
  18522. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  18523. $(event.currentTarget).data(dataKey, context);
  18524. }
  18525. context._activeTrigger.click = !context._activeTrigger.click;
  18526. if (context._isWithActiveTrigger()) {
  18527. context._enter(null, context);
  18528. } else {
  18529. context._leave(null, context);
  18530. }
  18531. } else {
  18532. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  18533. this._leave(null, this);
  18534. return;
  18535. }
  18536. this._enter(null, this);
  18537. }
  18538. };
  18539. _proto.dispose = function dispose() {
  18540. clearTimeout(this._timeout);
  18541. $.removeData(this.element, this.constructor.DATA_KEY);
  18542. $(this.element).off(this.constructor.EVENT_KEY);
  18543. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  18544. if (this.tip) {
  18545. $(this.tip).remove();
  18546. }
  18547. this._isEnabled = null;
  18548. this._timeout = null;
  18549. this._hoverState = null;
  18550. this._activeTrigger = null;
  18551. if (this._popper) {
  18552. this._popper.destroy();
  18553. }
  18554. this._popper = null;
  18555. this.element = null;
  18556. this.config = null;
  18557. this.tip = null;
  18558. };
  18559. _proto.show = function show() {
  18560. var _this = this;
  18561. if ($(this.element).css('display') === 'none') {
  18562. throw new Error('Please use show on visible elements');
  18563. }
  18564. var showEvent = $.Event(this.constructor.Event.SHOW);
  18565. if (this.isWithContent() && this._isEnabled) {
  18566. $(this.element).trigger(showEvent);
  18567. var shadowRoot = Util.findShadowRoot(this.element);
  18568. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  18569. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  18570. return;
  18571. }
  18572. var tip = this.getTipElement();
  18573. var tipId = Util.getUID(this.constructor.NAME);
  18574. tip.setAttribute('id', tipId);
  18575. this.element.setAttribute('aria-describedby', tipId);
  18576. this.setContent();
  18577. if (this.config.animation) {
  18578. $(tip).addClass(ClassName$6.FADE);
  18579. }
  18580. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  18581. var attachment = this._getAttachment(placement);
  18582. this.addAttachmentClass(attachment);
  18583. var container = this._getContainer();
  18584. $(tip).data(this.constructor.DATA_KEY, this);
  18585. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  18586. $(tip).appendTo(container);
  18587. }
  18588. $(this.element).trigger(this.constructor.Event.INSERTED);
  18589. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  18590. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  18591. // empty mouseover listeners to the body's immediate children;
  18592. // only needed because of broken event delegation on iOS
  18593. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  18594. if ('ontouchstart' in document.documentElement) {
  18595. $(document.body).children().on('mouseover', null, $.noop);
  18596. }
  18597. var complete = function complete() {
  18598. if (_this.config.animation) {
  18599. _this._fixTransition();
  18600. }
  18601. var prevHoverState = _this._hoverState;
  18602. _this._hoverState = null;
  18603. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  18604. if (prevHoverState === HoverState.OUT) {
  18605. _this._leave(null, _this);
  18606. }
  18607. };
  18608. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  18609. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  18610. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  18611. } else {
  18612. complete();
  18613. }
  18614. }
  18615. };
  18616. _proto.hide = function hide(callback) {
  18617. var _this2 = this;
  18618. var tip = this.getTipElement();
  18619. var hideEvent = $.Event(this.constructor.Event.HIDE);
  18620. var complete = function complete() {
  18621. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  18622. tip.parentNode.removeChild(tip);
  18623. }
  18624. _this2._cleanTipClass();
  18625. _this2.element.removeAttribute('aria-describedby');
  18626. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  18627. if (_this2._popper !== null) {
  18628. _this2._popper.destroy();
  18629. }
  18630. if (callback) {
  18631. callback();
  18632. }
  18633. };
  18634. $(this.element).trigger(hideEvent);
  18635. if (hideEvent.isDefaultPrevented()) {
  18636. return;
  18637. }
  18638. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  18639. // empty mouseover listeners we added for iOS support
  18640. if ('ontouchstart' in document.documentElement) {
  18641. $(document.body).children().off('mouseover', null, $.noop);
  18642. }
  18643. this._activeTrigger[Trigger.CLICK] = false;
  18644. this._activeTrigger[Trigger.FOCUS] = false;
  18645. this._activeTrigger[Trigger.HOVER] = false;
  18646. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  18647. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  18648. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  18649. } else {
  18650. complete();
  18651. }
  18652. this._hoverState = '';
  18653. };
  18654. _proto.update = function update() {
  18655. if (this._popper !== null) {
  18656. this._popper.scheduleUpdate();
  18657. }
  18658. } // Protected
  18659. ;
  18660. _proto.isWithContent = function isWithContent() {
  18661. return Boolean(this.getTitle());
  18662. };
  18663. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  18664. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  18665. };
  18666. _proto.getTipElement = function getTipElement() {
  18667. this.tip = this.tip || $(this.config.template)[0];
  18668. return this.tip;
  18669. };
  18670. _proto.setContent = function setContent() {
  18671. var tip = this.getTipElement();
  18672. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  18673. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  18674. };
  18675. _proto.setElementContent = function setElementContent($element, content) {
  18676. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  18677. // Content is a DOM node or a jQuery
  18678. if (this.config.html) {
  18679. if (!$(content).parent().is($element)) {
  18680. $element.empty().append(content);
  18681. }
  18682. } else {
  18683. $element.text($(content).text());
  18684. }
  18685. return;
  18686. }
  18687. if (this.config.html) {
  18688. if (this.config.sanitize) {
  18689. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  18690. }
  18691. $element.html(content);
  18692. } else {
  18693. $element.text(content);
  18694. }
  18695. };
  18696. _proto.getTitle = function getTitle() {
  18697. var title = this.element.getAttribute('data-original-title');
  18698. if (!title) {
  18699. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  18700. }
  18701. return title;
  18702. } // Private
  18703. ;
  18704. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  18705. var _this3 = this;
  18706. var defaultBsConfig = {
  18707. placement: attachment,
  18708. modifiers: {
  18709. offset: this._getOffset(),
  18710. flip: {
  18711. behavior: this.config.fallbackPlacement
  18712. },
  18713. arrow: {
  18714. element: Selector$6.ARROW
  18715. },
  18716. preventOverflow: {
  18717. boundariesElement: this.config.boundary
  18718. }
  18719. },
  18720. onCreate: function onCreate(data) {
  18721. if (data.originalPlacement !== data.placement) {
  18722. _this3._handlePopperPlacementChange(data);
  18723. }
  18724. },
  18725. onUpdate: function onUpdate(data) {
  18726. return _this3._handlePopperPlacementChange(data);
  18727. }
  18728. };
  18729. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  18730. };
  18731. _proto._getOffset = function _getOffset() {
  18732. var _this4 = this;
  18733. var offset = {};
  18734. if (typeof this.config.offset === 'function') {
  18735. offset.fn = function (data) {
  18736. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  18737. return data;
  18738. };
  18739. } else {
  18740. offset.offset = this.config.offset;
  18741. }
  18742. return offset;
  18743. };
  18744. _proto._getContainer = function _getContainer() {
  18745. if (this.config.container === false) {
  18746. return document.body;
  18747. }
  18748. if (Util.isElement(this.config.container)) {
  18749. return $(this.config.container);
  18750. }
  18751. return $(document).find(this.config.container);
  18752. };
  18753. _proto._getAttachment = function _getAttachment(placement) {
  18754. return AttachmentMap$1[placement.toUpperCase()];
  18755. };
  18756. _proto._setListeners = function _setListeners() {
  18757. var _this5 = this;
  18758. var triggers = this.config.trigger.split(' ');
  18759. triggers.forEach(function (trigger) {
  18760. if (trigger === 'click') {
  18761. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  18762. return _this5.toggle(event);
  18763. });
  18764. } else if (trigger !== Trigger.MANUAL) {
  18765. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  18766. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  18767. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  18768. return _this5._enter(event);
  18769. }).on(eventOut, _this5.config.selector, function (event) {
  18770. return _this5._leave(event);
  18771. });
  18772. }
  18773. });
  18774. this._hideModalHandler = function () {
  18775. if (_this5.element) {
  18776. _this5.hide();
  18777. }
  18778. };
  18779. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  18780. if (this.config.selector) {
  18781. this.config = _objectSpread2({}, this.config, {
  18782. trigger: 'manual',
  18783. selector: ''
  18784. });
  18785. } else {
  18786. this._fixTitle();
  18787. }
  18788. };
  18789. _proto._fixTitle = function _fixTitle() {
  18790. var titleType = typeof this.element.getAttribute('data-original-title');
  18791. if (this.element.getAttribute('title') || titleType !== 'string') {
  18792. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  18793. this.element.setAttribute('title', '');
  18794. }
  18795. };
  18796. _proto._enter = function _enter(event, context) {
  18797. var dataKey = this.constructor.DATA_KEY;
  18798. context = context || $(event.currentTarget).data(dataKey);
  18799. if (!context) {
  18800. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  18801. $(event.currentTarget).data(dataKey, context);
  18802. }
  18803. if (event) {
  18804. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  18805. }
  18806. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  18807. context._hoverState = HoverState.SHOW;
  18808. return;
  18809. }
  18810. clearTimeout(context._timeout);
  18811. context._hoverState = HoverState.SHOW;
  18812. if (!context.config.delay || !context.config.delay.show) {
  18813. context.show();
  18814. return;
  18815. }
  18816. context._timeout = setTimeout(function () {
  18817. if (context._hoverState === HoverState.SHOW) {
  18818. context.show();
  18819. }
  18820. }, context.config.delay.show);
  18821. };
  18822. _proto._leave = function _leave(event, context) {
  18823. var dataKey = this.constructor.DATA_KEY;
  18824. context = context || $(event.currentTarget).data(dataKey);
  18825. if (!context) {
  18826. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  18827. $(event.currentTarget).data(dataKey, context);
  18828. }
  18829. if (event) {
  18830. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  18831. }
  18832. if (context._isWithActiveTrigger()) {
  18833. return;
  18834. }
  18835. clearTimeout(context._timeout);
  18836. context._hoverState = HoverState.OUT;
  18837. if (!context.config.delay || !context.config.delay.hide) {
  18838. context.hide();
  18839. return;
  18840. }
  18841. context._timeout = setTimeout(function () {
  18842. if (context._hoverState === HoverState.OUT) {
  18843. context.hide();
  18844. }
  18845. }, context.config.delay.hide);
  18846. };
  18847. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  18848. for (var trigger in this._activeTrigger) {
  18849. if (this._activeTrigger[trigger]) {
  18850. return true;
  18851. }
  18852. }
  18853. return false;
  18854. };
  18855. _proto._getConfig = function _getConfig(config) {
  18856. var dataAttributes = $(this.element).data();
  18857. Object.keys(dataAttributes).forEach(function (dataAttr) {
  18858. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  18859. delete dataAttributes[dataAttr];
  18860. }
  18861. });
  18862. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  18863. if (typeof config.delay === 'number') {
  18864. config.delay = {
  18865. show: config.delay,
  18866. hide: config.delay
  18867. };
  18868. }
  18869. if (typeof config.title === 'number') {
  18870. config.title = config.title.toString();
  18871. }
  18872. if (typeof config.content === 'number') {
  18873. config.content = config.content.toString();
  18874. }
  18875. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  18876. if (config.sanitize) {
  18877. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  18878. }
  18879. return config;
  18880. };
  18881. _proto._getDelegateConfig = function _getDelegateConfig() {
  18882. var config = {};
  18883. if (this.config) {
  18884. for (var key in this.config) {
  18885. if (this.constructor.Default[key] !== this.config[key]) {
  18886. config[key] = this.config[key];
  18887. }
  18888. }
  18889. }
  18890. return config;
  18891. };
  18892. _proto._cleanTipClass = function _cleanTipClass() {
  18893. var $tip = $(this.getTipElement());
  18894. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  18895. if (tabClass !== null && tabClass.length) {
  18896. $tip.removeClass(tabClass.join(''));
  18897. }
  18898. };
  18899. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  18900. var popperInstance = popperData.instance;
  18901. this.tip = popperInstance.popper;
  18902. this._cleanTipClass();
  18903. this.addAttachmentClass(this._getAttachment(popperData.placement));
  18904. };
  18905. _proto._fixTransition = function _fixTransition() {
  18906. var tip = this.getTipElement();
  18907. var initConfigAnimation = this.config.animation;
  18908. if (tip.getAttribute('x-placement') !== null) {
  18909. return;
  18910. }
  18911. $(tip).removeClass(ClassName$6.FADE);
  18912. this.config.animation = false;
  18913. this.hide();
  18914. this.show();
  18915. this.config.animation = initConfigAnimation;
  18916. } // Static
  18917. ;
  18918. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  18919. return this.each(function () {
  18920. var data = $(this).data(DATA_KEY$6);
  18921. var _config = typeof config === 'object' && config;
  18922. if (!data && /dispose|hide/.test(config)) {
  18923. return;
  18924. }
  18925. if (!data) {
  18926. data = new Tooltip(this, _config);
  18927. $(this).data(DATA_KEY$6, data);
  18928. }
  18929. if (typeof config === 'string') {
  18930. if (typeof data[config] === 'undefined') {
  18931. throw new TypeError("No method named \"" + config + "\"");
  18932. }
  18933. data[config]();
  18934. }
  18935. });
  18936. };
  18937. _createClass(Tooltip, null, [{
  18938. key: "VERSION",
  18939. get: function get() {
  18940. return VERSION$6;
  18941. }
  18942. }, {
  18943. key: "Default",
  18944. get: function get() {
  18945. return Default$4;
  18946. }
  18947. }, {
  18948. key: "NAME",
  18949. get: function get() {
  18950. return NAME$6;
  18951. }
  18952. }, {
  18953. key: "DATA_KEY",
  18954. get: function get() {
  18955. return DATA_KEY$6;
  18956. }
  18957. }, {
  18958. key: "Event",
  18959. get: function get() {
  18960. return Event$6;
  18961. }
  18962. }, {
  18963. key: "EVENT_KEY",
  18964. get: function get() {
  18965. return EVENT_KEY$6;
  18966. }
  18967. }, {
  18968. key: "DefaultType",
  18969. get: function get() {
  18970. return DefaultType$4;
  18971. }
  18972. }]);
  18973. return Tooltip;
  18974. }();
  18975. /**
  18976. * ------------------------------------------------------------------------
  18977. * jQuery
  18978. * ------------------------------------------------------------------------
  18979. */
  18980. $.fn[NAME$6] = Tooltip._jQueryInterface;
  18981. $.fn[NAME$6].Constructor = Tooltip;
  18982. $.fn[NAME$6].noConflict = function () {
  18983. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  18984. return Tooltip._jQueryInterface;
  18985. };
  18986. /**
  18987. * ------------------------------------------------------------------------
  18988. * Constants
  18989. * ------------------------------------------------------------------------
  18990. */
  18991. var NAME$7 = 'popover';
  18992. var VERSION$7 = '4.4.1';
  18993. var DATA_KEY$7 = 'bs.popover';
  18994. var EVENT_KEY$7 = "." + DATA_KEY$7;
  18995. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  18996. var CLASS_PREFIX$1 = 'bs-popover';
  18997. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  18998. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  18999. placement: 'right',
  19000. trigger: 'click',
  19001. content: '',
  19002. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  19003. });
  19004. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  19005. content: '(string|element|function)'
  19006. });
  19007. var ClassName$7 = {
  19008. FADE: 'fade',
  19009. SHOW: 'show'
  19010. };
  19011. var Selector$7 = {
  19012. TITLE: '.popover-header',
  19013. CONTENT: '.popover-body'
  19014. };
  19015. var Event$7 = {
  19016. HIDE: "hide" + EVENT_KEY$7,
  19017. HIDDEN: "hidden" + EVENT_KEY$7,
  19018. SHOW: "show" + EVENT_KEY$7,
  19019. SHOWN: "shown" + EVENT_KEY$7,
  19020. INSERTED: "inserted" + EVENT_KEY$7,
  19021. CLICK: "click" + EVENT_KEY$7,
  19022. FOCUSIN: "focusin" + EVENT_KEY$7,
  19023. FOCUSOUT: "focusout" + EVENT_KEY$7,
  19024. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  19025. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  19026. };
  19027. /**
  19028. * ------------------------------------------------------------------------
  19029. * Class Definition
  19030. * ------------------------------------------------------------------------
  19031. */
  19032. var Popover =
  19033. /*#__PURE__*/
  19034. function (_Tooltip) {
  19035. _inheritsLoose(Popover, _Tooltip);
  19036. function Popover() {
  19037. return _Tooltip.apply(this, arguments) || this;
  19038. }
  19039. var _proto = Popover.prototype;
  19040. // Overrides
  19041. _proto.isWithContent = function isWithContent() {
  19042. return this.getTitle() || this._getContent();
  19043. };
  19044. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  19045. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  19046. };
  19047. _proto.getTipElement = function getTipElement() {
  19048. this.tip = this.tip || $(this.config.template)[0];
  19049. return this.tip;
  19050. };
  19051. _proto.setContent = function setContent() {
  19052. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  19053. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  19054. var content = this._getContent();
  19055. if (typeof content === 'function') {
  19056. content = content.call(this.element);
  19057. }
  19058. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  19059. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  19060. } // Private
  19061. ;
  19062. _proto._getContent = function _getContent() {
  19063. return this.element.getAttribute('data-content') || this.config.content;
  19064. };
  19065. _proto._cleanTipClass = function _cleanTipClass() {
  19066. var $tip = $(this.getTipElement());
  19067. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  19068. if (tabClass !== null && tabClass.length > 0) {
  19069. $tip.removeClass(tabClass.join(''));
  19070. }
  19071. } // Static
  19072. ;
  19073. Popover._jQueryInterface = function _jQueryInterface(config) {
  19074. return this.each(function () {
  19075. var data = $(this).data(DATA_KEY$7);
  19076. var _config = typeof config === 'object' ? config : null;
  19077. if (!data && /dispose|hide/.test(config)) {
  19078. return;
  19079. }
  19080. if (!data) {
  19081. data = new Popover(this, _config);
  19082. $(this).data(DATA_KEY$7, data);
  19083. }
  19084. if (typeof config === 'string') {
  19085. if (typeof data[config] === 'undefined') {
  19086. throw new TypeError("No method named \"" + config + "\"");
  19087. }
  19088. data[config]();
  19089. }
  19090. });
  19091. };
  19092. _createClass(Popover, null, [{
  19093. key: "VERSION",
  19094. // Getters
  19095. get: function get() {
  19096. return VERSION$7;
  19097. }
  19098. }, {
  19099. key: "Default",
  19100. get: function get() {
  19101. return Default$5;
  19102. }
  19103. }, {
  19104. key: "NAME",
  19105. get: function get() {
  19106. return NAME$7;
  19107. }
  19108. }, {
  19109. key: "DATA_KEY",
  19110. get: function get() {
  19111. return DATA_KEY$7;
  19112. }
  19113. }, {
  19114. key: "Event",
  19115. get: function get() {
  19116. return Event$7;
  19117. }
  19118. }, {
  19119. key: "EVENT_KEY",
  19120. get: function get() {
  19121. return EVENT_KEY$7;
  19122. }
  19123. }, {
  19124. key: "DefaultType",
  19125. get: function get() {
  19126. return DefaultType$5;
  19127. }
  19128. }]);
  19129. return Popover;
  19130. }(Tooltip);
  19131. /**
  19132. * ------------------------------------------------------------------------
  19133. * jQuery
  19134. * ------------------------------------------------------------------------
  19135. */
  19136. $.fn[NAME$7] = Popover._jQueryInterface;
  19137. $.fn[NAME$7].Constructor = Popover;
  19138. $.fn[NAME$7].noConflict = function () {
  19139. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  19140. return Popover._jQueryInterface;
  19141. };
  19142. /**
  19143. * ------------------------------------------------------------------------
  19144. * Constants
  19145. * ------------------------------------------------------------------------
  19146. */
  19147. var NAME$8 = 'scrollspy';
  19148. var VERSION$8 = '4.4.1';
  19149. var DATA_KEY$8 = 'bs.scrollspy';
  19150. var EVENT_KEY$8 = "." + DATA_KEY$8;
  19151. var DATA_API_KEY$6 = '.data-api';
  19152. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  19153. var Default$6 = {
  19154. offset: 10,
  19155. method: 'auto',
  19156. target: ''
  19157. };
  19158. var DefaultType$6 = {
  19159. offset: 'number',
  19160. method: 'string',
  19161. target: '(string|element)'
  19162. };
  19163. var Event$8 = {
  19164. ACTIVATE: "activate" + EVENT_KEY$8,
  19165. SCROLL: "scroll" + EVENT_KEY$8,
  19166. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  19167. };
  19168. var ClassName$8 = {
  19169. DROPDOWN_ITEM: 'dropdown-item',
  19170. DROPDOWN_MENU: 'dropdown-menu',
  19171. ACTIVE: 'active'
  19172. };
  19173. var Selector$8 = {
  19174. DATA_SPY: '[data-spy="scroll"]',
  19175. ACTIVE: '.active',
  19176. NAV_LIST_GROUP: '.nav, .list-group',
  19177. NAV_LINKS: '.nav-link',
  19178. NAV_ITEMS: '.nav-item',
  19179. LIST_ITEMS: '.list-group-item',
  19180. DROPDOWN: '.dropdown',
  19181. DROPDOWN_ITEMS: '.dropdown-item',
  19182. DROPDOWN_TOGGLE: '.dropdown-toggle'
  19183. };
  19184. var OffsetMethod = {
  19185. OFFSET: 'offset',
  19186. POSITION: 'position'
  19187. };
  19188. /**
  19189. * ------------------------------------------------------------------------
  19190. * Class Definition
  19191. * ------------------------------------------------------------------------
  19192. */
  19193. var ScrollSpy =
  19194. /*#__PURE__*/
  19195. function () {
  19196. function ScrollSpy(element, config) {
  19197. var _this = this;
  19198. this._element = element;
  19199. this._scrollElement = element.tagName === 'BODY' ? window : element;
  19200. this._config = this._getConfig(config);
  19201. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  19202. this._offsets = [];
  19203. this._targets = [];
  19204. this._activeTarget = null;
  19205. this._scrollHeight = 0;
  19206. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  19207. return _this._process(event);
  19208. });
  19209. this.refresh();
  19210. this._process();
  19211. } // Getters
  19212. var _proto = ScrollSpy.prototype;
  19213. // Public
  19214. _proto.refresh = function refresh() {
  19215. var _this2 = this;
  19216. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  19217. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  19218. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  19219. this._offsets = [];
  19220. this._targets = [];
  19221. this._scrollHeight = this._getScrollHeight();
  19222. var targets = [].slice.call(document.querySelectorAll(this._selector));
  19223. targets.map(function (element) {
  19224. var target;
  19225. var targetSelector = Util.getSelectorFromElement(element);
  19226. if (targetSelector) {
  19227. target = document.querySelector(targetSelector);
  19228. }
  19229. if (target) {
  19230. var targetBCR = target.getBoundingClientRect();
  19231. if (targetBCR.width || targetBCR.height) {
  19232. // TODO (fat): remove sketch reliance on jQuery position/offset
  19233. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  19234. }
  19235. }
  19236. return null;
  19237. }).filter(function (item) {
  19238. return item;
  19239. }).sort(function (a, b) {
  19240. return a[0] - b[0];
  19241. }).forEach(function (item) {
  19242. _this2._offsets.push(item[0]);
  19243. _this2._targets.push(item[1]);
  19244. });
  19245. };
  19246. _proto.dispose = function dispose() {
  19247. $.removeData(this._element, DATA_KEY$8);
  19248. $(this._scrollElement).off(EVENT_KEY$8);
  19249. this._element = null;
  19250. this._scrollElement = null;
  19251. this._config = null;
  19252. this._selector = null;
  19253. this._offsets = null;
  19254. this._targets = null;
  19255. this._activeTarget = null;
  19256. this._scrollHeight = null;
  19257. } // Private
  19258. ;
  19259. _proto._getConfig = function _getConfig(config) {
  19260. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  19261. if (typeof config.target !== 'string') {
  19262. var id = $(config.target).attr('id');
  19263. if (!id) {
  19264. id = Util.getUID(NAME$8);
  19265. $(config.target).attr('id', id);
  19266. }
  19267. config.target = "#" + id;
  19268. }
  19269. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  19270. return config;
  19271. };
  19272. _proto._getScrollTop = function _getScrollTop() {
  19273. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  19274. };
  19275. _proto._getScrollHeight = function _getScrollHeight() {
  19276. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  19277. };
  19278. _proto._getOffsetHeight = function _getOffsetHeight() {
  19279. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  19280. };
  19281. _proto._process = function _process() {
  19282. var scrollTop = this._getScrollTop() + this._config.offset;
  19283. var scrollHeight = this._getScrollHeight();
  19284. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  19285. if (this._scrollHeight !== scrollHeight) {
  19286. this.refresh();
  19287. }
  19288. if (scrollTop >= maxScroll) {
  19289. var target = this._targets[this._targets.length - 1];
  19290. if (this._activeTarget !== target) {
  19291. this._activate(target);
  19292. }
  19293. return;
  19294. }
  19295. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  19296. this._activeTarget = null;
  19297. this._clear();
  19298. return;
  19299. }
  19300. var offsetLength = this._offsets.length;
  19301. for (var i = offsetLength; i--;) {
  19302. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  19303. if (isActiveTarget) {
  19304. this._activate(this._targets[i]);
  19305. }
  19306. }
  19307. };
  19308. _proto._activate = function _activate(target) {
  19309. this._activeTarget = target;
  19310. this._clear();
  19311. var queries = this._selector.split(',').map(function (selector) {
  19312. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  19313. });
  19314. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  19315. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  19316. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  19317. $link.addClass(ClassName$8.ACTIVE);
  19318. } else {
  19319. // Set triggered link as active
  19320. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  19321. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  19322. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  19323. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  19324. }
  19325. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  19326. relatedTarget: target
  19327. });
  19328. };
  19329. _proto._clear = function _clear() {
  19330. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  19331. return node.classList.contains(ClassName$8.ACTIVE);
  19332. }).forEach(function (node) {
  19333. return node.classList.remove(ClassName$8.ACTIVE);
  19334. });
  19335. } // Static
  19336. ;
  19337. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  19338. return this.each(function () {
  19339. var data = $(this).data(DATA_KEY$8);
  19340. var _config = typeof config === 'object' && config;
  19341. if (!data) {
  19342. data = new ScrollSpy(this, _config);
  19343. $(this).data(DATA_KEY$8, data);
  19344. }
  19345. if (typeof config === 'string') {
  19346. if (typeof data[config] === 'undefined') {
  19347. throw new TypeError("No method named \"" + config + "\"");
  19348. }
  19349. data[config]();
  19350. }
  19351. });
  19352. };
  19353. _createClass(ScrollSpy, null, [{
  19354. key: "VERSION",
  19355. get: function get() {
  19356. return VERSION$8;
  19357. }
  19358. }, {
  19359. key: "Default",
  19360. get: function get() {
  19361. return Default$6;
  19362. }
  19363. }]);
  19364. return ScrollSpy;
  19365. }();
  19366. /**
  19367. * ------------------------------------------------------------------------
  19368. * Data Api implementation
  19369. * ------------------------------------------------------------------------
  19370. */
  19371. $(window).on(Event$8.LOAD_DATA_API, function () {
  19372. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  19373. var scrollSpysLength = scrollSpys.length;
  19374. for (var i = scrollSpysLength; i--;) {
  19375. var $spy = $(scrollSpys[i]);
  19376. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  19377. }
  19378. });
  19379. /**
  19380. * ------------------------------------------------------------------------
  19381. * jQuery
  19382. * ------------------------------------------------------------------------
  19383. */
  19384. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  19385. $.fn[NAME$8].Constructor = ScrollSpy;
  19386. $.fn[NAME$8].noConflict = function () {
  19387. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  19388. return ScrollSpy._jQueryInterface;
  19389. };
  19390. /**
  19391. * ------------------------------------------------------------------------
  19392. * Constants
  19393. * ------------------------------------------------------------------------
  19394. */
  19395. var NAME$9 = 'tab';
  19396. var VERSION$9 = '4.4.1';
  19397. var DATA_KEY$9 = 'bs.tab';
  19398. var EVENT_KEY$9 = "." + DATA_KEY$9;
  19399. var DATA_API_KEY$7 = '.data-api';
  19400. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  19401. var Event$9 = {
  19402. HIDE: "hide" + EVENT_KEY$9,
  19403. HIDDEN: "hidden" + EVENT_KEY$9,
  19404. SHOW: "show" + EVENT_KEY$9,
  19405. SHOWN: "shown" + EVENT_KEY$9,
  19406. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  19407. };
  19408. var ClassName$9 = {
  19409. DROPDOWN_MENU: 'dropdown-menu',
  19410. ACTIVE: 'active',
  19411. DISABLED: 'disabled',
  19412. FADE: 'fade',
  19413. SHOW: 'show'
  19414. };
  19415. var Selector$9 = {
  19416. DROPDOWN: '.dropdown',
  19417. NAV_LIST_GROUP: '.nav, .list-group',
  19418. ACTIVE: '.active',
  19419. ACTIVE_UL: '> li > .active',
  19420. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  19421. DROPDOWN_TOGGLE: '.dropdown-toggle',
  19422. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  19423. };
  19424. /**
  19425. * ------------------------------------------------------------------------
  19426. * Class Definition
  19427. * ------------------------------------------------------------------------
  19428. */
  19429. var Tab =
  19430. /*#__PURE__*/
  19431. function () {
  19432. function Tab(element) {
  19433. this._element = element;
  19434. } // Getters
  19435. var _proto = Tab.prototype;
  19436. // Public
  19437. _proto.show = function show() {
  19438. var _this = this;
  19439. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  19440. return;
  19441. }
  19442. var target;
  19443. var previous;
  19444. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  19445. var selector = Util.getSelectorFromElement(this._element);
  19446. if (listElement) {
  19447. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  19448. previous = $.makeArray($(listElement).find(itemSelector));
  19449. previous = previous[previous.length - 1];
  19450. }
  19451. var hideEvent = $.Event(Event$9.HIDE, {
  19452. relatedTarget: this._element
  19453. });
  19454. var showEvent = $.Event(Event$9.SHOW, {
  19455. relatedTarget: previous
  19456. });
  19457. if (previous) {
  19458. $(previous).trigger(hideEvent);
  19459. }
  19460. $(this._element).trigger(showEvent);
  19461. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  19462. return;
  19463. }
  19464. if (selector) {
  19465. target = document.querySelector(selector);
  19466. }
  19467. this._activate(this._element, listElement);
  19468. var complete = function complete() {
  19469. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  19470. relatedTarget: _this._element
  19471. });
  19472. var shownEvent = $.Event(Event$9.SHOWN, {
  19473. relatedTarget: previous
  19474. });
  19475. $(previous).trigger(hiddenEvent);
  19476. $(_this._element).trigger(shownEvent);
  19477. };
  19478. if (target) {
  19479. this._activate(target, target.parentNode, complete);
  19480. } else {
  19481. complete();
  19482. }
  19483. };
  19484. _proto.dispose = function dispose() {
  19485. $.removeData(this._element, DATA_KEY$9);
  19486. this._element = null;
  19487. } // Private
  19488. ;
  19489. _proto._activate = function _activate(element, container, callback) {
  19490. var _this2 = this;
  19491. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  19492. var active = activeElements[0];
  19493. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  19494. var complete = function complete() {
  19495. return _this2._transitionComplete(element, active, callback);
  19496. };
  19497. if (active && isTransitioning) {
  19498. var transitionDuration = Util.getTransitionDurationFromElement(active);
  19499. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  19500. } else {
  19501. complete();
  19502. }
  19503. };
  19504. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  19505. if (active) {
  19506. $(active).removeClass(ClassName$9.ACTIVE);
  19507. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  19508. if (dropdownChild) {
  19509. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  19510. }
  19511. if (active.getAttribute('role') === 'tab') {
  19512. active.setAttribute('aria-selected', false);
  19513. }
  19514. }
  19515. $(element).addClass(ClassName$9.ACTIVE);
  19516. if (element.getAttribute('role') === 'tab') {
  19517. element.setAttribute('aria-selected', true);
  19518. }
  19519. Util.reflow(element);
  19520. if (element.classList.contains(ClassName$9.FADE)) {
  19521. element.classList.add(ClassName$9.SHOW);
  19522. }
  19523. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  19524. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  19525. if (dropdownElement) {
  19526. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  19527. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  19528. }
  19529. element.setAttribute('aria-expanded', true);
  19530. }
  19531. if (callback) {
  19532. callback();
  19533. }
  19534. } // Static
  19535. ;
  19536. Tab._jQueryInterface = function _jQueryInterface(config) {
  19537. return this.each(function () {
  19538. var $this = $(this);
  19539. var data = $this.data(DATA_KEY$9);
  19540. if (!data) {
  19541. data = new Tab(this);
  19542. $this.data(DATA_KEY$9, data);
  19543. }
  19544. if (typeof config === 'string') {
  19545. if (typeof data[config] === 'undefined') {
  19546. throw new TypeError("No method named \"" + config + "\"");
  19547. }
  19548. data[config]();
  19549. }
  19550. });
  19551. };
  19552. _createClass(Tab, null, [{
  19553. key: "VERSION",
  19554. get: function get() {
  19555. return VERSION$9;
  19556. }
  19557. }]);
  19558. return Tab;
  19559. }();
  19560. /**
  19561. * ------------------------------------------------------------------------
  19562. * Data Api implementation
  19563. * ------------------------------------------------------------------------
  19564. */
  19565. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  19566. event.preventDefault();
  19567. Tab._jQueryInterface.call($(this), 'show');
  19568. });
  19569. /**
  19570. * ------------------------------------------------------------------------
  19571. * jQuery
  19572. * ------------------------------------------------------------------------
  19573. */
  19574. $.fn[NAME$9] = Tab._jQueryInterface;
  19575. $.fn[NAME$9].Constructor = Tab;
  19576. $.fn[NAME$9].noConflict = function () {
  19577. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  19578. return Tab._jQueryInterface;
  19579. };
  19580. /**
  19581. * ------------------------------------------------------------------------
  19582. * Constants
  19583. * ------------------------------------------------------------------------
  19584. */
  19585. var NAME$a = 'toast';
  19586. var VERSION$a = '4.4.1';
  19587. var DATA_KEY$a = 'bs.toast';
  19588. var EVENT_KEY$a = "." + DATA_KEY$a;
  19589. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  19590. var Event$a = {
  19591. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  19592. HIDE: "hide" + EVENT_KEY$a,
  19593. HIDDEN: "hidden" + EVENT_KEY$a,
  19594. SHOW: "show" + EVENT_KEY$a,
  19595. SHOWN: "shown" + EVENT_KEY$a
  19596. };
  19597. var ClassName$a = {
  19598. FADE: 'fade',
  19599. HIDE: 'hide',
  19600. SHOW: 'show',
  19601. SHOWING: 'showing'
  19602. };
  19603. var DefaultType$7 = {
  19604. animation: 'boolean',
  19605. autohide: 'boolean',
  19606. delay: 'number'
  19607. };
  19608. var Default$7 = {
  19609. animation: true,
  19610. autohide: true,
  19611. delay: 500
  19612. };
  19613. var Selector$a = {
  19614. DATA_DISMISS: '[data-dismiss="toast"]'
  19615. };
  19616. /**
  19617. * ------------------------------------------------------------------------
  19618. * Class Definition
  19619. * ------------------------------------------------------------------------
  19620. */
  19621. var Toast =
  19622. /*#__PURE__*/
  19623. function () {
  19624. function Toast(element, config) {
  19625. this._element = element;
  19626. this._config = this._getConfig(config);
  19627. this._timeout = null;
  19628. this._setListeners();
  19629. } // Getters
  19630. var _proto = Toast.prototype;
  19631. // Public
  19632. _proto.show = function show() {
  19633. var _this = this;
  19634. var showEvent = $.Event(Event$a.SHOW);
  19635. $(this._element).trigger(showEvent);
  19636. if (showEvent.isDefaultPrevented()) {
  19637. return;
  19638. }
  19639. if (this._config.animation) {
  19640. this._element.classList.add(ClassName$a.FADE);
  19641. }
  19642. var complete = function complete() {
  19643. _this._element.classList.remove(ClassName$a.SHOWING);
  19644. _this._element.classList.add(ClassName$a.SHOW);
  19645. $(_this._element).trigger(Event$a.SHOWN);
  19646. if (_this._config.autohide) {
  19647. _this._timeout = setTimeout(function () {
  19648. _this.hide();
  19649. }, _this._config.delay);
  19650. }
  19651. };
  19652. this._element.classList.remove(ClassName$a.HIDE);
  19653. Util.reflow(this._element);
  19654. this._element.classList.add(ClassName$a.SHOWING);
  19655. if (this._config.animation) {
  19656. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  19657. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  19658. } else {
  19659. complete();
  19660. }
  19661. };
  19662. _proto.hide = function hide() {
  19663. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  19664. return;
  19665. }
  19666. var hideEvent = $.Event(Event$a.HIDE);
  19667. $(this._element).trigger(hideEvent);
  19668. if (hideEvent.isDefaultPrevented()) {
  19669. return;
  19670. }
  19671. this._close();
  19672. };
  19673. _proto.dispose = function dispose() {
  19674. clearTimeout(this._timeout);
  19675. this._timeout = null;
  19676. if (this._element.classList.contains(ClassName$a.SHOW)) {
  19677. this._element.classList.remove(ClassName$a.SHOW);
  19678. }
  19679. $(this._element).off(Event$a.CLICK_DISMISS);
  19680. $.removeData(this._element, DATA_KEY$a);
  19681. this._element = null;
  19682. this._config = null;
  19683. } // Private
  19684. ;
  19685. _proto._getConfig = function _getConfig(config) {
  19686. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  19687. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  19688. return config;
  19689. };
  19690. _proto._setListeners = function _setListeners() {
  19691. var _this2 = this;
  19692. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  19693. return _this2.hide();
  19694. });
  19695. };
  19696. _proto._close = function _close() {
  19697. var _this3 = this;
  19698. var complete = function complete() {
  19699. _this3._element.classList.add(ClassName$a.HIDE);
  19700. $(_this3._element).trigger(Event$a.HIDDEN);
  19701. };
  19702. this._element.classList.remove(ClassName$a.SHOW);
  19703. if (this._config.animation) {
  19704. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  19705. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  19706. } else {
  19707. complete();
  19708. }
  19709. } // Static
  19710. ;
  19711. Toast._jQueryInterface = function _jQueryInterface(config) {
  19712. return this.each(function () {
  19713. var $element = $(this);
  19714. var data = $element.data(DATA_KEY$a);
  19715. var _config = typeof config === 'object' && config;
  19716. if (!data) {
  19717. data = new Toast(this, _config);
  19718. $element.data(DATA_KEY$a, data);
  19719. }
  19720. if (typeof config === 'string') {
  19721. if (typeof data[config] === 'undefined') {
  19722. throw new TypeError("No method named \"" + config + "\"");
  19723. }
  19724. data[config](this);
  19725. }
  19726. });
  19727. };
  19728. _createClass(Toast, null, [{
  19729. key: "VERSION",
  19730. get: function get() {
  19731. return VERSION$a;
  19732. }
  19733. }, {
  19734. key: "DefaultType",
  19735. get: function get() {
  19736. return DefaultType$7;
  19737. }
  19738. }, {
  19739. key: "Default",
  19740. get: function get() {
  19741. return Default$7;
  19742. }
  19743. }]);
  19744. return Toast;
  19745. }();
  19746. /**
  19747. * ------------------------------------------------------------------------
  19748. * jQuery
  19749. * ------------------------------------------------------------------------
  19750. */
  19751. $.fn[NAME$a] = Toast._jQueryInterface;
  19752. $.fn[NAME$a].Constructor = Toast;
  19753. $.fn[NAME$a].noConflict = function () {
  19754. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  19755. return Toast._jQueryInterface;
  19756. };
  19757. exports.Alert = Alert;
  19758. exports.Button = Button;
  19759. exports.Carousel = Carousel;
  19760. exports.Collapse = Collapse;
  19761. exports.Dropdown = Dropdown;
  19762. exports.Modal = Modal;
  19763. exports.Popover = Popover;
  19764. exports.Scrollspy = ScrollSpy;
  19765. exports.Tab = Tab;
  19766. exports.Toast = Toast;
  19767. exports.Tooltip = Tooltip;
  19768. exports.Util = Util;
  19769. Object.defineProperty(exports, '__esModule', { value: true });
  19770. })));
  19771. //# sourceMappingURL=bootstrap.js.map
  19772. /*! @preserve
  19773. * bootbox.js
  19774. * version: 5.1.1
  19775. * author: Nick Payne <nick@kurai.co.uk>
  19776. * license: MIT
  19777. * http://bootboxjs.com/
  19778. */
  19779. (function (root, factory) {
  19780. 'use strict';
  19781. if (typeof define === 'function' && define.amd) {
  19782. // AMD
  19783. define(['jquery'], factory);
  19784. } else if (typeof exports === 'object') {
  19785. // Node, CommonJS-like
  19786. module.exports = factory(require('jquery'));
  19787. } else {
  19788. // Browser globals (root is window)
  19789. root.bootbox = factory(root.jQuery);
  19790. }
  19791. }(this, function init($, undefined) {
  19792. 'use strict';
  19793. // Polyfills Object.keys, if necessary.
  19794. // @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
  19795. if (!Object.keys) {
  19796. Object.keys = (function () {
  19797. var hasOwnProperty = Object.prototype.hasOwnProperty,
  19798. hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
  19799. dontEnums = [
  19800. 'toString',
  19801. 'toLocaleString',
  19802. 'valueOf',
  19803. 'hasOwnProperty',
  19804. 'isPrototypeOf',
  19805. 'propertyIsEnumerable',
  19806. 'constructor'
  19807. ],
  19808. dontEnumsLength = dontEnums.length;
  19809. return function (obj) {
  19810. if (typeof obj !== 'function' && (typeof obj !== 'object' || obj === null)) {
  19811. throw new TypeError('Object.keys called on non-object');
  19812. }
  19813. var result = [], prop, i;
  19814. for (prop in obj) {
  19815. if (hasOwnProperty.call(obj, prop)) {
  19816. result.push(prop);
  19817. }
  19818. }
  19819. if (hasDontEnumBug) {
  19820. for (i = 0; i < dontEnumsLength; i++) {
  19821. if (hasOwnProperty.call(obj, dontEnums[i])) {
  19822. result.push(dontEnums[i]);
  19823. }
  19824. }
  19825. }
  19826. return result;
  19827. };
  19828. }());
  19829. }
  19830. var exports = {};
  19831. var VERSION = '5.0.0';
  19832. exports.VERSION = VERSION;
  19833. var locales = {};
  19834. var templates = {
  19835. dialog:
  19836. '<div class="bootbox modal" tabindex="-1" role="dialog" aria-hidden="true">' +
  19837. '<div class="modal-dialog">' +
  19838. '<div class="modal-content">' +
  19839. '<div class="modal-body"><div class="bootbox-body"></div></div>' +
  19840. '</div>' +
  19841. '</div>' +
  19842. '</div>',
  19843. header:
  19844. '<div class="modal-header">' +
  19845. '<h5 class="modal-title"></h5>' +
  19846. '</div>',
  19847. footer:
  19848. '<div class="modal-footer"></div>',
  19849. closeButton:
  19850. '<button type="button" class="bootbox-close-button close" aria-hidden="true">&times;</button>',
  19851. form:
  19852. '<form class="bootbox-form"></form>',
  19853. button:
  19854. '<button type="button" class="btn"></button>',
  19855. option:
  19856. '<option></option>',
  19857. promptMessage:
  19858. '<div class="bootbox-prompt-message"></div>',
  19859. inputs: {
  19860. text:
  19861. '<input class="bootbox-input bootbox-input-text form-control" autocomplete="off" type="text" />',
  19862. textarea:
  19863. '<textarea class="bootbox-input bootbox-input-textarea form-control"></textarea>',
  19864. email:
  19865. '<input class="bootbox-input bootbox-input-email form-control" autocomplete="off" type="email" />',
  19866. select:
  19867. '<select class="bootbox-input bootbox-input-select form-control"></select>',
  19868. checkbox:
  19869. '<div class="form-check checkbox"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-checkbox" type="checkbox" /></label></div>',
  19870. radio:
  19871. '<div class="form-check radio"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-radio" type="radio" name="bootbox-radio" /></label></div>',
  19872. date:
  19873. '<input class="bootbox-input bootbox-input-date form-control" autocomplete="off" type="date" />',
  19874. time:
  19875. '<input class="bootbox-input bootbox-input-time form-control" autocomplete="off" type="time" />',
  19876. number:
  19877. '<input class="bootbox-input bootbox-input-number form-control" autocomplete="off" type="number" />',
  19878. password:
  19879. '<input class="bootbox-input bootbox-input-password form-control" autocomplete="off" type="password" />',
  19880. range:
  19881. '<input class="bootbox-input bootbox-input-range form-control-range" autocomplete="off" type="range" />'
  19882. }
  19883. };
  19884. var defaults = {
  19885. // default language
  19886. locale: 'en',
  19887. // show backdrop or not. Default to static so user has to interact with dialog
  19888. backdrop: 'static',
  19889. // animate the modal in/out
  19890. animate: true,
  19891. // additional class string applied to the top level dialog
  19892. className: null,
  19893. // whether or not to include a close button
  19894. closeButton: true,
  19895. // show the dialog immediately by default
  19896. show: true,
  19897. // dialog container
  19898. container: 'body',
  19899. // default value (used by the prompt helper)
  19900. value: '',
  19901. // default input type (used by the prompt helper)
  19902. inputType: 'text',
  19903. // switch button order from cancel/confirm (default) to confirm/cancel
  19904. swapButtonOrder: false,
  19905. // center modal vertically in page
  19906. centerVertical: false,
  19907. // Append "multiple" property to the select when using the "prompt" helper
  19908. multiple: false,
  19909. // Automatically scroll modal content when height exceeds viewport height
  19910. scrollable: false
  19911. };
  19912. // PUBLIC FUNCTIONS
  19913. // *************************************************************************************************************
  19914. // Return all currently registered locales, or a specific locale if "name" is defined
  19915. exports.locales = function (name) {
  19916. return name ? locales[name] : locales;
  19917. };
  19918. // Register localized strings for the OK, Confirm, and Cancel buttons
  19919. exports.addLocale = function (name, values) {
  19920. $.each(['OK', 'CANCEL', 'CONFIRM'], function (_, v) {
  19921. if (!values[v]) {
  19922. throw new Error('Please supply a translation for "' + v + '"');
  19923. }
  19924. });
  19925. locales[name] = {
  19926. OK: values.OK,
  19927. CANCEL: values.CANCEL,
  19928. CONFIRM: values.CONFIRM
  19929. };
  19930. return exports;
  19931. };
  19932. // Remove a previously-registered locale
  19933. exports.removeLocale = function (name) {
  19934. if (name !== 'en') {
  19935. delete locales[name];
  19936. }
  19937. else {
  19938. throw new Error('"en" is used as the default and fallback locale and cannot be removed.');
  19939. }
  19940. return exports;
  19941. };
  19942. // Set the default locale
  19943. exports.setLocale = function (name) {
  19944. return exports.setDefaults('locale', name);
  19945. };
  19946. // Override default value(s) of Bootbox.
  19947. exports.setDefaults = function () {
  19948. var values = {};
  19949. if (arguments.length === 2) {
  19950. // allow passing of single key/value...
  19951. values[arguments[0]] = arguments[1];
  19952. } else {
  19953. // ... and as an object too
  19954. values = arguments[0];
  19955. }
  19956. $.extend(defaults, values);
  19957. return exports;
  19958. };
  19959. exports.setTemplates = function () {
  19960. var values = {};
  19961. if (arguments.length === 3) {
  19962. // allow passing of {key1: {key2: value}} as setTemplates(key1, key2, value)...
  19963. values[arguments[0]] = {};
  19964. values[arguments[0]][arguments[1]] = arguments[2];
  19965. } else if (arguments.length === 2) {
  19966. // ...or allow passing of {key: value} as setTemplates(key, value)...
  19967. values[arguments[0]] = arguments[1];
  19968. } else {
  19969. // ... and as an object too setTemplates(value)
  19970. values = arguments[0];
  19971. }
  19972. $.extend(templates, values);
  19973. };
  19974. // Hides all currently active Bootbox modals
  19975. exports.hideAll = function () {
  19976. $('.bootbox').modal('hide');
  19977. return exports;
  19978. };
  19979. // Allows the base init() function to be overridden
  19980. exports.init = function (_$) {
  19981. return init(_$ || $);
  19982. };
  19983. // CORE HELPER FUNCTIONS
  19984. // *************************************************************************************************************
  19985. // Core dialog function
  19986. exports.dialog = function (options) {
  19987. if ($.fn.modal === undefined) {
  19988. throw new Error(
  19989. '"$.fn.modal" is not defined; please double check you have included ' +
  19990. 'the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ ' +
  19991. 'for more details.'
  19992. );
  19993. }
  19994. options = sanitize(options);
  19995. if ($.fn.modal.Constructor.VERSION) {
  19996. options.fullBootstrapVersion = $.fn.modal.Constructor.VERSION;
  19997. var i = options.fullBootstrapVersion.indexOf('.');
  19998. options.bootstrap = options.fullBootstrapVersion.substring(0, i);
  19999. }
  20000. else {
  20001. // Assuming version 2.3.2, as that was the last "supported" 2.x version
  20002. options.bootstrap = '2';
  20003. options.fullBootstrapVersion = '2.3.2';
  20004. console.warn('Bootbox will *mostly* work with Bootstrap 2, but we do not officially support it. Please upgrade, if possible.');
  20005. }
  20006. var dialog = $(templates.dialog);
  20007. var innerDialog = dialog.find('.modal-dialog');
  20008. var body = dialog.find('.modal-body');
  20009. var header = $(templates.header);
  20010. var footer = $(templates.footer);
  20011. var buttons = options.buttons;
  20012. var callbacks = {
  20013. onEscape: options.onEscape
  20014. };
  20015. body.find('.bootbox-body').html(options.message);
  20016. // Only attempt to create buttons if at least one has
  20017. // been defined in the options object
  20018. if (getKeyLength(options.buttons) > 0) {
  20019. each(buttons, function (key, b) {
  20020. var button = $(templates.button);
  20021. button.data('bb-handler', key);
  20022. button.addClass(b.className);
  20023. switch(key)
  20024. {
  20025. case 'ok':
  20026. case 'confirm':
  20027. button.addClass('bootbox-accept');
  20028. break;
  20029. case 'cancel':
  20030. button.addClass('bootbox-cancel');
  20031. break;
  20032. }
  20033. button.html(b.label);
  20034. footer.append(button);
  20035. callbacks[key] = b.callback;
  20036. });
  20037. body.after(footer);
  20038. }
  20039. if (options.animate === true) {
  20040. dialog.addClass('fade');
  20041. }
  20042. if (options.className) {
  20043. dialog.addClass(options.className);
  20044. }
  20045. if (options.size) {
  20046. // Requires Bootstrap 3.1.0 or higher
  20047. if (options.fullBootstrapVersion.substring(0, 3) < '3.1') {
  20048. console.warn('"size" requires Bootstrap 3.1.0 or higher. You appear to be using ' + options.fullBootstrapVersion + '. Please upgrade to use this option.');
  20049. }
  20050. switch(options.size)
  20051. {
  20052. case 'small':
  20053. case 'sm':
  20054. innerDialog.addClass('modal-sm');
  20055. break;
  20056. case 'large':
  20057. case 'lg':
  20058. innerDialog.addClass('modal-lg');
  20059. break;
  20060. case 'xl':
  20061. case 'extra-large':
  20062. // Requires Bootstrap 4.2.0 or higher
  20063. if (options.fullBootstrapVersion.substring(0, 3) < '4.2') {
  20064. console.warn('Using size "xl"/"extra-large" requires Bootstrap 4.2.0 or higher. You appear to be using ' + options.fullBootstrapVersion + '. Please upgrade to use this option.');
  20065. }
  20066. innerDialog.addClass('modal-xl');
  20067. break;
  20068. }
  20069. }
  20070. if(options.scrollable){
  20071. // Requires Bootstrap 4.3.0 or higher
  20072. if (options.fullBootstrapVersion.substring(0, 3) < '4.3') {
  20073. console.warn('Using "scrollable" requires Bootstrap 4.3.0 or higher. You appear to be using ' + options.fullBootstrapVersion + '. Please upgrade to use this option.');
  20074. }
  20075. innerDialog.addClass('modal-dialog-scrollable');
  20076. }
  20077. if (options.title) {
  20078. body.before(header);
  20079. dialog.find('.modal-title').html(options.title);
  20080. }
  20081. if (options.closeButton) {
  20082. var closeButton = $(templates.closeButton);
  20083. if (options.title) {
  20084. if (options.bootstrap > 3) {
  20085. dialog.find('.modal-header').append(closeButton);
  20086. }
  20087. else {
  20088. dialog.find('.modal-header').prepend(closeButton);
  20089. }
  20090. } else {
  20091. closeButton.prependTo(body);
  20092. }
  20093. }
  20094. if(options.centerVertical){
  20095. // Requires Bootstrap 4.0.0-beta.3 or higher
  20096. if (options.fullBootstrapVersion < '4.0.0') {
  20097. console.warn('"centerVertical" requires Bootstrap 4.0.0-beta.3 or higher. You appear to be using ' + options.fullBootstrapVersion + '. Please upgrade to use this option.');
  20098. }
  20099. innerDialog.addClass('modal-dialog-centered');
  20100. }
  20101. // Bootstrap event listeners; these handle extra
  20102. // setup & teardown required after the underlying
  20103. // modal has performed certain actions.
  20104. // make sure we unbind any listeners once the dialog has definitively been dismissed
  20105. dialog.one('hide.bs.modal', function (e) {
  20106. if (e.target === this) {
  20107. dialog.off('escape.close.bb');
  20108. dialog.off('click');
  20109. }
  20110. });
  20111. dialog.one('hidden.bs.modal', function (e) {
  20112. // ensure we don't accidentally intercept hidden events triggered
  20113. // by children of the current dialog. We shouldn't need to handle this anymore,
  20114. // now that Bootstrap namespaces its events, but still worth doing.
  20115. if (e.target === this) {
  20116. dialog.remove();
  20117. }
  20118. });
  20119. dialog.one('shown.bs.modal', function () {
  20120. dialog.find('.bootbox-accept:first').trigger('focus');
  20121. });
  20122. // Bootbox event listeners; used to decouple some
  20123. // behaviours from their respective triggers
  20124. if (options.backdrop !== 'static') {
  20125. // A boolean true/false according to the Bootstrap docs
  20126. // should show a dialog the user can dismiss by clicking on
  20127. // the background.
  20128. // We always only ever pass static/false to the actual
  20129. // $.modal function because with "true" we can't trap
  20130. // this event (the .modal-backdrop swallows it)
  20131. // However, we still want to sort of respect true
  20132. // and invoke the escape mechanism instead
  20133. dialog.on('click.dismiss.bs.modal', function (e) {
  20134. // @NOTE: the target varies in >= 3.3.x releases since the modal backdrop
  20135. // moved *inside* the outer dialog rather than *alongside* it
  20136. if (dialog.children('.modal-backdrop').length) {
  20137. e.currentTarget = dialog.children('.modal-backdrop').get(0);
  20138. }
  20139. if (e.target !== e.currentTarget) {
  20140. return;
  20141. }
  20142. dialog.trigger('escape.close.bb');
  20143. });
  20144. }
  20145. dialog.on('escape.close.bb', function (e) {
  20146. // the if statement looks redundant but it isn't; without it
  20147. // if we *didn't* have an onEscape handler then processCallback
  20148. // would automatically dismiss the dialog
  20149. if (callbacks.onEscape) {
  20150. processCallback(e, dialog, callbacks.onEscape);
  20151. }
  20152. });
  20153. dialog.on('click', '.modal-footer button:not(.disabled)', function (e) {
  20154. var callbackKey = $(this).data('bb-handler');
  20155. processCallback(e, dialog, callbacks[callbackKey]);
  20156. });
  20157. dialog.on('click', '.bootbox-close-button', function (e) {
  20158. // onEscape might be falsy but that's fine; the fact is
  20159. // if the user has managed to click the close button we
  20160. // have to close the dialog, callback or not
  20161. processCallback(e, dialog, callbacks.onEscape);
  20162. });
  20163. dialog.on('keyup', function (e) {
  20164. if (e.which === 27) {
  20165. dialog.trigger('escape.close.bb');
  20166. }
  20167. });
  20168. // the remainder of this method simply deals with adding our
  20169. // dialogent to the DOM, augmenting it with Bootstrap's modal
  20170. // functionality and then giving the resulting object back
  20171. // to our caller
  20172. $(options.container).append(dialog);
  20173. dialog.modal({
  20174. backdrop: options.backdrop ? 'static' : false,
  20175. keyboard: false,
  20176. show: false
  20177. });
  20178. if (options.show) {
  20179. dialog.modal('show');
  20180. }
  20181. return dialog;
  20182. };
  20183. // Helper function to simulate the native alert() behavior. **NOTE**: This is non-blocking, so any
  20184. // code that must happen after the alert is dismissed should be placed within the callback function
  20185. // for this alert.
  20186. exports.alert = function () {
  20187. var options;
  20188. options = mergeDialogOptions('alert', ['ok'], ['message', 'callback'], arguments);
  20189. // @TODO: can this move inside exports.dialog when we're iterating over each
  20190. // button and checking its button.callback value instead?
  20191. if (options.callback && !$.isFunction(options.callback)) {
  20192. throw new Error('alert requires the "callback" property to be a function when provided');
  20193. }
  20194. // override the ok and escape callback to make sure they just invoke
  20195. // the single user-supplied one (if provided)
  20196. options.buttons.ok.callback = options.onEscape = function () {
  20197. if ($.isFunction(options.callback)) {
  20198. return options.callback.call(this);
  20199. }
  20200. return true;
  20201. };
  20202. return exports.dialog(options);
  20203. };
  20204. // Helper function to simulate the native confirm() behavior. **NOTE**: This is non-blocking, so any
  20205. // code that must happen after the confirm is dismissed should be placed within the callback function
  20206. // for this confirm.
  20207. exports.confirm = function () {
  20208. var options;
  20209. options = mergeDialogOptions('confirm', ['cancel', 'confirm'], ['message', 'callback'], arguments);
  20210. // confirm specific validation; they don't make sense without a callback so make
  20211. // sure it's present
  20212. if (!$.isFunction(options.callback)) {
  20213. throw new Error('confirm requires a callback');
  20214. }
  20215. // overrides; undo anything the user tried to set they shouldn't have
  20216. options.buttons.cancel.callback = options.onEscape = function () {
  20217. return options.callback.call(this, false);
  20218. };
  20219. options.buttons.confirm.callback = function () {
  20220. return options.callback.call(this, true);
  20221. };
  20222. return exports.dialog(options);
  20223. };
  20224. // Helper function to simulate the native prompt() behavior. **NOTE**: This is non-blocking, so any
  20225. // code that must happen after the prompt is dismissed should be placed within the callback function
  20226. // for this prompt.
  20227. exports.prompt = function () {
  20228. var options;
  20229. var promptDialog;
  20230. var form;
  20231. var input;
  20232. var shouldShow;
  20233. var inputOptions;
  20234. // we have to create our form first otherwise
  20235. // its value is undefined when gearing up our options
  20236. // @TODO this could be solved by allowing message to
  20237. // be a function instead...
  20238. form = $(templates.form);
  20239. // prompt defaults are more complex than others in that
  20240. // users can override more defaults
  20241. options = mergeDialogOptions('prompt', ['cancel', 'confirm'], ['title', 'callback'], arguments);
  20242. if (!options.value) {
  20243. options.value = defaults.value;
  20244. }
  20245. if (!options.inputType) {
  20246. options.inputType = defaults.inputType;
  20247. }
  20248. // capture the user's show value; we always set this to false before
  20249. // spawning the dialog to give us a chance to attach some handlers to
  20250. // it, but we need to make sure we respect a preference not to show it
  20251. shouldShow = (options.show === undefined) ? defaults.show : options.show;
  20252. // This is required prior to calling the dialog builder below - we need to
  20253. // add an event handler just before the prompt is shown
  20254. options.show = false;
  20255. // Handles the 'cancel' action
  20256. options.buttons.cancel.callback = options.onEscape = function () {
  20257. return options.callback.call(this, null);
  20258. };
  20259. // Prompt submitted - extract the prompt value. This requires a bit of work,
  20260. // given the different input types available.
  20261. options.buttons.confirm.callback = function () {
  20262. var value;
  20263. if (options.inputType === 'checkbox') {
  20264. value = input.find('input:checked').map(function () {
  20265. return $(this).val();
  20266. }).get();
  20267. } else if (options.inputType === 'radio') {
  20268. value = input.find('input:checked').val();
  20269. }
  20270. else {
  20271. if (input[0].checkValidity && !input[0].checkValidity()) {
  20272. // prevents button callback from being called
  20273. return false;
  20274. } else {
  20275. if (options.inputType === 'select' && options.multiple === true) {
  20276. value = input.find('option:selected').map(function () {
  20277. return $(this).val();
  20278. }).get();
  20279. }
  20280. else{
  20281. value = input.val();
  20282. }
  20283. }
  20284. }
  20285. return options.callback.call(this, value);
  20286. };
  20287. // prompt-specific validation
  20288. if (!options.title) {
  20289. throw new Error('prompt requires a title');
  20290. }
  20291. if (!$.isFunction(options.callback)) {
  20292. throw new Error('prompt requires a callback');
  20293. }
  20294. if (!templates.inputs[options.inputType]) {
  20295. throw new Error('Invalid prompt type');
  20296. }
  20297. // create the input based on the supplied type
  20298. input = $(templates.inputs[options.inputType]);
  20299. switch (options.inputType) {
  20300. case 'text':
  20301. case 'textarea':
  20302. case 'email':
  20303. case 'password':
  20304. input.val(options.value);
  20305. if (options.placeholder) {
  20306. input.attr('placeholder', options.placeholder);
  20307. }
  20308. if (options.pattern) {
  20309. input.attr('pattern', options.pattern);
  20310. }
  20311. if (options.maxlength) {
  20312. input.attr('maxlength', options.maxlength);
  20313. }
  20314. if (options.required) {
  20315. input.prop({ 'required': true });
  20316. }
  20317. if (options.rows && !isNaN(parseInt(options.rows))) {
  20318. if(options.inputType === 'textarea'){
  20319. input.attr({ 'rows': options.rows });
  20320. }
  20321. }
  20322. break;
  20323. case 'date':
  20324. case 'time':
  20325. case 'number':
  20326. case 'range':
  20327. input.val(options.value);
  20328. if (options.placeholder) {
  20329. input.attr('placeholder', options.placeholder);
  20330. }
  20331. if (options.pattern) {
  20332. input.attr('pattern', options.pattern);
  20333. }
  20334. if (options.required) {
  20335. input.prop({ 'required': true });
  20336. }
  20337. // These input types have extra attributes which affect their input validation.
  20338. // Warning: For most browsers, date inputs are buggy in their implementation of 'step', so
  20339. // this attribute will have no effect. Therefore, we don't set the attribute for date inputs.
  20340. // @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Setting_maximum_and_minimum_dates
  20341. if (options.inputType !== 'date') {
  20342. if (options.step) {
  20343. if (options.step === 'any' || (!isNaN(options.step) && parseInt(options.step) > 0)) {
  20344. input.attr('step', options.step);
  20345. }
  20346. else {
  20347. throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');
  20348. }
  20349. }
  20350. }
  20351. if(minAndMaxAreValid(options.inputType, options.min, options.max)){
  20352. if(options.min !== undefined){
  20353. input.attr('min', options.min);
  20354. }
  20355. if(options.max !== undefined){
  20356. input.attr('max', options.max);
  20357. }
  20358. }
  20359. break;
  20360. case 'select':
  20361. var groups = {};
  20362. inputOptions = options.inputOptions || [];
  20363. if (!$.isArray(inputOptions)) {
  20364. throw new Error('Please pass an array of input options');
  20365. }
  20366. if (!inputOptions.length) {
  20367. throw new Error('prompt with "inputType" set to "select" requires at least one option');
  20368. }
  20369. // placeholder is not actually a valid attribute for select,
  20370. // but we'll allow it, assuming it might be used for a plugin
  20371. if (options.placeholder) {
  20372. input.attr('placeholder', options.placeholder);
  20373. }
  20374. if (options.required) {
  20375. input.prop({ 'required': true });
  20376. }
  20377. if (options.multiple) {
  20378. input.prop({ 'multiple': true });
  20379. }
  20380. each(inputOptions, function (_, option) {
  20381. // assume the element to attach to is the input...
  20382. var elem = input;
  20383. if (option.value === undefined || option.text === undefined) {
  20384. throw new Error('each option needs a "value" property and a "text" property');
  20385. }
  20386. // ... but override that element if this option sits in a group
  20387. if (option.group) {
  20388. // initialise group if necessary
  20389. if (!groups[option.group]) {
  20390. groups[option.group] = $('<optgroup />').attr('label', option.group);
  20391. }
  20392. elem = groups[option.group];
  20393. }
  20394. var o = $(templates.option);
  20395. o.attr('value', option.value).text(option.text);
  20396. elem.append(o);
  20397. });
  20398. each(groups, function (_, group) {
  20399. input.append(group);
  20400. });
  20401. // safe to set a select's value as per a normal input
  20402. input.val(options.value);
  20403. break;
  20404. case 'checkbox':
  20405. var checkboxValues = $.isArray(options.value) ? options.value : [options.value];
  20406. inputOptions = options.inputOptions || [];
  20407. if (!inputOptions.length) {
  20408. throw new Error('prompt with "inputType" set to "checkbox" requires at least one option');
  20409. }
  20410. // checkboxes have to nest within a containing element, so
  20411. // they break the rules a bit and we end up re-assigning
  20412. // our 'input' element to this container instead
  20413. input = $('<div class="bootbox-checkbox-list"></div>');
  20414. each(inputOptions, function (_, option) {
  20415. if (option.value === undefined || option.text === undefined) {
  20416. throw new Error('each option needs a "value" property and a "text" property');
  20417. }
  20418. var checkbox = $(templates.inputs[options.inputType]);
  20419. checkbox.find('input').attr('value', option.value);
  20420. checkbox.find('label').append('\n' + option.text);
  20421. // we've ensured values is an array so we can always iterate over it
  20422. each(checkboxValues, function (_, value) {
  20423. if (value === option.value) {
  20424. checkbox.find('input').prop('checked', true);
  20425. }
  20426. });
  20427. input.append(checkbox);
  20428. });
  20429. break;
  20430. case 'radio':
  20431. // Make sure that value is not an array (only a single radio can ever be checked)
  20432. if (options.value !== undefined && $.isArray(options.value)) {
  20433. throw new Error('prompt with "inputType" set to "radio" requires a single, non-array value for "value"');
  20434. }
  20435. inputOptions = options.inputOptions || [];
  20436. if (!inputOptions.length) {
  20437. throw new Error('prompt with "inputType" set to "radio" requires at least one option');
  20438. }
  20439. // Radiobuttons have to nest within a containing element, so
  20440. // they break the rules a bit and we end up re-assigning
  20441. // our 'input' element to this container instead
  20442. input = $('<div class="bootbox-radiobutton-list"></div>');
  20443. // Radiobuttons should always have an initial checked input checked in a "group".
  20444. // If value is undefined or doesn't match an input option, select the first radiobutton
  20445. var checkFirstRadio = true;
  20446. each(inputOptions, function (_, option) {
  20447. if (option.value === undefined || option.text === undefined) {
  20448. throw new Error('each option needs a "value" property and a "text" property');
  20449. }
  20450. var radio = $(templates.inputs[options.inputType]);
  20451. radio.find('input').attr('value', option.value);
  20452. radio.find('label').append('\n' + option.text);
  20453. if (options.value !== undefined) {
  20454. if (option.value === options.value) {
  20455. radio.find('input').prop('checked', true);
  20456. checkFirstRadio = false;
  20457. }
  20458. }
  20459. input.append(radio);
  20460. });
  20461. if (checkFirstRadio) {
  20462. input.find('input[type="radio"]').first().prop('checked', true);
  20463. }
  20464. break;
  20465. }
  20466. // now place it in our form
  20467. form.append(input);
  20468. form.on('submit', function (e) {
  20469. e.preventDefault();
  20470. // Fix for SammyJS (or similar JS routing library) hijacking the form post.
  20471. e.stopPropagation();
  20472. // @TODO can we actually click *the* button object instead?
  20473. // e.g. buttons.confirm.click() or similar
  20474. promptDialog.find('.bootbox-accept').trigger('click');
  20475. });
  20476. if ($.trim(options.message) !== '') {
  20477. // Add the form to whatever content the user may have added.
  20478. var message = $(templates.promptMessage).html(options.message);
  20479. form.prepend(message);
  20480. options.message = form;
  20481. }
  20482. else {
  20483. options.message = form;
  20484. }
  20485. // Generate the dialog
  20486. promptDialog = exports.dialog(options);
  20487. // clear the existing handler focusing the submit button...
  20488. promptDialog.off('shown.bs.modal');
  20489. // ...and replace it with one focusing our input, if possible
  20490. promptDialog.on('shown.bs.modal', function () {
  20491. // need the closure here since input isn't
  20492. // an object otherwise
  20493. input.focus();
  20494. });
  20495. if (shouldShow === true) {
  20496. promptDialog.modal('show');
  20497. }
  20498. return promptDialog;
  20499. };
  20500. // INTERNAL FUNCTIONS
  20501. // *************************************************************************************************************
  20502. // Map a flexible set of arguments into a single returned object
  20503. // If args.length is already one just return it, otherwise
  20504. // use the properties argument to map the unnamed args to
  20505. // object properties.
  20506. // So in the latter case:
  20507. // mapArguments(["foo", $.noop], ["message", "callback"])
  20508. // -> { message: "foo", callback: $.noop }
  20509. function mapArguments(args, properties) {
  20510. var argn = args.length;
  20511. var options = {};
  20512. if (argn < 1 || argn > 2) {
  20513. throw new Error('Invalid argument length');
  20514. }
  20515. if (argn === 2 || typeof args[0] === 'string') {
  20516. options[properties[0]] = args[0];
  20517. options[properties[1]] = args[1];
  20518. } else {
  20519. options = args[0];
  20520. }
  20521. return options;
  20522. }
  20523. // Merge a set of default dialog options with user supplied arguments
  20524. function mergeArguments(defaults, args, properties) {
  20525. return $.extend(
  20526. // deep merge
  20527. true,
  20528. // ensure the target is an empty, unreferenced object
  20529. {},
  20530. // the base options object for this type of dialog (often just buttons)
  20531. defaults,
  20532. // args could be an object or array; if it's an array properties will
  20533. // map it to a proper options object
  20534. mapArguments(
  20535. args,
  20536. properties
  20537. )
  20538. );
  20539. }
  20540. // This entry-level method makes heavy use of composition to take a simple
  20541. // range of inputs and return valid options suitable for passing to bootbox.dialog
  20542. function mergeDialogOptions(className, labels, properties, args) {
  20543. var locale;
  20544. if(args && args[0]){
  20545. locale = args[0].locale || defaults.locale;
  20546. var swapButtons = args[0].swapButtonOrder || defaults.swapButtonOrder;
  20547. if(swapButtons){
  20548. labels = labels.reverse();
  20549. }
  20550. }
  20551. // build up a base set of dialog properties
  20552. var baseOptions = {
  20553. className: 'bootbox-' + className,
  20554. buttons: createLabels(labels, locale)
  20555. };
  20556. // Ensure the buttons properties generated, *after* merging
  20557. // with user args are still valid against the supplied labels
  20558. return validateButtons(
  20559. // merge the generated base properties with user supplied arguments
  20560. mergeArguments(
  20561. baseOptions,
  20562. args,
  20563. // if args.length > 1, properties specify how each arg maps to an object key
  20564. properties
  20565. ),
  20566. labels
  20567. );
  20568. }
  20569. // Checks each button object to see if key is valid.
  20570. // This function will only be called by the alert, confirm, and prompt helpers.
  20571. function validateButtons(options, buttons) {
  20572. var allowedButtons = {};
  20573. each(buttons, function (key, value) {
  20574. allowedButtons[value] = true;
  20575. });
  20576. each(options.buttons, function (key) {
  20577. if (allowedButtons[key] === undefined) {
  20578. throw new Error('button key "' + key + '" is not allowed (options are ' + buttons.join(' ') + ')');
  20579. }
  20580. });
  20581. return options;
  20582. }
  20583. // From a given list of arguments, return a suitable object of button labels.
  20584. // All this does is normalise the given labels and translate them where possible.
  20585. // e.g. "ok", "confirm" -> { ok: "OK", cancel: "Annuleren" }
  20586. function createLabels(labels, locale) {
  20587. var buttons = {};
  20588. for (var i = 0, j = labels.length; i < j; i++) {
  20589. var argument = labels[i];
  20590. var key = argument.toLowerCase();
  20591. var value = argument.toUpperCase();
  20592. buttons[key] = {
  20593. label: getText(value, locale)
  20594. };
  20595. }
  20596. return buttons;
  20597. }
  20598. // Get localized text from a locale. Defaults to 'en' locale if no locale
  20599. // provided or a non-registered locale is requested
  20600. function getText(key, locale) {
  20601. var labels = locales[locale];
  20602. return labels ? labels[key] : locales.en[key];
  20603. }
  20604. // Filter and tidy up any user supplied parameters to this dialog.
  20605. // Also looks for any shorthands used and ensures that the options
  20606. // which are returned are all normalized properly
  20607. function sanitize(options) {
  20608. var buttons;
  20609. var total;
  20610. if (typeof options !== 'object') {
  20611. throw new Error('Please supply an object of options');
  20612. }
  20613. if (!options.message) {
  20614. throw new Error('"message" option must not be null or an empty string.');
  20615. }
  20616. // make sure any supplied options take precedence over defaults
  20617. options = $.extend({}, defaults, options);
  20618. // no buttons is still a valid dialog but it's cleaner to always have
  20619. // a buttons object to iterate over, even if it's empty
  20620. if (!options.buttons) {
  20621. options.buttons = {};
  20622. }
  20623. buttons = options.buttons;
  20624. total = getKeyLength(buttons);
  20625. each(buttons, function (key, button, index) {
  20626. if ($.isFunction(button)) {
  20627. // short form, assume value is our callback. Since button
  20628. // isn't an object it isn't a reference either so re-assign it
  20629. button = buttons[key] = {
  20630. callback: button
  20631. };
  20632. }
  20633. // before any further checks make sure by now button is the correct type
  20634. if ($.type(button) !== 'object') {
  20635. throw new Error('button with key "' + key + '" must be an object');
  20636. }
  20637. if (!button.label) {
  20638. // the lack of an explicit label means we'll assume the key is good enough
  20639. button.label = key;
  20640. }
  20641. if (!button.className) {
  20642. var isPrimary = false;
  20643. if(options.swapButtonOrder){
  20644. isPrimary = index === 0;
  20645. }
  20646. else{
  20647. isPrimary = index === total-1;
  20648. }
  20649. if (total <= 2 && isPrimary) {
  20650. // always add a primary to the main option in a one or two-button dialog
  20651. button.className = 'btn-primary';
  20652. } else {
  20653. // adding both classes allows us to target both BS3 and BS4 without needing to check the version
  20654. button.className = 'btn-secondary btn-default';
  20655. }
  20656. }
  20657. });
  20658. return options;
  20659. }
  20660. // Returns a count of the properties defined on the object
  20661. function getKeyLength(obj) {
  20662. return Object.keys(obj).length;
  20663. }
  20664. // Tiny wrapper function around jQuery.each; just adds index as the third parameter
  20665. function each(collection, iterator) {
  20666. var index = 0;
  20667. $.each(collection, function (key, value) {
  20668. iterator(key, value, index++);
  20669. });
  20670. }
  20671. // Handle the invoked dialog callback
  20672. function processCallback(e, dialog, callback) {
  20673. e.stopPropagation();
  20674. e.preventDefault();
  20675. // by default we assume a callback will get rid of the dialog,
  20676. // although it is given the opportunity to override this
  20677. // so, if the callback can be invoked and it *explicitly returns false*
  20678. // then we'll set a flag to keep the dialog active...
  20679. var preserveDialog = $.isFunction(callback) && callback.call(dialog, e) === false;
  20680. // ... otherwise we'll bin it
  20681. if (!preserveDialog) {
  20682. dialog.modal('hide');
  20683. }
  20684. }
  20685. // Validate `min` and `max` values based on the current `inputType` value
  20686. function minAndMaxAreValid(type, min, max){
  20687. var result = false;
  20688. var minValid = true;
  20689. var maxValid = true;
  20690. if (type === 'date') {
  20691. if (min !== undefined && !(minValid = dateIsValid(min))) {
  20692. console.warn('Browsers which natively support the "date" input type expect date values to be of the form "YYYY-MM-DD" (see ISO-8601 https://www.iso.org/iso-8601-date-and-time-format.html). Bootbox does not enforce this rule, but your min value may not be enforced by this browser.');
  20693. }
  20694. else if (max !== undefined && !(maxValid = dateIsValid(max))) {
  20695. console.warn('Browsers which natively support the "date" input type expect date values to be of the form "YYYY-MM-DD" (see ISO-8601 https://www.iso.org/iso-8601-date-and-time-format.html). Bootbox does not enforce this rule, but your max value may not be enforced by this browser.');
  20696. }
  20697. }
  20698. else if (type === 'time') {
  20699. if (min !== undefined && !(minValid = timeIsValid(min))) {
  20700. throw new Error('"min" is not a valid time. See https://www.w3.org/TR/2012/WD-html-markup-20120315/datatypes.html#form.data.time for more information.');
  20701. }
  20702. else if (max !== undefined && !(maxValid = timeIsValid(max))) {
  20703. throw new Error('"max" is not a valid time. See https://www.w3.org/TR/2012/WD-html-markup-20120315/datatypes.html#form.data.time for more information.');
  20704. }
  20705. }
  20706. else {
  20707. if (min !== undefined && isNaN(min)) {
  20708. throw new Error('"min" must be a valid number. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-min for more information.');
  20709. }
  20710. if (max !== undefined && isNaN(max)) {
  20711. throw new Error('"max" must be a valid number. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-max for more information.');
  20712. }
  20713. }
  20714. if(minValid && maxValid){
  20715. if(max <= min){
  20716. throw new Error('"max" must be greater than "min". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-max for more information.');
  20717. }
  20718. else{
  20719. result = true;
  20720. }
  20721. }
  20722. return result;
  20723. }
  20724. function timeIsValid(value){
  20725. return /([01][0-9]|2[0-3]):[0-5][0-9]?:[0-5][0-9]/.test(value);
  20726. }
  20727. function dateIsValid(value){
  20728. return /(\d{4})-(\d{2})-(\d{2})/.test(value);
  20729. }
  20730. // Register the default locale
  20731. exports.addLocale('en', {
  20732. OK: 'OK',
  20733. CANCEL: 'Cancel',
  20734. CONFIRM: 'OK'
  20735. });
  20736. // The Bootbox object
  20737. return exports;
  20738. }));
  20739. bootbox.setTemplates({
  20740. dialog:
  20741. '<div class="bootbox modal" tabindex="-1" role="dialog" aria-hidden="true">' +
  20742. '<div class="modal-dialog">' +
  20743. '<div class="modal-content">' +
  20744. '<div class="modal-body"><div class="bootbox-body"></div></div>' +
  20745. '</div>' +
  20746. '</div>' +
  20747. '</div>',
  20748. header:
  20749. '<div class="modal-header">' +
  20750. '<h5 class="modal-title"></h5>' +
  20751. '</div>',
  20752. footer:
  20753. '<div class="modal-footer"></div>',
  20754. closeButton:
  20755. '<button type="button" class="bootbox-close-button close" aria-hidden="true"><i class="fal fa-times"></i></button>',
  20756. form:
  20757. '<form class="bootbox-form"></form>',
  20758. button:
  20759. '<button type="button" class="btn"></button>',
  20760. option:
  20761. '<option></option>',
  20762. promptMessage:
  20763. '<div class="bootbox-prompt-message"></div>',
  20764. inputs: {
  20765. text:
  20766. '<input class="bootbox-input bootbox-input-text form-control" autocomplete="off" type="text" />',
  20767. textarea:
  20768. '<textarea class="bootbox-input bootbox-input-textarea form-control"></textarea>',
  20769. email:
  20770. '<input class="bootbox-input bootbox-input-email form-control" autocomplete="off" type="email" />',
  20771. select:
  20772. '<select class="bootbox-input bootbox-input-select form-control"></select>',
  20773. checkbox:
  20774. '<div class="form-check checkbox"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-checkbox" type="checkbox" /></label></div>',
  20775. radio:
  20776. '<div class="form-check radio"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-radio" type="radio" name="bootbox-radio" /></label></div>',
  20777. date:
  20778. '<input class="bootbox-input bootbox-input-date form-control" autocomplete="off" type="date" />',
  20779. time:
  20780. '<input class="bootbox-input bootbox-input-time form-control" autocomplete="off" type="time" />',
  20781. number:
  20782. '<input class="bootbox-input bootbox-input-number form-control" autocomplete="off" type="number" />',
  20783. password:
  20784. '<input class="bootbox-input bootbox-input-password form-control" autocomplete="off" type="password" />',
  20785. range:
  20786. '<input class="bootbox-input bootbox-input-range form-control-range" autocomplete="off" type="range" />'
  20787. }
  20788. });
  20789. /**
  20790. * author: andreas johan virkus
  20791. * snippet url: https://gist.github.com/andreasvirkus/bfaedc839de0d46ffe4c
  20792. *
  20793. * Remove classes that have given prefix
  20794. * Example: You have an element with classes "apple juiceSmall juiceBig banana"
  20795. * You run:
  20796. * $elem.removeClassPrefix('juice');
  20797. * The resulting classes are "apple banana"
  20798. */
  20799. $.fn.removeClassPrefix = function (prefix) {
  20800. this.each( function ( i, it ) {
  20801. var classes = it.className.split(" ").map(function (item) {
  20802. return item.indexOf(prefix) === 0 ? "" : item;
  20803. });
  20804. it.className = classes.join(" ");
  20805. });
  20806. return this;
  20807. };
  20808. /**
  20809. * "http://dummy.com/?technology=jquery&blog=jquerybyexample".
  20810. * 1 var tech = getUrlParameter('technology');
  20811. * 2 var blog = getUrlParameter('blog');
  20812. * note: we are using this inside icon generator page
  20813. */
  20814. var getUrlParameter = function getUrlParameter(sParam) {
  20815. var sPageURL = decodeURIComponent(window.location.search.substring(1)),
  20816. sURLVariables = sPageURL.split('&'),
  20817. sParameterName,
  20818. i;
  20819. for (i = 0; i < sURLVariables.length; i++) {
  20820. sParameterName = sURLVariables[i].split('=');
  20821. if (sParameterName[0] === sParam) {
  20822. return sParameterName[1] === undefined ? true : sParameterName[1];
  20823. }
  20824. }
  20825. };
  20826. /**
  20827. * detect IE
  20828. * returns version of IE or false, if browser is not Internet Explorer
  20829. */
  20830. function detectIE() {
  20831. var ua = window.navigator.userAgent;
  20832. var msie = ua.indexOf('MSIE ');
  20833. if (msie > 0) {
  20834. // IE 10 or older => return version number
  20835. return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
  20836. }
  20837. var trident = ua.indexOf('Trident/');
  20838. if (trident > 0) {
  20839. // IE 11 => return version number
  20840. var rv = ua.indexOf('rv:');
  20841. return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
  20842. }
  20843. var edge = ua.indexOf('Edge/');
  20844. if (edge > 0) {
  20845. // Edge (IE 12+) => return version number
  20846. return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
  20847. }
  20848. // other browser
  20849. return false;
  20850. }
  20851. /*
  20852. * Toggle text
  20853. * $(".example").toggleText('Initial', 'Secondary');
  20854. * https://stackoverflow.com/questions/2155453/jquery-toggle-text
  20855. */
  20856. jQuery.fn.extend({
  20857. toggleText: function (a, b){
  20858. var that = this;
  20859. if (that.text() != a && that.text() != b){
  20860. that.text(a);
  20861. }
  20862. else
  20863. if (that.text() == a){
  20864. that.text(b);
  20865. }
  20866. else
  20867. if (that.text() == b){
  20868. that.text(a);
  20869. }
  20870. return this;
  20871. }
  20872. });
  20873. /*
  20874. * Convert RGB to HEX
  20875. * rgb2hex(hex_value)
  20876. */
  20877. function rgb2hex(rgb) {
  20878. rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
  20879. function hex(x) {
  20880. return ("0" + parseInt(x).toString(16)).slice(-2);
  20881. }
  20882. return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
  20883. }
  20884. /*!
  20885. * jQuery throttle / debounce - v1.1 - 3/7/2010
  20886. * http://benalman.com/projects/jquery-throttle-debounce-plugin/
  20887. *
  20888. * Copyright (c) 2010 "Cowboy" Ben Alman
  20889. * Dual licensed under the MIT and GPL licenses.
  20890. * http://benalman.com/about/license/
  20891. */
  20892. // Script: jQuery throttle / debounce: Sometimes, less is more!
  20893. //
  20894. // *Version: 1.1, Last updated: 3/7/2010*
  20895. //
  20896. // Project Home - http://benalman.com/projects/jquery-throttle-debounce-plugin/
  20897. // GitHub - http://github.com/cowboy/jquery-throttle-debounce/
  20898. // Source - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.js
  20899. // (Minified) - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js (0.7kb)
  20900. //
  20901. // About: License
  20902. //
  20903. // Copyright (c) 2010 "Cowboy" Ben Alman,
  20904. // Dual licensed under the MIT and GPL licenses.
  20905. // http://benalman.com/about/license/
  20906. //
  20907. // About: Examples
  20908. //
  20909. // These working examples, complete with fully commented code, illustrate a few
  20910. // ways in which this plugin can be used.
  20911. //
  20912. // Throttle - http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/
  20913. // Debounce - http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/
  20914. //
  20915. // About: Support and Testing
  20916. //
  20917. // Information about what version or versions of jQuery this plugin has been
  20918. // tested with, what browsers it has been tested in, and where the unit tests
  20919. // reside (so you can test it yourself).
  20920. //
  20921. // jQuery Versions - none, 1.3.2, 1.4.2
  20922. // Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
  20923. // Unit Tests - http://benalman.com/code/projects/jquery-throttle-debounce/unit/
  20924. //
  20925. // About: Release History
  20926. //
  20927. // 1.1 - (3/7/2010) Fixed a bug in <jQuery.throttle> where trailing callbacks
  20928. // executed later than they should. Reworked a fair amount of internal
  20929. // logic as well.
  20930. // 1.0 - (3/6/2010) Initial release as a stand-alone project. Migrated over
  20931. // from jquery-misc repo v0.4 to jquery-throttle repo v1.0, added the
  20932. // no_trailing throttle parameter and debounce functionality.
  20933. //
  20934. // Topic: Note for non-jQuery users
  20935. //
  20936. // jQuery isn't actually required for this plugin, because nothing internal
  20937. // uses any jQuery methods or properties. jQuery is just used as a namespace
  20938. // under which these methods can exist.
  20939. //
  20940. // Since jQuery isn't actually required for this plugin, if jQuery doesn't exist
  20941. // when this plugin is loaded, the method described below will be created in
  20942. // the `Cowboy` namespace. Usage will be exactly the same, but instead of
  20943. // $.method() or jQuery.method(), you'll need to use Cowboy.method().
  20944. (function(window,undefined){
  20945. '$:nomunge'; // Used by YUI compressor.
  20946. // Since jQuery really isn't required for this plugin, use `jQuery` as the
  20947. // namespace only if it already exists, otherwise use the `Cowboy` namespace,
  20948. // creating it if necessary.
  20949. var $ = window.jQuery || window.Cowboy || ( window.Cowboy = {} ),
  20950. // Internal method reference.
  20951. jq_throttle;
  20952. // Method: jQuery.throttle
  20953. //
  20954. // Throttle execution of a function. Especially useful for rate limiting
  20955. // execution of handlers on events like resize and scroll. If you want to
  20956. // rate-limit execution of a function to a single time, see the
  20957. // <jQuery.debounce> method.
  20958. //
  20959. // In this visualization, | is a throttled-function call and X is the actual
  20960. // callback execution:
  20961. //
  20962. // > Throttled with `no_trailing` specified as false or unspecified:
  20963. // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
  20964. // > X X X X X X X X X X X X
  20965. // >
  20966. // > Throttled with `no_trailing` specified as true:
  20967. // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
  20968. // > X X X X X X X X X X
  20969. //
  20970. // Usage:
  20971. //
  20972. // > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback );
  20973. // >
  20974. // > jQuery('selector').bind( 'someevent', throttled );
  20975. // > jQuery('selector').unbind( 'someevent', throttled );
  20976. //
  20977. // This also works in jQuery 1.4+:
  20978. //
  20979. // > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) );
  20980. // > jQuery('selector').unbind( 'someevent', callback );
  20981. //
  20982. // Arguments:
  20983. //
  20984. // delay - (Number) A zero-or-greater delay in milliseconds. For event
  20985. // callbacks, values around 100 or 250 (or even higher) are most useful.
  20986. // no_trailing - (Boolean) Optional, defaults to false. If no_trailing is
  20987. // true, callback will only execute every `delay` milliseconds while the
  20988. // throttled-function is being called. If no_trailing is false or
  20989. // unspecified, callback will be executed one final time after the last
  20990. // throttled-function call. (After the throttled-function has not been
  20991. // called for `delay` milliseconds, the internal counter is reset)
  20992. // callback - (Function) A function to be executed after delay milliseconds.
  20993. // The `this` context and all arguments are passed through, as-is, to
  20994. // `callback` when the throttled-function is executed.
  20995. //
  20996. // Returns:
  20997. //
  20998. // (Function) A new, throttled, function.
  20999. $.throttle = jq_throttle = function( delay, no_trailing, callback, debounce_mode ) {
  21000. // After wrapper has stopped being called, this timeout ensures that
  21001. // `callback` is executed at the proper times in `throttle` and `end`
  21002. // debounce modes.
  21003. var timeout_id,
  21004. // Keep track of the last time `callback` was executed.
  21005. last_exec = 0;
  21006. // `no_trailing` defaults to falsy.
  21007. if ( typeof no_trailing !== 'boolean' ) {
  21008. debounce_mode = callback;
  21009. callback = no_trailing;
  21010. no_trailing = undefined;
  21011. }
  21012. // The `wrapper` function encapsulates all of the throttling / debouncing
  21013. // functionality and when executed will limit the rate at which `callback`
  21014. // is executed.
  21015. function wrapper() {
  21016. var that = this,
  21017. elapsed = +new Date() - last_exec,
  21018. args = arguments;
  21019. // Execute `callback` and update the `last_exec` timestamp.
  21020. function exec() {
  21021. last_exec = +new Date();
  21022. callback.apply( that, args );
  21023. };
  21024. // If `debounce_mode` is true (at_begin) this is used to clear the flag
  21025. // to allow future `callback` executions.
  21026. function clear() {
  21027. timeout_id = undefined;
  21028. };
  21029. if ( debounce_mode && !timeout_id ) {
  21030. // Since `wrapper` is being called for the first time and
  21031. // `debounce_mode` is true (at_begin), execute `callback`.
  21032. exec();
  21033. }
  21034. // Clear any existing timeout.
  21035. timeout_id && clearTimeout( timeout_id );
  21036. if ( debounce_mode === undefined && elapsed > delay ) {
  21037. // In throttle mode, if `delay` time has been exceeded, execute
  21038. // `callback`.
  21039. exec();
  21040. } else if ( no_trailing !== true ) {
  21041. // In trailing throttle mode, since `delay` time has not been
  21042. // exceeded, schedule `callback` to execute `delay` ms after most
  21043. // recent execution.
  21044. //
  21045. // If `debounce_mode` is true (at_begin), schedule `clear` to execute
  21046. // after `delay` ms.
  21047. //
  21048. // If `debounce_mode` is false (at end), schedule `callback` to
  21049. // execute after `delay` ms.
  21050. timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );
  21051. }
  21052. };
  21053. // Set the guid of `wrapper` function to the same of original callback, so
  21054. // it can be removed in jQuery 1.4+ .unbind or .die by using the original
  21055. // callback as a reference.
  21056. if ( $.guid ) {
  21057. wrapper.guid = callback.guid = callback.guid || $.guid++;
  21058. }
  21059. // Return the wrapper function.
  21060. return wrapper;
  21061. };
  21062. // Method: jQuery.debounce
  21063. //
  21064. // Debounce execution of a function. Debouncing, unlike throttling,
  21065. // guarantees that a function is only executed a single time, either at the
  21066. // very beginning of a series of calls, or at the very end. If you want to
  21067. // simply rate-limit execution of a function, see the <jQuery.throttle>
  21068. // method.
  21069. //
  21070. // In this visualization, | is a debounced-function call and X is the actual
  21071. // callback execution:
  21072. //
  21073. // > Debounced with `at_begin` specified as false or unspecified:
  21074. // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
  21075. // > X X
  21076. // >
  21077. // > Debounced with `at_begin` specified as true:
  21078. // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
  21079. // > X X
  21080. //
  21081. // Usage:
  21082. //
  21083. // > var debounced = jQuery.debounce( delay, [ at_begin, ] callback );
  21084. // >
  21085. // > jQuery('selector').bind( 'someevent', debounced );
  21086. // > jQuery('selector').unbind( 'someevent', debounced );
  21087. //
  21088. // This also works in jQuery 1.4+:
  21089. //
  21090. // > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) );
  21091. // > jQuery('selector').unbind( 'someevent', callback );
  21092. //
  21093. // Arguments:
  21094. //
  21095. // delay - (Number) A zero-or-greater delay in milliseconds. For event
  21096. // callbacks, values around 100 or 250 (or even higher) are most useful.
  21097. // at_begin - (Boolean) Optional, defaults to false. If at_begin is false or
  21098. // unspecified, callback will only be executed `delay` milliseconds after
  21099. // the last debounced-function call. If at_begin is true, callback will be
  21100. // executed only at the first debounced-function call. (After the
  21101. // throttled-function has not been called for `delay` milliseconds, the
  21102. // internal counter is reset)
  21103. // callback - (Function) A function to be executed after delay milliseconds.
  21104. // The `this` context and all arguments are passed through, as-is, to
  21105. // `callback` when the debounced-function is executed.
  21106. //
  21107. // Returns:
  21108. //
  21109. // (Function) A new, debounced, function.
  21110. $.debounce = function( delay, at_begin, callback ) {
  21111. return callback === undefined
  21112. ? jq_throttle( delay, at_begin, false )
  21113. : jq_throttle( delay, callback, at_begin !== false );
  21114. };
  21115. })(this);
  21116. /*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
  21117. * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
  21118. * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
  21119. *
  21120. * Version: 1.3.8
  21121. *
  21122. */
  21123. (function($) {
  21124. $.fn.extend({
  21125. slimScroll: function(options) {
  21126. var defaults = {
  21127. // width in pixels of the visible scroll area
  21128. width : 'auto',
  21129. // height in pixels of the visible scroll area
  21130. height : '250px',
  21131. // width in pixels of the scrollbar and rail
  21132. size : '7px',
  21133. // scrollbar color, accepts any hex/color value
  21134. color: '#000',
  21135. // scrollbar position - left/right
  21136. position : 'right',
  21137. // distance in pixels between the side edge and the scrollbar
  21138. distance : '1px',
  21139. // default scroll position on load - top / bottom / $('selector')
  21140. start : 'top',
  21141. // sets scrollbar opacity
  21142. opacity : .4,
  21143. // enables always-on mode for the scrollbar
  21144. alwaysVisible : false,
  21145. // check if we should hide the scrollbar when user is hovering over
  21146. disableFadeOut : false,
  21147. // sets visibility of the rail
  21148. railVisible : false,
  21149. // sets rail color
  21150. railColor : '#333',
  21151. // sets rail opacity
  21152. railOpacity : .2,
  21153. // whether we should use jQuery UI Draggable to enable bar dragging
  21154. railDraggable : true,
  21155. // defautlt CSS class of the slimscroll rail
  21156. railClass : 'slimScrollRail',
  21157. // defautlt CSS class of the slimscroll bar
  21158. barClass : 'slimScrollBar',
  21159. // defautlt CSS class of the slimscroll wrapper
  21160. wrapperClass : 'slimScrollDiv',
  21161. // check if mousewheel should scroll the window if we reach top/bottom
  21162. allowPageScroll : false,
  21163. // scroll amount applied to each mouse wheel step
  21164. wheelStep : 20,
  21165. // scroll amount applied when user is using gestures
  21166. touchScrollStep : 200,
  21167. // sets border radius
  21168. borderRadius: '7px',
  21169. // sets border radius of the rail
  21170. railBorderRadius : '7px'
  21171. };
  21172. var o = $.extend(defaults, options);
  21173. // do it for every element that matches selector
  21174. this.each(function(){
  21175. var isOverPanel, isOverBar, isDragg, queueHide, touchDif,
  21176. barHeight, percentScroll, lastScroll,
  21177. divS = '<div></div>',
  21178. minBarHeight = 30,
  21179. releaseScroll = false;
  21180. // used in event handlers and for better minification
  21181. var me = $(this);
  21182. // ensure we are not binding it again
  21183. if (me.parent().hasClass(o.wrapperClass))
  21184. {
  21185. // start from last bar position
  21186. var offset = me.scrollTop();
  21187. // find bar and rail
  21188. bar = me.siblings('.' + o.barClass);
  21189. rail = me.siblings('.' + o.railClass);
  21190. getBarHeight();
  21191. // check if we should scroll existing instance
  21192. if ($.isPlainObject(options))
  21193. {
  21194. // Pass height: auto to an existing slimscroll object to force a resize after contents have changed
  21195. if ( 'height' in options && options.height == 'auto' ) {
  21196. me.parent().css('height', 'auto');
  21197. me.css('height', 'auto');
  21198. var height = me.parent().parent().height();
  21199. me.parent().css('height', height);
  21200. me.css('height', height);
  21201. } else if ('height' in options) {
  21202. var h = options.height;
  21203. me.parent().css('height', h);
  21204. me.css('height', h);
  21205. }
  21206. if ('scrollTo' in options)
  21207. {
  21208. // jump to a static point
  21209. offset = parseInt(o.scrollTo);
  21210. }
  21211. else if ('scrollBy' in options)
  21212. {
  21213. // jump by value pixels
  21214. offset += parseInt(o.scrollBy);
  21215. }
  21216. else if ('destroy' in options)
  21217. {
  21218. // remove slimscroll elements
  21219. bar.remove();
  21220. rail.remove();
  21221. me.unwrap();
  21222. return;
  21223. }
  21224. // scroll content by the given offset
  21225. scrollContent(offset, false, true);
  21226. }
  21227. return;
  21228. }
  21229. else if ($.isPlainObject(options))
  21230. {
  21231. if ('destroy' in options)
  21232. {
  21233. return;
  21234. }
  21235. }
  21236. // optionally set height to the parent's height
  21237. o.height = (o.height == 'auto') ? me.parent().height() : o.height;
  21238. // wrap content
  21239. var wrapper = $(divS)
  21240. .addClass(o.wrapperClass)
  21241. .css({
  21242. position: 'relative',
  21243. overflow: 'hidden',
  21244. width: o.width,
  21245. height: o.height
  21246. });
  21247. // update style for the div
  21248. me.css({
  21249. overflow: 'hidden',
  21250. width: o.width,
  21251. height: o.height
  21252. });
  21253. // create scrollbar rail
  21254. var rail = $(divS)
  21255. .addClass(o.railClass)
  21256. .css({
  21257. width: o.size,
  21258. height: '100%',
  21259. position: 'absolute',
  21260. top: 0,
  21261. display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none',
  21262. 'border-radius': o.railBorderRadius,
  21263. background: o.railColor,
  21264. opacity: o.railOpacity,
  21265. zIndex: 90
  21266. });
  21267. // create scrollbar
  21268. var bar = $(divS)
  21269. .addClass(o.barClass)
  21270. .css({
  21271. background: o.color,
  21272. width: o.size,
  21273. position: 'absolute',
  21274. top: 0,
  21275. opacity: o.opacity,
  21276. display: o.alwaysVisible ? 'block' : 'none',
  21277. 'border-radius' : o.borderRadius,
  21278. BorderRadius: o.borderRadius,
  21279. MozBorderRadius: o.borderRadius,
  21280. WebkitBorderRadius: o.borderRadius,
  21281. zIndex: 99
  21282. });
  21283. // set position
  21284. var posCss = (o.position == 'right') ? { right: o.distance } : { left: o.distance };
  21285. rail.css(posCss);
  21286. bar.css(posCss);
  21287. // wrap it
  21288. me.wrap(wrapper);
  21289. // append to parent div
  21290. me.parent().append(bar);
  21291. me.parent().append(rail);
  21292. // make it draggable and no longer dependent on the jqueryUI
  21293. if (o.railDraggable){
  21294. bar.bind("mousedown", function(e) {
  21295. var $doc = $(document);
  21296. isDragg = true;
  21297. t = parseFloat(bar.css('top'));
  21298. pageY = e.pageY;
  21299. $doc.bind("mousemove.slimscroll", function(e){
  21300. currTop = t + e.pageY - pageY;
  21301. bar.css('top', currTop);
  21302. scrollContent(0, bar.position().top, false);// scroll content
  21303. });
  21304. $doc.bind("mouseup.slimscroll", function(e) {
  21305. isDragg = false;hideBar();
  21306. $doc.unbind('.slimscroll');
  21307. });
  21308. return false;
  21309. }).bind("selectstart.slimscroll", function(e){
  21310. e.stopPropagation();
  21311. e.preventDefault();
  21312. return false;
  21313. });
  21314. }
  21315. // on rail over
  21316. rail.hover(function(){
  21317. showBar();
  21318. }, function(){
  21319. hideBar();
  21320. });
  21321. // on bar over
  21322. bar.hover(function(){
  21323. isOverBar = true;
  21324. }, function(){
  21325. isOverBar = false;
  21326. });
  21327. // show on parent mouseover
  21328. me.hover(function(){
  21329. isOverPanel = true;
  21330. showBar();
  21331. hideBar();
  21332. }, function(){
  21333. isOverPanel = false;
  21334. hideBar();
  21335. });
  21336. // support for mobile
  21337. me.bind('touchstart', function(e,b){
  21338. if (e.originalEvent.touches.length)
  21339. {
  21340. // record where touch started
  21341. touchDif = e.originalEvent.touches[0].pageY;
  21342. }
  21343. });
  21344. me.bind('touchmove', function(e){
  21345. // prevent scrolling the page if necessary
  21346. if(!releaseScroll)
  21347. {
  21348. e.originalEvent.preventDefault();
  21349. }
  21350. if (e.originalEvent.touches.length)
  21351. {
  21352. // see how far user swiped
  21353. var diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep;
  21354. // scroll content
  21355. scrollContent(diff, true);
  21356. touchDif = e.originalEvent.touches[0].pageY;
  21357. }
  21358. });
  21359. // set up initial height
  21360. getBarHeight();
  21361. // check start position
  21362. if (o.start === 'bottom')
  21363. {
  21364. // scroll content to bottom
  21365. bar.css({ top: me.outerHeight() - bar.outerHeight() });
  21366. scrollContent(0, true);
  21367. }
  21368. else if (o.start !== 'top')
  21369. {
  21370. // assume jQuery selector
  21371. scrollContent($(o.start).position().top, null, true);
  21372. // make sure bar stays hidden
  21373. if (!o.alwaysVisible) { bar.hide(); }
  21374. }
  21375. // attach scroll events
  21376. attachWheel(this);
  21377. function _onWheel(e)
  21378. {
  21379. // use mouse wheel only when mouse is over
  21380. if (!isOverPanel) { return; }
  21381. var e = e || window.event;
  21382. var delta = 0;
  21383. if (e.wheelDelta) { delta = -e.wheelDelta/120; }
  21384. if (e.detail) { delta = e.detail / 3; }
  21385. var target = e.target || e.srcTarget || e.srcElement;
  21386. if ($(target).closest('.' + o.wrapperClass).is(me.parent())) {
  21387. // scroll content
  21388. scrollContent(delta, true);
  21389. }
  21390. // stop window scroll
  21391. if (e.preventDefault && !releaseScroll) { e.preventDefault(); }
  21392. if (!releaseScroll) { e.returnValue = false; }
  21393. }
  21394. function scrollContent(y, isWheel, isJump)
  21395. {
  21396. releaseScroll = false;
  21397. var delta = y;
  21398. var maxTop = me.outerHeight() - bar.outerHeight();
  21399. if (isWheel)
  21400. {
  21401. // move bar with mouse wheel
  21402. delta = parseInt(bar.css('top')) + y * parseInt(o.wheelStep) / 100 * bar.outerHeight();
  21403. // move bar, make sure it doesn't go out
  21404. delta = Math.min(Math.max(delta, 0), maxTop);
  21405. // if scrolling down, make sure a fractional change to the
  21406. // scroll position isn't rounded away when the scrollbar's CSS is set
  21407. // this flooring of delta would happened automatically when
  21408. // bar.css is set below, but we floor here for clarity
  21409. delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta);
  21410. // scroll the scrollbar
  21411. bar.css({ top: delta + 'px' });
  21412. }
  21413. // calculate actual scroll amount
  21414. percentScroll = parseInt(bar.css('top')) / (me.outerHeight() - bar.outerHeight());
  21415. delta = percentScroll * (me[0].scrollHeight - me.outerHeight());
  21416. if (isJump)
  21417. {
  21418. delta = y;
  21419. var offsetTop = delta / me[0].scrollHeight * me.outerHeight();
  21420. offsetTop = Math.min(Math.max(offsetTop, 0), maxTop);
  21421. bar.css({ top: offsetTop + 'px' });
  21422. }
  21423. // scroll content
  21424. me.scrollTop(delta);
  21425. // fire scrolling event
  21426. me.trigger('slimscrolling', ~~delta);
  21427. // ensure bar is visible
  21428. showBar();
  21429. // trigger hide when scroll is stopped
  21430. hideBar();
  21431. }
  21432. function attachWheel(target)
  21433. {
  21434. if (window.addEventListener)
  21435. {
  21436. target.addEventListener('DOMMouseScroll', _onWheel, false );
  21437. target.addEventListener('mousewheel', _onWheel, false );
  21438. }
  21439. else
  21440. {
  21441. document.attachEvent("onmousewheel", _onWheel)
  21442. }
  21443. }
  21444. function getBarHeight()
  21445. {
  21446. // calculate scrollbar height and make sure it is not too small
  21447. barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight);
  21448. bar.css({ height: barHeight + 'px' });
  21449. // hide scrollbar if content is not long enough
  21450. var display = barHeight == me.outerHeight() ? 'none' : 'block';
  21451. bar.css({ display: display });
  21452. }
  21453. function showBar()
  21454. {
  21455. // recalculate bar height
  21456. getBarHeight();
  21457. clearTimeout(queueHide);
  21458. // when bar reached top or bottom
  21459. if (percentScroll == ~~percentScroll)
  21460. {
  21461. //release wheel
  21462. releaseScroll = o.allowPageScroll;
  21463. // publish approporiate event
  21464. if (lastScroll != percentScroll)
  21465. {
  21466. var msg = (~~percentScroll == 0) ? 'top' : 'bottom';
  21467. me.trigger('slimscroll', msg);
  21468. }
  21469. }
  21470. else
  21471. {
  21472. releaseScroll = false;
  21473. }
  21474. lastScroll = percentScroll;
  21475. // show only when required
  21476. if(barHeight >= me.outerHeight()) {
  21477. //allow window scroll
  21478. releaseScroll = true;
  21479. return;
  21480. }
  21481. bar.stop(true,true).fadeIn('fast');
  21482. if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); }
  21483. }
  21484. function hideBar()
  21485. {
  21486. // only hide when options allow it
  21487. if (!o.alwaysVisible)
  21488. {
  21489. queueHide = setTimeout(function(){
  21490. if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg)
  21491. {
  21492. bar.fadeOut('slow');
  21493. rail.fadeOut('slow');
  21494. }
  21495. }, 1000);
  21496. }
  21497. }
  21498. });
  21499. // maintain chainability
  21500. return this;
  21501. }
  21502. });
  21503. $.fn.extend({
  21504. slimscroll: $.fn.slimScroll
  21505. });
  21506. })(jQuery);
  21507. /*!
  21508. * Waves v0.7.6
  21509. * http://fian.my.id/Waves
  21510. *
  21511. * Copyright 2014-2018 Alfiana E. Sibuea and other contributors
  21512. * Released under the MIT license
  21513. * https://github.com/fians/Waves/blob/master/LICENSE
  21514. */
  21515. ;(function(window, factory) {
  21516. 'use strict';
  21517. // AMD. Register as an anonymous module. Wrap in function so we have access
  21518. // to root via `this`.
  21519. if (typeof define === 'function' && define.amd) {
  21520. define([], function() {
  21521. window.Waves = factory.call(window);
  21522. return window.Waves;
  21523. });
  21524. }
  21525. // Node. Does not work with strict CommonJS, but only CommonJS-like
  21526. // environments that support module.exports, like Node.
  21527. else if (typeof exports === 'object') {
  21528. module.exports = factory.call(window);
  21529. }
  21530. // Browser globals.
  21531. else {
  21532. window.Waves = factory.call(window);
  21533. }
  21534. })(typeof global === 'object' ? global : this, function() {
  21535. 'use strict';
  21536. var Waves = Waves || {};
  21537. var $$ = document.querySelectorAll.bind(document);
  21538. var toString = Object.prototype.toString;
  21539. var isTouchAvailable = 'ontouchstart' in window;
  21540. // Find exact position of element
  21541. function isWindow(obj) {
  21542. return obj !== null && obj === obj.window;
  21543. }
  21544. function getWindow(elem) {
  21545. return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
  21546. }
  21547. function isObject(value) {
  21548. var type = typeof value;
  21549. return type === 'function' || type === 'object' && !!value;
  21550. }
  21551. function isDOMNode(obj) {
  21552. return isObject(obj) && obj.nodeType > 0;
  21553. }
  21554. function getWavesElements(nodes) {
  21555. var stringRepr = toString.call(nodes);
  21556. if (stringRepr === '[object String]') {
  21557. return $$(nodes);
  21558. } else if (isObject(nodes) && /^\[object (Array|HTMLCollection|NodeList|Object)\]$/.test(stringRepr) && nodes.hasOwnProperty('length')) {
  21559. return nodes;
  21560. } else if (isDOMNode(nodes)) {
  21561. return [nodes];
  21562. }
  21563. return [];
  21564. }
  21565. function offset(elem) {
  21566. var docElem, win,
  21567. box = { top: 0, left: 0 },
  21568. doc = elem && elem.ownerDocument;
  21569. docElem = doc.documentElement;
  21570. if (typeof elem.getBoundingClientRect !== typeof undefined) {
  21571. box = elem.getBoundingClientRect();
  21572. }
  21573. win = getWindow(doc);
  21574. return {
  21575. top: box.top + win.pageYOffset - docElem.clientTop,
  21576. left: box.left + win.pageXOffset - docElem.clientLeft
  21577. };
  21578. }
  21579. function convertStyle(styleObj) {
  21580. var style = '';
  21581. for (var prop in styleObj) {
  21582. if (styleObj.hasOwnProperty(prop)) {
  21583. style += (prop + ':' + styleObj[prop] + ';');
  21584. }
  21585. }
  21586. return style;
  21587. }
  21588. var Effect = {
  21589. // Effect duration
  21590. duration: 750,
  21591. // Effect delay (check for scroll before showing effect)
  21592. delay: 200,
  21593. show: function(e, element, velocity) {
  21594. // Disable right click
  21595. if (e.button === 2) {
  21596. return false;
  21597. }
  21598. element = element || this;
  21599. // Create ripple
  21600. var ripple = document.createElement('div');
  21601. ripple.className = 'waves-ripple waves-rippling';
  21602. element.appendChild(ripple);
  21603. // Get click coordinate and element width
  21604. var pos = offset(element);
  21605. var relativeY = 0;
  21606. var relativeX = 0;
  21607. // Support for touch devices
  21608. if('touches' in e && e.touches.length) {
  21609. relativeY = (e.touches[0].pageY - pos.top);
  21610. relativeX = (e.touches[0].pageX - pos.left);
  21611. }
  21612. //Normal case
  21613. else {
  21614. relativeY = (e.pageY - pos.top);
  21615. relativeX = (e.pageX - pos.left);
  21616. }
  21617. // Support for synthetic events
  21618. relativeX = relativeX >= 0 ? relativeX : 0;
  21619. relativeY = relativeY >= 0 ? relativeY : 0;
  21620. var scale = 'scale(' + ((element.clientWidth / 100) * 3) + ')';
  21621. var translate = 'translate(0,0)';
  21622. if (velocity) {
  21623. translate = 'translate(' + (velocity.x) + 'px, ' + (velocity.y) + 'px)';
  21624. }
  21625. // Attach data to element
  21626. ripple.setAttribute('data-hold', Date.now());
  21627. ripple.setAttribute('data-x', relativeX);
  21628. ripple.setAttribute('data-y', relativeY);
  21629. ripple.setAttribute('data-scale', scale);
  21630. ripple.setAttribute('data-translate', translate);
  21631. // Set ripple position
  21632. var rippleStyle = {
  21633. top: relativeY + 'px',
  21634. left: relativeX + 'px'
  21635. };
  21636. ripple.classList.add('waves-notransition');
  21637. ripple.setAttribute('style', convertStyle(rippleStyle));
  21638. ripple.classList.remove('waves-notransition');
  21639. // Scale the ripple
  21640. rippleStyle['-webkit-transform'] = scale + ' ' + translate;
  21641. rippleStyle['-moz-transform'] = scale + ' ' + translate;
  21642. rippleStyle['-ms-transform'] = scale + ' ' + translate;
  21643. rippleStyle['-o-transform'] = scale + ' ' + translate;
  21644. rippleStyle.transform = scale + ' ' + translate;
  21645. rippleStyle.opacity = '1';
  21646. var duration = e.type === 'mousemove' ? 2500 : Effect.duration;
  21647. rippleStyle['-webkit-transition-duration'] = duration + 'ms';
  21648. rippleStyle['-moz-transition-duration'] = duration + 'ms';
  21649. rippleStyle['-o-transition-duration'] = duration + 'ms';
  21650. rippleStyle['transition-duration'] = duration + 'ms';
  21651. ripple.setAttribute('style', convertStyle(rippleStyle));
  21652. },
  21653. hide: function(e, element) {
  21654. element = element || this;
  21655. var ripples = element.getElementsByClassName('waves-rippling');
  21656. for (var i = 0, len = ripples.length; i < len; i++) {
  21657. removeRipple(e, element, ripples[i]);
  21658. }
  21659. if (isTouchAvailable) {
  21660. element.removeEventListener('touchend', Effect.hide);
  21661. element.removeEventListener('touchcancel', Effect.hide);
  21662. }
  21663. element.removeEventListener('mouseup', Effect.hide);
  21664. element.removeEventListener('mouseleave', Effect.hide);
  21665. }
  21666. };
  21667. /**
  21668. * Collection of wrapper for HTML element that only have single tag
  21669. * like <input> and <img>
  21670. */
  21671. var TagWrapper = {
  21672. // Wrap <input> tag so it can perform the effect
  21673. input: function(element) {
  21674. var parent = element.parentNode;
  21675. // If input already have parent just pass through
  21676. if (parent.tagName.toLowerCase() === 'i' && parent.classList.contains('waves-effect')) {
  21677. return;
  21678. }
  21679. // Put element class and style to the specified parent
  21680. var wrapper = document.createElement('i');
  21681. wrapper.className = element.className + ' waves-input-wrapper';
  21682. element.className = 'waves-button-input';
  21683. // Put element as child
  21684. parent.replaceChild(wrapper, element);
  21685. wrapper.appendChild(element);
  21686. // Apply element color and background color to wrapper
  21687. var elementStyle = window.getComputedStyle(element, null);
  21688. var color = elementStyle.color;
  21689. var backgroundColor = elementStyle.backgroundColor;
  21690. wrapper.setAttribute('style', 'color:' + color + ';background:' + backgroundColor);
  21691. element.setAttribute('style', 'background-color:rgba(0,0,0,0);');
  21692. },
  21693. // Wrap <img> tag so it can perform the effect
  21694. img: function(element) {
  21695. var parent = element.parentNode;
  21696. // If input already have parent just pass through
  21697. if (parent.tagName.toLowerCase() === 'i' && parent.classList.contains('waves-effect')) {
  21698. return;
  21699. }
  21700. // Put element as child
  21701. var wrapper = document.createElement('i');
  21702. parent.replaceChild(wrapper, element);
  21703. wrapper.appendChild(element);
  21704. }
  21705. };
  21706. /**
  21707. * Hide the effect and remove the ripple. Must be
  21708. * a separate function to pass the JSLint...
  21709. */
  21710. function removeRipple(e, el, ripple) {
  21711. // Check if the ripple still exist
  21712. if (!ripple) {
  21713. return;
  21714. }
  21715. ripple.classList.remove('waves-rippling');
  21716. var relativeX = ripple.getAttribute('data-x');
  21717. var relativeY = ripple.getAttribute('data-y');
  21718. var scale = ripple.getAttribute('data-scale');
  21719. var translate = ripple.getAttribute('data-translate');
  21720. // Get delay beetween mousedown and mouse leave
  21721. var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
  21722. var delay = 350 - diff;
  21723. if (delay < 0) {
  21724. delay = 0;
  21725. }
  21726. if (e.type === 'mousemove') {
  21727. delay = 150;
  21728. }
  21729. // Fade out ripple after delay
  21730. var duration = e.type === 'mousemove' ? 2500 : Effect.duration;
  21731. setTimeout(function() {
  21732. var style = {
  21733. top: relativeY + 'px',
  21734. left: relativeX + 'px',
  21735. opacity: '0',
  21736. // Duration
  21737. '-webkit-transition-duration': duration + 'ms',
  21738. '-moz-transition-duration': duration + 'ms',
  21739. '-o-transition-duration': duration + 'ms',
  21740. 'transition-duration': duration + 'ms',
  21741. '-webkit-transform': scale + ' ' + translate,
  21742. '-moz-transform': scale + ' ' + translate,
  21743. '-ms-transform': scale + ' ' + translate,
  21744. '-o-transform': scale + ' ' + translate,
  21745. 'transform': scale + ' ' + translate
  21746. };
  21747. ripple.setAttribute('style', convertStyle(style));
  21748. setTimeout(function() {
  21749. try {
  21750. el.removeChild(ripple);
  21751. } catch (e) {
  21752. return false;
  21753. }
  21754. }, duration);
  21755. }, delay);
  21756. }
  21757. /**
  21758. * Disable mousedown event for 500ms during and after touch
  21759. */
  21760. var TouchHandler = {
  21761. /* uses an integer rather than bool so there's no issues with
  21762. * needing to clear timeouts if another touch event occurred
  21763. * within the 500ms. Cannot mouseup between touchstart and
  21764. * touchend, nor in the 500ms after touchend. */
  21765. touches: 0,
  21766. allowEvent: function(e) {
  21767. var allow = true;
  21768. if (/^(mousedown|mousemove)$/.test(e.type) && TouchHandler.touches) {
  21769. allow = false;
  21770. }
  21771. return allow;
  21772. },
  21773. registerEvent: function(e) {
  21774. var eType = e.type;
  21775. if (eType === 'touchstart') {
  21776. TouchHandler.touches += 1; // push
  21777. } else if (/^(touchend|touchcancel)$/.test(eType)) {
  21778. setTimeout(function() {
  21779. if (TouchHandler.touches) {
  21780. TouchHandler.touches -= 1; // pop after 500ms
  21781. }
  21782. }, 500);
  21783. }
  21784. }
  21785. };
  21786. /**
  21787. * Delegated click handler for .waves-effect element.
  21788. * returns null when .waves-effect element not in "click tree"
  21789. */
  21790. function getWavesEffectElement(e) {
  21791. if (TouchHandler.allowEvent(e) === false) {
  21792. return null;
  21793. }
  21794. var element = null;
  21795. var target = e.target || e.srcElement;
  21796. while (target.parentElement) {
  21797. if ( (!(target instanceof SVGElement)) && target.classList.contains('waves-effect')) {
  21798. element = target;
  21799. break;
  21800. }
  21801. target = target.parentElement;
  21802. }
  21803. return element;
  21804. }
  21805. /**
  21806. * Bubble the click and show effect if .waves-effect elem was found
  21807. */
  21808. function showEffect(e) {
  21809. // Disable effect if element has "disabled" property on it
  21810. // In some cases, the event is not triggered by the current element
  21811. // if (e.target.getAttribute('disabled') !== null) {
  21812. // return;
  21813. // }
  21814. var element = getWavesEffectElement(e);
  21815. if (element !== null) {
  21816. // Make it sure the element has either disabled property, disabled attribute or 'disabled' class
  21817. if (element.disabled || element.getAttribute('disabled') || element.classList.contains('disabled')) {
  21818. return;
  21819. }
  21820. TouchHandler.registerEvent(e);
  21821. if (e.type === 'touchstart' && Effect.delay) {
  21822. var hidden = false;
  21823. var timer = setTimeout(function () {
  21824. timer = null;
  21825. Effect.show(e, element);
  21826. }, Effect.delay);
  21827. var hideEffect = function(hideEvent) {
  21828. // if touch hasn't moved, and effect not yet started: start effect now
  21829. if (timer) {
  21830. clearTimeout(timer);
  21831. timer = null;
  21832. Effect.show(e, element);
  21833. }
  21834. if (!hidden) {
  21835. hidden = true;
  21836. Effect.hide(hideEvent, element);
  21837. }
  21838. removeListeners();
  21839. };
  21840. var touchMove = function(moveEvent) {
  21841. if (timer) {
  21842. clearTimeout(timer);
  21843. timer = null;
  21844. }
  21845. hideEffect(moveEvent);
  21846. removeListeners();
  21847. };
  21848. element.addEventListener('touchmove', touchMove, false);
  21849. element.addEventListener('touchend', hideEffect, false);
  21850. element.addEventListener('touchcancel', hideEffect, false);
  21851. var removeListeners = function() {
  21852. element.removeEventListener('touchmove', touchMove);
  21853. element.removeEventListener('touchend', hideEffect);
  21854. element.removeEventListener('touchcancel', hideEffect);
  21855. };
  21856. } else {
  21857. Effect.show(e, element);
  21858. if (isTouchAvailable) {
  21859. element.addEventListener('touchend', Effect.hide, false);
  21860. element.addEventListener('touchcancel', Effect.hide, false);
  21861. }
  21862. element.addEventListener('mouseup', Effect.hide, false);
  21863. element.addEventListener('mouseleave', Effect.hide, false);
  21864. }
  21865. }
  21866. }
  21867. Waves.init = function(options) {
  21868. var body = document.body;
  21869. options = options || {};
  21870. if ('duration' in options) {
  21871. Effect.duration = options.duration;
  21872. }
  21873. if ('delay' in options) {
  21874. Effect.delay = options.delay;
  21875. }
  21876. if (isTouchAvailable) {
  21877. body.addEventListener('touchstart', showEffect, false);
  21878. body.addEventListener('touchcancel', TouchHandler.registerEvent, false);
  21879. body.addEventListener('touchend', TouchHandler.registerEvent, false);
  21880. }
  21881. body.addEventListener('mousedown', showEffect, false);
  21882. };
  21883. /**
  21884. * Attach Waves to dynamically loaded inputs, or add .waves-effect and other
  21885. * waves classes to a set of elements. Set drag to true if the ripple mouseover
  21886. * or skimming effect should be applied to the elements.
  21887. */
  21888. Waves.attach = function(elements, classes) {
  21889. elements = getWavesElements(elements);
  21890. if (toString.call(classes) === '[object Array]') {
  21891. classes = classes.join(' ');
  21892. }
  21893. classes = classes ? ' ' + classes : '';
  21894. var element, tagName;
  21895. for (var i = 0, len = elements.length; i < len; i++) {
  21896. element = elements[i];
  21897. tagName = element.tagName.toLowerCase();
  21898. if (['input', 'img'].indexOf(tagName) !== -1) {
  21899. TagWrapper[tagName](element);
  21900. element = element.parentElement;
  21901. }
  21902. if (element.className.indexOf('waves-effect') === -1) {
  21903. element.className += ' waves-effect' + classes;
  21904. }
  21905. }
  21906. };
  21907. /**
  21908. * Cause a ripple to appear in an element via code.
  21909. */
  21910. Waves.ripple = function(elements, options) {
  21911. elements = getWavesElements(elements);
  21912. var elementsLen = elements.length;
  21913. options = options || {};
  21914. options.wait = options.wait || 0;
  21915. options.position = options.position || null; // default = centre of element
  21916. if (elementsLen) {
  21917. var element, pos, off, centre = {}, i = 0;
  21918. var mousedown = {
  21919. type: 'mousedown',
  21920. button: 1
  21921. };
  21922. var hideRipple = function(mouseup, element) {
  21923. return function() {
  21924. Effect.hide(mouseup, element);
  21925. };
  21926. };
  21927. for (; i < elementsLen; i++) {
  21928. element = elements[i];
  21929. pos = options.position || {
  21930. x: element.clientWidth / 2,
  21931. y: element.clientHeight / 2
  21932. };
  21933. off = offset(element);
  21934. centre.x = off.left + pos.x;
  21935. centre.y = off.top + pos.y;
  21936. mousedown.pageX = centre.x;
  21937. mousedown.pageY = centre.y;
  21938. Effect.show(mousedown, element);
  21939. if (options.wait >= 0 && options.wait !== null) {
  21940. var mouseup = {
  21941. type: 'mouseup',
  21942. button: 1
  21943. };
  21944. setTimeout(hideRipple(mouseup, element), options.wait);
  21945. }
  21946. }
  21947. }
  21948. };
  21949. /**
  21950. * Remove all ripples from an element.
  21951. */
  21952. Waves.calm = function(elements) {
  21953. elements = getWavesElements(elements);
  21954. var mouseup = {
  21955. type: 'mouseup',
  21956. button: 1
  21957. };
  21958. for (var i = 0, len = elements.length; i < len; i++) {
  21959. Effect.hide(mouseup, elements[i]);
  21960. }
  21961. };
  21962. /**
  21963. * Deprecated API fallback
  21964. */
  21965. Waves.displayEffect = function(options) {
  21966. console.error('Waves.displayEffect() has been deprecated and will be removed in future version. Please use Waves.init() to initialize Waves effect');
  21967. Waves.init(options);
  21968. };
  21969. return Waves;
  21970. });
  21971. /*!
  21972. * jQuery SmartPanels v1.0.0
  21973. *
  21974. * Copyright 2019, 2020 SmartAdmin WebApp
  21975. * Released under Marketplace License (see your license details for usage)
  21976. *
  21977. * Publish Date: 2018-01-01T17:42Z
  21978. */
  21979. (function ($, window, document, undefined) {
  21980. //"use strict";
  21981. var pluginName = 'smartPanel';
  21982. /**
  21983. * Check for touch support and set right click events.
  21984. **/
  21985. /*var clickEvent = (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch ?
  21986. 'clickEvent' : 'click') + '.' + pluginName;*/
  21987. var clickEvent;
  21988. if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
  21989. clickEvent = 'click tap';
  21990. } else {
  21991. clickEvent = 'click';
  21992. }
  21993. function Plugin(element, options) {
  21994. /**
  21995. * Variables.
  21996. **/
  21997. this.obj = $(element);
  21998. this.o = $.extend({}, $.fn[pluginName].defaults, options);
  21999. this.objId = this.obj.attr('id');
  22000. this.panel = this.obj.find(this.o.panels);
  22001. this.storage = {enabled: this.o.localStorage};
  22002. this.initialized = false;
  22003. this.init();
  22004. }
  22005. Plugin.prototype = {
  22006. /**
  22007. * Function for the indicator image.
  22008. *
  22009. * @param:
  22010. **/
  22011. _runPanelLoader: function (elm) {
  22012. var self = this;
  22013. if (self.o.localStorage === true) {
  22014. elm.closest(self.o.panels)
  22015. .find('.panel-saving')
  22016. .stop(true, true)
  22017. .fadeIn(100)
  22018. .delay(600)
  22019. .fadeOut(100);
  22020. }
  22021. },
  22022. _loadKeys : function () {
  22023. var self = this;
  22024. var panel_url = self.o.pageKey || location.pathname;
  22025. self.storage.keySettings = 'smartPanel_settings_' + panel_url + '_' + self.objId;
  22026. self.storage.keyPosition = 'smartPanel_position_' + panel_url + '_' + self.objId;
  22027. },
  22028. /**
  22029. * Save all settings to the localStorage.
  22030. *
  22031. * @param:
  22032. **/
  22033. _savePanelSettings: function () {
  22034. var self = this;
  22035. var storage = self.storage;
  22036. self._loadKeys();
  22037. var storeSettings = self.obj.find(self.o.panels)
  22038. .map(function () {
  22039. var storeSettingsStr = {};
  22040. storeSettingsStr.id = $(this)
  22041. .attr('id');
  22042. storeSettingsStr.style = $(this)
  22043. .attr('data-panel-attstyle');
  22044. storeSettingsStr.locked = ($(this)
  22045. .hasClass('panel-locked') ? 1 : 0);
  22046. storeSettingsStr.collapsed = ($(this)
  22047. .hasClass('panel-collapsed') ? 1 : 0);
  22048. return storeSettingsStr;
  22049. }).get();
  22050. var storeSettingsObj = JSON.stringify({
  22051. 'panel': storeSettings
  22052. });
  22053. /* Place it in the storage(only if needed) */
  22054. if (storage.enabled && storage.getKeySettings != storeSettingsObj) {
  22055. localStorage.setItem(storage.keySettings, storeSettingsObj);
  22056. storage.getKeySettings = storeSettingsObj;
  22057. //if (myapp_config.debugState)
  22058. //console.log("storeSettingsObj:" + storeSettingsObj)
  22059. }
  22060. /**
  22061. * Run the callback function.
  22062. **/
  22063. if (typeof self.o.onSave == 'function') {
  22064. self.o.onSave.call(this, null, storeSettingsObj, storage.keySettings);
  22065. if (myapp_config.debugState)
  22066. console.log("keySettings: " + storage.keySettings)
  22067. }
  22068. },
  22069. /**
  22070. * Save positions to the localStorage.
  22071. *
  22072. * @param:
  22073. **/
  22074. _savePanelPosition: function () {
  22075. var self = this;
  22076. var storage = self.storage;
  22077. self._loadKeys();
  22078. var mainArr = self.obj.find(self.o.grid + '.sortable-grid')
  22079. .map(function () {
  22080. var subArr = $(this)
  22081. .children(self.o.panels)
  22082. .map(function () {
  22083. return {
  22084. 'id': $(this).attr('id')
  22085. };
  22086. }).get();
  22087. return {
  22088. 'section': subArr
  22089. };
  22090. }).get();
  22091. var storePositionObj = JSON.stringify({
  22092. 'grid': mainArr
  22093. });
  22094. /* Place it in the storage(only if needed) */
  22095. if (storage.enabled && storage.getKeyPosition != storePositionObj) {
  22096. localStorage.setItem(storage.keyPosition, storePositionObj);
  22097. storage.getKeyPosition = storePositionObj
  22098. }
  22099. /**
  22100. * Run the callback function.
  22101. **/
  22102. if (typeof self.o.onSave == 'function') {
  22103. self.o.onSave.call(this, storePositionObj, storage.keyPosition);
  22104. }
  22105. },
  22106. /**
  22107. * Code that we run at the start.
  22108. *
  22109. * @param:
  22110. **/
  22111. init: function () {
  22112. var self = this;
  22113. if (self.initialized) return;
  22114. self._initStorage(self.storage);
  22115. /**
  22116. * Force users to use an id(it's needed for the local storage).
  22117. **/
  22118. if (!$('#' + self.objId)
  22119. .length) {
  22120. //alert('Your panel ID is missing!');
  22121. if (typeof bootbox != 'undefined') {
  22122. bootbox.alert("Your panel ID is missing!");
  22123. } else {
  22124. alert('Your panel ID is missing!');
  22125. }
  22126. }
  22127. /**
  22128. * This will add an extra class that we use to store the
  22129. * panels in the right order.(savety)
  22130. **/
  22131. $(self.o.grid)
  22132. .each(function () {
  22133. if ($(this)
  22134. .find(self.o.panels)
  22135. .length) {
  22136. $(this)
  22137. .addClass('sortable-grid');
  22138. }
  22139. });
  22140. /**
  22141. * SET POSITION PANEL
  22142. **/
  22143. /**
  22144. * Run if data is present.
  22145. **/
  22146. if (self.storage.enabled && self.storage.getKeyPosition) {
  22147. var jsonPosition = JSON.parse(self.storage.getKeyPosition);
  22148. /**
  22149. * Loop the data, and put every panels on the right place.
  22150. **/
  22151. for (var key in jsonPosition.grid) {
  22152. var changeOrder = self.obj.find(self.o.grid + '.sortable-grid')
  22153. .eq(key);
  22154. for (var key2 in jsonPosition.grid[key].section) {
  22155. changeOrder.append($('#' + jsonPosition.grid[key].section[key2].id));
  22156. }
  22157. }
  22158. }
  22159. /**
  22160. * SET SETTINGS PANEL
  22161. **/
  22162. /**
  22163. * Run if data is present.
  22164. **/
  22165. if (self.storage.enabled && self.storage.getKeySettings) {
  22166. var jsonSettings = JSON.parse(self.storage.getKeySettings);
  22167. if (myapp_config.debugState)
  22168. console.log("Panel settings loaded: " + self.storage.getKeySettings)
  22169. /**
  22170. * Loop the data and hide/show the panels and set the inputs in
  22171. * panel to checked(if hidden) and add an indicator class to the div.
  22172. * Loop all labels and update the panel titles.
  22173. **/
  22174. for (var key in jsonSettings.panel) {
  22175. var panelId = $('#' + jsonSettings.panel[key].id);
  22176. /**
  22177. * Set a style(if present).
  22178. **/
  22179. if (jsonSettings.panel[key].style) {
  22180. panelId.attr('data-panel-attstyle', '' + jsonSettings.panel[key].style + '')
  22181. .children('.panel-hdr')
  22182. .removeClassPrefix('bg-')
  22183. .addClass(jsonSettings.panel[key].style);
  22184. }
  22185. /**
  22186. * Toggle content panel.
  22187. **/
  22188. if (jsonSettings.panel[key].collapsed == 1) {
  22189. panelId.addClass('panel-collapsed')
  22190. .children('.panel-container').addClass('collapse').removeClass('show');
  22191. }
  22192. /**
  22193. * Locked panel from sorting.
  22194. **/
  22195. if (jsonSettings.panel[key].locked == 1) {
  22196. panelId.addClass('panel-locked');
  22197. }
  22198. }
  22199. }
  22200. /**
  22201. * Format colors
  22202. **/
  22203. if (self.o.panelColors && self.o.colorButton) {
  22204. var formatedPanelColors = [];
  22205. for (var key in self.o.panelColors) {
  22206. formatedPanelColors.push('<a href="#" class="btn d-inline-block '+ self.o.panelColors[key] +' width-2 height-2 p-0 rounded-0 js-panel-color hover-effect-dot" data-panel-setstyle="'+ self.o.panelColors[key] +'" style="margin:1px;"></a>');
  22207. }
  22208. }
  22209. /**
  22210. * LOOP ALL PANELS
  22211. **/
  22212. self.panel.each(function () {
  22213. var tPanel = $(this),
  22214. closeButton,
  22215. fullscreenButton,
  22216. collapseButton,
  22217. lockedButton,
  22218. refreshButton,
  22219. colorButton,
  22220. resetButton,
  22221. customButton,
  22222. thisHeader = $(this).children('.panel-hdr'),
  22223. thisContainer = $(this).children('.panel-container');
  22224. /**
  22225. * Dont double wrap(check).
  22226. **/
  22227. if (!thisHeader.parent().attr('role')) {
  22228. /**
  22229. * Adding a helper class to all sortable panels, this will be
  22230. * used to find the panels that are sortable, it will skip the panels
  22231. * that have the dataset 'panels-sortable="false"' set to false.
  22232. **/
  22233. if (self.o.sortable === true && tPanel.data('panel-sortable') === undefined) {
  22234. tPanel.addClass('panel-sortable');
  22235. }
  22236. /**
  22237. * Add a close button to the panel header (if set to true)
  22238. **/
  22239. if (self.o.closeButton === true && tPanel.data('panel-close') === undefined) {
  22240. closeButton = '<a href="#" class="btn btn-panel hover-effect-dot js-panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></a>';
  22241. } else {
  22242. closeButton = '';
  22243. }
  22244. /**
  22245. * Add a fullscreen button to the panel header (if set to true).
  22246. **/
  22247. if (self.o.fullscreenButton === true && tPanel.data('panel-fullscreen') === undefined) {
  22248. fullscreenButton = '<a href="#" class="btn btn-panel hover-effect-dot js-panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></a>';
  22249. } else {
  22250. fullscreenButton = '';
  22251. }
  22252. /**
  22253. * Add a collapse button to the panel header (if set to true).
  22254. **/
  22255. if (self.o.collapseButton === true && tPanel.data('panel-collapsed') === undefined) {
  22256. collapseButton = '<a href="#" class="btn btn-panel hover-effect-dot js-panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></a>'
  22257. } else {
  22258. collapseButton = '';
  22259. }
  22260. /**
  22261. * Add a locked button to the panel header (if set to true).
  22262. **/
  22263. if (self.o.lockedButton === true && tPanel.data('panel-locked') === undefined) {
  22264. lockedButton = '<a href="#" class="dropdown-item js-panel-locked"><span data-i18n="drpdwn.lockpanel">' + self.o.lockedButtonLabel + '</span></a>'
  22265. } else {
  22266. lockedButton = '';
  22267. }
  22268. /**
  22269. * Add a refresh button to the panel header (if set to true).
  22270. **/
  22271. if (self.o.refreshButton === true && tPanel.data('panel-refresh') === undefined) {
  22272. refreshButton = '<a href="#" class="dropdown-item js-panel-refresh"><span data-i18n="drpdwn.refreshpanel">' + self.o.refreshButtonLabel + '</span></a>';
  22273. thisContainer.prepend(
  22274. '<div class="loader"><i class="fal fa-spinner-third fa-spin-4x fs-xxl"></i></div>'
  22275. );
  22276. //append** conflicts with panel > container > content:last child, so changed to prepend
  22277. } else {
  22278. refreshButton = '';
  22279. }
  22280. /**
  22281. * Add a color select button to the panel header (if set to true).
  22282. **/
  22283. if (self.o.colorButton === true && tPanel.data('panel-color') === undefined) {
  22284. colorButton = ' <div class="dropdown-multilevel dropdown-multilevel-left">\
  22285. <div class="dropdown-item">\
  22286. <span data-i18n="drpdwn.panelcolor">' + self.o.colorButtonLabel + '</span>\
  22287. </div>\
  22288. <div class="dropdown-menu d-flex flex-wrap" style="min-width: 9.5rem; width: 9.5rem; padding: 0.5rem">' + formatedPanelColors.join(" ") + '</div>\
  22289. </div>'
  22290. } else {
  22291. colorButton = '';
  22292. }
  22293. /**
  22294. * Add a reset widget button to the panel header (if set to true).
  22295. **/
  22296. if (self.o.resetButton === true && tPanel.data('panel-reset') === undefined) {
  22297. resetButton = '<div class="dropdown-divider m-0"></div><a href="#" class="dropdown-item js-panel-reset"><span data-i18n="drpdwn.resetpanel">' + self.o.resetButtonLabel + '</span></a>'
  22298. } else {
  22299. resetButton = '';
  22300. }
  22301. /**
  22302. * Add a custom button to the panel header (if set to true).
  22303. **/
  22304. if (self.o.customButton === true && tPanel.data('panel-custombutton') === undefined) {
  22305. customButton = '<a href="#" class="dropdown-item js-panel-custombutton pl-4"><span data-i18n="drpdwn.custombutton">' + self.o.customButtonLabel + '</span></a>'
  22306. } else {
  22307. customButton = '';
  22308. }
  22309. /**
  22310. * Append the image to the panel header.
  22311. **/
  22312. thisHeader.append(
  22313. '<div class="panel-saving mr-2" style="display:none"><i class="fal fa-spinner-third fa-spin-4x fs-xl"></i></div>'
  22314. );
  22315. /**
  22316. * Set the buttons order.
  22317. **/
  22318. var formatButtons = self.o.buttonOrder
  22319. .replace(/%close%/g, closeButton)
  22320. .replace(/%fullscreen%/g, fullscreenButton)
  22321. .replace(/%collapse%/g, collapseButton);
  22322. /**
  22323. * Add a button wrapper to the header.
  22324. **/
  22325. if (closeButton !== '' || fullscreenButton !== '' || collapseButton !== '') {
  22326. thisHeader.append('<div class="panel-toolbar">' + formatButtons + '</div>');
  22327. }
  22328. /**
  22329. * Set the dropdown buttons order.
  22330. **/
  22331. var formatDropdownButtons = self.o.buttonOrderDropdown
  22332. .replace(/%locked%/g, lockedButton)
  22333. .replace(/%color%/g, colorButton)
  22334. .replace(/%refresh%/g, refreshButton)
  22335. .replace(/%reset%/g, resetButton)
  22336. .replace(/%custom%/g, customButton);
  22337. /**
  22338. * Add a button wrapper to the header.
  22339. **/
  22340. if (lockedButton !== '' || colorButton !== '' || refreshButton !== '' || resetButton !== '' || customButton !== '') {
  22341. thisHeader.append('<div class="panel-toolbar"><a href="#" class="btn btn-toolbar-master" data-toggle="dropdown"><i class="fal fa-ellipsis-v"></i></a><div class="dropdown-menu dropdown-menu-animated dropdown-menu-right p-0">' + formatDropdownButtons + '</div></div>');
  22342. }
  22343. /**
  22344. * Adding roles to some parts.
  22345. **/
  22346. tPanel.attr('role', 'widget')
  22347. .children('div')
  22348. .attr('role', 'content')
  22349. .prev('.panel-hdr')
  22350. .attr('role', 'heading')
  22351. .children('.panel-toolbar')
  22352. .attr('role', 'menu');
  22353. }
  22354. });
  22355. /**
  22356. * SORTABLE
  22357. **/
  22358. /**
  22359. * jQuery UI soratble, this allows users to sort the panels.
  22360. * Notice that this part needs the jquery-ui core to work.
  22361. **/
  22362. if (self.o.sortable === true && jQuery.ui) {
  22363. var sortItem = self.obj.find(self.o.grid + '.sortable-grid')
  22364. .not('[data-panel-excludegrid]');
  22365. sortItem.sortable({
  22366. items: sortItem.find(self.o.panels + '.panel-sortable'),
  22367. connectWith: sortItem,
  22368. placeholder: self.o.placeholderClass,
  22369. cursor: 'move',
  22370. //revert: true,
  22371. opacity: self.o.opacity,
  22372. delay: 0,
  22373. revert: 350,
  22374. cancel: '.btn-panel, .panel-fullscreen .panel-fullscreen, .mod-panel-disable .panel-sortable, .panel-locked.panel-sortable',
  22375. zIndex: 10000,
  22376. handle: self.o.dragHandle,
  22377. forcePlaceholderSize: true,
  22378. forceHelperSize: true,
  22379. update: function (event, ui) {
  22380. /* run pre-loader in the panel */
  22381. self._runPanelLoader(ui.item.children());
  22382. /* store the positions of the plugins */
  22383. self._savePanelPosition();
  22384. /**
  22385. * Run the callback function.
  22386. **/
  22387. if (typeof self.o.onChange == 'function') {
  22388. self.o.onChange.call(this, ui.item);
  22389. }
  22390. }
  22391. }); //you can add }).disableSelection() if you don't want text to be selected accidently.
  22392. }
  22393. /**
  22394. * CLICKEVENTS
  22395. **/
  22396. self._clickEvents();
  22397. /**
  22398. * DELETE LOCAL STORAGE KEYS
  22399. **/
  22400. if (self.storage.enabled) {
  22401. // Delete the settings key.
  22402. $(self.o.deleteSettingsKey)
  22403. .on(clickEvent, this, function (e) {
  22404. var cleared = confirm(self.o.settingsKeyLabel);
  22405. if (cleared) {
  22406. localStorage.removeItem(keySettings);
  22407. }
  22408. e.preventDefault();
  22409. });
  22410. // Delete the position key.
  22411. $(self.o.deletePositionKey)
  22412. .on(clickEvent, this, function (e) {
  22413. var cleared = confirm(self.o.positionKeyLabel);
  22414. if (cleared) {
  22415. localStorage.removeItem(keyPosition);
  22416. }
  22417. e.preventDefault();
  22418. });
  22419. }
  22420. initialized = true;
  22421. },
  22422. /**
  22423. * Initialize storage.
  22424. *
  22425. * @param:
  22426. **/
  22427. _initStorage: function (storage) {
  22428. /**
  22429. * LOCALSTORAGE CHECK
  22430. **/
  22431. storage.enabled = storage.enabled && !! function () {
  22432. var result, uid = +new Date();
  22433. try {
  22434. localStorage.setItem(uid, uid);
  22435. result = localStorage.getItem(uid) == uid;
  22436. localStorage.removeItem(uid);
  22437. return result;
  22438. } catch (e) {}
  22439. }();
  22440. this._loadKeys();
  22441. if (storage.enabled) {
  22442. storage.getKeySettings = localStorage.getItem(storage.keySettings);
  22443. storage.getKeyPosition = localStorage.getItem(storage.keyPosition);
  22444. } // end if
  22445. },
  22446. /**
  22447. * Register all click events.
  22448. *
  22449. * @param:
  22450. **/
  22451. _clickEvents: function () {
  22452. var self = this;
  22453. var headers = self.panel.children('.panel-hdr');
  22454. /**
  22455. * Allow users to toggle collapse.
  22456. **/
  22457. headers.on(clickEvent, '.js-panel-collapse', function (e) {
  22458. var tPanel = $(this),
  22459. pPanel = tPanel.closest(self.o.panels);
  22460. /**
  22461. * Close tooltip
  22462. **/
  22463. if( typeof($.fn.tooltip) !== 'undefined' && $('[data-toggle="tooltip"]').length ){
  22464. $(this).tooltip('hide');
  22465. } else {
  22466. console.log("bs.tooltip is not loaded");
  22467. }
  22468. /**
  22469. * Run function for the indicator image.
  22470. **/
  22471. // pPanel.toggleClass("panel-collapsed");
  22472. pPanel.children('.panel-container').collapse('toggle')
  22473. .on('shown.bs.collapse', function() {
  22474. pPanel.removeClass('panel-collapsed');
  22475. self._savePanelSettings();
  22476. }).on('hidden.bs.collapse', function(){
  22477. pPanel.addClass('panel-collapsed');
  22478. self._savePanelSettings();
  22479. });
  22480. /*if (pPanel.hasClass('panel-collapsed')) {
  22481. pPanel.removeClass('panel-collapsed')
  22482. .children('.panel-container')
  22483. .slideDown(400, function () {
  22484. self._savePanelSettings();
  22485. });
  22486. } else {
  22487. pPanel.addClass('panel-collapsed')
  22488. .children('.panel-container')
  22489. .slideUp(400, function () {
  22490. self._savePanelSettings();
  22491. });
  22492. }*/
  22493. /**
  22494. * Run function for the indicator image.
  22495. **/
  22496. self._runPanelLoader(tPanel);
  22497. /**
  22498. * Run the callback function.
  22499. **/
  22500. if (typeof self.o.onCollapse == 'function') {
  22501. self.o.onCollapse.call(this, pPanel);
  22502. }
  22503. /**
  22504. * Lets save the setings.
  22505. **/
  22506. // self._savePanelSettings();
  22507. e.preventDefault();
  22508. });
  22509. /**
  22510. * Allow users to toggle fullscreen.
  22511. **/
  22512. headers.on(clickEvent, '.js-panel-fullscreen', function (e) {
  22513. var tPanel = $(this),
  22514. pPanel = tPanel.closest(self.o.panels);
  22515. /**
  22516. * Close tooltip
  22517. **/
  22518. if( typeof($.fn.tooltip) !== 'undefined' && $('[data-toggle="tooltip"]').length ){
  22519. $(this).tooltip('hide');
  22520. } else {
  22521. console.log("bs.tooltip is not loaded");
  22522. }
  22523. /**
  22524. * Run function for the indicator image.
  22525. **/
  22526. pPanel.toggleClass("panel-fullscreen");
  22527. myapp_config.root_.toggleClass('panel-fullscreen');
  22528. /**
  22529. * Run function for the indicator image.
  22530. **/
  22531. self._runPanelLoader(tPanel);
  22532. /**
  22533. * Run the callback function.
  22534. **/
  22535. if (typeof self.o.onFullscreen == 'function') {
  22536. self.o.onFullscreen.call(this, pPanel);
  22537. }
  22538. e.preventDefault();
  22539. });
  22540. /**
  22541. * Allow users to close the panel.
  22542. **/
  22543. headers.on(clickEvent, '.js-panel-close', function (e) {
  22544. var tPanel = $(this),
  22545. pPanel = tPanel.closest(self.o.panels),
  22546. pTitle = pPanel.children('.panel-hdr').children('h2').text().trim();
  22547. /**
  22548. * Close tooltip
  22549. **/
  22550. if( typeof($.fn.tooltip) !== 'undefined' && $('[data-toggle="tooltip"]').length ){
  22551. $(this).tooltip('hide');
  22552. } else {
  22553. console.log("bs.tooltip is not loaded");
  22554. }
  22555. var killPanel = function (){
  22556. /**
  22557. * Run function for the indicator image.
  22558. **/
  22559. pPanel.fadeOut(500,function(){
  22560. /* remove panel */
  22561. $(this).remove();
  22562. /**
  22563. * Run the callback function.
  22564. **/
  22565. if (typeof self.o.onClosepanel == 'function') {
  22566. self.o.onClosepanel.call(this, pPanel);
  22567. }
  22568. });
  22569. /**
  22570. * Run function for the indicator image.
  22571. **/
  22572. self._runPanelLoader(tPanel);
  22573. };
  22574. //backdrop sound
  22575. initApp.playSound('media/sound', 'messagebox')
  22576. if (typeof bootbox != 'undefined') {
  22577. bootbox.confirm({
  22578. title: "<i class='fal fa-times-circle text-danger mr-2'></i> Do you wish to delete panel <span class='fw-500'>&nbsp;'" +pTitle+"'&nbsp;</span>?",
  22579. message: "<span><strong>Warning:</strong> This action cannot be undone!</span>",
  22580. centerVertical: true,
  22581. swapButtonOrder: true,
  22582. buttons: {
  22583. confirm: {
  22584. label: 'Yes',
  22585. className: 'btn-danger shadow-0'
  22586. },
  22587. cancel: {
  22588. label: 'No',
  22589. className: 'btn-default'
  22590. }
  22591. },
  22592. className: "modal-alert",
  22593. closeButton: false,
  22594. callback: function (result) {
  22595. if (result == true) {
  22596. //close panel
  22597. killPanel();
  22598. }
  22599. }
  22600. });
  22601. } else {
  22602. if (confirm( 'Do you wish to delete panel ' + pTitle + '?' )) {
  22603. killPanel();
  22604. }
  22605. }
  22606. e.preventDefault();
  22607. });
  22608. /**
  22609. * Allow users to set widget style (color).
  22610. **/
  22611. headers.on(clickEvent, '.js-panel-color', function (e) {
  22612. var tPanel = $(this),
  22613. pPanel = tPanel.closest(self.o.panels),
  22614. selectedHdr = tPanel.closest('.panel-hdr'),
  22615. val = tPanel.data('panel-setstyle');
  22616. /**
  22617. * Run the callback function.
  22618. **/
  22619. selectedHdr.removeClassPrefix('bg-')
  22620. .addClass(val)
  22621. .closest('.panel')
  22622. .attr('data-panel-attstyle', '' + val + '');
  22623. /**
  22624. * Run the callback function.
  22625. **/
  22626. if (typeof self.o.onColor == 'function') {
  22627. self.o.onColor.call(this, pPanel);
  22628. }
  22629. /**
  22630. * Run function for the indicator image.
  22631. **/
  22632. self._runPanelLoader(tPanel);
  22633. /**
  22634. * Lets save the setings.
  22635. **/
  22636. self._savePanelSettings();
  22637. e.preventDefault();
  22638. });
  22639. /**
  22640. * Allow users to lock widget to grid - preventing draging.
  22641. **/
  22642. headers.on(clickEvent, '.js-panel-locked', function (e) {
  22643. var tPanel = $(this),
  22644. pPanel = tPanel.closest(self.o.panels);
  22645. /**
  22646. * Run function for the indicator image.
  22647. **/
  22648. pPanel.toggleClass('panel-locked');
  22649. /**
  22650. * Run function for the indicator image.
  22651. **/
  22652. self._runPanelLoader(tPanel);
  22653. /**
  22654. * Run the callback function.
  22655. **/
  22656. if (typeof self.o.onLocked == 'function') {
  22657. self.o.onLocked.call(this, pPanel);
  22658. }
  22659. /**
  22660. * Lets save the setings.
  22661. **/
  22662. self._savePanelSettings();
  22663. e.preventDefault();
  22664. });
  22665. /**
  22666. * Allow users to toggle refresh widget content.
  22667. **/
  22668. headers.on(clickEvent, '.js-panel-refresh', function (e) {
  22669. var tPanel = $(this),
  22670. pPanel = tPanel.closest(self.o.panels),
  22671. //pContainer = pPanel.children('.panel-container'),
  22672. dTimer = pPanel.attr('data-refresh-timer') || 1500;
  22673. /**
  22674. * Run function for the indicator image.
  22675. **/
  22676. pPanel.addClass('panel-refresh').children('.panel-container').addClass('enable-loader')
  22677. .stop(true, true)
  22678. .delay(dTimer).queue(function(){
  22679. //pContainer.removeClass('enable-spinner').dequeue();
  22680. pPanel.removeClass('panel-refresh').children('.panel-container').removeClass('enable-loader').dequeue();
  22681. console.log(pPanel.attr('id') + " refresh complete");
  22682. });
  22683. /**
  22684. * Run the callback function.
  22685. **/
  22686. if (typeof self.o.onRefresh == 'function') {
  22687. self.o.onRefresh.call(this, pPanel);
  22688. }
  22689. e.preventDefault();
  22690. });
  22691. /**
  22692. * Allow users to toggle reset widget settings.
  22693. **/
  22694. headers.on(clickEvent, '.js-panel-reset', function (e) {
  22695. var tPanel = $(this),
  22696. pPanel = tPanel.closest(self.o.panels),
  22697. selectedHdr = tPanel.closest('.panel-hdr');
  22698. /**
  22699. * Remove all setting classes.
  22700. **/
  22701. selectedHdr.removeClassPrefix('bg-')
  22702. .closest('.panel')
  22703. .removeClass('panel-collapsed panel-fullscreen panel-locked')
  22704. .attr('data-panel-attstyle', '')
  22705. .children('.panel-container').collapse('show');
  22706. /**
  22707. * Run function for the indicator image.
  22708. **/
  22709. self._runPanelLoader(tPanel);
  22710. /**
  22711. * Lets save the setings.
  22712. **/
  22713. self._savePanelSettings();
  22714. /**
  22715. * Run the callback function.
  22716. **/
  22717. if (typeof self.o.onReset == 'function') {
  22718. self.o.onReset.call(this, pPanel);
  22719. }
  22720. e.preventDefault();
  22721. });
  22722. headers = null;
  22723. },
  22724. /**
  22725. * Destroy.
  22726. *
  22727. * @param:
  22728. **/
  22729. destroy: function () {
  22730. var self = this,
  22731. namespace = '.' + pluginName,
  22732. sortItem = self.obj.find(self.o.grid + '.sortable-grid').not('[data-panel-excludegrid]');
  22733. self.panel.removeClass('panel-sortable');
  22734. sortItem.sortable('destroy');
  22735. self.panel.children('.panel-hdr').off(namespace);
  22736. $(self.o.deletePositionKey).off(namespace);
  22737. $(window).off(namespace);
  22738. self.obj.removeData(pluginName);
  22739. self.initialized = false;
  22740. }
  22741. };
  22742. $.fn[pluginName] = function (option) {
  22743. return this.each(function () {
  22744. var $this = $(this),
  22745. data = $this.data(pluginName);
  22746. if (!data) {
  22747. var options = typeof option == 'object' && option;
  22748. $this.data(pluginName, (data = new Plugin(this, options)));
  22749. }
  22750. if (typeof option == 'string') {
  22751. data[option]();
  22752. }
  22753. });
  22754. };
  22755. /**
  22756. * Default settings(dont change).
  22757. * You can globally override these options
  22758. * by using $.fn.pluginName.key = 'value';
  22759. **/
  22760. $.fn[pluginName].defaults = {
  22761. grid: '[class*="col-"]',
  22762. panels: '.panel',
  22763. placeholderClass: 'panel-placeholder',
  22764. dragHandle: '> .panel-hdr > h2',
  22765. localStorage: true,
  22766. onChange: function () {},
  22767. onSave: function () {},
  22768. opacity: 1,
  22769. deleteSettingsKey: '',
  22770. settingsKeyLabel: 'Reset settings?',
  22771. deletePositionKey: '',
  22772. positionKeyLabel: 'Reset position?',
  22773. sortable: true,
  22774. buttonOrder: '%collapse% %fullscreen% %close%',
  22775. buttonOrderDropdown: '%refresh% %locked% %color% %custom% %reset%',
  22776. customButton: false,
  22777. customButtonLabel: "Custom Label",
  22778. onCustom: function () {},
  22779. closeButton: true,
  22780. onClosepanel: function() {
  22781. if (myapp_config.debugState)
  22782. console.log($(this).closest(".panel").attr('id') + " onClosepanel")
  22783. },
  22784. fullscreenButton: true,
  22785. onFullscreen: function() {
  22786. if (myapp_config.debugState)
  22787. console.log($(this).closest(".panel").attr('id') + " onFullscreen")
  22788. },
  22789. collapseButton: true,
  22790. onCollapse: function() {
  22791. if (myapp_config.debugState)
  22792. console.log($(this).closest(".panel").attr('id') + " onCollapse")
  22793. },
  22794. lockedButton: true,
  22795. lockedButtonLabel: "Lock Position",
  22796. onLocked: function() {
  22797. if (myapp_config.debugState)
  22798. console.log($(this).closest(".panel").attr('id') + " onLocked")
  22799. },
  22800. refreshButton: true,
  22801. refreshButtonLabel: "Refresh Content",
  22802. onRefresh: function() {
  22803. if (myapp_config.debugState)
  22804. console.log($(this).closest(".panel").attr('id') + " onRefresh")
  22805. },
  22806. colorButton: true,
  22807. colorButtonLabel: "Panel Style",
  22808. onColor: function() {
  22809. if (myapp_config.debugState)
  22810. console.log($(this).closest(".panel").attr('id') + " onColor")
  22811. },
  22812. panelColors: ['bg-primary-700 bg-success-gradient',
  22813. 'bg-primary-500 bg-info-gradient',
  22814. 'bg-primary-600 bg-primary-gradient',
  22815. 'bg-info-600 bg-primray-gradient',
  22816. 'bg-info-600 bg-info-gradient',
  22817. 'bg-info-700 bg-success-gradient',
  22818. 'bg-success-900 bg-info-gradient',
  22819. 'bg-success-700 bg-primary-gradient',
  22820. 'bg-success-600 bg-success-gradient',
  22821. 'bg-danger-900 bg-info-gradient',
  22822. 'bg-fusion-400 bg-fusion-gradient',
  22823. 'bg-faded'],
  22824. resetButton: true,
  22825. resetButtonLabel: "Reset Panel",
  22826. onReset: function() {
  22827. if (myapp_config.debugState)
  22828. console.log( $(this).closest(".panel").attr('id') + " onReset callback" )
  22829. }
  22830. };
  22831. })(jQuery, window, document);