jquery.js 265 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363
  1. /*!
  2. * jQuery JavaScript Library v3.3.1-dfsg
  3. * https://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * https://sizzlejs.com/
  7. *
  8. * Copyright JS Foundation and other contributors
  9. * Released under the MIT license
  10. * https://jquery.org/license
  11. *
  12. * Date: 2021-03-09T19:42Z
  13. */
  14. ( function( global, factory ) {
  15. "use strict";
  16. if ( typeof module === "object" && typeof module.exports === "object" ) {
  17. // For CommonJS and CommonJS-like environments where a proper `window`
  18. // is present, execute the factory and get jQuery.
  19. // For environments that do not have a `window` with a `document`
  20. // (such as Node.js), expose a factory as module.exports.
  21. // This accentuates the need for the creation of a real `window`.
  22. // e.g. var jQuery = require("jquery")(window);
  23. // See ticket #14549 for more info.
  24. module.exports = global.document ?
  25. factory( global, true ) :
  26. function( w ) {
  27. if ( !w.document ) {
  28. throw new Error( "jQuery requires a window with a document" );
  29. }
  30. return factory( w );
  31. };
  32. } else {
  33. factory( global );
  34. }
  35. // Pass this if window is not defined yet
  36. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  37. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  38. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  39. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  40. // enough that all such attempts are guarded in a try block.
  41. var arr = [];
  42. var document = window.document;
  43. var getProto = Object.getPrototypeOf;
  44. var slice = arr.slice;
  45. var concat = arr.concat;
  46. var push = arr.push;
  47. var indexOf = arr.indexOf;
  48. var class2type = {};
  49. var toString = class2type.toString;
  50. var hasOwn = class2type.hasOwnProperty;
  51. var fnToString = hasOwn.toString;
  52. var ObjectFunctionString = fnToString.call( Object );
  53. var support = {};
  54. var isFunction = function isFunction( obj ) {
  55. // Support: Chrome <=57, Firefox <=52
  56. // In some browsers, typeof returns "function" for HTML <object> elements
  57. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  58. // We don't want to classify *any* DOM node as a function.
  59. return typeof obj === "function" && typeof obj.nodeType !== "number";
  60. };
  61. var isWindow = function isWindow( obj ) {
  62. return obj != null && obj === obj.window;
  63. };
  64. var preservedScriptAttributes = {
  65. type: true,
  66. src: true,
  67. noModule: true
  68. };
  69. function DOMEval( code, doc, node ) {
  70. doc = doc || document;
  71. var i,
  72. script = doc.createElement( "script" );
  73. script.text = code;
  74. if ( node ) {
  75. for ( i in preservedScriptAttributes ) {
  76. if ( node[ i ] ) {
  77. script[ i ] = node[ i ];
  78. }
  79. }
  80. }
  81. doc.head.appendChild( script ).parentNode.removeChild( script );
  82. }
  83. function toType( obj ) {
  84. if ( obj == null ) {
  85. return obj + "";
  86. }
  87. // Support: Android <=2.3 only (functionish RegExp)
  88. return typeof obj === "object" || typeof obj === "function" ?
  89. class2type[ toString.call( obj ) ] || "object" :
  90. typeof obj;
  91. }
  92. /* global Symbol */
  93. // Defining this global in .eslintrc.json would create a danger of using the global
  94. // unguarded in another place, it seems safer to define global only for this module
  95. var
  96. version = "3.3.1",
  97. // Define a local copy of jQuery
  98. jQuery = function( selector, context ) {
  99. // The jQuery object is actually just the init constructor 'enhanced'
  100. // Need init if jQuery is called (just allow error to be thrown if not included)
  101. return new jQuery.fn.init( selector, context );
  102. },
  103. // Support: Android <=4.0 only
  104. // Make sure we trim BOM and NBSP
  105. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  106. jQuery.fn = jQuery.prototype = {
  107. // The current version of jQuery being used
  108. jquery: version,
  109. constructor: jQuery,
  110. // The default length of a jQuery object is 0
  111. length: 0,
  112. toArray: function() {
  113. return slice.call( this );
  114. },
  115. // Get the Nth element in the matched element set OR
  116. // Get the whole matched element set as a clean array
  117. get: function( num ) {
  118. // Return all the elements in a clean array
  119. if ( num == null ) {
  120. return slice.call( this );
  121. }
  122. // Return just the one element from the set
  123. return num < 0 ? this[ num + this.length ] : this[ num ];
  124. },
  125. // Take an array of elements and push it onto the stack
  126. // (returning the new matched element set)
  127. pushStack: function( elems ) {
  128. // Build a new jQuery matched element set
  129. var ret = jQuery.merge( this.constructor(), elems );
  130. // Add the old object onto the stack (as a reference)
  131. ret.prevObject = this;
  132. // Return the newly-formed element set
  133. return ret;
  134. },
  135. // Execute a callback for every element in the matched set.
  136. each: function( callback ) {
  137. return jQuery.each( this, callback );
  138. },
  139. map: function( callback ) {
  140. return this.pushStack( jQuery.map( this, function( elem, i ) {
  141. return callback.call( elem, i, elem );
  142. } ) );
  143. },
  144. slice: function() {
  145. return this.pushStack( slice.apply( this, arguments ) );
  146. },
  147. first: function() {
  148. return this.eq( 0 );
  149. },
  150. last: function() {
  151. return this.eq( -1 );
  152. },
  153. eq: function( i ) {
  154. var len = this.length,
  155. j = +i + ( i < 0 ? len : 0 );
  156. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  157. },
  158. end: function() {
  159. return this.prevObject || this.constructor();
  160. },
  161. // For internal use only.
  162. // Behaves like an Array's method, not like a jQuery method.
  163. push: push,
  164. sort: arr.sort,
  165. splice: arr.splice
  166. };
  167. jQuery.extend = jQuery.fn.extend = function() {
  168. var options, name, src, copy, copyIsArray, clone,
  169. target = arguments[ 0 ] || {},
  170. i = 1,
  171. length = arguments.length,
  172. deep = false;
  173. // Handle a deep copy situation
  174. if ( typeof target === "boolean" ) {
  175. deep = target;
  176. // Skip the boolean and the target
  177. target = arguments[ i ] || {};
  178. i++;
  179. }
  180. // Handle case when target is a string or something (possible in deep copy)
  181. if ( typeof target !== "object" && !isFunction( target ) ) {
  182. target = {};
  183. }
  184. // Extend jQuery itself if only one argument is passed
  185. if ( i === length ) {
  186. target = this;
  187. i--;
  188. }
  189. for ( ; i < length; i++ ) {
  190. // Only deal with non-null/undefined values
  191. if ( ( options = arguments[ i ] ) != null ) {
  192. // Extend the base object
  193. for ( name in options ) {
  194. src = target[ name ];
  195. copy = options[ name ];
  196. // Prevent Object.prototype pollution
  197. // Prevent never-ending loop
  198. if ( name === "__proto__" || target === copy ) {
  199. continue;
  200. }
  201. // Recurse if we're merging plain objects or arrays
  202. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  203. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  204. if ( copyIsArray ) {
  205. copyIsArray = false;
  206. clone = src && Array.isArray( src ) ? src : [];
  207. } else {
  208. clone = src && jQuery.isPlainObject( src ) ? src : {};
  209. }
  210. // Never move original objects, clone them
  211. target[ name ] = jQuery.extend( deep, clone, copy );
  212. // Don't bring in undefined values
  213. } else if ( copy !== undefined ) {
  214. target[ name ] = copy;
  215. }
  216. }
  217. }
  218. }
  219. // Return the modified object
  220. return target;
  221. };
  222. jQuery.extend( {
  223. // Unique for each copy of jQuery on the page
  224. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  225. // Assume jQuery is ready without the ready module
  226. isReady: true,
  227. error: function( msg ) {
  228. throw new Error( msg );
  229. },
  230. noop: function() {},
  231. isPlainObject: function( obj ) {
  232. var proto, Ctor;
  233. // Detect obvious negatives
  234. // Use toString instead of jQuery.type to catch host objects
  235. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  236. return false;
  237. }
  238. proto = getProto( obj );
  239. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  240. if ( !proto ) {
  241. return true;
  242. }
  243. // Objects with prototype are plain iff they were constructed by a global Object function
  244. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  245. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  246. },
  247. isEmptyObject: function( obj ) {
  248. /* eslint-disable no-unused-vars */
  249. // See https://github.com/eslint/eslint/issues/6125
  250. var name;
  251. for ( name in obj ) {
  252. return false;
  253. }
  254. return true;
  255. },
  256. // Evaluates a script in a global context
  257. globalEval: function( code ) {
  258. DOMEval( code );
  259. },
  260. each: function( obj, callback ) {
  261. var length, i = 0;
  262. if ( isArrayLike( obj ) ) {
  263. length = obj.length;
  264. for ( ; i < length; i++ ) {
  265. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  266. break;
  267. }
  268. }
  269. } else {
  270. for ( i in obj ) {
  271. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  272. break;
  273. }
  274. }
  275. }
  276. return obj;
  277. },
  278. // Support: Android <=4.0 only
  279. trim: function( text ) {
  280. return text == null ?
  281. "" :
  282. ( text + "" ).replace( rtrim, "" );
  283. },
  284. // results is for internal usage only
  285. makeArray: function( arr, results ) {
  286. var ret = results || [];
  287. if ( arr != null ) {
  288. if ( isArrayLike( Object( arr ) ) ) {
  289. jQuery.merge( ret,
  290. typeof arr === "string" ?
  291. [ arr ] : arr
  292. );
  293. } else {
  294. push.call( ret, arr );
  295. }
  296. }
  297. return ret;
  298. },
  299. inArray: function( elem, arr, i ) {
  300. return arr == null ? -1 : indexOf.call( arr, elem, i );
  301. },
  302. // Support: Android <=4.0 only, PhantomJS 1 only
  303. // push.apply(_, arraylike) throws on ancient WebKit
  304. merge: function( first, second ) {
  305. var len = +second.length,
  306. j = 0,
  307. i = first.length;
  308. for ( ; j < len; j++ ) {
  309. first[ i++ ] = second[ j ];
  310. }
  311. first.length = i;
  312. return first;
  313. },
  314. grep: function( elems, callback, invert ) {
  315. var callbackInverse,
  316. matches = [],
  317. i = 0,
  318. length = elems.length,
  319. callbackExpect = !invert;
  320. // Go through the array, only saving the items
  321. // that pass the validator function
  322. for ( ; i < length; i++ ) {
  323. callbackInverse = !callback( elems[ i ], i );
  324. if ( callbackInverse !== callbackExpect ) {
  325. matches.push( elems[ i ] );
  326. }
  327. }
  328. return matches;
  329. },
  330. // arg is for internal usage only
  331. map: function( elems, callback, arg ) {
  332. var length, value,
  333. i = 0,
  334. ret = [];
  335. // Go through the array, translating each of the items to their new values
  336. if ( isArrayLike( elems ) ) {
  337. length = elems.length;
  338. for ( ; i < length; i++ ) {
  339. value = callback( elems[ i ], i, arg );
  340. if ( value != null ) {
  341. ret.push( value );
  342. }
  343. }
  344. // Go through every key on the object,
  345. } else {
  346. for ( i in elems ) {
  347. value = callback( elems[ i ], i, arg );
  348. if ( value != null ) {
  349. ret.push( value );
  350. }
  351. }
  352. }
  353. // Flatten any nested arrays
  354. return concat.apply( [], ret );
  355. },
  356. // A global GUID counter for objects
  357. guid: 1,
  358. // jQuery.support is not used in Core but other projects attach their
  359. // properties to it so it needs to exist.
  360. support: support
  361. } );
  362. if ( typeof Symbol === "function" ) {
  363. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  364. }
  365. // Populate the class2type map
  366. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  367. function( i, name ) {
  368. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  369. } );
  370. function isArrayLike( obj ) {
  371. // Support: real iOS 8.2 only (not reproducible in simulator)
  372. // `in` check used to prevent JIT error (gh-2145)
  373. // hasOwn isn't used here due to false negatives
  374. // regarding Nodelist length in IE
  375. var length = !!obj && "length" in obj && obj.length,
  376. type = toType( obj );
  377. if ( isFunction( obj ) || isWindow( obj ) ) {
  378. return false;
  379. }
  380. return type === "array" || length === 0 ||
  381. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  382. }
  383. var Sizzle =
  384. /*!
  385. * Sizzle CSS Selector Engine v2.3.3
  386. * https://sizzlejs.com/
  387. *
  388. * Copyright jQuery Foundation and other contributors
  389. * Released under the MIT license
  390. * http://jquery.org/license
  391. *
  392. * Date: 2016-08-08
  393. */
  394. (function( window ) {
  395. var i,
  396. support,
  397. Expr,
  398. getText,
  399. isXML,
  400. tokenize,
  401. compile,
  402. select,
  403. outermostContext,
  404. sortInput,
  405. hasDuplicate,
  406. // Local document vars
  407. setDocument,
  408. document,
  409. docElem,
  410. documentIsHTML,
  411. rbuggyQSA,
  412. rbuggyMatches,
  413. matches,
  414. contains,
  415. // Instance-specific data
  416. expando = "sizzle" + 1 * new Date(),
  417. preferredDoc = window.document,
  418. dirruns = 0,
  419. done = 0,
  420. classCache = createCache(),
  421. tokenCache = createCache(),
  422. compilerCache = createCache(),
  423. sortOrder = function( a, b ) {
  424. if ( a === b ) {
  425. hasDuplicate = true;
  426. }
  427. return 0;
  428. },
  429. // Instance methods
  430. hasOwn = ({}).hasOwnProperty,
  431. arr = [],
  432. pop = arr.pop,
  433. push_native = arr.push,
  434. push = arr.push,
  435. slice = arr.slice,
  436. // Use a stripped-down indexOf as it's faster than native
  437. // https://jsperf.com/thor-indexof-vs-for/5
  438. indexOf = function( list, elem ) {
  439. var i = 0,
  440. len = list.length;
  441. for ( ; i < len; i++ ) {
  442. if ( list[i] === elem ) {
  443. return i;
  444. }
  445. }
  446. return -1;
  447. },
  448. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  449. // Regular expressions
  450. // http://www.w3.org/TR/css3-selectors/#whitespace
  451. whitespace = "[\\x20\\t\\r\\n\\f]",
  452. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  453. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  454. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  455. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  456. // Operator (capture 2)
  457. "*([*^$|!~]?=)" + whitespace +
  458. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  459. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  460. "*\\]",
  461. pseudos = ":(" + identifier + ")(?:\\((" +
  462. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  463. // 1. quoted (capture 3; capture 4 or capture 5)
  464. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  465. // 2. simple (capture 6)
  466. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  467. // 3. anything else (capture 2)
  468. ".*" +
  469. ")\\)|)",
  470. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  471. rwhitespace = new RegExp( whitespace + "+", "g" ),
  472. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  473. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  474. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  475. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  476. rpseudo = new RegExp( pseudos ),
  477. ridentifier = new RegExp( "^" + identifier + "$" ),
  478. matchExpr = {
  479. "ID": new RegExp( "^#(" + identifier + ")" ),
  480. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  481. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  482. "ATTR": new RegExp( "^" + attributes ),
  483. "PSEUDO": new RegExp( "^" + pseudos ),
  484. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  485. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  486. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  487. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  488. // For use in libraries implementing .is()
  489. // We use this for POS matching in `select`
  490. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  491. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  492. },
  493. rinputs = /^(?:input|select|textarea|button)$/i,
  494. rheader = /^h\d$/i,
  495. rnative = /^[^{]+\{\s*\[native \w/,
  496. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  497. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  498. rsibling = /[+~]/,
  499. // CSS escapes
  500. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  501. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  502. funescape = function( _, escaped, escapedWhitespace ) {
  503. var high = "0x" + escaped - 0x10000;
  504. // NaN means non-codepoint
  505. // Support: Firefox<24
  506. // Workaround erroneous numeric interpretation of +"0x"
  507. return high !== high || escapedWhitespace ?
  508. escaped :
  509. high < 0 ?
  510. // BMP codepoint
  511. String.fromCharCode( high + 0x10000 ) :
  512. // Supplemental Plane codepoint (surrogate pair)
  513. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  514. },
  515. // CSS string/identifier serialization
  516. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  517. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  518. fcssescape = function( ch, asCodePoint ) {
  519. if ( asCodePoint ) {
  520. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  521. if ( ch === "\0" ) {
  522. return "\uFFFD";
  523. }
  524. // Control characters and (dependent upon position) numbers get escaped as code points
  525. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  526. }
  527. // Other potentially-special ASCII characters get backslash-escaped
  528. return "\\" + ch;
  529. },
  530. // Used for iframes
  531. // See setDocument()
  532. // Removing the function wrapper causes a "Permission Denied"
  533. // error in IE
  534. unloadHandler = function() {
  535. setDocument();
  536. },
  537. disabledAncestor = addCombinator(
  538. function( elem ) {
  539. return elem.disabled === true && ("form" in elem || "label" in elem);
  540. },
  541. { dir: "parentNode", next: "legend" }
  542. );
  543. // Optimize for push.apply( _, NodeList )
  544. try {
  545. push.apply(
  546. (arr = slice.call( preferredDoc.childNodes )),
  547. preferredDoc.childNodes
  548. );
  549. // Support: Android<4.0
  550. // Detect silently failing push.apply
  551. arr[ preferredDoc.childNodes.length ].nodeType;
  552. } catch ( e ) {
  553. push = { apply: arr.length ?
  554. // Leverage slice if possible
  555. function( target, els ) {
  556. push_native.apply( target, slice.call(els) );
  557. } :
  558. // Support: IE<9
  559. // Otherwise append directly
  560. function( target, els ) {
  561. var j = target.length,
  562. i = 0;
  563. // Can't trust NodeList.length
  564. while ( (target[j++] = els[i++]) ) {}
  565. target.length = j - 1;
  566. }
  567. };
  568. }
  569. function Sizzle( selector, context, results, seed ) {
  570. var m, i, elem, nid, match, groups, newSelector,
  571. newContext = context && context.ownerDocument,
  572. // nodeType defaults to 9, since context defaults to document
  573. nodeType = context ? context.nodeType : 9;
  574. results = results || [];
  575. // Return early from calls with invalid selector or context
  576. if ( typeof selector !== "string" || !selector ||
  577. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  578. return results;
  579. }
  580. // Try to shortcut find operations (as opposed to filters) in HTML documents
  581. if ( !seed ) {
  582. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  583. setDocument( context );
  584. }
  585. context = context || document;
  586. if ( documentIsHTML ) {
  587. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  588. // (excepting DocumentFragment context, where the methods don't exist)
  589. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  590. // ID selector
  591. if ( (m = match[1]) ) {
  592. // Document context
  593. if ( nodeType === 9 ) {
  594. if ( (elem = context.getElementById( m )) ) {
  595. // Support: IE, Opera, Webkit
  596. // TODO: identify versions
  597. // getElementById can match elements by name instead of ID
  598. if ( elem.id === m ) {
  599. results.push( elem );
  600. return results;
  601. }
  602. } else {
  603. return results;
  604. }
  605. // Element context
  606. } else {
  607. // Support: IE, Opera, Webkit
  608. // TODO: identify versions
  609. // getElementById can match elements by name instead of ID
  610. if ( newContext && (elem = newContext.getElementById( m )) &&
  611. contains( context, elem ) &&
  612. elem.id === m ) {
  613. results.push( elem );
  614. return results;
  615. }
  616. }
  617. // Type selector
  618. } else if ( match[2] ) {
  619. push.apply( results, context.getElementsByTagName( selector ) );
  620. return results;
  621. // Class selector
  622. } else if ( (m = match[3]) && support.getElementsByClassName &&
  623. context.getElementsByClassName ) {
  624. push.apply( results, context.getElementsByClassName( m ) );
  625. return results;
  626. }
  627. }
  628. // Take advantage of querySelectorAll
  629. if ( support.qsa &&
  630. !compilerCache[ selector + " " ] &&
  631. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  632. if ( nodeType !== 1 ) {
  633. newContext = context;
  634. newSelector = selector;
  635. // qSA looks outside Element context, which is not what we want
  636. // Thanks to Andrew Dupont for this workaround technique
  637. // Support: IE <=8
  638. // Exclude object elements
  639. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  640. // Capture the context ID, setting it first if necessary
  641. if ( (nid = context.getAttribute( "id" )) ) {
  642. nid = nid.replace( rcssescape, fcssescape );
  643. } else {
  644. context.setAttribute( "id", (nid = expando) );
  645. }
  646. // Prefix every selector in the list
  647. groups = tokenize( selector );
  648. i = groups.length;
  649. while ( i-- ) {
  650. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  651. }
  652. newSelector = groups.join( "," );
  653. // Expand context for sibling selectors
  654. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  655. context;
  656. }
  657. if ( newSelector ) {
  658. try {
  659. push.apply( results,
  660. newContext.querySelectorAll( newSelector )
  661. );
  662. return results;
  663. } catch ( qsaError ) {
  664. } finally {
  665. if ( nid === expando ) {
  666. context.removeAttribute( "id" );
  667. }
  668. }
  669. }
  670. }
  671. }
  672. }
  673. // All others
  674. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  675. }
  676. /**
  677. * Create key-value caches of limited size
  678. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  679. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  680. * deleting the oldest entry
  681. */
  682. function createCache() {
  683. var keys = [];
  684. function cache( key, value ) {
  685. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  686. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  687. // Only keep the most recent entries
  688. delete cache[ keys.shift() ];
  689. }
  690. return (cache[ key + " " ] = value);
  691. }
  692. return cache;
  693. }
  694. /**
  695. * Mark a function for special use by Sizzle
  696. * @param {Function} fn The function to mark
  697. */
  698. function markFunction( fn ) {
  699. fn[ expando ] = true;
  700. return fn;
  701. }
  702. /**
  703. * Support testing using an element
  704. * @param {Function} fn Passed the created element and returns a boolean result
  705. */
  706. function assert( fn ) {
  707. var el = document.createElement("fieldset");
  708. try {
  709. return !!fn( el );
  710. } catch (e) {
  711. return false;
  712. } finally {
  713. // Remove from its parent by default
  714. if ( el.parentNode ) {
  715. el.parentNode.removeChild( el );
  716. }
  717. // release memory in IE
  718. el = null;
  719. }
  720. }
  721. /**
  722. * Adds the same handler for all of the specified attrs
  723. * @param {String} attrs Pipe-separated list of attributes
  724. * @param {Function} handler The method that will be applied
  725. */
  726. function addHandle( attrs, handler ) {
  727. var arr = attrs.split("|"),
  728. i = arr.length;
  729. while ( i-- ) {
  730. Expr.attrHandle[ arr[i] ] = handler;
  731. }
  732. }
  733. /**
  734. * Checks document order of two siblings
  735. * @param {Element} a
  736. * @param {Element} b
  737. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  738. */
  739. function siblingCheck( a, b ) {
  740. var cur = b && a,
  741. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  742. a.sourceIndex - b.sourceIndex;
  743. // Use IE sourceIndex if available on both nodes
  744. if ( diff ) {
  745. return diff;
  746. }
  747. // Check if b follows a
  748. if ( cur ) {
  749. while ( (cur = cur.nextSibling) ) {
  750. if ( cur === b ) {
  751. return -1;
  752. }
  753. }
  754. }
  755. return a ? 1 : -1;
  756. }
  757. /**
  758. * Returns a function to use in pseudos for input types
  759. * @param {String} type
  760. */
  761. function createInputPseudo( type ) {
  762. return function( elem ) {
  763. var name = elem.nodeName.toLowerCase();
  764. return name === "input" && elem.type === type;
  765. };
  766. }
  767. /**
  768. * Returns a function to use in pseudos for buttons
  769. * @param {String} type
  770. */
  771. function createButtonPseudo( type ) {
  772. return function( elem ) {
  773. var name = elem.nodeName.toLowerCase();
  774. return (name === "input" || name === "button") && elem.type === type;
  775. };
  776. }
  777. /**
  778. * Returns a function to use in pseudos for :enabled/:disabled
  779. * @param {Boolean} disabled true for :disabled; false for :enabled
  780. */
  781. function createDisabledPseudo( disabled ) {
  782. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  783. return function( elem ) {
  784. // Only certain elements can match :enabled or :disabled
  785. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  786. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  787. if ( "form" in elem ) {
  788. // Check for inherited disabledness on relevant non-disabled elements:
  789. // * listed form-associated elements in a disabled fieldset
  790. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  791. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  792. // * option elements in a disabled optgroup
  793. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  794. // All such elements have a "form" property.
  795. if ( elem.parentNode && elem.disabled === false ) {
  796. // Option elements defer to a parent optgroup if present
  797. if ( "label" in elem ) {
  798. if ( "label" in elem.parentNode ) {
  799. return elem.parentNode.disabled === disabled;
  800. } else {
  801. return elem.disabled === disabled;
  802. }
  803. }
  804. // Support: IE 6 - 11
  805. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  806. return elem.isDisabled === disabled ||
  807. // Where there is no isDisabled, check manually
  808. /* jshint -W018 */
  809. elem.isDisabled !== !disabled &&
  810. disabledAncestor( elem ) === disabled;
  811. }
  812. return elem.disabled === disabled;
  813. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  814. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  815. // even exist on them, let alone have a boolean value.
  816. } else if ( "label" in elem ) {
  817. return elem.disabled === disabled;
  818. }
  819. // Remaining elements are neither :enabled nor :disabled
  820. return false;
  821. };
  822. }
  823. /**
  824. * Returns a function to use in pseudos for positionals
  825. * @param {Function} fn
  826. */
  827. function createPositionalPseudo( fn ) {
  828. return markFunction(function( argument ) {
  829. argument = +argument;
  830. return markFunction(function( seed, matches ) {
  831. var j,
  832. matchIndexes = fn( [], seed.length, argument ),
  833. i = matchIndexes.length;
  834. // Match elements found at the specified indexes
  835. while ( i-- ) {
  836. if ( seed[ (j = matchIndexes[i]) ] ) {
  837. seed[j] = !(matches[j] = seed[j]);
  838. }
  839. }
  840. });
  841. });
  842. }
  843. /**
  844. * Checks a node for validity as a Sizzle context
  845. * @param {Element|Object=} context
  846. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  847. */
  848. function testContext( context ) {
  849. return context && typeof context.getElementsByTagName !== "undefined" && context;
  850. }
  851. // Expose support vars for convenience
  852. support = Sizzle.support = {};
  853. /**
  854. * Detects XML nodes
  855. * @param {Element|Object} elem An element or a document
  856. * @returns {Boolean} True iff elem is a non-HTML XML node
  857. */
  858. isXML = Sizzle.isXML = function( elem ) {
  859. // documentElement is verified for cases where it doesn't yet exist
  860. // (such as loading iframes in IE - #4833)
  861. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  862. return documentElement ? documentElement.nodeName !== "HTML" : false;
  863. };
  864. /**
  865. * Sets document-related variables once based on the current document
  866. * @param {Element|Object} [doc] An element or document object to use to set the document
  867. * @returns {Object} Returns the current document
  868. */
  869. setDocument = Sizzle.setDocument = function( node ) {
  870. var hasCompare, subWindow,
  871. doc = node ? node.ownerDocument || node : preferredDoc;
  872. // Return early if doc is invalid or already selected
  873. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  874. return document;
  875. }
  876. // Update global variables
  877. document = doc;
  878. docElem = document.documentElement;
  879. documentIsHTML = !isXML( document );
  880. // Support: IE 9-11, Edge
  881. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  882. if ( preferredDoc !== document &&
  883. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  884. // Support: IE 11, Edge
  885. if ( subWindow.addEventListener ) {
  886. subWindow.addEventListener( "unload", unloadHandler, false );
  887. // Support: IE 9 - 10 only
  888. } else if ( subWindow.attachEvent ) {
  889. subWindow.attachEvent( "onunload", unloadHandler );
  890. }
  891. }
  892. /* Attributes
  893. ---------------------------------------------------------------------- */
  894. // Support: IE<8
  895. // Verify that getAttribute really returns attributes and not properties
  896. // (excepting IE8 booleans)
  897. support.attributes = assert(function( el ) {
  898. el.className = "i";
  899. return !el.getAttribute("className");
  900. });
  901. /* getElement(s)By*
  902. ---------------------------------------------------------------------- */
  903. // Check if getElementsByTagName("*") returns only elements
  904. support.getElementsByTagName = assert(function( el ) {
  905. el.appendChild( document.createComment("") );
  906. return !el.getElementsByTagName("*").length;
  907. });
  908. // Support: IE<9
  909. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  910. // Support: IE<10
  911. // Check if getElementById returns elements by name
  912. // The broken getElementById methods don't pick up programmatically-set names,
  913. // so use a roundabout getElementsByName test
  914. support.getById = assert(function( el ) {
  915. docElem.appendChild( el ).id = expando;
  916. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  917. });
  918. // ID filter and find
  919. if ( support.getById ) {
  920. Expr.filter["ID"] = function( id ) {
  921. var attrId = id.replace( runescape, funescape );
  922. return function( elem ) {
  923. return elem.getAttribute("id") === attrId;
  924. };
  925. };
  926. Expr.find["ID"] = function( id, context ) {
  927. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  928. var elem = context.getElementById( id );
  929. return elem ? [ elem ] : [];
  930. }
  931. };
  932. } else {
  933. Expr.filter["ID"] = function( id ) {
  934. var attrId = id.replace( runescape, funescape );
  935. return function( elem ) {
  936. var node = typeof elem.getAttributeNode !== "undefined" &&
  937. elem.getAttributeNode("id");
  938. return node && node.value === attrId;
  939. };
  940. };
  941. // Support: IE 6 - 7 only
  942. // getElementById is not reliable as a find shortcut
  943. Expr.find["ID"] = function( id, context ) {
  944. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  945. var node, i, elems,
  946. elem = context.getElementById( id );
  947. if ( elem ) {
  948. // Verify the id attribute
  949. node = elem.getAttributeNode("id");
  950. if ( node && node.value === id ) {
  951. return [ elem ];
  952. }
  953. // Fall back on getElementsByName
  954. elems = context.getElementsByName( id );
  955. i = 0;
  956. while ( (elem = elems[i++]) ) {
  957. node = elem.getAttributeNode("id");
  958. if ( node && node.value === id ) {
  959. return [ elem ];
  960. }
  961. }
  962. }
  963. return [];
  964. }
  965. };
  966. }
  967. // Tag
  968. Expr.find["TAG"] = support.getElementsByTagName ?
  969. function( tag, context ) {
  970. if ( typeof context.getElementsByTagName !== "undefined" ) {
  971. return context.getElementsByTagName( tag );
  972. // DocumentFragment nodes don't have gEBTN
  973. } else if ( support.qsa ) {
  974. return context.querySelectorAll( tag );
  975. }
  976. } :
  977. function( tag, context ) {
  978. var elem,
  979. tmp = [],
  980. i = 0,
  981. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  982. results = context.getElementsByTagName( tag );
  983. // Filter out possible comments
  984. if ( tag === "*" ) {
  985. while ( (elem = results[i++]) ) {
  986. if ( elem.nodeType === 1 ) {
  987. tmp.push( elem );
  988. }
  989. }
  990. return tmp;
  991. }
  992. return results;
  993. };
  994. // Class
  995. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  996. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  997. return context.getElementsByClassName( className );
  998. }
  999. };
  1000. /* QSA/matchesSelector
  1001. ---------------------------------------------------------------------- */
  1002. // QSA and matchesSelector support
  1003. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1004. rbuggyMatches = [];
  1005. // qSa(:focus) reports false when true (Chrome 21)
  1006. // We allow this because of a bug in IE8/9 that throws an error
  1007. // whenever `document.activeElement` is accessed on an iframe
  1008. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1009. // See https://bugs.jquery.com/ticket/13378
  1010. rbuggyQSA = [];
  1011. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1012. // Build QSA regex
  1013. // Regex strategy adopted from Diego Perini
  1014. assert(function( el ) {
  1015. // Select is set to empty string on purpose
  1016. // This is to test IE's treatment of not explicitly
  1017. // setting a boolean content attribute,
  1018. // since its presence should be enough
  1019. // https://bugs.jquery.com/ticket/12359
  1020. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1021. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1022. "<option selected=''></option></select>";
  1023. // Support: IE8, Opera 11-12.16
  1024. // Nothing should be selected when empty strings follow ^= or $= or *=
  1025. // The test attribute must be unknown in Opera but "safe" for WinRT
  1026. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1027. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1028. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1029. }
  1030. // Support: IE8
  1031. // Boolean attributes and "value" are not treated correctly
  1032. if ( !el.querySelectorAll("[selected]").length ) {
  1033. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1034. }
  1035. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1036. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1037. rbuggyQSA.push("~=");
  1038. }
  1039. // Webkit/Opera - :checked should return selected option elements
  1040. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1041. // IE8 throws error here and will not see later tests
  1042. if ( !el.querySelectorAll(":checked").length ) {
  1043. rbuggyQSA.push(":checked");
  1044. }
  1045. // Support: Safari 8+, iOS 8+
  1046. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1047. // In-page `selector#id sibling-combinator selector` fails
  1048. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1049. rbuggyQSA.push(".#.+[+~]");
  1050. }
  1051. });
  1052. assert(function( el ) {
  1053. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1054. "<select disabled='disabled'><option/></select>";
  1055. // Support: Windows 8 Native Apps
  1056. // The type and name attributes are restricted during .innerHTML assignment
  1057. var input = document.createElement("input");
  1058. input.setAttribute( "type", "hidden" );
  1059. el.appendChild( input ).setAttribute( "name", "D" );
  1060. // Support: IE8
  1061. // Enforce case-sensitivity of name attribute
  1062. if ( el.querySelectorAll("[name=d]").length ) {
  1063. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1064. }
  1065. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1066. // IE8 throws error here and will not see later tests
  1067. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1068. rbuggyQSA.push( ":enabled", ":disabled" );
  1069. }
  1070. // Support: IE9-11+
  1071. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1072. docElem.appendChild( el ).disabled = true;
  1073. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1074. rbuggyQSA.push( ":enabled", ":disabled" );
  1075. }
  1076. // Opera 10-11 does not throw on post-comma invalid pseudos
  1077. el.querySelectorAll("*,:x");
  1078. rbuggyQSA.push(",.*:");
  1079. });
  1080. }
  1081. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1082. docElem.webkitMatchesSelector ||
  1083. docElem.mozMatchesSelector ||
  1084. docElem.oMatchesSelector ||
  1085. docElem.msMatchesSelector) )) ) {
  1086. assert(function( el ) {
  1087. // Check to see if it's possible to do matchesSelector
  1088. // on a disconnected node (IE 9)
  1089. support.disconnectedMatch = matches.call( el, "*" );
  1090. // This should fail with an exception
  1091. // Gecko does not error, returns false instead
  1092. matches.call( el, "[s!='']:x" );
  1093. rbuggyMatches.push( "!=", pseudos );
  1094. });
  1095. }
  1096. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1097. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1098. /* Contains
  1099. ---------------------------------------------------------------------- */
  1100. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1101. // Element contains another
  1102. // Purposefully self-exclusive
  1103. // As in, an element does not contain itself
  1104. contains = hasCompare || rnative.test( docElem.contains ) ?
  1105. function( a, b ) {
  1106. var adown = a.nodeType === 9 ? a.documentElement : a,
  1107. bup = b && b.parentNode;
  1108. return a === bup || !!( bup && bup.nodeType === 1 && (
  1109. adown.contains ?
  1110. adown.contains( bup ) :
  1111. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1112. ));
  1113. } :
  1114. function( a, b ) {
  1115. if ( b ) {
  1116. while ( (b = b.parentNode) ) {
  1117. if ( b === a ) {
  1118. return true;
  1119. }
  1120. }
  1121. }
  1122. return false;
  1123. };
  1124. /* Sorting
  1125. ---------------------------------------------------------------------- */
  1126. // Document order sorting
  1127. sortOrder = hasCompare ?
  1128. function( a, b ) {
  1129. // Flag for duplicate removal
  1130. if ( a === b ) {
  1131. hasDuplicate = true;
  1132. return 0;
  1133. }
  1134. // Sort on method existence if only one input has compareDocumentPosition
  1135. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1136. if ( compare ) {
  1137. return compare;
  1138. }
  1139. // Calculate position if both inputs belong to the same document
  1140. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1141. a.compareDocumentPosition( b ) :
  1142. // Otherwise we know they are disconnected
  1143. 1;
  1144. // Disconnected nodes
  1145. if ( compare & 1 ||
  1146. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1147. // Choose the first element that is related to our preferred document
  1148. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1149. return -1;
  1150. }
  1151. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1152. return 1;
  1153. }
  1154. // Maintain original order
  1155. return sortInput ?
  1156. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1157. 0;
  1158. }
  1159. return compare & 4 ? -1 : 1;
  1160. } :
  1161. function( a, b ) {
  1162. // Exit early if the nodes are identical
  1163. if ( a === b ) {
  1164. hasDuplicate = true;
  1165. return 0;
  1166. }
  1167. var cur,
  1168. i = 0,
  1169. aup = a.parentNode,
  1170. bup = b.parentNode,
  1171. ap = [ a ],
  1172. bp = [ b ];
  1173. // Parentless nodes are either documents or disconnected
  1174. if ( !aup || !bup ) {
  1175. return a === document ? -1 :
  1176. b === document ? 1 :
  1177. aup ? -1 :
  1178. bup ? 1 :
  1179. sortInput ?
  1180. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1181. 0;
  1182. // If the nodes are siblings, we can do a quick check
  1183. } else if ( aup === bup ) {
  1184. return siblingCheck( a, b );
  1185. }
  1186. // Otherwise we need full lists of their ancestors for comparison
  1187. cur = a;
  1188. while ( (cur = cur.parentNode) ) {
  1189. ap.unshift( cur );
  1190. }
  1191. cur = b;
  1192. while ( (cur = cur.parentNode) ) {
  1193. bp.unshift( cur );
  1194. }
  1195. // Walk down the tree looking for a discrepancy
  1196. while ( ap[i] === bp[i] ) {
  1197. i++;
  1198. }
  1199. return i ?
  1200. // Do a sibling check if the nodes have a common ancestor
  1201. siblingCheck( ap[i], bp[i] ) :
  1202. // Otherwise nodes in our document sort first
  1203. ap[i] === preferredDoc ? -1 :
  1204. bp[i] === preferredDoc ? 1 :
  1205. 0;
  1206. };
  1207. return document;
  1208. };
  1209. Sizzle.matches = function( expr, elements ) {
  1210. return Sizzle( expr, null, null, elements );
  1211. };
  1212. Sizzle.matchesSelector = function( elem, expr ) {
  1213. // Set document vars if needed
  1214. if ( ( elem.ownerDocument || elem ) !== document ) {
  1215. setDocument( elem );
  1216. }
  1217. // Make sure that attribute selectors are quoted
  1218. expr = expr.replace( rattributeQuotes, "='$1']" );
  1219. if ( support.matchesSelector && documentIsHTML &&
  1220. !compilerCache[ expr + " " ] &&
  1221. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1222. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1223. try {
  1224. var ret = matches.call( elem, expr );
  1225. // IE 9's matchesSelector returns false on disconnected nodes
  1226. if ( ret || support.disconnectedMatch ||
  1227. // As well, disconnected nodes are said to be in a document
  1228. // fragment in IE 9
  1229. elem.document && elem.document.nodeType !== 11 ) {
  1230. return ret;
  1231. }
  1232. } catch (e) {}
  1233. }
  1234. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1235. };
  1236. Sizzle.contains = function( context, elem ) {
  1237. // Set document vars if needed
  1238. if ( ( context.ownerDocument || context ) !== document ) {
  1239. setDocument( context );
  1240. }
  1241. return contains( context, elem );
  1242. };
  1243. Sizzle.attr = function( elem, name ) {
  1244. // Set document vars if needed
  1245. if ( ( elem.ownerDocument || elem ) !== document ) {
  1246. setDocument( elem );
  1247. }
  1248. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1249. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1250. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1251. fn( elem, name, !documentIsHTML ) :
  1252. undefined;
  1253. return val !== undefined ?
  1254. val :
  1255. support.attributes || !documentIsHTML ?
  1256. elem.getAttribute( name ) :
  1257. (val = elem.getAttributeNode(name)) && val.specified ?
  1258. val.value :
  1259. null;
  1260. };
  1261. Sizzle.escape = function( sel ) {
  1262. return (sel + "").replace( rcssescape, fcssescape );
  1263. };
  1264. Sizzle.error = function( msg ) {
  1265. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1266. };
  1267. /**
  1268. * Document sorting and removing duplicates
  1269. * @param {ArrayLike} results
  1270. */
  1271. Sizzle.uniqueSort = function( results ) {
  1272. var elem,
  1273. duplicates = [],
  1274. j = 0,
  1275. i = 0;
  1276. // Unless we *know* we can detect duplicates, assume their presence
  1277. hasDuplicate = !support.detectDuplicates;
  1278. sortInput = !support.sortStable && results.slice( 0 );
  1279. results.sort( sortOrder );
  1280. if ( hasDuplicate ) {
  1281. while ( (elem = results[i++]) ) {
  1282. if ( elem === results[ i ] ) {
  1283. j = duplicates.push( i );
  1284. }
  1285. }
  1286. while ( j-- ) {
  1287. results.splice( duplicates[ j ], 1 );
  1288. }
  1289. }
  1290. // Clear input after sorting to release objects
  1291. // See https://github.com/jquery/sizzle/pull/225
  1292. sortInput = null;
  1293. return results;
  1294. };
  1295. /**
  1296. * Utility function for retrieving the text value of an array of DOM nodes
  1297. * @param {Array|Element} elem
  1298. */
  1299. getText = Sizzle.getText = function( elem ) {
  1300. var node,
  1301. ret = "",
  1302. i = 0,
  1303. nodeType = elem.nodeType;
  1304. if ( !nodeType ) {
  1305. // If no nodeType, this is expected to be an array
  1306. while ( (node = elem[i++]) ) {
  1307. // Do not traverse comment nodes
  1308. ret += getText( node );
  1309. }
  1310. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1311. // Use textContent for elements
  1312. // innerText usage removed for consistency of new lines (jQuery #11153)
  1313. if ( typeof elem.textContent === "string" ) {
  1314. return elem.textContent;
  1315. } else {
  1316. // Traverse its children
  1317. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1318. ret += getText( elem );
  1319. }
  1320. }
  1321. } else if ( nodeType === 3 || nodeType === 4 ) {
  1322. return elem.nodeValue;
  1323. }
  1324. // Do not include comment or processing instruction nodes
  1325. return ret;
  1326. };
  1327. Expr = Sizzle.selectors = {
  1328. // Can be adjusted by the user
  1329. cacheLength: 50,
  1330. createPseudo: markFunction,
  1331. match: matchExpr,
  1332. attrHandle: {},
  1333. find: {},
  1334. relative: {
  1335. ">": { dir: "parentNode", first: true },
  1336. " ": { dir: "parentNode" },
  1337. "+": { dir: "previousSibling", first: true },
  1338. "~": { dir: "previousSibling" }
  1339. },
  1340. preFilter: {
  1341. "ATTR": function( match ) {
  1342. match[1] = match[1].replace( runescape, funescape );
  1343. // Move the given value to match[3] whether quoted or unquoted
  1344. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1345. if ( match[2] === "~=" ) {
  1346. match[3] = " " + match[3] + " ";
  1347. }
  1348. return match.slice( 0, 4 );
  1349. },
  1350. "CHILD": function( match ) {
  1351. /* matches from matchExpr["CHILD"]
  1352. 1 type (only|nth|...)
  1353. 2 what (child|of-type)
  1354. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1355. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1356. 5 sign of xn-component
  1357. 6 x of xn-component
  1358. 7 sign of y-component
  1359. 8 y of y-component
  1360. */
  1361. match[1] = match[1].toLowerCase();
  1362. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1363. // nth-* requires argument
  1364. if ( !match[3] ) {
  1365. Sizzle.error( match[0] );
  1366. }
  1367. // numeric x and y parameters for Expr.filter.CHILD
  1368. // remember that false/true cast respectively to 0/1
  1369. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1370. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1371. // other types prohibit arguments
  1372. } else if ( match[3] ) {
  1373. Sizzle.error( match[0] );
  1374. }
  1375. return match;
  1376. },
  1377. "PSEUDO": function( match ) {
  1378. var excess,
  1379. unquoted = !match[6] && match[2];
  1380. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1381. return null;
  1382. }
  1383. // Accept quoted arguments as-is
  1384. if ( match[3] ) {
  1385. match[2] = match[4] || match[5] || "";
  1386. // Strip excess characters from unquoted arguments
  1387. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1388. // Get excess from tokenize (recursively)
  1389. (excess = tokenize( unquoted, true )) &&
  1390. // advance to the next closing parenthesis
  1391. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1392. // excess is a negative index
  1393. match[0] = match[0].slice( 0, excess );
  1394. match[2] = unquoted.slice( 0, excess );
  1395. }
  1396. // Return only captures needed by the pseudo filter method (type and argument)
  1397. return match.slice( 0, 3 );
  1398. }
  1399. },
  1400. filter: {
  1401. "TAG": function( nodeNameSelector ) {
  1402. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1403. return nodeNameSelector === "*" ?
  1404. function() { return true; } :
  1405. function( elem ) {
  1406. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1407. };
  1408. },
  1409. "CLASS": function( className ) {
  1410. var pattern = classCache[ className + " " ];
  1411. return pattern ||
  1412. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1413. classCache( className, function( elem ) {
  1414. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1415. });
  1416. },
  1417. "ATTR": function( name, operator, check ) {
  1418. return function( elem ) {
  1419. var result = Sizzle.attr( elem, name );
  1420. if ( result == null ) {
  1421. return operator === "!=";
  1422. }
  1423. if ( !operator ) {
  1424. return true;
  1425. }
  1426. result += "";
  1427. return operator === "=" ? result === check :
  1428. operator === "!=" ? result !== check :
  1429. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1430. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1431. operator === "$=" ? check && result.slice( -check.length ) === check :
  1432. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1433. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1434. false;
  1435. };
  1436. },
  1437. "CHILD": function( type, what, argument, first, last ) {
  1438. var simple = type.slice( 0, 3 ) !== "nth",
  1439. forward = type.slice( -4 ) !== "last",
  1440. ofType = what === "of-type";
  1441. return first === 1 && last === 0 ?
  1442. // Shortcut for :nth-*(n)
  1443. function( elem ) {
  1444. return !!elem.parentNode;
  1445. } :
  1446. function( elem, context, xml ) {
  1447. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1448. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1449. parent = elem.parentNode,
  1450. name = ofType && elem.nodeName.toLowerCase(),
  1451. useCache = !xml && !ofType,
  1452. diff = false;
  1453. if ( parent ) {
  1454. // :(first|last|only)-(child|of-type)
  1455. if ( simple ) {
  1456. while ( dir ) {
  1457. node = elem;
  1458. while ( (node = node[ dir ]) ) {
  1459. if ( ofType ?
  1460. node.nodeName.toLowerCase() === name :
  1461. node.nodeType === 1 ) {
  1462. return false;
  1463. }
  1464. }
  1465. // Reverse direction for :only-* (if we haven't yet done so)
  1466. start = dir = type === "only" && !start && "nextSibling";
  1467. }
  1468. return true;
  1469. }
  1470. start = [ forward ? parent.firstChild : parent.lastChild ];
  1471. // non-xml :nth-child(...) stores cache data on `parent`
  1472. if ( forward && useCache ) {
  1473. // Seek `elem` from a previously-cached index
  1474. // ...in a gzip-friendly way
  1475. node = parent;
  1476. outerCache = node[ expando ] || (node[ expando ] = {});
  1477. // Support: IE <9 only
  1478. // Defend against cloned attroperties (jQuery gh-1709)
  1479. uniqueCache = outerCache[ node.uniqueID ] ||
  1480. (outerCache[ node.uniqueID ] = {});
  1481. cache = uniqueCache[ type ] || [];
  1482. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1483. diff = nodeIndex && cache[ 2 ];
  1484. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1485. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1486. // Fallback to seeking `elem` from the start
  1487. (diff = nodeIndex = 0) || start.pop()) ) {
  1488. // When found, cache indexes on `parent` and break
  1489. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1490. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1491. break;
  1492. }
  1493. }
  1494. } else {
  1495. // Use previously-cached element index if available
  1496. if ( useCache ) {
  1497. // ...in a gzip-friendly way
  1498. node = elem;
  1499. outerCache = node[ expando ] || (node[ expando ] = {});
  1500. // Support: IE <9 only
  1501. // Defend against cloned attroperties (jQuery gh-1709)
  1502. uniqueCache = outerCache[ node.uniqueID ] ||
  1503. (outerCache[ node.uniqueID ] = {});
  1504. cache = uniqueCache[ type ] || [];
  1505. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1506. diff = nodeIndex;
  1507. }
  1508. // xml :nth-child(...)
  1509. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1510. if ( diff === false ) {
  1511. // Use the same loop as above to seek `elem` from the start
  1512. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1513. (diff = nodeIndex = 0) || start.pop()) ) {
  1514. if ( ( ofType ?
  1515. node.nodeName.toLowerCase() === name :
  1516. node.nodeType === 1 ) &&
  1517. ++diff ) {
  1518. // Cache the index of each encountered element
  1519. if ( useCache ) {
  1520. outerCache = node[ expando ] || (node[ expando ] = {});
  1521. // Support: IE <9 only
  1522. // Defend against cloned attroperties (jQuery gh-1709)
  1523. uniqueCache = outerCache[ node.uniqueID ] ||
  1524. (outerCache[ node.uniqueID ] = {});
  1525. uniqueCache[ type ] = [ dirruns, diff ];
  1526. }
  1527. if ( node === elem ) {
  1528. break;
  1529. }
  1530. }
  1531. }
  1532. }
  1533. }
  1534. // Incorporate the offset, then check against cycle size
  1535. diff -= last;
  1536. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1537. }
  1538. };
  1539. },
  1540. "PSEUDO": function( pseudo, argument ) {
  1541. // pseudo-class names are case-insensitive
  1542. // http://www.w3.org/TR/selectors/#pseudo-classes
  1543. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1544. // Remember that setFilters inherits from pseudos
  1545. var args,
  1546. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1547. Sizzle.error( "unsupported pseudo: " + pseudo );
  1548. // The user may use createPseudo to indicate that
  1549. // arguments are needed to create the filter function
  1550. // just as Sizzle does
  1551. if ( fn[ expando ] ) {
  1552. return fn( argument );
  1553. }
  1554. // But maintain support for old signatures
  1555. if ( fn.length > 1 ) {
  1556. args = [ pseudo, pseudo, "", argument ];
  1557. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1558. markFunction(function( seed, matches ) {
  1559. var idx,
  1560. matched = fn( seed, argument ),
  1561. i = matched.length;
  1562. while ( i-- ) {
  1563. idx = indexOf( seed, matched[i] );
  1564. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1565. }
  1566. }) :
  1567. function( elem ) {
  1568. return fn( elem, 0, args );
  1569. };
  1570. }
  1571. return fn;
  1572. }
  1573. },
  1574. pseudos: {
  1575. // Potentially complex pseudos
  1576. "not": markFunction(function( selector ) {
  1577. // Trim the selector passed to compile
  1578. // to avoid treating leading and trailing
  1579. // spaces as combinators
  1580. var input = [],
  1581. results = [],
  1582. matcher = compile( selector.replace( rtrim, "$1" ) );
  1583. return matcher[ expando ] ?
  1584. markFunction(function( seed, matches, context, xml ) {
  1585. var elem,
  1586. unmatched = matcher( seed, null, xml, [] ),
  1587. i = seed.length;
  1588. // Match elements unmatched by `matcher`
  1589. while ( i-- ) {
  1590. if ( (elem = unmatched[i]) ) {
  1591. seed[i] = !(matches[i] = elem);
  1592. }
  1593. }
  1594. }) :
  1595. function( elem, context, xml ) {
  1596. input[0] = elem;
  1597. matcher( input, null, xml, results );
  1598. // Don't keep the element (issue #299)
  1599. input[0] = null;
  1600. return !results.pop();
  1601. };
  1602. }),
  1603. "has": markFunction(function( selector ) {
  1604. return function( elem ) {
  1605. return Sizzle( selector, elem ).length > 0;
  1606. };
  1607. }),
  1608. "contains": markFunction(function( text ) {
  1609. text = text.replace( runescape, funescape );
  1610. return function( elem ) {
  1611. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1612. };
  1613. }),
  1614. // "Whether an element is represented by a :lang() selector
  1615. // is based solely on the element's language value
  1616. // being equal to the identifier C,
  1617. // or beginning with the identifier C immediately followed by "-".
  1618. // The matching of C against the element's language value is performed case-insensitively.
  1619. // The identifier C does not have to be a valid language name."
  1620. // http://www.w3.org/TR/selectors/#lang-pseudo
  1621. "lang": markFunction( function( lang ) {
  1622. // lang value must be a valid identifier
  1623. if ( !ridentifier.test(lang || "") ) {
  1624. Sizzle.error( "unsupported lang: " + lang );
  1625. }
  1626. lang = lang.replace( runescape, funescape ).toLowerCase();
  1627. return function( elem ) {
  1628. var elemLang;
  1629. do {
  1630. if ( (elemLang = documentIsHTML ?
  1631. elem.lang :
  1632. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1633. elemLang = elemLang.toLowerCase();
  1634. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1635. }
  1636. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1637. return false;
  1638. };
  1639. }),
  1640. // Miscellaneous
  1641. "target": function( elem ) {
  1642. var hash = window.location && window.location.hash;
  1643. return hash && hash.slice( 1 ) === elem.id;
  1644. },
  1645. "root": function( elem ) {
  1646. return elem === docElem;
  1647. },
  1648. "focus": function( elem ) {
  1649. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1650. },
  1651. // Boolean properties
  1652. "enabled": createDisabledPseudo( false ),
  1653. "disabled": createDisabledPseudo( true ),
  1654. "checked": function( elem ) {
  1655. // In CSS3, :checked should return both checked and selected elements
  1656. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1657. var nodeName = elem.nodeName.toLowerCase();
  1658. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1659. },
  1660. "selected": function( elem ) {
  1661. // Accessing this property makes selected-by-default
  1662. // options in Safari work properly
  1663. if ( elem.parentNode ) {
  1664. elem.parentNode.selectedIndex;
  1665. }
  1666. return elem.selected === true;
  1667. },
  1668. // Contents
  1669. "empty": function( elem ) {
  1670. // http://www.w3.org/TR/selectors/#empty-pseudo
  1671. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1672. // but not by others (comment: 8; processing instruction: 7; etc.)
  1673. // nodeType < 6 works because attributes (2) do not appear as children
  1674. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1675. if ( elem.nodeType < 6 ) {
  1676. return false;
  1677. }
  1678. }
  1679. return true;
  1680. },
  1681. "parent": function( elem ) {
  1682. return !Expr.pseudos["empty"]( elem );
  1683. },
  1684. // Element/input types
  1685. "header": function( elem ) {
  1686. return rheader.test( elem.nodeName );
  1687. },
  1688. "input": function( elem ) {
  1689. return rinputs.test( elem.nodeName );
  1690. },
  1691. "button": function( elem ) {
  1692. var name = elem.nodeName.toLowerCase();
  1693. return name === "input" && elem.type === "button" || name === "button";
  1694. },
  1695. "text": function( elem ) {
  1696. var attr;
  1697. return elem.nodeName.toLowerCase() === "input" &&
  1698. elem.type === "text" &&
  1699. // Support: IE<8
  1700. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1701. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1702. },
  1703. // Position-in-collection
  1704. "first": createPositionalPseudo(function() {
  1705. return [ 0 ];
  1706. }),
  1707. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1708. return [ length - 1 ];
  1709. }),
  1710. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1711. return [ argument < 0 ? argument + length : argument ];
  1712. }),
  1713. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1714. var i = 0;
  1715. for ( ; i < length; i += 2 ) {
  1716. matchIndexes.push( i );
  1717. }
  1718. return matchIndexes;
  1719. }),
  1720. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1721. var i = 1;
  1722. for ( ; i < length; i += 2 ) {
  1723. matchIndexes.push( i );
  1724. }
  1725. return matchIndexes;
  1726. }),
  1727. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1728. var i = argument < 0 ? argument + length : argument;
  1729. for ( ; --i >= 0; ) {
  1730. matchIndexes.push( i );
  1731. }
  1732. return matchIndexes;
  1733. }),
  1734. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1735. var i = argument < 0 ? argument + length : argument;
  1736. for ( ; ++i < length; ) {
  1737. matchIndexes.push( i );
  1738. }
  1739. return matchIndexes;
  1740. })
  1741. }
  1742. };
  1743. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1744. // Add button/input type pseudos
  1745. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1746. Expr.pseudos[ i ] = createInputPseudo( i );
  1747. }
  1748. for ( i in { submit: true, reset: true } ) {
  1749. Expr.pseudos[ i ] = createButtonPseudo( i );
  1750. }
  1751. // Easy API for creating new setFilters
  1752. function setFilters() {}
  1753. setFilters.prototype = Expr.filters = Expr.pseudos;
  1754. Expr.setFilters = new setFilters();
  1755. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1756. var matched, match, tokens, type,
  1757. soFar, groups, preFilters,
  1758. cached = tokenCache[ selector + " " ];
  1759. if ( cached ) {
  1760. return parseOnly ? 0 : cached.slice( 0 );
  1761. }
  1762. soFar = selector;
  1763. groups = [];
  1764. preFilters = Expr.preFilter;
  1765. while ( soFar ) {
  1766. // Comma and first run
  1767. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1768. if ( match ) {
  1769. // Don't consume trailing commas as valid
  1770. soFar = soFar.slice( match[0].length ) || soFar;
  1771. }
  1772. groups.push( (tokens = []) );
  1773. }
  1774. matched = false;
  1775. // Combinators
  1776. if ( (match = rcombinators.exec( soFar )) ) {
  1777. matched = match.shift();
  1778. tokens.push({
  1779. value: matched,
  1780. // Cast descendant combinators to space
  1781. type: match[0].replace( rtrim, " " )
  1782. });
  1783. soFar = soFar.slice( matched.length );
  1784. }
  1785. // Filters
  1786. for ( type in Expr.filter ) {
  1787. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1788. (match = preFilters[ type ]( match ))) ) {
  1789. matched = match.shift();
  1790. tokens.push({
  1791. value: matched,
  1792. type: type,
  1793. matches: match
  1794. });
  1795. soFar = soFar.slice( matched.length );
  1796. }
  1797. }
  1798. if ( !matched ) {
  1799. break;
  1800. }
  1801. }
  1802. // Return the length of the invalid excess
  1803. // if we're just parsing
  1804. // Otherwise, throw an error or return tokens
  1805. return parseOnly ?
  1806. soFar.length :
  1807. soFar ?
  1808. Sizzle.error( selector ) :
  1809. // Cache the tokens
  1810. tokenCache( selector, groups ).slice( 0 );
  1811. };
  1812. function toSelector( tokens ) {
  1813. var i = 0,
  1814. len = tokens.length,
  1815. selector = "";
  1816. for ( ; i < len; i++ ) {
  1817. selector += tokens[i].value;
  1818. }
  1819. return selector;
  1820. }
  1821. function addCombinator( matcher, combinator, base ) {
  1822. var dir = combinator.dir,
  1823. skip = combinator.next,
  1824. key = skip || dir,
  1825. checkNonElements = base && key === "parentNode",
  1826. doneName = done++;
  1827. return combinator.first ?
  1828. // Check against closest ancestor/preceding element
  1829. function( elem, context, xml ) {
  1830. while ( (elem = elem[ dir ]) ) {
  1831. if ( elem.nodeType === 1 || checkNonElements ) {
  1832. return matcher( elem, context, xml );
  1833. }
  1834. }
  1835. return false;
  1836. } :
  1837. // Check against all ancestor/preceding elements
  1838. function( elem, context, xml ) {
  1839. var oldCache, uniqueCache, outerCache,
  1840. newCache = [ dirruns, doneName ];
  1841. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1842. if ( xml ) {
  1843. while ( (elem = elem[ dir ]) ) {
  1844. if ( elem.nodeType === 1 || checkNonElements ) {
  1845. if ( matcher( elem, context, xml ) ) {
  1846. return true;
  1847. }
  1848. }
  1849. }
  1850. } else {
  1851. while ( (elem = elem[ dir ]) ) {
  1852. if ( elem.nodeType === 1 || checkNonElements ) {
  1853. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1854. // Support: IE <9 only
  1855. // Defend against cloned attroperties (jQuery gh-1709)
  1856. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  1857. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  1858. elem = elem[ dir ] || elem;
  1859. } else if ( (oldCache = uniqueCache[ key ]) &&
  1860. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1861. // Assign to newCache so results back-propagate to previous elements
  1862. return (newCache[ 2 ] = oldCache[ 2 ]);
  1863. } else {
  1864. // Reuse newcache so results back-propagate to previous elements
  1865. uniqueCache[ key ] = newCache;
  1866. // A match means we're done; a fail means we have to keep checking
  1867. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1868. return true;
  1869. }
  1870. }
  1871. }
  1872. }
  1873. }
  1874. return false;
  1875. };
  1876. }
  1877. function elementMatcher( matchers ) {
  1878. return matchers.length > 1 ?
  1879. function( elem, context, xml ) {
  1880. var i = matchers.length;
  1881. while ( i-- ) {
  1882. if ( !matchers[i]( elem, context, xml ) ) {
  1883. return false;
  1884. }
  1885. }
  1886. return true;
  1887. } :
  1888. matchers[0];
  1889. }
  1890. function multipleContexts( selector, contexts, results ) {
  1891. var i = 0,
  1892. len = contexts.length;
  1893. for ( ; i < len; i++ ) {
  1894. Sizzle( selector, contexts[i], results );
  1895. }
  1896. return results;
  1897. }
  1898. function condense( unmatched, map, filter, context, xml ) {
  1899. var elem,
  1900. newUnmatched = [],
  1901. i = 0,
  1902. len = unmatched.length,
  1903. mapped = map != null;
  1904. for ( ; i < len; i++ ) {
  1905. if ( (elem = unmatched[i]) ) {
  1906. if ( !filter || filter( elem, context, xml ) ) {
  1907. newUnmatched.push( elem );
  1908. if ( mapped ) {
  1909. map.push( i );
  1910. }
  1911. }
  1912. }
  1913. }
  1914. return newUnmatched;
  1915. }
  1916. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1917. if ( postFilter && !postFilter[ expando ] ) {
  1918. postFilter = setMatcher( postFilter );
  1919. }
  1920. if ( postFinder && !postFinder[ expando ] ) {
  1921. postFinder = setMatcher( postFinder, postSelector );
  1922. }
  1923. return markFunction(function( seed, results, context, xml ) {
  1924. var temp, i, elem,
  1925. preMap = [],
  1926. postMap = [],
  1927. preexisting = results.length,
  1928. // Get initial elements from seed or context
  1929. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1930. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1931. matcherIn = preFilter && ( seed || !selector ) ?
  1932. condense( elems, preMap, preFilter, context, xml ) :
  1933. elems,
  1934. matcherOut = matcher ?
  1935. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1936. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1937. // ...intermediate processing is necessary
  1938. [] :
  1939. // ...otherwise use results directly
  1940. results :
  1941. matcherIn;
  1942. // Find primary matches
  1943. if ( matcher ) {
  1944. matcher( matcherIn, matcherOut, context, xml );
  1945. }
  1946. // Apply postFilter
  1947. if ( postFilter ) {
  1948. temp = condense( matcherOut, postMap );
  1949. postFilter( temp, [], context, xml );
  1950. // Un-match failing elements by moving them back to matcherIn
  1951. i = temp.length;
  1952. while ( i-- ) {
  1953. if ( (elem = temp[i]) ) {
  1954. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1955. }
  1956. }
  1957. }
  1958. if ( seed ) {
  1959. if ( postFinder || preFilter ) {
  1960. if ( postFinder ) {
  1961. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1962. temp = [];
  1963. i = matcherOut.length;
  1964. while ( i-- ) {
  1965. if ( (elem = matcherOut[i]) ) {
  1966. // Restore matcherIn since elem is not yet a final match
  1967. temp.push( (matcherIn[i] = elem) );
  1968. }
  1969. }
  1970. postFinder( null, (matcherOut = []), temp, xml );
  1971. }
  1972. // Move matched elements from seed to results to keep them synchronized
  1973. i = matcherOut.length;
  1974. while ( i-- ) {
  1975. if ( (elem = matcherOut[i]) &&
  1976. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  1977. seed[temp] = !(results[temp] = elem);
  1978. }
  1979. }
  1980. }
  1981. // Add elements to results, through postFinder if defined
  1982. } else {
  1983. matcherOut = condense(
  1984. matcherOut === results ?
  1985. matcherOut.splice( preexisting, matcherOut.length ) :
  1986. matcherOut
  1987. );
  1988. if ( postFinder ) {
  1989. postFinder( null, results, matcherOut, xml );
  1990. } else {
  1991. push.apply( results, matcherOut );
  1992. }
  1993. }
  1994. });
  1995. }
  1996. function matcherFromTokens( tokens ) {
  1997. var checkContext, matcher, j,
  1998. len = tokens.length,
  1999. leadingRelative = Expr.relative[ tokens[0].type ],
  2000. implicitRelative = leadingRelative || Expr.relative[" "],
  2001. i = leadingRelative ? 1 : 0,
  2002. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2003. matchContext = addCombinator( function( elem ) {
  2004. return elem === checkContext;
  2005. }, implicitRelative, true ),
  2006. matchAnyContext = addCombinator( function( elem ) {
  2007. return indexOf( checkContext, elem ) > -1;
  2008. }, implicitRelative, true ),
  2009. matchers = [ function( elem, context, xml ) {
  2010. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2011. (checkContext = context).nodeType ?
  2012. matchContext( elem, context, xml ) :
  2013. matchAnyContext( elem, context, xml ) );
  2014. // Avoid hanging onto element (issue #299)
  2015. checkContext = null;
  2016. return ret;
  2017. } ];
  2018. for ( ; i < len; i++ ) {
  2019. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2020. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2021. } else {
  2022. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2023. // Return special upon seeing a positional matcher
  2024. if ( matcher[ expando ] ) {
  2025. // Find the next relative operator (if any) for proper handling
  2026. j = ++i;
  2027. for ( ; j < len; j++ ) {
  2028. if ( Expr.relative[ tokens[j].type ] ) {
  2029. break;
  2030. }
  2031. }
  2032. return setMatcher(
  2033. i > 1 && elementMatcher( matchers ),
  2034. i > 1 && toSelector(
  2035. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2036. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2037. ).replace( rtrim, "$1" ),
  2038. matcher,
  2039. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2040. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2041. j < len && toSelector( tokens )
  2042. );
  2043. }
  2044. matchers.push( matcher );
  2045. }
  2046. }
  2047. return elementMatcher( matchers );
  2048. }
  2049. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2050. var bySet = setMatchers.length > 0,
  2051. byElement = elementMatchers.length > 0,
  2052. superMatcher = function( seed, context, xml, results, outermost ) {
  2053. var elem, j, matcher,
  2054. matchedCount = 0,
  2055. i = "0",
  2056. unmatched = seed && [],
  2057. setMatched = [],
  2058. contextBackup = outermostContext,
  2059. // We must always have either seed elements or outermost context
  2060. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2061. // Use integer dirruns iff this is the outermost matcher
  2062. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2063. len = elems.length;
  2064. if ( outermost ) {
  2065. outermostContext = context === document || context || outermost;
  2066. }
  2067. // Add elements passing elementMatchers directly to results
  2068. // Support: IE<9, Safari
  2069. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2070. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2071. if ( byElement && elem ) {
  2072. j = 0;
  2073. if ( !context && elem.ownerDocument !== document ) {
  2074. setDocument( elem );
  2075. xml = !documentIsHTML;
  2076. }
  2077. while ( (matcher = elementMatchers[j++]) ) {
  2078. if ( matcher( elem, context || document, xml) ) {
  2079. results.push( elem );
  2080. break;
  2081. }
  2082. }
  2083. if ( outermost ) {
  2084. dirruns = dirrunsUnique;
  2085. }
  2086. }
  2087. // Track unmatched elements for set filters
  2088. if ( bySet ) {
  2089. // They will have gone through all possible matchers
  2090. if ( (elem = !matcher && elem) ) {
  2091. matchedCount--;
  2092. }
  2093. // Lengthen the array for every element, matched or not
  2094. if ( seed ) {
  2095. unmatched.push( elem );
  2096. }
  2097. }
  2098. }
  2099. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2100. // makes the latter nonnegative.
  2101. matchedCount += i;
  2102. // Apply set filters to unmatched elements
  2103. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2104. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2105. // no element matchers and no seed.
  2106. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2107. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2108. // numerically zero.
  2109. if ( bySet && i !== matchedCount ) {
  2110. j = 0;
  2111. while ( (matcher = setMatchers[j++]) ) {
  2112. matcher( unmatched, setMatched, context, xml );
  2113. }
  2114. if ( seed ) {
  2115. // Reintegrate element matches to eliminate the need for sorting
  2116. if ( matchedCount > 0 ) {
  2117. while ( i-- ) {
  2118. if ( !(unmatched[i] || setMatched[i]) ) {
  2119. setMatched[i] = pop.call( results );
  2120. }
  2121. }
  2122. }
  2123. // Discard index placeholder values to get only actual matches
  2124. setMatched = condense( setMatched );
  2125. }
  2126. // Add matches to results
  2127. push.apply( results, setMatched );
  2128. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2129. if ( outermost && !seed && setMatched.length > 0 &&
  2130. ( matchedCount + setMatchers.length ) > 1 ) {
  2131. Sizzle.uniqueSort( results );
  2132. }
  2133. }
  2134. // Override manipulation of globals by nested matchers
  2135. if ( outermost ) {
  2136. dirruns = dirrunsUnique;
  2137. outermostContext = contextBackup;
  2138. }
  2139. return unmatched;
  2140. };
  2141. return bySet ?
  2142. markFunction( superMatcher ) :
  2143. superMatcher;
  2144. }
  2145. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2146. var i,
  2147. setMatchers = [],
  2148. elementMatchers = [],
  2149. cached = compilerCache[ selector + " " ];
  2150. if ( !cached ) {
  2151. // Generate a function of recursive functions that can be used to check each element
  2152. if ( !match ) {
  2153. match = tokenize( selector );
  2154. }
  2155. i = match.length;
  2156. while ( i-- ) {
  2157. cached = matcherFromTokens( match[i] );
  2158. if ( cached[ expando ] ) {
  2159. setMatchers.push( cached );
  2160. } else {
  2161. elementMatchers.push( cached );
  2162. }
  2163. }
  2164. // Cache the compiled function
  2165. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2166. // Save selector and tokenization
  2167. cached.selector = selector;
  2168. }
  2169. return cached;
  2170. };
  2171. /**
  2172. * A low-level selection function that works with Sizzle's compiled
  2173. * selector functions
  2174. * @param {String|Function} selector A selector or a pre-compiled
  2175. * selector function built with Sizzle.compile
  2176. * @param {Element} context
  2177. * @param {Array} [results]
  2178. * @param {Array} [seed] A set of elements to match against
  2179. */
  2180. select = Sizzle.select = function( selector, context, results, seed ) {
  2181. var i, tokens, token, type, find,
  2182. compiled = typeof selector === "function" && selector,
  2183. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2184. results = results || [];
  2185. // Try to minimize operations if there is only one selector in the list and no seed
  2186. // (the latter of which guarantees us context)
  2187. if ( match.length === 1 ) {
  2188. // Reduce context if the leading compound selector is an ID
  2189. tokens = match[0] = match[0].slice( 0 );
  2190. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2191. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  2192. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2193. if ( !context ) {
  2194. return results;
  2195. // Precompiled matchers will still verify ancestry, so step up a level
  2196. } else if ( compiled ) {
  2197. context = context.parentNode;
  2198. }
  2199. selector = selector.slice( tokens.shift().value.length );
  2200. }
  2201. // Fetch a seed set for right-to-left matching
  2202. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2203. while ( i-- ) {
  2204. token = tokens[i];
  2205. // Abort if we hit a combinator
  2206. if ( Expr.relative[ (type = token.type) ] ) {
  2207. break;
  2208. }
  2209. if ( (find = Expr.find[ type ]) ) {
  2210. // Search, expanding context for leading sibling combinators
  2211. if ( (seed = find(
  2212. token.matches[0].replace( runescape, funescape ),
  2213. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2214. )) ) {
  2215. // If seed is empty or no tokens remain, we can return early
  2216. tokens.splice( i, 1 );
  2217. selector = seed.length && toSelector( tokens );
  2218. if ( !selector ) {
  2219. push.apply( results, seed );
  2220. return results;
  2221. }
  2222. break;
  2223. }
  2224. }
  2225. }
  2226. }
  2227. // Compile and execute a filtering function if one is not provided
  2228. // Provide `match` to avoid retokenization if we modified the selector above
  2229. ( compiled || compile( selector, match ) )(
  2230. seed,
  2231. context,
  2232. !documentIsHTML,
  2233. results,
  2234. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2235. );
  2236. return results;
  2237. };
  2238. // One-time assignments
  2239. // Sort stability
  2240. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2241. // Support: Chrome 14-35+
  2242. // Always assume duplicates if they aren't passed to the comparison function
  2243. support.detectDuplicates = !!hasDuplicate;
  2244. // Initialize against the default document
  2245. setDocument();
  2246. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2247. // Detached nodes confoundingly follow *each other*
  2248. support.sortDetached = assert(function( el ) {
  2249. // Should return 1, but returns 4 (following)
  2250. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  2251. });
  2252. // Support: IE<8
  2253. // Prevent attribute/property "interpolation"
  2254. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2255. if ( !assert(function( el ) {
  2256. el.innerHTML = "<a href='#'></a>";
  2257. return el.firstChild.getAttribute("href") === "#" ;
  2258. }) ) {
  2259. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2260. if ( !isXML ) {
  2261. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2262. }
  2263. });
  2264. }
  2265. // Support: IE<9
  2266. // Use defaultValue in place of getAttribute("value")
  2267. if ( !support.attributes || !assert(function( el ) {
  2268. el.innerHTML = "<input/>";
  2269. el.firstChild.setAttribute( "value", "" );
  2270. return el.firstChild.getAttribute( "value" ) === "";
  2271. }) ) {
  2272. addHandle( "value", function( elem, name, isXML ) {
  2273. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2274. return elem.defaultValue;
  2275. }
  2276. });
  2277. }
  2278. // Support: IE<9
  2279. // Use getAttributeNode to fetch booleans when getAttribute lies
  2280. if ( !assert(function( el ) {
  2281. return el.getAttribute("disabled") == null;
  2282. }) ) {
  2283. addHandle( booleans, function( elem, name, isXML ) {
  2284. var val;
  2285. if ( !isXML ) {
  2286. return elem[ name ] === true ? name.toLowerCase() :
  2287. (val = elem.getAttributeNode( name )) && val.specified ?
  2288. val.value :
  2289. null;
  2290. }
  2291. });
  2292. }
  2293. return Sizzle;
  2294. })( window );
  2295. jQuery.find = Sizzle;
  2296. jQuery.expr = Sizzle.selectors;
  2297. // Deprecated
  2298. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2299. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2300. jQuery.text = Sizzle.getText;
  2301. jQuery.isXMLDoc = Sizzle.isXML;
  2302. jQuery.contains = Sizzle.contains;
  2303. jQuery.escapeSelector = Sizzle.escape;
  2304. var dir = function( elem, dir, until ) {
  2305. var matched = [],
  2306. truncate = until !== undefined;
  2307. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2308. if ( elem.nodeType === 1 ) {
  2309. if ( truncate && jQuery( elem ).is( until ) ) {
  2310. break;
  2311. }
  2312. matched.push( elem );
  2313. }
  2314. }
  2315. return matched;
  2316. };
  2317. var siblings = function( n, elem ) {
  2318. var matched = [];
  2319. for ( ; n; n = n.nextSibling ) {
  2320. if ( n.nodeType === 1 && n !== elem ) {
  2321. matched.push( n );
  2322. }
  2323. }
  2324. return matched;
  2325. };
  2326. var rneedsContext = jQuery.expr.match.needsContext;
  2327. function nodeName( elem, name ) {
  2328. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  2329. };
  2330. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  2331. // Implement the identical functionality for filter and not
  2332. function winnow( elements, qualifier, not ) {
  2333. if ( isFunction( qualifier ) ) {
  2334. return jQuery.grep( elements, function( elem, i ) {
  2335. return !!qualifier.call( elem, i, elem ) !== not;
  2336. } );
  2337. }
  2338. // Single element
  2339. if ( qualifier.nodeType ) {
  2340. return jQuery.grep( elements, function( elem ) {
  2341. return ( elem === qualifier ) !== not;
  2342. } );
  2343. }
  2344. // Arraylike of elements (jQuery, arguments, Array)
  2345. if ( typeof qualifier !== "string" ) {
  2346. return jQuery.grep( elements, function( elem ) {
  2347. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  2348. } );
  2349. }
  2350. // Filtered directly for both simple and complex selectors
  2351. return jQuery.filter( qualifier, elements, not );
  2352. }
  2353. jQuery.filter = function( expr, elems, not ) {
  2354. var elem = elems[ 0 ];
  2355. if ( not ) {
  2356. expr = ":not(" + expr + ")";
  2357. }
  2358. if ( elems.length === 1 && elem.nodeType === 1 ) {
  2359. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  2360. }
  2361. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2362. return elem.nodeType === 1;
  2363. } ) );
  2364. };
  2365. jQuery.fn.extend( {
  2366. find: function( selector ) {
  2367. var i, ret,
  2368. len = this.length,
  2369. self = this;
  2370. if ( typeof selector !== "string" ) {
  2371. return this.pushStack( jQuery( selector ).filter( function() {
  2372. for ( i = 0; i < len; i++ ) {
  2373. if ( jQuery.contains( self[ i ], this ) ) {
  2374. return true;
  2375. }
  2376. }
  2377. } ) );
  2378. }
  2379. ret = this.pushStack( [] );
  2380. for ( i = 0; i < len; i++ ) {
  2381. jQuery.find( selector, self[ i ], ret );
  2382. }
  2383. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  2384. },
  2385. filter: function( selector ) {
  2386. return this.pushStack( winnow( this, selector || [], false ) );
  2387. },
  2388. not: function( selector ) {
  2389. return this.pushStack( winnow( this, selector || [], true ) );
  2390. },
  2391. is: function( selector ) {
  2392. return !!winnow(
  2393. this,
  2394. // If this is a positional/relative selector, check membership in the returned set
  2395. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2396. typeof selector === "string" && rneedsContext.test( selector ) ?
  2397. jQuery( selector ) :
  2398. selector || [],
  2399. false
  2400. ).length;
  2401. }
  2402. } );
  2403. // Initialize a jQuery object
  2404. // A central reference to the root jQuery(document)
  2405. var rootjQuery,
  2406. // A simple way to check for HTML strings
  2407. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2408. // Strict HTML recognition (#11290: must start with <)
  2409. // Shortcut simple #id case for speed
  2410. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2411. init = jQuery.fn.init = function( selector, context, root ) {
  2412. var match, elem;
  2413. // HANDLE: $(""), $(null), $(undefined), $(false)
  2414. if ( !selector ) {
  2415. return this;
  2416. }
  2417. // Method init() accepts an alternate rootjQuery
  2418. // so migrate can support jQuery.sub (gh-2101)
  2419. root = root || rootjQuery;
  2420. // Handle HTML strings
  2421. if ( typeof selector === "string" ) {
  2422. if ( selector[ 0 ] === "<" &&
  2423. selector[ selector.length - 1 ] === ">" &&
  2424. selector.length >= 3 ) {
  2425. // Assume that strings that start and end with <> are HTML and skip the regex check
  2426. match = [ null, selector, null ];
  2427. } else {
  2428. match = rquickExpr.exec( selector );
  2429. }
  2430. // Match html or make sure no context is specified for #id
  2431. if ( match && ( match[ 1 ] || !context ) ) {
  2432. // HANDLE: $(html) -> $(array)
  2433. if ( match[ 1 ] ) {
  2434. context = context instanceof jQuery ? context[ 0 ] : context;
  2435. // Option to run scripts is true for back-compat
  2436. // Intentionally let the error be thrown if parseHTML is not present
  2437. jQuery.merge( this, jQuery.parseHTML(
  2438. match[ 1 ],
  2439. context && context.nodeType ? context.ownerDocument || context : document,
  2440. true
  2441. ) );
  2442. // HANDLE: $(html, props)
  2443. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  2444. for ( match in context ) {
  2445. // Properties of context are called as methods if possible
  2446. if ( isFunction( this[ match ] ) ) {
  2447. this[ match ]( context[ match ] );
  2448. // ...and otherwise set as attributes
  2449. } else {
  2450. this.attr( match, context[ match ] );
  2451. }
  2452. }
  2453. }
  2454. return this;
  2455. // HANDLE: $(#id)
  2456. } else {
  2457. elem = document.getElementById( match[ 2 ] );
  2458. if ( elem ) {
  2459. // Inject the element directly into the jQuery object
  2460. this[ 0 ] = elem;
  2461. this.length = 1;
  2462. }
  2463. return this;
  2464. }
  2465. // HANDLE: $(expr, $(...))
  2466. } else if ( !context || context.jquery ) {
  2467. return ( context || root ).find( selector );
  2468. // HANDLE: $(expr, context)
  2469. // (which is just equivalent to: $(context).find(expr)
  2470. } else {
  2471. return this.constructor( context ).find( selector );
  2472. }
  2473. // HANDLE: $(DOMElement)
  2474. } else if ( selector.nodeType ) {
  2475. this[ 0 ] = selector;
  2476. this.length = 1;
  2477. return this;
  2478. // HANDLE: $(function)
  2479. // Shortcut for document ready
  2480. } else if ( isFunction( selector ) ) {
  2481. return root.ready !== undefined ?
  2482. root.ready( selector ) :
  2483. // Execute immediately if ready is not present
  2484. selector( jQuery );
  2485. }
  2486. return jQuery.makeArray( selector, this );
  2487. };
  2488. // Give the init function the jQuery prototype for later instantiation
  2489. init.prototype = jQuery.fn;
  2490. // Initialize central reference
  2491. rootjQuery = jQuery( document );
  2492. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2493. // Methods guaranteed to produce a unique set when starting from a unique set
  2494. guaranteedUnique = {
  2495. children: true,
  2496. contents: true,
  2497. next: true,
  2498. prev: true
  2499. };
  2500. jQuery.fn.extend( {
  2501. has: function( target ) {
  2502. var targets = jQuery( target, this ),
  2503. l = targets.length;
  2504. return this.filter( function() {
  2505. var i = 0;
  2506. for ( ; i < l; i++ ) {
  2507. if ( jQuery.contains( this, targets[ i ] ) ) {
  2508. return true;
  2509. }
  2510. }
  2511. } );
  2512. },
  2513. closest: function( selectors, context ) {
  2514. var cur,
  2515. i = 0,
  2516. l = this.length,
  2517. matched = [],
  2518. targets = typeof selectors !== "string" && jQuery( selectors );
  2519. // Positional selectors never match, since there's no _selection_ context
  2520. if ( !rneedsContext.test( selectors ) ) {
  2521. for ( ; i < l; i++ ) {
  2522. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  2523. // Always skip document fragments
  2524. if ( cur.nodeType < 11 && ( targets ?
  2525. targets.index( cur ) > -1 :
  2526. // Don't pass non-elements to Sizzle
  2527. cur.nodeType === 1 &&
  2528. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  2529. matched.push( cur );
  2530. break;
  2531. }
  2532. }
  2533. }
  2534. }
  2535. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  2536. },
  2537. // Determine the position of an element within the set
  2538. index: function( elem ) {
  2539. // No argument, return index in parent
  2540. if ( !elem ) {
  2541. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2542. }
  2543. // Index in selector
  2544. if ( typeof elem === "string" ) {
  2545. return indexOf.call( jQuery( elem ), this[ 0 ] );
  2546. }
  2547. // Locate the position of the desired element
  2548. return indexOf.call( this,
  2549. // If it receives a jQuery object, the first element is used
  2550. elem.jquery ? elem[ 0 ] : elem
  2551. );
  2552. },
  2553. add: function( selector, context ) {
  2554. return this.pushStack(
  2555. jQuery.uniqueSort(
  2556. jQuery.merge( this.get(), jQuery( selector, context ) )
  2557. )
  2558. );
  2559. },
  2560. addBack: function( selector ) {
  2561. return this.add( selector == null ?
  2562. this.prevObject : this.prevObject.filter( selector )
  2563. );
  2564. }
  2565. } );
  2566. function sibling( cur, dir ) {
  2567. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  2568. return cur;
  2569. }
  2570. jQuery.each( {
  2571. parent: function( elem ) {
  2572. var parent = elem.parentNode;
  2573. return parent && parent.nodeType !== 11 ? parent : null;
  2574. },
  2575. parents: function( elem ) {
  2576. return dir( elem, "parentNode" );
  2577. },
  2578. parentsUntil: function( elem, i, until ) {
  2579. return dir( elem, "parentNode", until );
  2580. },
  2581. next: function( elem ) {
  2582. return sibling( elem, "nextSibling" );
  2583. },
  2584. prev: function( elem ) {
  2585. return sibling( elem, "previousSibling" );
  2586. },
  2587. nextAll: function( elem ) {
  2588. return dir( elem, "nextSibling" );
  2589. },
  2590. prevAll: function( elem ) {
  2591. return dir( elem, "previousSibling" );
  2592. },
  2593. nextUntil: function( elem, i, until ) {
  2594. return dir( elem, "nextSibling", until );
  2595. },
  2596. prevUntil: function( elem, i, until ) {
  2597. return dir( elem, "previousSibling", until );
  2598. },
  2599. siblings: function( elem ) {
  2600. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  2601. },
  2602. children: function( elem ) {
  2603. return siblings( elem.firstChild );
  2604. },
  2605. contents: function( elem ) {
  2606. if ( nodeName( elem, "iframe" ) ) {
  2607. return elem.contentDocument;
  2608. }
  2609. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  2610. // Treat the template element as a regular one in browsers that
  2611. // don't support it.
  2612. if ( nodeName( elem, "template" ) ) {
  2613. elem = elem.content || elem;
  2614. }
  2615. return jQuery.merge( [], elem.childNodes );
  2616. }
  2617. }, function( name, fn ) {
  2618. jQuery.fn[ name ] = function( until, selector ) {
  2619. var matched = jQuery.map( this, fn, until );
  2620. if ( name.slice( -5 ) !== "Until" ) {
  2621. selector = until;
  2622. }
  2623. if ( selector && typeof selector === "string" ) {
  2624. matched = jQuery.filter( selector, matched );
  2625. }
  2626. if ( this.length > 1 ) {
  2627. // Remove duplicates
  2628. if ( !guaranteedUnique[ name ] ) {
  2629. jQuery.uniqueSort( matched );
  2630. }
  2631. // Reverse order for parents* and prev-derivatives
  2632. if ( rparentsprev.test( name ) ) {
  2633. matched.reverse();
  2634. }
  2635. }
  2636. return this.pushStack( matched );
  2637. };
  2638. } );
  2639. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  2640. // Convert String-formatted options into Object-formatted ones
  2641. function createOptions( options ) {
  2642. var object = {};
  2643. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  2644. object[ flag ] = true;
  2645. } );
  2646. return object;
  2647. }
  2648. /*
  2649. * Create a callback list using the following parameters:
  2650. *
  2651. * options: an optional list of space-separated options that will change how
  2652. * the callback list behaves or a more traditional option object
  2653. *
  2654. * By default a callback list will act like an event callback list and can be
  2655. * "fired" multiple times.
  2656. *
  2657. * Possible options:
  2658. *
  2659. * once: will ensure the callback list can only be fired once (like a Deferred)
  2660. *
  2661. * memory: will keep track of previous values and will call any callback added
  2662. * after the list has been fired right away with the latest "memorized"
  2663. * values (like a Deferred)
  2664. *
  2665. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2666. *
  2667. * stopOnFalse: interrupt callings when a callback returns false
  2668. *
  2669. */
  2670. jQuery.Callbacks = function( options ) {
  2671. // Convert options from String-formatted to Object-formatted if needed
  2672. // (we check in cache first)
  2673. options = typeof options === "string" ?
  2674. createOptions( options ) :
  2675. jQuery.extend( {}, options );
  2676. var // Flag to know if list is currently firing
  2677. firing,
  2678. // Last fire value for non-forgettable lists
  2679. memory,
  2680. // Flag to know if list was already fired
  2681. fired,
  2682. // Flag to prevent firing
  2683. locked,
  2684. // Actual callback list
  2685. list = [],
  2686. // Queue of execution data for repeatable lists
  2687. queue = [],
  2688. // Index of currently firing callback (modified by add/remove as needed)
  2689. firingIndex = -1,
  2690. // Fire callbacks
  2691. fire = function() {
  2692. // Enforce single-firing
  2693. locked = locked || options.once;
  2694. // Execute callbacks for all pending executions,
  2695. // respecting firingIndex overrides and runtime changes
  2696. fired = firing = true;
  2697. for ( ; queue.length; firingIndex = -1 ) {
  2698. memory = queue.shift();
  2699. while ( ++firingIndex < list.length ) {
  2700. // Run callback and check for early termination
  2701. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  2702. options.stopOnFalse ) {
  2703. // Jump to end and forget the data so .add doesn't re-fire
  2704. firingIndex = list.length;
  2705. memory = false;
  2706. }
  2707. }
  2708. }
  2709. // Forget the data if we're done with it
  2710. if ( !options.memory ) {
  2711. memory = false;
  2712. }
  2713. firing = false;
  2714. // Clean up if we're done firing for good
  2715. if ( locked ) {
  2716. // Keep an empty list if we have data for future add calls
  2717. if ( memory ) {
  2718. list = [];
  2719. // Otherwise, this object is spent
  2720. } else {
  2721. list = "";
  2722. }
  2723. }
  2724. },
  2725. // Actual Callbacks object
  2726. self = {
  2727. // Add a callback or a collection of callbacks to the list
  2728. add: function() {
  2729. if ( list ) {
  2730. // If we have memory from a past run, we should fire after adding
  2731. if ( memory && !firing ) {
  2732. firingIndex = list.length - 1;
  2733. queue.push( memory );
  2734. }
  2735. ( function add( args ) {
  2736. jQuery.each( args, function( _, arg ) {
  2737. if ( isFunction( arg ) ) {
  2738. if ( !options.unique || !self.has( arg ) ) {
  2739. list.push( arg );
  2740. }
  2741. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  2742. // Inspect recursively
  2743. add( arg );
  2744. }
  2745. } );
  2746. } )( arguments );
  2747. if ( memory && !firing ) {
  2748. fire();
  2749. }
  2750. }
  2751. return this;
  2752. },
  2753. // Remove a callback from the list
  2754. remove: function() {
  2755. jQuery.each( arguments, function( _, arg ) {
  2756. var index;
  2757. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2758. list.splice( index, 1 );
  2759. // Handle firing indexes
  2760. if ( index <= firingIndex ) {
  2761. firingIndex--;
  2762. }
  2763. }
  2764. } );
  2765. return this;
  2766. },
  2767. // Check if a given callback is in the list.
  2768. // If no argument is given, return whether or not list has callbacks attached.
  2769. has: function( fn ) {
  2770. return fn ?
  2771. jQuery.inArray( fn, list ) > -1 :
  2772. list.length > 0;
  2773. },
  2774. // Remove all callbacks from the list
  2775. empty: function() {
  2776. if ( list ) {
  2777. list = [];
  2778. }
  2779. return this;
  2780. },
  2781. // Disable .fire and .add
  2782. // Abort any current/pending executions
  2783. // Clear all callbacks and values
  2784. disable: function() {
  2785. locked = queue = [];
  2786. list = memory = "";
  2787. return this;
  2788. },
  2789. disabled: function() {
  2790. return !list;
  2791. },
  2792. // Disable .fire
  2793. // Also disable .add unless we have memory (since it would have no effect)
  2794. // Abort any pending executions
  2795. lock: function() {
  2796. locked = queue = [];
  2797. if ( !memory && !firing ) {
  2798. list = memory = "";
  2799. }
  2800. return this;
  2801. },
  2802. locked: function() {
  2803. return !!locked;
  2804. },
  2805. // Call all callbacks with the given context and arguments
  2806. fireWith: function( context, args ) {
  2807. if ( !locked ) {
  2808. args = args || [];
  2809. args = [ context, args.slice ? args.slice() : args ];
  2810. queue.push( args );
  2811. if ( !firing ) {
  2812. fire();
  2813. }
  2814. }
  2815. return this;
  2816. },
  2817. // Call all the callbacks with the given arguments
  2818. fire: function() {
  2819. self.fireWith( this, arguments );
  2820. return this;
  2821. },
  2822. // To know if the callbacks have already been called at least once
  2823. fired: function() {
  2824. return !!fired;
  2825. }
  2826. };
  2827. return self;
  2828. };
  2829. function Identity( v ) {
  2830. return v;
  2831. }
  2832. function Thrower( ex ) {
  2833. throw ex;
  2834. }
  2835. function adoptValue( value, resolve, reject, noValue ) {
  2836. var method;
  2837. try {
  2838. // Check for promise aspect first to privilege synchronous behavior
  2839. if ( value && isFunction( ( method = value.promise ) ) ) {
  2840. method.call( value ).done( resolve ).fail( reject );
  2841. // Other thenables
  2842. } else if ( value && isFunction( ( method = value.then ) ) ) {
  2843. method.call( value, resolve, reject );
  2844. // Other non-thenables
  2845. } else {
  2846. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  2847. // * false: [ value ].slice( 0 ) => resolve( value )
  2848. // * true: [ value ].slice( 1 ) => resolve()
  2849. resolve.apply( undefined, [ value ].slice( noValue ) );
  2850. }
  2851. // For Promises/A+, convert exceptions into rejections
  2852. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  2853. // Deferred#then to conditionally suppress rejection.
  2854. } catch ( value ) {
  2855. // Support: Android 4.0 only
  2856. // Strict mode functions invoked without .call/.apply get global-object context
  2857. reject.apply( undefined, [ value ] );
  2858. }
  2859. }
  2860. jQuery.extend( {
  2861. Deferred: function( func ) {
  2862. var tuples = [
  2863. // action, add listener, callbacks,
  2864. // ... .then handlers, argument index, [final state]
  2865. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  2866. jQuery.Callbacks( "memory" ), 2 ],
  2867. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  2868. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  2869. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  2870. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  2871. ],
  2872. state = "pending",
  2873. promise = {
  2874. state: function() {
  2875. return state;
  2876. },
  2877. always: function() {
  2878. deferred.done( arguments ).fail( arguments );
  2879. return this;
  2880. },
  2881. "catch": function( fn ) {
  2882. return promise.then( null, fn );
  2883. },
  2884. // Keep pipe for back-compat
  2885. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  2886. var fns = arguments;
  2887. return jQuery.Deferred( function( newDefer ) {
  2888. jQuery.each( tuples, function( i, tuple ) {
  2889. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  2890. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  2891. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  2892. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  2893. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  2894. deferred[ tuple[ 1 ] ]( function() {
  2895. var returned = fn && fn.apply( this, arguments );
  2896. if ( returned && isFunction( returned.promise ) ) {
  2897. returned.promise()
  2898. .progress( newDefer.notify )
  2899. .done( newDefer.resolve )
  2900. .fail( newDefer.reject );
  2901. } else {
  2902. newDefer[ tuple[ 0 ] + "With" ](
  2903. this,
  2904. fn ? [ returned ] : arguments
  2905. );
  2906. }
  2907. } );
  2908. } );
  2909. fns = null;
  2910. } ).promise();
  2911. },
  2912. then: function( onFulfilled, onRejected, onProgress ) {
  2913. var maxDepth = 0;
  2914. function resolve( depth, deferred, handler, special ) {
  2915. return function() {
  2916. var that = this,
  2917. args = arguments,
  2918. mightThrow = function() {
  2919. var returned, then;
  2920. // Support: Promises/A+ section 2.3.3.3.3
  2921. // https://promisesaplus.com/#point-59
  2922. // Ignore double-resolution attempts
  2923. if ( depth < maxDepth ) {
  2924. return;
  2925. }
  2926. returned = handler.apply( that, args );
  2927. // Support: Promises/A+ section 2.3.1
  2928. // https://promisesaplus.com/#point-48
  2929. if ( returned === deferred.promise() ) {
  2930. throw new TypeError( "Thenable self-resolution" );
  2931. }
  2932. // Support: Promises/A+ sections 2.3.3.1, 3.5
  2933. // https://promisesaplus.com/#point-54
  2934. // https://promisesaplus.com/#point-75
  2935. // Retrieve `then` only once
  2936. then = returned &&
  2937. // Support: Promises/A+ section 2.3.4
  2938. // https://promisesaplus.com/#point-64
  2939. // Only check objects and functions for thenability
  2940. ( typeof returned === "object" ||
  2941. typeof returned === "function" ) &&
  2942. returned.then;
  2943. // Handle a returned thenable
  2944. if ( isFunction( then ) ) {
  2945. // Special processors (notify) just wait for resolution
  2946. if ( special ) {
  2947. then.call(
  2948. returned,
  2949. resolve( maxDepth, deferred, Identity, special ),
  2950. resolve( maxDepth, deferred, Thrower, special )
  2951. );
  2952. // Normal processors (resolve) also hook into progress
  2953. } else {
  2954. // ...and disregard older resolution values
  2955. maxDepth++;
  2956. then.call(
  2957. returned,
  2958. resolve( maxDepth, deferred, Identity, special ),
  2959. resolve( maxDepth, deferred, Thrower, special ),
  2960. resolve( maxDepth, deferred, Identity,
  2961. deferred.notifyWith )
  2962. );
  2963. }
  2964. // Handle all other returned values
  2965. } else {
  2966. // Only substitute handlers pass on context
  2967. // and multiple values (non-spec behavior)
  2968. if ( handler !== Identity ) {
  2969. that = undefined;
  2970. args = [ returned ];
  2971. }
  2972. // Process the value(s)
  2973. // Default process is resolve
  2974. ( special || deferred.resolveWith )( that, args );
  2975. }
  2976. },
  2977. // Only normal processors (resolve) catch and reject exceptions
  2978. process = special ?
  2979. mightThrow :
  2980. function() {
  2981. try {
  2982. mightThrow();
  2983. } catch ( e ) {
  2984. if ( jQuery.Deferred.exceptionHook ) {
  2985. jQuery.Deferred.exceptionHook( e,
  2986. process.stackTrace );
  2987. }
  2988. // Support: Promises/A+ section 2.3.3.3.4.1
  2989. // https://promisesaplus.com/#point-61
  2990. // Ignore post-resolution exceptions
  2991. if ( depth + 1 >= maxDepth ) {
  2992. // Only substitute handlers pass on context
  2993. // and multiple values (non-spec behavior)
  2994. if ( handler !== Thrower ) {
  2995. that = undefined;
  2996. args = [ e ];
  2997. }
  2998. deferred.rejectWith( that, args );
  2999. }
  3000. }
  3001. };
  3002. // Support: Promises/A+ section 2.3.3.3.1
  3003. // https://promisesaplus.com/#point-57
  3004. // Re-resolve promises immediately to dodge false rejection from
  3005. // subsequent errors
  3006. if ( depth ) {
  3007. process();
  3008. } else {
  3009. // Call an optional hook to record the stack, in case of exception
  3010. // since it's otherwise lost when execution goes async
  3011. if ( jQuery.Deferred.getStackHook ) {
  3012. process.stackTrace = jQuery.Deferred.getStackHook();
  3013. }
  3014. window.setTimeout( process );
  3015. }
  3016. };
  3017. }
  3018. return jQuery.Deferred( function( newDefer ) {
  3019. // progress_handlers.add( ... )
  3020. tuples[ 0 ][ 3 ].add(
  3021. resolve(
  3022. 0,
  3023. newDefer,
  3024. isFunction( onProgress ) ?
  3025. onProgress :
  3026. Identity,
  3027. newDefer.notifyWith
  3028. )
  3029. );
  3030. // fulfilled_handlers.add( ... )
  3031. tuples[ 1 ][ 3 ].add(
  3032. resolve(
  3033. 0,
  3034. newDefer,
  3035. isFunction( onFulfilled ) ?
  3036. onFulfilled :
  3037. Identity
  3038. )
  3039. );
  3040. // rejected_handlers.add( ... )
  3041. tuples[ 2 ][ 3 ].add(
  3042. resolve(
  3043. 0,
  3044. newDefer,
  3045. isFunction( onRejected ) ?
  3046. onRejected :
  3047. Thrower
  3048. )
  3049. );
  3050. } ).promise();
  3051. },
  3052. // Get a promise for this deferred
  3053. // If obj is provided, the promise aspect is added to the object
  3054. promise: function( obj ) {
  3055. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3056. }
  3057. },
  3058. deferred = {};
  3059. // Add list-specific methods
  3060. jQuery.each( tuples, function( i, tuple ) {
  3061. var list = tuple[ 2 ],
  3062. stateString = tuple[ 5 ];
  3063. // promise.progress = list.add
  3064. // promise.done = list.add
  3065. // promise.fail = list.add
  3066. promise[ tuple[ 1 ] ] = list.add;
  3067. // Handle state
  3068. if ( stateString ) {
  3069. list.add(
  3070. function() {
  3071. // state = "resolved" (i.e., fulfilled)
  3072. // state = "rejected"
  3073. state = stateString;
  3074. },
  3075. // rejected_callbacks.disable
  3076. // fulfilled_callbacks.disable
  3077. tuples[ 3 - i ][ 2 ].disable,
  3078. // rejected_handlers.disable
  3079. // fulfilled_handlers.disable
  3080. tuples[ 3 - i ][ 3 ].disable,
  3081. // progress_callbacks.lock
  3082. tuples[ 0 ][ 2 ].lock,
  3083. // progress_handlers.lock
  3084. tuples[ 0 ][ 3 ].lock
  3085. );
  3086. }
  3087. // progress_handlers.fire
  3088. // fulfilled_handlers.fire
  3089. // rejected_handlers.fire
  3090. list.add( tuple[ 3 ].fire );
  3091. // deferred.notify = function() { deferred.notifyWith(...) }
  3092. // deferred.resolve = function() { deferred.resolveWith(...) }
  3093. // deferred.reject = function() { deferred.rejectWith(...) }
  3094. deferred[ tuple[ 0 ] ] = function() {
  3095. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3096. return this;
  3097. };
  3098. // deferred.notifyWith = list.fireWith
  3099. // deferred.resolveWith = list.fireWith
  3100. // deferred.rejectWith = list.fireWith
  3101. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3102. } );
  3103. // Make the deferred a promise
  3104. promise.promise( deferred );
  3105. // Call given func if any
  3106. if ( func ) {
  3107. func.call( deferred, deferred );
  3108. }
  3109. // All done!
  3110. return deferred;
  3111. },
  3112. // Deferred helper
  3113. when: function( singleValue ) {
  3114. var
  3115. // count of uncompleted subordinates
  3116. remaining = arguments.length,
  3117. // count of unprocessed arguments
  3118. i = remaining,
  3119. // subordinate fulfillment data
  3120. resolveContexts = Array( i ),
  3121. resolveValues = slice.call( arguments ),
  3122. // the master Deferred
  3123. master = jQuery.Deferred(),
  3124. // subordinate callback factory
  3125. updateFunc = function( i ) {
  3126. return function( value ) {
  3127. resolveContexts[ i ] = this;
  3128. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3129. if ( !( --remaining ) ) {
  3130. master.resolveWith( resolveContexts, resolveValues );
  3131. }
  3132. };
  3133. };
  3134. // Single- and empty arguments are adopted like Promise.resolve
  3135. if ( remaining <= 1 ) {
  3136. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3137. !remaining );
  3138. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3139. if ( master.state() === "pending" ||
  3140. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3141. return master.then();
  3142. }
  3143. }
  3144. // Multiple arguments are aggregated like Promise.all array elements
  3145. while ( i-- ) {
  3146. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  3147. }
  3148. return master.promise();
  3149. }
  3150. } );
  3151. // These usually indicate a programmer mistake during development,
  3152. // warn about them ASAP rather than swallowing them by default.
  3153. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3154. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3155. // Support: IE 8 - 9 only
  3156. // Console exists when dev tools are open, which can happen at any time
  3157. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3158. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  3159. }
  3160. };
  3161. jQuery.readyException = function( error ) {
  3162. window.setTimeout( function() {
  3163. throw error;
  3164. } );
  3165. };
  3166. // The deferred used on DOM ready
  3167. var readyList = jQuery.Deferred();
  3168. jQuery.fn.ready = function( fn ) {
  3169. readyList
  3170. .then( fn )
  3171. // Wrap jQuery.readyException in a function so that the lookup
  3172. // happens at the time of error handling instead of callback
  3173. // registration.
  3174. .catch( function( error ) {
  3175. jQuery.readyException( error );
  3176. } );
  3177. return this;
  3178. };
  3179. jQuery.extend( {
  3180. // Is the DOM ready to be used? Set to true once it occurs.
  3181. isReady: false,
  3182. // A counter to track how many items to wait for before
  3183. // the ready event fires. See #6781
  3184. readyWait: 1,
  3185. // Handle when the DOM is ready
  3186. ready: function( wait ) {
  3187. // Abort if there are pending holds or we're already ready
  3188. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3189. return;
  3190. }
  3191. // Remember that the DOM is ready
  3192. jQuery.isReady = true;
  3193. // If a normal DOM Ready event fired, decrement, and wait if need be
  3194. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3195. return;
  3196. }
  3197. // If there are functions bound, to execute
  3198. readyList.resolveWith( document, [ jQuery ] );
  3199. }
  3200. } );
  3201. jQuery.ready.then = readyList.then;
  3202. // The ready event handler and self cleanup method
  3203. function completed() {
  3204. document.removeEventListener( "DOMContentLoaded", completed );
  3205. window.removeEventListener( "load", completed );
  3206. jQuery.ready();
  3207. }
  3208. // Catch cases where $(document).ready() is called
  3209. // after the browser event has already occurred.
  3210. // Support: IE <=9 - 10 only
  3211. // Older IE sometimes signals "interactive" too soon
  3212. if ( document.readyState === "complete" ||
  3213. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3214. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3215. window.setTimeout( jQuery.ready );
  3216. } else {
  3217. // Use the handy event callback
  3218. document.addEventListener( "DOMContentLoaded", completed );
  3219. // A fallback to window.onload, that will always work
  3220. window.addEventListener( "load", completed );
  3221. }
  3222. // Multifunctional method to get and set values of a collection
  3223. // The value/s can optionally be executed if it's a function
  3224. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3225. var i = 0,
  3226. len = elems.length,
  3227. bulk = key == null;
  3228. // Sets many values
  3229. if ( toType( key ) === "object" ) {
  3230. chainable = true;
  3231. for ( i in key ) {
  3232. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3233. }
  3234. // Sets one value
  3235. } else if ( value !== undefined ) {
  3236. chainable = true;
  3237. if ( !isFunction( value ) ) {
  3238. raw = true;
  3239. }
  3240. if ( bulk ) {
  3241. // Bulk operations run against the entire set
  3242. if ( raw ) {
  3243. fn.call( elems, value );
  3244. fn = null;
  3245. // ...except when executing function values
  3246. } else {
  3247. bulk = fn;
  3248. fn = function( elem, key, value ) {
  3249. return bulk.call( jQuery( elem ), value );
  3250. };
  3251. }
  3252. }
  3253. if ( fn ) {
  3254. for ( ; i < len; i++ ) {
  3255. fn(
  3256. elems[ i ], key, raw ?
  3257. value :
  3258. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3259. );
  3260. }
  3261. }
  3262. }
  3263. if ( chainable ) {
  3264. return elems;
  3265. }
  3266. // Gets
  3267. if ( bulk ) {
  3268. return fn.call( elems );
  3269. }
  3270. return len ? fn( elems[ 0 ], key ) : emptyGet;
  3271. };
  3272. // Matches dashed string for camelizing
  3273. var rmsPrefix = /^-ms-/,
  3274. rdashAlpha = /-([a-z])/g;
  3275. // Used by camelCase as callback to replace()
  3276. function fcamelCase( all, letter ) {
  3277. return letter.toUpperCase();
  3278. }
  3279. // Convert dashed to camelCase; used by the css and data modules
  3280. // Support: IE <=9 - 11, Edge 12 - 15
  3281. // Microsoft forgot to hump their vendor prefix (#9572)
  3282. function camelCase( string ) {
  3283. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  3284. }
  3285. var acceptData = function( owner ) {
  3286. // Accepts only:
  3287. // - Node
  3288. // - Node.ELEMENT_NODE
  3289. // - Node.DOCUMENT_NODE
  3290. // - Object
  3291. // - Any
  3292. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  3293. };
  3294. function Data() {
  3295. this.expando = jQuery.expando + Data.uid++;
  3296. }
  3297. Data.uid = 1;
  3298. Data.prototype = {
  3299. cache: function( owner ) {
  3300. // Check if the owner object already has a cache
  3301. var value = owner[ this.expando ];
  3302. // If not, create one
  3303. if ( !value ) {
  3304. value = {};
  3305. // We can accept data for non-element nodes in modern browsers,
  3306. // but we should not, see #8335.
  3307. // Always return an empty object.
  3308. if ( acceptData( owner ) ) {
  3309. // If it is a node unlikely to be stringify-ed or looped over
  3310. // use plain assignment
  3311. if ( owner.nodeType ) {
  3312. owner[ this.expando ] = value;
  3313. // Otherwise secure it in a non-enumerable property
  3314. // configurable must be true to allow the property to be
  3315. // deleted when data is removed
  3316. } else {
  3317. Object.defineProperty( owner, this.expando, {
  3318. value: value,
  3319. configurable: true
  3320. } );
  3321. }
  3322. }
  3323. }
  3324. return value;
  3325. },
  3326. set: function( owner, data, value ) {
  3327. var prop,
  3328. cache = this.cache( owner );
  3329. // Handle: [ owner, key, value ] args
  3330. // Always use camelCase key (gh-2257)
  3331. if ( typeof data === "string" ) {
  3332. cache[ camelCase( data ) ] = value;
  3333. // Handle: [ owner, { properties } ] args
  3334. } else {
  3335. // Copy the properties one-by-one to the cache object
  3336. for ( prop in data ) {
  3337. cache[ camelCase( prop ) ] = data[ prop ];
  3338. }
  3339. }
  3340. return cache;
  3341. },
  3342. get: function( owner, key ) {
  3343. return key === undefined ?
  3344. this.cache( owner ) :
  3345. // Always use camelCase key (gh-2257)
  3346. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  3347. },
  3348. access: function( owner, key, value ) {
  3349. // In cases where either:
  3350. //
  3351. // 1. No key was specified
  3352. // 2. A string key was specified, but no value provided
  3353. //
  3354. // Take the "read" path and allow the get method to determine
  3355. // which value to return, respectively either:
  3356. //
  3357. // 1. The entire cache object
  3358. // 2. The data stored at the key
  3359. //
  3360. if ( key === undefined ||
  3361. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  3362. return this.get( owner, key );
  3363. }
  3364. // When the key is not a string, or both a key and value
  3365. // are specified, set or extend (existing objects) with either:
  3366. //
  3367. // 1. An object of properties
  3368. // 2. A key and value
  3369. //
  3370. this.set( owner, key, value );
  3371. // Since the "set" path can have two possible entry points
  3372. // return the expected data based on which path was taken[*]
  3373. return value !== undefined ? value : key;
  3374. },
  3375. remove: function( owner, key ) {
  3376. var i,
  3377. cache = owner[ this.expando ];
  3378. if ( cache === undefined ) {
  3379. return;
  3380. }
  3381. if ( key !== undefined ) {
  3382. // Support array or space separated string of keys
  3383. if ( Array.isArray( key ) ) {
  3384. // If key is an array of keys...
  3385. // We always set camelCase keys, so remove that.
  3386. key = key.map( camelCase );
  3387. } else {
  3388. key = camelCase( key );
  3389. // If a key with the spaces exists, use it.
  3390. // Otherwise, create an array by matching non-whitespace
  3391. key = key in cache ?
  3392. [ key ] :
  3393. ( key.match( rnothtmlwhite ) || [] );
  3394. }
  3395. i = key.length;
  3396. while ( i-- ) {
  3397. delete cache[ key[ i ] ];
  3398. }
  3399. }
  3400. // Remove the expando if there's no more data
  3401. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  3402. // Support: Chrome <=35 - 45
  3403. // Webkit & Blink performance suffers when deleting properties
  3404. // from DOM nodes, so set to undefined instead
  3405. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  3406. if ( owner.nodeType ) {
  3407. owner[ this.expando ] = undefined;
  3408. } else {
  3409. delete owner[ this.expando ];
  3410. }
  3411. }
  3412. },
  3413. hasData: function( owner ) {
  3414. var cache = owner[ this.expando ];
  3415. return cache !== undefined && !jQuery.isEmptyObject( cache );
  3416. }
  3417. };
  3418. var dataPriv = new Data();
  3419. var dataUser = new Data();
  3420. // Implementation Summary
  3421. //
  3422. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3423. // 2. Improve the module's maintainability by reducing the storage
  3424. // paths to a single mechanism.
  3425. // 3. Use the same single mechanism to support "private" and "user" data.
  3426. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3427. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3428. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3429. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3430. rmultiDash = /[A-Z]/g;
  3431. function getData( data ) {
  3432. if ( data === "true" ) {
  3433. return true;
  3434. }
  3435. if ( data === "false" ) {
  3436. return false;
  3437. }
  3438. if ( data === "null" ) {
  3439. return null;
  3440. }
  3441. // Only convert to a number if it doesn't change the string
  3442. if ( data === +data + "" ) {
  3443. return +data;
  3444. }
  3445. if ( rbrace.test( data ) ) {
  3446. return JSON.parse( data );
  3447. }
  3448. return data;
  3449. }
  3450. function dataAttr( elem, key, data ) {
  3451. var name;
  3452. // If nothing was found internally, try to fetch any
  3453. // data from the HTML5 data-* attribute
  3454. if ( data === undefined && elem.nodeType === 1 ) {
  3455. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  3456. data = elem.getAttribute( name );
  3457. if ( typeof data === "string" ) {
  3458. try {
  3459. data = getData( data );
  3460. } catch ( e ) {}
  3461. // Make sure we set the data so it isn't changed later
  3462. dataUser.set( elem, key, data );
  3463. } else {
  3464. data = undefined;
  3465. }
  3466. }
  3467. return data;
  3468. }
  3469. jQuery.extend( {
  3470. hasData: function( elem ) {
  3471. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  3472. },
  3473. data: function( elem, name, data ) {
  3474. return dataUser.access( elem, name, data );
  3475. },
  3476. removeData: function( elem, name ) {
  3477. dataUser.remove( elem, name );
  3478. },
  3479. // TODO: Now that all calls to _data and _removeData have been replaced
  3480. // with direct calls to dataPriv methods, these can be deprecated.
  3481. _data: function( elem, name, data ) {
  3482. return dataPriv.access( elem, name, data );
  3483. },
  3484. _removeData: function( elem, name ) {
  3485. dataPriv.remove( elem, name );
  3486. }
  3487. } );
  3488. jQuery.fn.extend( {
  3489. data: function( key, value ) {
  3490. var i, name, data,
  3491. elem = this[ 0 ],
  3492. attrs = elem && elem.attributes;
  3493. // Gets all values
  3494. if ( key === undefined ) {
  3495. if ( this.length ) {
  3496. data = dataUser.get( elem );
  3497. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  3498. i = attrs.length;
  3499. while ( i-- ) {
  3500. // Support: IE 11 only
  3501. // The attrs elements can be null (#14894)
  3502. if ( attrs[ i ] ) {
  3503. name = attrs[ i ].name;
  3504. if ( name.indexOf( "data-" ) === 0 ) {
  3505. name = camelCase( name.slice( 5 ) );
  3506. dataAttr( elem, name, data[ name ] );
  3507. }
  3508. }
  3509. }
  3510. dataPriv.set( elem, "hasDataAttrs", true );
  3511. }
  3512. }
  3513. return data;
  3514. }
  3515. // Sets multiple values
  3516. if ( typeof key === "object" ) {
  3517. return this.each( function() {
  3518. dataUser.set( this, key );
  3519. } );
  3520. }
  3521. return access( this, function( value ) {
  3522. var data;
  3523. // The calling jQuery object (element matches) is not empty
  3524. // (and therefore has an element appears at this[ 0 ]) and the
  3525. // `value` parameter was not undefined. An empty jQuery object
  3526. // will result in `undefined` for elem = this[ 0 ] which will
  3527. // throw an exception if an attempt to read a data cache is made.
  3528. if ( elem && value === undefined ) {
  3529. // Attempt to get data from the cache
  3530. // The key will always be camelCased in Data
  3531. data = dataUser.get( elem, key );
  3532. if ( data !== undefined ) {
  3533. return data;
  3534. }
  3535. // Attempt to "discover" the data in
  3536. // HTML5 custom data-* attrs
  3537. data = dataAttr( elem, key );
  3538. if ( data !== undefined ) {
  3539. return data;
  3540. }
  3541. // We tried really hard, but the data doesn't exist.
  3542. return;
  3543. }
  3544. // Set the data...
  3545. this.each( function() {
  3546. // We always store the camelCased key
  3547. dataUser.set( this, key, value );
  3548. } );
  3549. }, null, value, arguments.length > 1, null, true );
  3550. },
  3551. removeData: function( key ) {
  3552. return this.each( function() {
  3553. dataUser.remove( this, key );
  3554. } );
  3555. }
  3556. } );
  3557. jQuery.extend( {
  3558. queue: function( elem, type, data ) {
  3559. var queue;
  3560. if ( elem ) {
  3561. type = ( type || "fx" ) + "queue";
  3562. queue = dataPriv.get( elem, type );
  3563. // Speed up dequeue by getting out quickly if this is just a lookup
  3564. if ( data ) {
  3565. if ( !queue || Array.isArray( data ) ) {
  3566. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  3567. } else {
  3568. queue.push( data );
  3569. }
  3570. }
  3571. return queue || [];
  3572. }
  3573. },
  3574. dequeue: function( elem, type ) {
  3575. type = type || "fx";
  3576. var queue = jQuery.queue( elem, type ),
  3577. startLength = queue.length,
  3578. fn = queue.shift(),
  3579. hooks = jQuery._queueHooks( elem, type ),
  3580. next = function() {
  3581. jQuery.dequeue( elem, type );
  3582. };
  3583. // If the fx queue is dequeued, always remove the progress sentinel
  3584. if ( fn === "inprogress" ) {
  3585. fn = queue.shift();
  3586. startLength--;
  3587. }
  3588. if ( fn ) {
  3589. // Add a progress sentinel to prevent the fx queue from being
  3590. // automatically dequeued
  3591. if ( type === "fx" ) {
  3592. queue.unshift( "inprogress" );
  3593. }
  3594. // Clear up the last queue stop function
  3595. delete hooks.stop;
  3596. fn.call( elem, next, hooks );
  3597. }
  3598. if ( !startLength && hooks ) {
  3599. hooks.empty.fire();
  3600. }
  3601. },
  3602. // Not public - generate a queueHooks object, or return the current one
  3603. _queueHooks: function( elem, type ) {
  3604. var key = type + "queueHooks";
  3605. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  3606. empty: jQuery.Callbacks( "once memory" ).add( function() {
  3607. dataPriv.remove( elem, [ type + "queue", key ] );
  3608. } )
  3609. } );
  3610. }
  3611. } );
  3612. jQuery.fn.extend( {
  3613. queue: function( type, data ) {
  3614. var setter = 2;
  3615. if ( typeof type !== "string" ) {
  3616. data = type;
  3617. type = "fx";
  3618. setter--;
  3619. }
  3620. if ( arguments.length < setter ) {
  3621. return jQuery.queue( this[ 0 ], type );
  3622. }
  3623. return data === undefined ?
  3624. this :
  3625. this.each( function() {
  3626. var queue = jQuery.queue( this, type, data );
  3627. // Ensure a hooks for this queue
  3628. jQuery._queueHooks( this, type );
  3629. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  3630. jQuery.dequeue( this, type );
  3631. }
  3632. } );
  3633. },
  3634. dequeue: function( type ) {
  3635. return this.each( function() {
  3636. jQuery.dequeue( this, type );
  3637. } );
  3638. },
  3639. clearQueue: function( type ) {
  3640. return this.queue( type || "fx", [] );
  3641. },
  3642. // Get a promise resolved when queues of a certain type
  3643. // are emptied (fx is the type by default)
  3644. promise: function( type, obj ) {
  3645. var tmp,
  3646. count = 1,
  3647. defer = jQuery.Deferred(),
  3648. elements = this,
  3649. i = this.length,
  3650. resolve = function() {
  3651. if ( !( --count ) ) {
  3652. defer.resolveWith( elements, [ elements ] );
  3653. }
  3654. };
  3655. if ( typeof type !== "string" ) {
  3656. obj = type;
  3657. type = undefined;
  3658. }
  3659. type = type || "fx";
  3660. while ( i-- ) {
  3661. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  3662. if ( tmp && tmp.empty ) {
  3663. count++;
  3664. tmp.empty.add( resolve );
  3665. }
  3666. }
  3667. resolve();
  3668. return defer.promise( obj );
  3669. }
  3670. } );
  3671. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  3672. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  3673. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3674. var isHiddenWithinTree = function( elem, el ) {
  3675. // isHiddenWithinTree might be called from jQuery#filter function;
  3676. // in that case, element will be second argument
  3677. elem = el || elem;
  3678. // Inline style trumps all
  3679. return elem.style.display === "none" ||
  3680. elem.style.display === "" &&
  3681. // Otherwise, check computed style
  3682. // Support: Firefox <=43 - 45
  3683. // Disconnected elements can have computed display: none, so first confirm that elem is
  3684. // in the document.
  3685. jQuery.contains( elem.ownerDocument, elem ) &&
  3686. jQuery.css( elem, "display" ) === "none";
  3687. };
  3688. var swap = function( elem, options, callback, args ) {
  3689. var ret, name,
  3690. old = {};
  3691. // Remember the old values, and insert the new ones
  3692. for ( name in options ) {
  3693. old[ name ] = elem.style[ name ];
  3694. elem.style[ name ] = options[ name ];
  3695. }
  3696. ret = callback.apply( elem, args || [] );
  3697. // Revert the old values
  3698. for ( name in options ) {
  3699. elem.style[ name ] = old[ name ];
  3700. }
  3701. return ret;
  3702. };
  3703. function adjustCSS( elem, prop, valueParts, tween ) {
  3704. var adjusted, scale,
  3705. maxIterations = 20,
  3706. currentValue = tween ?
  3707. function() {
  3708. return tween.cur();
  3709. } :
  3710. function() {
  3711. return jQuery.css( elem, prop, "" );
  3712. },
  3713. initial = currentValue(),
  3714. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  3715. // Starting value computation is required for potential unit mismatches
  3716. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  3717. rcssNum.exec( jQuery.css( elem, prop ) );
  3718. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  3719. // Support: Firefox <=54
  3720. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  3721. initial = initial / 2;
  3722. // Trust units reported by jQuery.css
  3723. unit = unit || initialInUnit[ 3 ];
  3724. // Iteratively approximate from a nonzero starting point
  3725. initialInUnit = +initial || 1;
  3726. while ( maxIterations-- ) {
  3727. // Evaluate and update our best guess (doubling guesses that zero out).
  3728. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  3729. jQuery.style( elem, prop, initialInUnit + unit );
  3730. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  3731. maxIterations = 0;
  3732. }
  3733. initialInUnit = initialInUnit / scale;
  3734. }
  3735. initialInUnit = initialInUnit * 2;
  3736. jQuery.style( elem, prop, initialInUnit + unit );
  3737. // Make sure we update the tween properties later on
  3738. valueParts = valueParts || [];
  3739. }
  3740. if ( valueParts ) {
  3741. initialInUnit = +initialInUnit || +initial || 0;
  3742. // Apply relative offset (+=/-=) if specified
  3743. adjusted = valueParts[ 1 ] ?
  3744. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  3745. +valueParts[ 2 ];
  3746. if ( tween ) {
  3747. tween.unit = unit;
  3748. tween.start = initialInUnit;
  3749. tween.end = adjusted;
  3750. }
  3751. }
  3752. return adjusted;
  3753. }
  3754. var defaultDisplayMap = {};
  3755. function getDefaultDisplay( elem ) {
  3756. var temp,
  3757. doc = elem.ownerDocument,
  3758. nodeName = elem.nodeName,
  3759. display = defaultDisplayMap[ nodeName ];
  3760. if ( display ) {
  3761. return display;
  3762. }
  3763. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  3764. display = jQuery.css( temp, "display" );
  3765. temp.parentNode.removeChild( temp );
  3766. if ( display === "none" ) {
  3767. display = "block";
  3768. }
  3769. defaultDisplayMap[ nodeName ] = display;
  3770. return display;
  3771. }
  3772. function showHide( elements, show ) {
  3773. var display, elem,
  3774. values = [],
  3775. index = 0,
  3776. length = elements.length;
  3777. // Determine new display value for elements that need to change
  3778. for ( ; index < length; index++ ) {
  3779. elem = elements[ index ];
  3780. if ( !elem.style ) {
  3781. continue;
  3782. }
  3783. display = elem.style.display;
  3784. if ( show ) {
  3785. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  3786. // check is required in this first loop unless we have a nonempty display value (either
  3787. // inline or about-to-be-restored)
  3788. if ( display === "none" ) {
  3789. values[ index ] = dataPriv.get( elem, "display" ) || null;
  3790. if ( !values[ index ] ) {
  3791. elem.style.display = "";
  3792. }
  3793. }
  3794. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  3795. values[ index ] = getDefaultDisplay( elem );
  3796. }
  3797. } else {
  3798. if ( display !== "none" ) {
  3799. values[ index ] = "none";
  3800. // Remember what we're overwriting
  3801. dataPriv.set( elem, "display", display );
  3802. }
  3803. }
  3804. }
  3805. // Set the display of the elements in a second loop to avoid constant reflow
  3806. for ( index = 0; index < length; index++ ) {
  3807. if ( values[ index ] != null ) {
  3808. elements[ index ].style.display = values[ index ];
  3809. }
  3810. }
  3811. return elements;
  3812. }
  3813. jQuery.fn.extend( {
  3814. show: function() {
  3815. return showHide( this, true );
  3816. },
  3817. hide: function() {
  3818. return showHide( this );
  3819. },
  3820. toggle: function( state ) {
  3821. if ( typeof state === "boolean" ) {
  3822. return state ? this.show() : this.hide();
  3823. }
  3824. return this.each( function() {
  3825. if ( isHiddenWithinTree( this ) ) {
  3826. jQuery( this ).show();
  3827. } else {
  3828. jQuery( this ).hide();
  3829. }
  3830. } );
  3831. }
  3832. } );
  3833. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  3834. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  3835. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  3836. ( function() {
  3837. var fragment = document.createDocumentFragment(),
  3838. div = fragment.appendChild( document.createElement( "div" ) ),
  3839. input = document.createElement( "input" );
  3840. // Support: Android 4.0 - 4.3 only
  3841. // Check state lost if the name is set (#11217)
  3842. // Support: Windows Web Apps (WWA)
  3843. // `name` and `type` must use .setAttribute for WWA (#14901)
  3844. input.setAttribute( "type", "radio" );
  3845. input.setAttribute( "checked", "checked" );
  3846. input.setAttribute( "name", "t" );
  3847. div.appendChild( input );
  3848. // Support: Android <=4.1 only
  3849. // Older WebKit doesn't clone checked state correctly in fragments
  3850. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3851. // Support: IE <=11 only
  3852. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3853. div.innerHTML = "<textarea>x</textarea>";
  3854. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3855. // Support: IE <=9 only
  3856. // IE <=9 replaces <option> tags with their contents when inserted outside of
  3857. // the select element.
  3858. div.innerHTML = "<option></option>";
  3859. support.option = !!div.lastChild;
  3860. } )();
  3861. // We have to close these tags to support XHTML (#13200)
  3862. var wrapMap = {
  3863. // XHTML parsers do not magically insert elements in the
  3864. // same way that tag soup parsers do. So we cannot shorten
  3865. // this by omitting <tbody> or other required elements.
  3866. thead: [ 1, "<table>", "</table>" ],
  3867. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  3868. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3869. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3870. _default: [ 0, "", "" ]
  3871. };
  3872. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3873. wrapMap.th = wrapMap.td;
  3874. // Support: IE <=9 only
  3875. if ( !support.option ) {
  3876. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  3877. }
  3878. function getAll( context, tag ) {
  3879. // Support: IE <=9 - 11 only
  3880. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  3881. var ret;
  3882. if ( typeof context.getElementsByTagName !== "undefined" ) {
  3883. ret = context.getElementsByTagName( tag || "*" );
  3884. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  3885. ret = context.querySelectorAll( tag || "*" );
  3886. } else {
  3887. ret = [];
  3888. }
  3889. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  3890. return jQuery.merge( [ context ], ret );
  3891. }
  3892. return ret;
  3893. }
  3894. // Mark scripts as having already been evaluated
  3895. function setGlobalEval( elems, refElements ) {
  3896. var i = 0,
  3897. l = elems.length;
  3898. for ( ; i < l; i++ ) {
  3899. dataPriv.set(
  3900. elems[ i ],
  3901. "globalEval",
  3902. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  3903. );
  3904. }
  3905. }
  3906. var rhtml = /<|&#?\w+;/;
  3907. function buildFragment( elems, context, scripts, selection, ignored ) {
  3908. var elem, tmp, tag, wrap, contains, j,
  3909. fragment = context.createDocumentFragment(),
  3910. nodes = [],
  3911. i = 0,
  3912. l = elems.length;
  3913. for ( ; i < l; i++ ) {
  3914. elem = elems[ i ];
  3915. if ( elem || elem === 0 ) {
  3916. // Add nodes directly
  3917. if ( toType( elem ) === "object" ) {
  3918. // Support: Android <=4.0 only, PhantomJS 1 only
  3919. // push.apply(_, arraylike) throws on ancient WebKit
  3920. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  3921. // Convert non-html into a text node
  3922. } else if ( !rhtml.test( elem ) ) {
  3923. nodes.push( context.createTextNode( elem ) );
  3924. // Convert html into DOM nodes
  3925. } else {
  3926. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  3927. // Deserialize a standard representation
  3928. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  3929. wrap = wrapMap[ tag ] || wrapMap._default;
  3930. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  3931. // Descend through wrappers to the right content
  3932. j = wrap[ 0 ];
  3933. while ( j-- ) {
  3934. tmp = tmp.lastChild;
  3935. }
  3936. // Support: Android <=4.0 only, PhantomJS 1 only
  3937. // push.apply(_, arraylike) throws on ancient WebKit
  3938. jQuery.merge( nodes, tmp.childNodes );
  3939. // Remember the top-level container
  3940. tmp = fragment.firstChild;
  3941. // Ensure the created nodes are orphaned (#12392)
  3942. tmp.textContent = "";
  3943. }
  3944. }
  3945. }
  3946. // Remove wrapper from fragment
  3947. fragment.textContent = "";
  3948. i = 0;
  3949. while ( ( elem = nodes[ i++ ] ) ) {
  3950. // Skip elements already in the context collection (trac-4087)
  3951. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  3952. if ( ignored ) {
  3953. ignored.push( elem );
  3954. }
  3955. continue;
  3956. }
  3957. contains = jQuery.contains( elem.ownerDocument, elem );
  3958. // Append to fragment
  3959. tmp = getAll( fragment.appendChild( elem ), "script" );
  3960. // Preserve script evaluation history
  3961. if ( contains ) {
  3962. setGlobalEval( tmp );
  3963. }
  3964. // Capture executables
  3965. if ( scripts ) {
  3966. j = 0;
  3967. while ( ( elem = tmp[ j++ ] ) ) {
  3968. if ( rscriptType.test( elem.type || "" ) ) {
  3969. scripts.push( elem );
  3970. }
  3971. }
  3972. }
  3973. }
  3974. return fragment;
  3975. }
  3976. var documentElement = document.documentElement;
  3977. var
  3978. rkeyEvent = /^key/,
  3979. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  3980. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  3981. function returnTrue() {
  3982. return true;
  3983. }
  3984. function returnFalse() {
  3985. return false;
  3986. }
  3987. // Support: IE <=9 only
  3988. // See #13393 for more info
  3989. function safeActiveElement() {
  3990. try {
  3991. return document.activeElement;
  3992. } catch ( err ) { }
  3993. }
  3994. function on( elem, types, selector, data, fn, one ) {
  3995. var origFn, type;
  3996. // Types can be a map of types/handlers
  3997. if ( typeof types === "object" ) {
  3998. // ( types-Object, selector, data )
  3999. if ( typeof selector !== "string" ) {
  4000. // ( types-Object, data )
  4001. data = data || selector;
  4002. selector = undefined;
  4003. }
  4004. for ( type in types ) {
  4005. on( elem, type, selector, data, types[ type ], one );
  4006. }
  4007. return elem;
  4008. }
  4009. if ( data == null && fn == null ) {
  4010. // ( types, fn )
  4011. fn = selector;
  4012. data = selector = undefined;
  4013. } else if ( fn == null ) {
  4014. if ( typeof selector === "string" ) {
  4015. // ( types, selector, fn )
  4016. fn = data;
  4017. data = undefined;
  4018. } else {
  4019. // ( types, data, fn )
  4020. fn = data;
  4021. data = selector;
  4022. selector = undefined;
  4023. }
  4024. }
  4025. if ( fn === false ) {
  4026. fn = returnFalse;
  4027. } else if ( !fn ) {
  4028. return elem;
  4029. }
  4030. if ( one === 1 ) {
  4031. origFn = fn;
  4032. fn = function( event ) {
  4033. // Can use an empty set, since event contains the info
  4034. jQuery().off( event );
  4035. return origFn.apply( this, arguments );
  4036. };
  4037. // Use same guid so caller can remove using origFn
  4038. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4039. }
  4040. return elem.each( function() {
  4041. jQuery.event.add( this, types, fn, data, selector );
  4042. } );
  4043. }
  4044. /*
  4045. * Helper functions for managing events -- not part of the public interface.
  4046. * Props to Dean Edwards' addEvent library for many of the ideas.
  4047. */
  4048. jQuery.event = {
  4049. global: {},
  4050. add: function( elem, types, handler, data, selector ) {
  4051. var handleObjIn, eventHandle, tmp,
  4052. events, t, handleObj,
  4053. special, handlers, type, namespaces, origType,
  4054. elemData = dataPriv.get( elem );
  4055. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4056. if ( !elemData ) {
  4057. return;
  4058. }
  4059. // Caller can pass in an object of custom data in lieu of the handler
  4060. if ( handler.handler ) {
  4061. handleObjIn = handler;
  4062. handler = handleObjIn.handler;
  4063. selector = handleObjIn.selector;
  4064. }
  4065. // Ensure that invalid selectors throw exceptions at attach time
  4066. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4067. if ( selector ) {
  4068. jQuery.find.matchesSelector( documentElement, selector );
  4069. }
  4070. // Make sure that the handler has a unique ID, used to find/remove it later
  4071. if ( !handler.guid ) {
  4072. handler.guid = jQuery.guid++;
  4073. }
  4074. // Init the element's event structure and main handler, if this is the first
  4075. if ( !( events = elemData.events ) ) {
  4076. events = elemData.events = {};
  4077. }
  4078. if ( !( eventHandle = elemData.handle ) ) {
  4079. eventHandle = elemData.handle = function( e ) {
  4080. // Discard the second event of a jQuery.event.trigger() and
  4081. // when an event is called after a page has unloaded
  4082. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4083. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4084. };
  4085. }
  4086. // Handle multiple events separated by a space
  4087. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4088. t = types.length;
  4089. while ( t-- ) {
  4090. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4091. type = origType = tmp[ 1 ];
  4092. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4093. // There *must* be a type, no attaching namespace-only handlers
  4094. if ( !type ) {
  4095. continue;
  4096. }
  4097. // If event changes its type, use the special event handlers for the changed type
  4098. special = jQuery.event.special[ type ] || {};
  4099. // If selector defined, determine special event api type, otherwise given type
  4100. type = ( selector ? special.delegateType : special.bindType ) || type;
  4101. // Update special based on newly reset type
  4102. special = jQuery.event.special[ type ] || {};
  4103. // handleObj is passed to all event handlers
  4104. handleObj = jQuery.extend( {
  4105. type: type,
  4106. origType: origType,
  4107. data: data,
  4108. handler: handler,
  4109. guid: handler.guid,
  4110. selector: selector,
  4111. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4112. namespace: namespaces.join( "." )
  4113. }, handleObjIn );
  4114. // Init the event handler queue if we're the first
  4115. if ( !( handlers = events[ type ] ) ) {
  4116. handlers = events[ type ] = [];
  4117. handlers.delegateCount = 0;
  4118. // Only use addEventListener if the special events handler returns false
  4119. if ( !special.setup ||
  4120. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4121. if ( elem.addEventListener ) {
  4122. elem.addEventListener( type, eventHandle );
  4123. }
  4124. }
  4125. }
  4126. if ( special.add ) {
  4127. special.add.call( elem, handleObj );
  4128. if ( !handleObj.handler.guid ) {
  4129. handleObj.handler.guid = handler.guid;
  4130. }
  4131. }
  4132. // Add to the element's handler list, delegates in front
  4133. if ( selector ) {
  4134. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4135. } else {
  4136. handlers.push( handleObj );
  4137. }
  4138. // Keep track of which events have ever been used, for event optimization
  4139. jQuery.event.global[ type ] = true;
  4140. }
  4141. },
  4142. // Detach an event or set of events from an element
  4143. remove: function( elem, types, handler, selector, mappedTypes ) {
  4144. var j, origCount, tmp,
  4145. events, t, handleObj,
  4146. special, handlers, type, namespaces, origType,
  4147. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4148. if ( !elemData || !( events = elemData.events ) ) {
  4149. return;
  4150. }
  4151. // Once for each type.namespace in types; type may be omitted
  4152. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4153. t = types.length;
  4154. while ( t-- ) {
  4155. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4156. type = origType = tmp[ 1 ];
  4157. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4158. // Unbind all events (on this namespace, if provided) for the element
  4159. if ( !type ) {
  4160. for ( type in events ) {
  4161. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4162. }
  4163. continue;
  4164. }
  4165. special = jQuery.event.special[ type ] || {};
  4166. type = ( selector ? special.delegateType : special.bindType ) || type;
  4167. handlers = events[ type ] || [];
  4168. tmp = tmp[ 2 ] &&
  4169. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4170. // Remove matching events
  4171. origCount = j = handlers.length;
  4172. while ( j-- ) {
  4173. handleObj = handlers[ j ];
  4174. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4175. ( !handler || handler.guid === handleObj.guid ) &&
  4176. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4177. ( !selector || selector === handleObj.selector ||
  4178. selector === "**" && handleObj.selector ) ) {
  4179. handlers.splice( j, 1 );
  4180. if ( handleObj.selector ) {
  4181. handlers.delegateCount--;
  4182. }
  4183. if ( special.remove ) {
  4184. special.remove.call( elem, handleObj );
  4185. }
  4186. }
  4187. }
  4188. // Remove generic event handler if we removed something and no more handlers exist
  4189. // (avoids potential for endless recursion during removal of special event handlers)
  4190. if ( origCount && !handlers.length ) {
  4191. if ( !special.teardown ||
  4192. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4193. jQuery.removeEvent( elem, type, elemData.handle );
  4194. }
  4195. delete events[ type ];
  4196. }
  4197. }
  4198. // Remove data and the expando if it's no longer used
  4199. if ( jQuery.isEmptyObject( events ) ) {
  4200. dataPriv.remove( elem, "handle events" );
  4201. }
  4202. },
  4203. dispatch: function( nativeEvent ) {
  4204. // Make a writable jQuery.Event from the native event object
  4205. var event = jQuery.event.fix( nativeEvent );
  4206. var i, j, ret, matched, handleObj, handlerQueue,
  4207. args = new Array( arguments.length ),
  4208. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  4209. special = jQuery.event.special[ event.type ] || {};
  4210. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4211. args[ 0 ] = event;
  4212. for ( i = 1; i < arguments.length; i++ ) {
  4213. args[ i ] = arguments[ i ];
  4214. }
  4215. event.delegateTarget = this;
  4216. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4217. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4218. return;
  4219. }
  4220. // Determine handlers
  4221. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4222. // Run delegates first; they may want to stop propagation beneath us
  4223. i = 0;
  4224. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4225. event.currentTarget = matched.elem;
  4226. j = 0;
  4227. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4228. !event.isImmediatePropagationStopped() ) {
  4229. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4230. // a subset or equal to those in the bound event (both can have no namespace).
  4231. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4232. event.handleObj = handleObj;
  4233. event.data = handleObj.data;
  4234. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4235. handleObj.handler ).apply( matched.elem, args );
  4236. if ( ret !== undefined ) {
  4237. if ( ( event.result = ret ) === false ) {
  4238. event.preventDefault();
  4239. event.stopPropagation();
  4240. }
  4241. }
  4242. }
  4243. }
  4244. }
  4245. // Call the postDispatch hook for the mapped type
  4246. if ( special.postDispatch ) {
  4247. special.postDispatch.call( this, event );
  4248. }
  4249. return event.result;
  4250. },
  4251. handlers: function( event, handlers ) {
  4252. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4253. handlerQueue = [],
  4254. delegateCount = handlers.delegateCount,
  4255. cur = event.target;
  4256. // Find delegate handlers
  4257. if ( delegateCount &&
  4258. // Support: IE <=9
  4259. // Black-hole SVG <use> instance trees (trac-13180)
  4260. cur.nodeType &&
  4261. // Support: Firefox <=42
  4262. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  4263. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  4264. // Support: IE 11 only
  4265. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  4266. !( event.type === "click" && event.button >= 1 ) ) {
  4267. for ( ; cur !== this; cur = cur.parentNode || this ) {
  4268. // Don't check non-elements (#13208)
  4269. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4270. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  4271. matchedHandlers = [];
  4272. matchedSelectors = {};
  4273. for ( i = 0; i < delegateCount; i++ ) {
  4274. handleObj = handlers[ i ];
  4275. // Don't conflict with Object.prototype properties (#13203)
  4276. sel = handleObj.selector + " ";
  4277. if ( matchedSelectors[ sel ] === undefined ) {
  4278. matchedSelectors[ sel ] = handleObj.needsContext ?
  4279. jQuery( sel, this ).index( cur ) > -1 :
  4280. jQuery.find( sel, this, null, [ cur ] ).length;
  4281. }
  4282. if ( matchedSelectors[ sel ] ) {
  4283. matchedHandlers.push( handleObj );
  4284. }
  4285. }
  4286. if ( matchedHandlers.length ) {
  4287. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  4288. }
  4289. }
  4290. }
  4291. }
  4292. // Add the remaining (directly-bound) handlers
  4293. cur = this;
  4294. if ( delegateCount < handlers.length ) {
  4295. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  4296. }
  4297. return handlerQueue;
  4298. },
  4299. addProp: function( name, hook ) {
  4300. Object.defineProperty( jQuery.Event.prototype, name, {
  4301. enumerable: true,
  4302. configurable: true,
  4303. get: isFunction( hook ) ?
  4304. function() {
  4305. if ( this.originalEvent ) {
  4306. return hook( this.originalEvent );
  4307. }
  4308. } :
  4309. function() {
  4310. if ( this.originalEvent ) {
  4311. return this.originalEvent[ name ];
  4312. }
  4313. },
  4314. set: function( value ) {
  4315. Object.defineProperty( this, name, {
  4316. enumerable: true,
  4317. configurable: true,
  4318. writable: true,
  4319. value: value
  4320. } );
  4321. }
  4322. } );
  4323. },
  4324. fix: function( originalEvent ) {
  4325. return originalEvent[ jQuery.expando ] ?
  4326. originalEvent :
  4327. new jQuery.Event( originalEvent );
  4328. },
  4329. special: {
  4330. load: {
  4331. // Prevent triggered image.load events from bubbling to window.load
  4332. noBubble: true
  4333. },
  4334. focus: {
  4335. // Fire native event if possible so blur/focus sequence is correct
  4336. trigger: function() {
  4337. if ( this !== safeActiveElement() && this.focus ) {
  4338. this.focus();
  4339. return false;
  4340. }
  4341. },
  4342. delegateType: "focusin"
  4343. },
  4344. blur: {
  4345. trigger: function() {
  4346. if ( this === safeActiveElement() && this.blur ) {
  4347. this.blur();
  4348. return false;
  4349. }
  4350. },
  4351. delegateType: "focusout"
  4352. },
  4353. click: {
  4354. // For checkbox, fire native event so checked state will be right
  4355. trigger: function() {
  4356. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  4357. this.click();
  4358. return false;
  4359. }
  4360. },
  4361. // For cross-browser consistency, don't fire native .click() on links
  4362. _default: function( event ) {
  4363. return nodeName( event.target, "a" );
  4364. }
  4365. },
  4366. beforeunload: {
  4367. postDispatch: function( event ) {
  4368. // Support: Firefox 20+
  4369. // Firefox doesn't alert if the returnValue field is not set.
  4370. if ( event.result !== undefined && event.originalEvent ) {
  4371. event.originalEvent.returnValue = event.result;
  4372. }
  4373. }
  4374. }
  4375. }
  4376. };
  4377. jQuery.removeEvent = function( elem, type, handle ) {
  4378. // This "if" is needed for plain objects
  4379. if ( elem.removeEventListener ) {
  4380. elem.removeEventListener( type, handle );
  4381. }
  4382. };
  4383. jQuery.Event = function( src, props ) {
  4384. // Allow instantiation without the 'new' keyword
  4385. if ( !( this instanceof jQuery.Event ) ) {
  4386. return new jQuery.Event( src, props );
  4387. }
  4388. // Event object
  4389. if ( src && src.type ) {
  4390. this.originalEvent = src;
  4391. this.type = src.type;
  4392. // Events bubbling up the document may have been marked as prevented
  4393. // by a handler lower down the tree; reflect the correct value.
  4394. this.isDefaultPrevented = src.defaultPrevented ||
  4395. src.defaultPrevented === undefined &&
  4396. // Support: Android <=2.3 only
  4397. src.returnValue === false ?
  4398. returnTrue :
  4399. returnFalse;
  4400. // Create target properties
  4401. // Support: Safari <=6 - 7 only
  4402. // Target should not be a text node (#504, #13143)
  4403. this.target = ( src.target && src.target.nodeType === 3 ) ?
  4404. src.target.parentNode :
  4405. src.target;
  4406. this.currentTarget = src.currentTarget;
  4407. this.relatedTarget = src.relatedTarget;
  4408. // Event type
  4409. } else {
  4410. this.type = src;
  4411. }
  4412. // Put explicitly provided properties onto the event object
  4413. if ( props ) {
  4414. jQuery.extend( this, props );
  4415. }
  4416. // Create a timestamp if incoming event doesn't have one
  4417. this.timeStamp = src && src.timeStamp || Date.now();
  4418. // Mark it as fixed
  4419. this[ jQuery.expando ] = true;
  4420. };
  4421. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4422. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4423. jQuery.Event.prototype = {
  4424. constructor: jQuery.Event,
  4425. isDefaultPrevented: returnFalse,
  4426. isPropagationStopped: returnFalse,
  4427. isImmediatePropagationStopped: returnFalse,
  4428. isSimulated: false,
  4429. preventDefault: function() {
  4430. var e = this.originalEvent;
  4431. this.isDefaultPrevented = returnTrue;
  4432. if ( e && !this.isSimulated ) {
  4433. e.preventDefault();
  4434. }
  4435. },
  4436. stopPropagation: function() {
  4437. var e = this.originalEvent;
  4438. this.isPropagationStopped = returnTrue;
  4439. if ( e && !this.isSimulated ) {
  4440. e.stopPropagation();
  4441. }
  4442. },
  4443. stopImmediatePropagation: function() {
  4444. var e = this.originalEvent;
  4445. this.isImmediatePropagationStopped = returnTrue;
  4446. if ( e && !this.isSimulated ) {
  4447. e.stopImmediatePropagation();
  4448. }
  4449. this.stopPropagation();
  4450. }
  4451. };
  4452. // Includes all common event props including KeyEvent and MouseEvent specific props
  4453. jQuery.each( {
  4454. altKey: true,
  4455. bubbles: true,
  4456. cancelable: true,
  4457. changedTouches: true,
  4458. ctrlKey: true,
  4459. detail: true,
  4460. eventPhase: true,
  4461. metaKey: true,
  4462. pageX: true,
  4463. pageY: true,
  4464. shiftKey: true,
  4465. view: true,
  4466. "char": true,
  4467. charCode: true,
  4468. key: true,
  4469. keyCode: true,
  4470. button: true,
  4471. buttons: true,
  4472. clientX: true,
  4473. clientY: true,
  4474. offsetX: true,
  4475. offsetY: true,
  4476. pointerId: true,
  4477. pointerType: true,
  4478. screenX: true,
  4479. screenY: true,
  4480. targetTouches: true,
  4481. toElement: true,
  4482. touches: true,
  4483. which: function( event ) {
  4484. var button = event.button;
  4485. // Add which for key events
  4486. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  4487. return event.charCode != null ? event.charCode : event.keyCode;
  4488. }
  4489. // Add which for click: 1 === left; 2 === middle; 3 === right
  4490. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  4491. if ( button & 1 ) {
  4492. return 1;
  4493. }
  4494. if ( button & 2 ) {
  4495. return 3;
  4496. }
  4497. if ( button & 4 ) {
  4498. return 2;
  4499. }
  4500. return 0;
  4501. }
  4502. return event.which;
  4503. }
  4504. }, jQuery.event.addProp );
  4505. // Create mouseenter/leave events using mouseover/out and event-time checks
  4506. // so that event delegation works in jQuery.
  4507. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4508. //
  4509. // Support: Safari 7 only
  4510. // Safari sends mouseenter too often; see:
  4511. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  4512. // for the description of the bug (it existed in older Chrome versions as well).
  4513. jQuery.each( {
  4514. mouseenter: "mouseover",
  4515. mouseleave: "mouseout",
  4516. pointerenter: "pointerover",
  4517. pointerleave: "pointerout"
  4518. }, function( orig, fix ) {
  4519. jQuery.event.special[ orig ] = {
  4520. delegateType: fix,
  4521. bindType: fix,
  4522. handle: function( event ) {
  4523. var ret,
  4524. target = this,
  4525. related = event.relatedTarget,
  4526. handleObj = event.handleObj;
  4527. // For mouseenter/leave call the handler if related is outside the target.
  4528. // NB: No relatedTarget if the mouse left/entered the browser window
  4529. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  4530. event.type = handleObj.origType;
  4531. ret = handleObj.handler.apply( this, arguments );
  4532. event.type = fix;
  4533. }
  4534. return ret;
  4535. }
  4536. };
  4537. } );
  4538. jQuery.fn.extend( {
  4539. on: function( types, selector, data, fn ) {
  4540. return on( this, types, selector, data, fn );
  4541. },
  4542. one: function( types, selector, data, fn ) {
  4543. return on( this, types, selector, data, fn, 1 );
  4544. },
  4545. off: function( types, selector, fn ) {
  4546. var handleObj, type;
  4547. if ( types && types.preventDefault && types.handleObj ) {
  4548. // ( event ) dispatched jQuery.Event
  4549. handleObj = types.handleObj;
  4550. jQuery( types.delegateTarget ).off(
  4551. handleObj.namespace ?
  4552. handleObj.origType + "." + handleObj.namespace :
  4553. handleObj.origType,
  4554. handleObj.selector,
  4555. handleObj.handler
  4556. );
  4557. return this;
  4558. }
  4559. if ( typeof types === "object" ) {
  4560. // ( types-object [, selector] )
  4561. for ( type in types ) {
  4562. this.off( type, selector, types[ type ] );
  4563. }
  4564. return this;
  4565. }
  4566. if ( selector === false || typeof selector === "function" ) {
  4567. // ( types [, fn] )
  4568. fn = selector;
  4569. selector = undefined;
  4570. }
  4571. if ( fn === false ) {
  4572. fn = returnFalse;
  4573. }
  4574. return this.each( function() {
  4575. jQuery.event.remove( this, types, fn, selector );
  4576. } );
  4577. }
  4578. } );
  4579. var
  4580. // Support: IE <=10 - 11, Edge 12 - 13 only
  4581. // In IE/Edge using regex groups here causes severe slowdowns.
  4582. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4583. rnoInnerhtml = /<script|<style|<link/i,
  4584. // checked="checked" or checked
  4585. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4586. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  4587. // Prefer a tbody over its parent table for containing new rows
  4588. function manipulationTarget( elem, content ) {
  4589. if ( nodeName( elem, "table" ) &&
  4590. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  4591. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  4592. }
  4593. return elem;
  4594. }
  4595. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4596. function disableScript( elem ) {
  4597. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  4598. return elem;
  4599. }
  4600. function restoreScript( elem ) {
  4601. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  4602. elem.type = elem.type.slice( 5 );
  4603. } else {
  4604. elem.removeAttribute( "type" );
  4605. }
  4606. return elem;
  4607. }
  4608. function cloneCopyEvent( src, dest ) {
  4609. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4610. if ( dest.nodeType !== 1 ) {
  4611. return;
  4612. }
  4613. // 1. Copy private data: events, handlers, etc.
  4614. if ( dataPriv.hasData( src ) ) {
  4615. pdataOld = dataPriv.access( src );
  4616. pdataCur = dataPriv.set( dest, pdataOld );
  4617. events = pdataOld.events;
  4618. if ( events ) {
  4619. delete pdataCur.handle;
  4620. pdataCur.events = {};
  4621. for ( type in events ) {
  4622. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4623. jQuery.event.add( dest, type, events[ type ][ i ] );
  4624. }
  4625. }
  4626. }
  4627. }
  4628. // 2. Copy user data
  4629. if ( dataUser.hasData( src ) ) {
  4630. udataOld = dataUser.access( src );
  4631. udataCur = jQuery.extend( {}, udataOld );
  4632. dataUser.set( dest, udataCur );
  4633. }
  4634. }
  4635. // Fix IE bugs, see support tests
  4636. function fixInput( src, dest ) {
  4637. var nodeName = dest.nodeName.toLowerCase();
  4638. // Fails to persist the checked state of a cloned checkbox or radio button.
  4639. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4640. dest.checked = src.checked;
  4641. // Fails to return the selected option to the default selected state when cloning options
  4642. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4643. dest.defaultValue = src.defaultValue;
  4644. }
  4645. }
  4646. function domManip( collection, args, callback, ignored ) {
  4647. // Flatten any nested arrays
  4648. args = concat.apply( [], args );
  4649. var fragment, first, scripts, hasScripts, node, doc,
  4650. i = 0,
  4651. l = collection.length,
  4652. iNoClone = l - 1,
  4653. value = args[ 0 ],
  4654. valueIsFunction = isFunction( value );
  4655. // We can't cloneNode fragments that contain checked, in WebKit
  4656. if ( valueIsFunction ||
  4657. ( l > 1 && typeof value === "string" &&
  4658. !support.checkClone && rchecked.test( value ) ) ) {
  4659. return collection.each( function( index ) {
  4660. var self = collection.eq( index );
  4661. if ( valueIsFunction ) {
  4662. args[ 0 ] = value.call( this, index, self.html() );
  4663. }
  4664. domManip( self, args, callback, ignored );
  4665. } );
  4666. }
  4667. if ( l ) {
  4668. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  4669. first = fragment.firstChild;
  4670. if ( fragment.childNodes.length === 1 ) {
  4671. fragment = first;
  4672. }
  4673. // Require either new content or an interest in ignored elements to invoke the callback
  4674. if ( first || ignored ) {
  4675. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4676. hasScripts = scripts.length;
  4677. // Use the original fragment for the last item
  4678. // instead of the first because it can end up
  4679. // being emptied incorrectly in certain situations (#8070).
  4680. for ( ; i < l; i++ ) {
  4681. node = fragment;
  4682. if ( i !== iNoClone ) {
  4683. node = jQuery.clone( node, true, true );
  4684. // Keep references to cloned scripts for later restoration
  4685. if ( hasScripts ) {
  4686. // Support: Android <=4.0 only, PhantomJS 1 only
  4687. // push.apply(_, arraylike) throws on ancient WebKit
  4688. jQuery.merge( scripts, getAll( node, "script" ) );
  4689. }
  4690. }
  4691. callback.call( collection[ i ], node, i );
  4692. }
  4693. if ( hasScripts ) {
  4694. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4695. // Reenable scripts
  4696. jQuery.map( scripts, restoreScript );
  4697. // Evaluate executable scripts on first document insertion
  4698. for ( i = 0; i < hasScripts; i++ ) {
  4699. node = scripts[ i ];
  4700. if ( rscriptType.test( node.type || "" ) &&
  4701. !dataPriv.access( node, "globalEval" ) &&
  4702. jQuery.contains( doc, node ) ) {
  4703. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  4704. // Optional AJAX dependency, but won't run scripts if not present
  4705. if ( jQuery._evalUrl ) {
  4706. jQuery._evalUrl( node.src );
  4707. }
  4708. } else {
  4709. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  4710. }
  4711. }
  4712. }
  4713. }
  4714. }
  4715. }
  4716. return collection;
  4717. }
  4718. function remove( elem, selector, keepData ) {
  4719. var node,
  4720. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  4721. i = 0;
  4722. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  4723. if ( !keepData && node.nodeType === 1 ) {
  4724. jQuery.cleanData( getAll( node ) );
  4725. }
  4726. if ( node.parentNode ) {
  4727. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  4728. setGlobalEval( getAll( node, "script" ) );
  4729. }
  4730. node.parentNode.removeChild( node );
  4731. }
  4732. }
  4733. return elem;
  4734. }
  4735. jQuery.extend( {
  4736. htmlPrefilter: function( html ) {
  4737. return html;
  4738. },
  4739. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4740. var i, l, srcElements, destElements,
  4741. clone = elem.cloneNode( true ),
  4742. inPage = jQuery.contains( elem.ownerDocument, elem );
  4743. // Fix IE cloning issues
  4744. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  4745. !jQuery.isXMLDoc( elem ) ) {
  4746. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  4747. destElements = getAll( clone );
  4748. srcElements = getAll( elem );
  4749. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4750. fixInput( srcElements[ i ], destElements[ i ] );
  4751. }
  4752. }
  4753. // Copy the events from the original to the clone
  4754. if ( dataAndEvents ) {
  4755. if ( deepDataAndEvents ) {
  4756. srcElements = srcElements || getAll( elem );
  4757. destElements = destElements || getAll( clone );
  4758. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4759. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  4760. }
  4761. } else {
  4762. cloneCopyEvent( elem, clone );
  4763. }
  4764. }
  4765. // Preserve script evaluation history
  4766. destElements = getAll( clone, "script" );
  4767. if ( destElements.length > 0 ) {
  4768. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  4769. }
  4770. // Return the cloned set
  4771. return clone;
  4772. },
  4773. cleanData: function( elems ) {
  4774. var data, elem, type,
  4775. special = jQuery.event.special,
  4776. i = 0;
  4777. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  4778. if ( acceptData( elem ) ) {
  4779. if ( ( data = elem[ dataPriv.expando ] ) ) {
  4780. if ( data.events ) {
  4781. for ( type in data.events ) {
  4782. if ( special[ type ] ) {
  4783. jQuery.event.remove( elem, type );
  4784. // This is a shortcut to avoid jQuery.event.remove's overhead
  4785. } else {
  4786. jQuery.removeEvent( elem, type, data.handle );
  4787. }
  4788. }
  4789. }
  4790. // Support: Chrome <=35 - 45+
  4791. // Assign undefined instead of using delete, see Data#remove
  4792. elem[ dataPriv.expando ] = undefined;
  4793. }
  4794. if ( elem[ dataUser.expando ] ) {
  4795. // Support: Chrome <=35 - 45+
  4796. // Assign undefined instead of using delete, see Data#remove
  4797. elem[ dataUser.expando ] = undefined;
  4798. }
  4799. }
  4800. }
  4801. }
  4802. } );
  4803. jQuery.fn.extend( {
  4804. detach: function( selector ) {
  4805. return remove( this, selector, true );
  4806. },
  4807. remove: function( selector ) {
  4808. return remove( this, selector );
  4809. },
  4810. text: function( value ) {
  4811. return access( this, function( value ) {
  4812. return value === undefined ?
  4813. jQuery.text( this ) :
  4814. this.empty().each( function() {
  4815. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4816. this.textContent = value;
  4817. }
  4818. } );
  4819. }, null, value, arguments.length );
  4820. },
  4821. append: function() {
  4822. return domManip( this, arguments, function( elem ) {
  4823. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4824. var target = manipulationTarget( this, elem );
  4825. target.appendChild( elem );
  4826. }
  4827. } );
  4828. },
  4829. prepend: function() {
  4830. return domManip( this, arguments, function( elem ) {
  4831. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4832. var target = manipulationTarget( this, elem );
  4833. target.insertBefore( elem, target.firstChild );
  4834. }
  4835. } );
  4836. },
  4837. before: function() {
  4838. return domManip( this, arguments, function( elem ) {
  4839. if ( this.parentNode ) {
  4840. this.parentNode.insertBefore( elem, this );
  4841. }
  4842. } );
  4843. },
  4844. after: function() {
  4845. return domManip( this, arguments, function( elem ) {
  4846. if ( this.parentNode ) {
  4847. this.parentNode.insertBefore( elem, this.nextSibling );
  4848. }
  4849. } );
  4850. },
  4851. empty: function() {
  4852. var elem,
  4853. i = 0;
  4854. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  4855. if ( elem.nodeType === 1 ) {
  4856. // Prevent memory leaks
  4857. jQuery.cleanData( getAll( elem, false ) );
  4858. // Remove any remaining nodes
  4859. elem.textContent = "";
  4860. }
  4861. }
  4862. return this;
  4863. },
  4864. clone: function( dataAndEvents, deepDataAndEvents ) {
  4865. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4866. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4867. return this.map( function() {
  4868. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4869. } );
  4870. },
  4871. html: function( value ) {
  4872. return access( this, function( value ) {
  4873. var elem = this[ 0 ] || {},
  4874. i = 0,
  4875. l = this.length;
  4876. if ( value === undefined && elem.nodeType === 1 ) {
  4877. return elem.innerHTML;
  4878. }
  4879. // See if we can take a shortcut and just use innerHTML
  4880. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  4881. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  4882. value = jQuery.htmlPrefilter( value );
  4883. try {
  4884. for ( ; i < l; i++ ) {
  4885. elem = this[ i ] || {};
  4886. // Remove element nodes and prevent memory leaks
  4887. if ( elem.nodeType === 1 ) {
  4888. jQuery.cleanData( getAll( elem, false ) );
  4889. elem.innerHTML = value;
  4890. }
  4891. }
  4892. elem = 0;
  4893. // If using innerHTML throws an exception, use the fallback method
  4894. } catch ( e ) {}
  4895. }
  4896. if ( elem ) {
  4897. this.empty().append( value );
  4898. }
  4899. }, null, value, arguments.length );
  4900. },
  4901. replaceWith: function() {
  4902. var ignored = [];
  4903. // Make the changes, replacing each non-ignored context element with the new content
  4904. return domManip( this, arguments, function( elem ) {
  4905. var parent = this.parentNode;
  4906. if ( jQuery.inArray( this, ignored ) < 0 ) {
  4907. jQuery.cleanData( getAll( this ) );
  4908. if ( parent ) {
  4909. parent.replaceChild( elem, this );
  4910. }
  4911. }
  4912. // Force callback invocation
  4913. }, ignored );
  4914. }
  4915. } );
  4916. jQuery.each( {
  4917. appendTo: "append",
  4918. prependTo: "prepend",
  4919. insertBefore: "before",
  4920. insertAfter: "after",
  4921. replaceAll: "replaceWith"
  4922. }, function( name, original ) {
  4923. jQuery.fn[ name ] = function( selector ) {
  4924. var elems,
  4925. ret = [],
  4926. insert = jQuery( selector ),
  4927. last = insert.length - 1,
  4928. i = 0;
  4929. for ( ; i <= last; i++ ) {
  4930. elems = i === last ? this : this.clone( true );
  4931. jQuery( insert[ i ] )[ original ]( elems );
  4932. // Support: Android <=4.0 only, PhantomJS 1 only
  4933. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  4934. push.apply( ret, elems.get() );
  4935. }
  4936. return this.pushStack( ret );
  4937. };
  4938. } );
  4939. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  4940. var getStyles = function( elem ) {
  4941. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  4942. // IE throws on elements created in popups
  4943. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  4944. var view = elem.ownerDocument.defaultView;
  4945. if ( !view || !view.opener ) {
  4946. view = window;
  4947. }
  4948. return view.getComputedStyle( elem );
  4949. };
  4950. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  4951. ( function() {
  4952. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  4953. // so they're executed at the same time to save the second computation.
  4954. function computeStyleTests() {
  4955. // This is a singleton, we need to execute it only once
  4956. if ( !div ) {
  4957. return;
  4958. }
  4959. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  4960. "margin-top:1px;padding:0;border:0";
  4961. div.style.cssText =
  4962. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  4963. "margin:auto;border:1px;padding:1px;" +
  4964. "width:60%;top:1%";
  4965. documentElement.appendChild( container ).appendChild( div );
  4966. var divStyle = window.getComputedStyle( div );
  4967. pixelPositionVal = divStyle.top !== "1%";
  4968. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  4969. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  4970. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  4971. // Some styles come back with percentage values, even though they shouldn't
  4972. div.style.right = "60%";
  4973. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  4974. // Support: IE 9 - 11 only
  4975. // Detect misreporting of content dimensions for box-sizing:border-box elements
  4976. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  4977. // Support: IE 9 only
  4978. // Detect overflow:scroll screwiness (gh-3699)
  4979. div.style.position = "absolute";
  4980. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  4981. documentElement.removeChild( container );
  4982. // Nullify the div so it wouldn't be stored in the memory and
  4983. // it will also be a sign that checks already performed
  4984. div = null;
  4985. }
  4986. function roundPixelMeasures( measure ) {
  4987. return Math.round( parseFloat( measure ) );
  4988. }
  4989. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  4990. reliableMarginLeftVal,
  4991. container = document.createElement( "div" ),
  4992. div = document.createElement( "div" );
  4993. // Finish early in limited (non-browser) environments
  4994. if ( !div.style ) {
  4995. return;
  4996. }
  4997. // Support: IE <=9 - 11 only
  4998. // Style of cloned element affects source element cloned (#8908)
  4999. div.style.backgroundClip = "content-box";
  5000. div.cloneNode( true ).style.backgroundClip = "";
  5001. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5002. jQuery.extend( support, {
  5003. boxSizingReliable: function() {
  5004. computeStyleTests();
  5005. return boxSizingReliableVal;
  5006. },
  5007. pixelBoxStyles: function() {
  5008. computeStyleTests();
  5009. return pixelBoxStylesVal;
  5010. },
  5011. pixelPosition: function() {
  5012. computeStyleTests();
  5013. return pixelPositionVal;
  5014. },
  5015. reliableMarginLeft: function() {
  5016. computeStyleTests();
  5017. return reliableMarginLeftVal;
  5018. },
  5019. scrollboxSize: function() {
  5020. computeStyleTests();
  5021. return scrollboxSizeVal;
  5022. }
  5023. } );
  5024. } )();
  5025. function curCSS( elem, name, computed ) {
  5026. var width, minWidth, maxWidth, ret,
  5027. // Support: Firefox 51+
  5028. // Retrieving style before computed somehow
  5029. // fixes an issue with getting wrong values
  5030. // on detached elements
  5031. style = elem.style;
  5032. computed = computed || getStyles( elem );
  5033. // getPropertyValue is needed for:
  5034. // .css('filter') (IE 9 only, #12537)
  5035. // .css('--customProperty) (#3144)
  5036. if ( computed ) {
  5037. ret = computed.getPropertyValue( name ) || computed[ name ];
  5038. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5039. ret = jQuery.style( elem, name );
  5040. }
  5041. // A tribute to the "awesome hack by Dean Edwards"
  5042. // Android Browser returns percentage for some values,
  5043. // but width seems to be reliably pixels.
  5044. // This is against the CSSOM draft spec:
  5045. // https://drafts.csswg.org/cssom/#resolved-values
  5046. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  5047. // Remember the original values
  5048. width = style.width;
  5049. minWidth = style.minWidth;
  5050. maxWidth = style.maxWidth;
  5051. // Put in the new values to get a computed value out
  5052. style.minWidth = style.maxWidth = style.width = ret;
  5053. ret = computed.width;
  5054. // Revert the changed values
  5055. style.width = width;
  5056. style.minWidth = minWidth;
  5057. style.maxWidth = maxWidth;
  5058. }
  5059. }
  5060. return ret !== undefined ?
  5061. // Support: IE <=9 - 11 only
  5062. // IE returns zIndex value as an integer.
  5063. ret + "" :
  5064. ret;
  5065. }
  5066. function addGetHookIf( conditionFn, hookFn ) {
  5067. // Define the hook, we'll check on the first run if it's really needed.
  5068. return {
  5069. get: function() {
  5070. if ( conditionFn() ) {
  5071. // Hook not needed (or it's not possible to use it due
  5072. // to missing dependency), remove it.
  5073. delete this.get;
  5074. return;
  5075. }
  5076. // Hook needed; redefine it so that the support test is not executed again.
  5077. return ( this.get = hookFn ).apply( this, arguments );
  5078. }
  5079. };
  5080. }
  5081. var
  5082. // Swappable if display is none or starts with table
  5083. // except "table", "table-cell", or "table-caption"
  5084. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5085. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5086. rcustomProp = /^--/,
  5087. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5088. cssNormalTransform = {
  5089. letterSpacing: "0",
  5090. fontWeight: "400"
  5091. },
  5092. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5093. emptyStyle = document.createElement( "div" ).style;
  5094. // Return a css property mapped to a potentially vendor prefixed property
  5095. function vendorPropName( name ) {
  5096. // Shortcut for names that are not vendor prefixed
  5097. if ( name in emptyStyle ) {
  5098. return name;
  5099. }
  5100. // Check for vendor prefixed names
  5101. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5102. i = cssPrefixes.length;
  5103. while ( i-- ) {
  5104. name = cssPrefixes[ i ] + capName;
  5105. if ( name in emptyStyle ) {
  5106. return name;
  5107. }
  5108. }
  5109. }
  5110. // Return a property mapped along what jQuery.cssProps suggests or to
  5111. // a vendor prefixed property.
  5112. function finalPropName( name ) {
  5113. var ret = jQuery.cssProps[ name ];
  5114. if ( !ret ) {
  5115. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  5116. }
  5117. return ret;
  5118. }
  5119. function setPositiveNumber( elem, value, subtract ) {
  5120. // Any relative (+/-) values have already been
  5121. // normalized at this point
  5122. var matches = rcssNum.exec( value );
  5123. return matches ?
  5124. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5125. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5126. value;
  5127. }
  5128. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  5129. var i = dimension === "width" ? 1 : 0,
  5130. extra = 0,
  5131. delta = 0;
  5132. // Adjustment may not be necessary
  5133. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  5134. return 0;
  5135. }
  5136. for ( ; i < 4; i += 2 ) {
  5137. // Both box models exclude margin
  5138. if ( box === "margin" ) {
  5139. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  5140. }
  5141. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  5142. if ( !isBorderBox ) {
  5143. // Add padding
  5144. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5145. // For "border" or "margin", add border
  5146. if ( box !== "padding" ) {
  5147. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5148. // But still keep track of it otherwise
  5149. } else {
  5150. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5151. }
  5152. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  5153. // "padding" or "margin"
  5154. } else {
  5155. // For "content", subtract padding
  5156. if ( box === "content" ) {
  5157. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5158. }
  5159. // For "content" or "padding", subtract border
  5160. if ( box !== "margin" ) {
  5161. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5162. }
  5163. }
  5164. }
  5165. // Account for positive content-box scroll gutter when requested by providing computedVal
  5166. if ( !isBorderBox && computedVal >= 0 ) {
  5167. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  5168. // Assuming integer scroll gutter, subtract the rest and round down
  5169. delta += Math.max( 0, Math.ceil(
  5170. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5171. computedVal -
  5172. delta -
  5173. extra -
  5174. 0.5
  5175. ) );
  5176. }
  5177. return delta;
  5178. }
  5179. function getWidthOrHeight( elem, dimension, extra ) {
  5180. // Start with computed style
  5181. var styles = getStyles( elem ),
  5182. val = curCSS( elem, dimension, styles ),
  5183. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5184. valueIsBorderBox = isBorderBox;
  5185. // Support: Firefox <=54
  5186. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  5187. if ( rnumnonpx.test( val ) ) {
  5188. if ( !extra ) {
  5189. return val;
  5190. }
  5191. val = "auto";
  5192. }
  5193. // Check for style in case a browser which returns unreliable values
  5194. // for getComputedStyle silently falls back to the reliable elem.style
  5195. valueIsBorderBox = valueIsBorderBox &&
  5196. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  5197. // Fall back to offsetWidth/offsetHeight when value is "auto"
  5198. // This happens for inline elements with no explicit setting (gh-3571)
  5199. // Support: Android <=4.1 - 4.3 only
  5200. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  5201. if ( val === "auto" ||
  5202. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  5203. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  5204. // offsetWidth/offsetHeight provide border-box values
  5205. valueIsBorderBox = true;
  5206. }
  5207. // Normalize "" and auto
  5208. val = parseFloat( val ) || 0;
  5209. // Adjust for the element's box model
  5210. return ( val +
  5211. boxModelAdjustment(
  5212. elem,
  5213. dimension,
  5214. extra || ( isBorderBox ? "border" : "content" ),
  5215. valueIsBorderBox,
  5216. styles,
  5217. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  5218. val
  5219. )
  5220. ) + "px";
  5221. }
  5222. jQuery.extend( {
  5223. // Add in style property hooks for overriding the default
  5224. // behavior of getting and setting a style property
  5225. cssHooks: {
  5226. opacity: {
  5227. get: function( elem, computed ) {
  5228. if ( computed ) {
  5229. // We should always get a number back from opacity
  5230. var ret = curCSS( elem, "opacity" );
  5231. return ret === "" ? "1" : ret;
  5232. }
  5233. }
  5234. }
  5235. },
  5236. // Don't automatically add "px" to these possibly-unitless properties
  5237. cssNumber: {
  5238. "animationIterationCount": true,
  5239. "columnCount": true,
  5240. "fillOpacity": true,
  5241. "flexGrow": true,
  5242. "flexShrink": true,
  5243. "fontWeight": true,
  5244. "lineHeight": true,
  5245. "opacity": true,
  5246. "order": true,
  5247. "orphans": true,
  5248. "widows": true,
  5249. "zIndex": true,
  5250. "zoom": true
  5251. },
  5252. // Add in properties whose names you wish to fix before
  5253. // setting or getting the value
  5254. cssProps: {},
  5255. // Get and set the style property on a DOM Node
  5256. style: function( elem, name, value, extra ) {
  5257. // Don't set styles on text and comment nodes
  5258. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5259. return;
  5260. }
  5261. // Make sure that we're working with the right name
  5262. var ret, type, hooks,
  5263. origName = camelCase( name ),
  5264. isCustomProp = rcustomProp.test( name ),
  5265. style = elem.style;
  5266. // Make sure that we're working with the right name. We don't
  5267. // want to query the value if it is a CSS custom property
  5268. // since they are user-defined.
  5269. if ( !isCustomProp ) {
  5270. name = finalPropName( origName );
  5271. }
  5272. // Gets hook for the prefixed version, then unprefixed version
  5273. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5274. // Check if we're setting a value
  5275. if ( value !== undefined ) {
  5276. type = typeof value;
  5277. // Convert "+=" or "-=" to relative numbers (#7345)
  5278. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5279. value = adjustCSS( elem, name, ret );
  5280. // Fixes bug #9237
  5281. type = "number";
  5282. }
  5283. // Make sure that null and NaN values aren't set (#7116)
  5284. if ( value == null || value !== value ) {
  5285. return;
  5286. }
  5287. // If a number was passed in, add the unit (except for certain CSS properties)
  5288. if ( type === "number" ) {
  5289. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5290. }
  5291. // background-* props affect original clone's values
  5292. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5293. style[ name ] = "inherit";
  5294. }
  5295. // If a hook was provided, use that value, otherwise just set the specified value
  5296. if ( !hooks || !( "set" in hooks ) ||
  5297. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5298. if ( isCustomProp ) {
  5299. style.setProperty( name, value );
  5300. } else {
  5301. style[ name ] = value;
  5302. }
  5303. }
  5304. } else {
  5305. // If a hook was provided get the non-computed value from there
  5306. if ( hooks && "get" in hooks &&
  5307. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5308. return ret;
  5309. }
  5310. // Otherwise just get the value from the style object
  5311. return style[ name ];
  5312. }
  5313. },
  5314. css: function( elem, name, extra, styles ) {
  5315. var val, num, hooks,
  5316. origName = camelCase( name ),
  5317. isCustomProp = rcustomProp.test( name );
  5318. // Make sure that we're working with the right name. We don't
  5319. // want to modify the value if it is a CSS custom property
  5320. // since they are user-defined.
  5321. if ( !isCustomProp ) {
  5322. name = finalPropName( origName );
  5323. }
  5324. // Try prefixed name followed by the unprefixed name
  5325. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5326. // If a hook was provided get the computed value from there
  5327. if ( hooks && "get" in hooks ) {
  5328. val = hooks.get( elem, true, extra );
  5329. }
  5330. // Otherwise, if a way to get the computed value exists, use that
  5331. if ( val === undefined ) {
  5332. val = curCSS( elem, name, styles );
  5333. }
  5334. // Convert "normal" to computed value
  5335. if ( val === "normal" && name in cssNormalTransform ) {
  5336. val = cssNormalTransform[ name ];
  5337. }
  5338. // Make numeric if forced or a qualifier was provided and val looks numeric
  5339. if ( extra === "" || extra ) {
  5340. num = parseFloat( val );
  5341. return extra === true || isFinite( num ) ? num || 0 : val;
  5342. }
  5343. return val;
  5344. }
  5345. } );
  5346. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  5347. jQuery.cssHooks[ dimension ] = {
  5348. get: function( elem, computed, extra ) {
  5349. if ( computed ) {
  5350. // Certain elements can have dimension info if we invisibly show them
  5351. // but it must have a current display style that would benefit
  5352. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5353. // Support: Safari 8+
  5354. // Table columns in Safari have non-zero offsetWidth & zero
  5355. // getBoundingClientRect().width unless display is changed.
  5356. // Support: IE <=11 only
  5357. // Running getBoundingClientRect on a disconnected node
  5358. // in IE throws an error.
  5359. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  5360. swap( elem, cssShow, function() {
  5361. return getWidthOrHeight( elem, dimension, extra );
  5362. } ) :
  5363. getWidthOrHeight( elem, dimension, extra );
  5364. }
  5365. },
  5366. set: function( elem, value, extra ) {
  5367. var matches,
  5368. styles = getStyles( elem ),
  5369. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5370. subtract = extra && boxModelAdjustment(
  5371. elem,
  5372. dimension,
  5373. extra,
  5374. isBorderBox,
  5375. styles
  5376. );
  5377. // Account for unreliable border-box dimensions by comparing offset* to computed and
  5378. // faking a content-box to get border and padding (gh-3699)
  5379. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  5380. subtract -= Math.ceil(
  5381. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5382. parseFloat( styles[ dimension ] ) -
  5383. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  5384. 0.5
  5385. );
  5386. }
  5387. // Convert to pixels if value adjustment is needed
  5388. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  5389. ( matches[ 3 ] || "px" ) !== "px" ) {
  5390. elem.style[ dimension ] = value;
  5391. value = jQuery.css( elem, dimension );
  5392. }
  5393. return setPositiveNumber( elem, value, subtract );
  5394. }
  5395. };
  5396. } );
  5397. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  5398. function( elem, computed ) {
  5399. if ( computed ) {
  5400. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  5401. elem.getBoundingClientRect().left -
  5402. swap( elem, { marginLeft: 0 }, function() {
  5403. return elem.getBoundingClientRect().left;
  5404. } )
  5405. ) + "px";
  5406. }
  5407. }
  5408. );
  5409. // These hooks are used by animate to expand properties
  5410. jQuery.each( {
  5411. margin: "",
  5412. padding: "",
  5413. border: "Width"
  5414. }, function( prefix, suffix ) {
  5415. jQuery.cssHooks[ prefix + suffix ] = {
  5416. expand: function( value ) {
  5417. var i = 0,
  5418. expanded = {},
  5419. // Assumes a single number if not a string
  5420. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  5421. for ( ; i < 4; i++ ) {
  5422. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5423. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5424. }
  5425. return expanded;
  5426. }
  5427. };
  5428. if ( prefix !== "margin" ) {
  5429. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5430. }
  5431. } );
  5432. jQuery.fn.extend( {
  5433. css: function( name, value ) {
  5434. return access( this, function( elem, name, value ) {
  5435. var styles, len,
  5436. map = {},
  5437. i = 0;
  5438. if ( Array.isArray( name ) ) {
  5439. styles = getStyles( elem );
  5440. len = name.length;
  5441. for ( ; i < len; i++ ) {
  5442. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5443. }
  5444. return map;
  5445. }
  5446. return value !== undefined ?
  5447. jQuery.style( elem, name, value ) :
  5448. jQuery.css( elem, name );
  5449. }, name, value, arguments.length > 1 );
  5450. }
  5451. } );
  5452. function Tween( elem, options, prop, end, easing ) {
  5453. return new Tween.prototype.init( elem, options, prop, end, easing );
  5454. }
  5455. jQuery.Tween = Tween;
  5456. Tween.prototype = {
  5457. constructor: Tween,
  5458. init: function( elem, options, prop, end, easing, unit ) {
  5459. this.elem = elem;
  5460. this.prop = prop;
  5461. this.easing = easing || jQuery.easing._default;
  5462. this.options = options;
  5463. this.start = this.now = this.cur();
  5464. this.end = end;
  5465. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  5466. },
  5467. cur: function() {
  5468. var hooks = Tween.propHooks[ this.prop ];
  5469. return hooks && hooks.get ?
  5470. hooks.get( this ) :
  5471. Tween.propHooks._default.get( this );
  5472. },
  5473. run: function( percent ) {
  5474. var eased,
  5475. hooks = Tween.propHooks[ this.prop ];
  5476. if ( this.options.duration ) {
  5477. this.pos = eased = jQuery.easing[ this.easing ](
  5478. percent, this.options.duration * percent, 0, 1, this.options.duration
  5479. );
  5480. } else {
  5481. this.pos = eased = percent;
  5482. }
  5483. this.now = ( this.end - this.start ) * eased + this.start;
  5484. if ( this.options.step ) {
  5485. this.options.step.call( this.elem, this.now, this );
  5486. }
  5487. if ( hooks && hooks.set ) {
  5488. hooks.set( this );
  5489. } else {
  5490. Tween.propHooks._default.set( this );
  5491. }
  5492. return this;
  5493. }
  5494. };
  5495. Tween.prototype.init.prototype = Tween.prototype;
  5496. Tween.propHooks = {
  5497. _default: {
  5498. get: function( tween ) {
  5499. var result;
  5500. // Use a property on the element directly when it is not a DOM element,
  5501. // or when there is no matching style property that exists.
  5502. if ( tween.elem.nodeType !== 1 ||
  5503. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  5504. return tween.elem[ tween.prop ];
  5505. }
  5506. // Passing an empty string as a 3rd parameter to .css will automatically
  5507. // attempt a parseFloat and fallback to a string if the parse fails.
  5508. // Simple values such as "10px" are parsed to Float;
  5509. // complex values such as "rotate(1rad)" are returned as-is.
  5510. result = jQuery.css( tween.elem, tween.prop, "" );
  5511. // Empty strings, null, undefined and "auto" are converted to 0.
  5512. return !result || result === "auto" ? 0 : result;
  5513. },
  5514. set: function( tween ) {
  5515. // Use step hook for back compat.
  5516. // Use cssHook if its there.
  5517. // Use .style if available and use plain properties where available.
  5518. if ( jQuery.fx.step[ tween.prop ] ) {
  5519. jQuery.fx.step[ tween.prop ]( tween );
  5520. } else if ( tween.elem.nodeType === 1 &&
  5521. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  5522. jQuery.cssHooks[ tween.prop ] ) ) {
  5523. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  5524. } else {
  5525. tween.elem[ tween.prop ] = tween.now;
  5526. }
  5527. }
  5528. }
  5529. };
  5530. // Support: IE <=9 only
  5531. // Panic based approach to setting things on disconnected nodes
  5532. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  5533. set: function( tween ) {
  5534. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  5535. tween.elem[ tween.prop ] = tween.now;
  5536. }
  5537. }
  5538. };
  5539. jQuery.easing = {
  5540. linear: function( p ) {
  5541. return p;
  5542. },
  5543. swing: function( p ) {
  5544. return 0.5 - Math.cos( p * Math.PI ) / 2;
  5545. },
  5546. _default: "swing"
  5547. };
  5548. jQuery.fx = Tween.prototype.init;
  5549. // Back compat <1.8 extension point
  5550. jQuery.fx.step = {};
  5551. var
  5552. fxNow, inProgress,
  5553. rfxtypes = /^(?:toggle|show|hide)$/,
  5554. rrun = /queueHooks$/;
  5555. function schedule() {
  5556. if ( inProgress ) {
  5557. if ( document.hidden === false && window.requestAnimationFrame ) {
  5558. window.requestAnimationFrame( schedule );
  5559. } else {
  5560. window.setTimeout( schedule, jQuery.fx.interval );
  5561. }
  5562. jQuery.fx.tick();
  5563. }
  5564. }
  5565. // Animations created synchronously will run synchronously
  5566. function createFxNow() {
  5567. window.setTimeout( function() {
  5568. fxNow = undefined;
  5569. } );
  5570. return ( fxNow = Date.now() );
  5571. }
  5572. // Generate parameters to create a standard animation
  5573. function genFx( type, includeWidth ) {
  5574. var which,
  5575. i = 0,
  5576. attrs = { height: type };
  5577. // If we include width, step value is 1 to do all cssExpand values,
  5578. // otherwise step value is 2 to skip over Left and Right
  5579. includeWidth = includeWidth ? 1 : 0;
  5580. for ( ; i < 4; i += 2 - includeWidth ) {
  5581. which = cssExpand[ i ];
  5582. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  5583. }
  5584. if ( includeWidth ) {
  5585. attrs.opacity = attrs.width = type;
  5586. }
  5587. return attrs;
  5588. }
  5589. function createTween( value, prop, animation ) {
  5590. var tween,
  5591. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  5592. index = 0,
  5593. length = collection.length;
  5594. for ( ; index < length; index++ ) {
  5595. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  5596. // We're done with this property
  5597. return tween;
  5598. }
  5599. }
  5600. }
  5601. function defaultPrefilter( elem, props, opts ) {
  5602. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  5603. isBox = "width" in props || "height" in props,
  5604. anim = this,
  5605. orig = {},
  5606. style = elem.style,
  5607. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  5608. dataShow = dataPriv.get( elem, "fxshow" );
  5609. // Queue-skipping animations hijack the fx hooks
  5610. if ( !opts.queue ) {
  5611. hooks = jQuery._queueHooks( elem, "fx" );
  5612. if ( hooks.unqueued == null ) {
  5613. hooks.unqueued = 0;
  5614. oldfire = hooks.empty.fire;
  5615. hooks.empty.fire = function() {
  5616. if ( !hooks.unqueued ) {
  5617. oldfire();
  5618. }
  5619. };
  5620. }
  5621. hooks.unqueued++;
  5622. anim.always( function() {
  5623. // Ensure the complete handler is called before this completes
  5624. anim.always( function() {
  5625. hooks.unqueued--;
  5626. if ( !jQuery.queue( elem, "fx" ).length ) {
  5627. hooks.empty.fire();
  5628. }
  5629. } );
  5630. } );
  5631. }
  5632. // Detect show/hide animations
  5633. for ( prop in props ) {
  5634. value = props[ prop ];
  5635. if ( rfxtypes.test( value ) ) {
  5636. delete props[ prop ];
  5637. toggle = toggle || value === "toggle";
  5638. if ( value === ( hidden ? "hide" : "show" ) ) {
  5639. // Pretend to be hidden if this is a "show" and
  5640. // there is still data from a stopped show/hide
  5641. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  5642. hidden = true;
  5643. // Ignore all other no-op show/hide data
  5644. } else {
  5645. continue;
  5646. }
  5647. }
  5648. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  5649. }
  5650. }
  5651. // Bail out if this is a no-op like .hide().hide()
  5652. propTween = !jQuery.isEmptyObject( props );
  5653. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  5654. return;
  5655. }
  5656. // Restrict "overflow" and "display" styles during box animations
  5657. if ( isBox && elem.nodeType === 1 ) {
  5658. // Support: IE <=9 - 11, Edge 12 - 15
  5659. // Record all 3 overflow attributes because IE does not infer the shorthand
  5660. // from identically-valued overflowX and overflowY and Edge just mirrors
  5661. // the overflowX value there.
  5662. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  5663. // Identify a display type, preferring old show/hide data over the CSS cascade
  5664. restoreDisplay = dataShow && dataShow.display;
  5665. if ( restoreDisplay == null ) {
  5666. restoreDisplay = dataPriv.get( elem, "display" );
  5667. }
  5668. display = jQuery.css( elem, "display" );
  5669. if ( display === "none" ) {
  5670. if ( restoreDisplay ) {
  5671. display = restoreDisplay;
  5672. } else {
  5673. // Get nonempty value(s) by temporarily forcing visibility
  5674. showHide( [ elem ], true );
  5675. restoreDisplay = elem.style.display || restoreDisplay;
  5676. display = jQuery.css( elem, "display" );
  5677. showHide( [ elem ] );
  5678. }
  5679. }
  5680. // Animate inline elements as inline-block
  5681. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  5682. if ( jQuery.css( elem, "float" ) === "none" ) {
  5683. // Restore the original display value at the end of pure show/hide animations
  5684. if ( !propTween ) {
  5685. anim.done( function() {
  5686. style.display = restoreDisplay;
  5687. } );
  5688. if ( restoreDisplay == null ) {
  5689. display = style.display;
  5690. restoreDisplay = display === "none" ? "" : display;
  5691. }
  5692. }
  5693. style.display = "inline-block";
  5694. }
  5695. }
  5696. }
  5697. if ( opts.overflow ) {
  5698. style.overflow = "hidden";
  5699. anim.always( function() {
  5700. style.overflow = opts.overflow[ 0 ];
  5701. style.overflowX = opts.overflow[ 1 ];
  5702. style.overflowY = opts.overflow[ 2 ];
  5703. } );
  5704. }
  5705. // Implement show/hide animations
  5706. propTween = false;
  5707. for ( prop in orig ) {
  5708. // General show/hide setup for this element animation
  5709. if ( !propTween ) {
  5710. if ( dataShow ) {
  5711. if ( "hidden" in dataShow ) {
  5712. hidden = dataShow.hidden;
  5713. }
  5714. } else {
  5715. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  5716. }
  5717. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  5718. if ( toggle ) {
  5719. dataShow.hidden = !hidden;
  5720. }
  5721. // Show elements before animating them
  5722. if ( hidden ) {
  5723. showHide( [ elem ], true );
  5724. }
  5725. /* eslint-disable no-loop-func */
  5726. anim.done( function() {
  5727. /* eslint-enable no-loop-func */
  5728. // The final step of a "hide" animation is actually hiding the element
  5729. if ( !hidden ) {
  5730. showHide( [ elem ] );
  5731. }
  5732. dataPriv.remove( elem, "fxshow" );
  5733. for ( prop in orig ) {
  5734. jQuery.style( elem, prop, orig[ prop ] );
  5735. }
  5736. } );
  5737. }
  5738. // Per-property setup
  5739. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  5740. if ( !( prop in dataShow ) ) {
  5741. dataShow[ prop ] = propTween.start;
  5742. if ( hidden ) {
  5743. propTween.end = propTween.start;
  5744. propTween.start = 0;
  5745. }
  5746. }
  5747. }
  5748. }
  5749. function propFilter( props, specialEasing ) {
  5750. var index, name, easing, value, hooks;
  5751. // camelCase, specialEasing and expand cssHook pass
  5752. for ( index in props ) {
  5753. name = camelCase( index );
  5754. easing = specialEasing[ name ];
  5755. value = props[ index ];
  5756. if ( Array.isArray( value ) ) {
  5757. easing = value[ 1 ];
  5758. value = props[ index ] = value[ 0 ];
  5759. }
  5760. if ( index !== name ) {
  5761. props[ name ] = value;
  5762. delete props[ index ];
  5763. }
  5764. hooks = jQuery.cssHooks[ name ];
  5765. if ( hooks && "expand" in hooks ) {
  5766. value = hooks.expand( value );
  5767. delete props[ name ];
  5768. // Not quite $.extend, this won't overwrite existing keys.
  5769. // Reusing 'index' because we have the correct "name"
  5770. for ( index in value ) {
  5771. if ( !( index in props ) ) {
  5772. props[ index ] = value[ index ];
  5773. specialEasing[ index ] = easing;
  5774. }
  5775. }
  5776. } else {
  5777. specialEasing[ name ] = easing;
  5778. }
  5779. }
  5780. }
  5781. function Animation( elem, properties, options ) {
  5782. var result,
  5783. stopped,
  5784. index = 0,
  5785. length = Animation.prefilters.length,
  5786. deferred = jQuery.Deferred().always( function() {
  5787. // Don't match elem in the :animated selector
  5788. delete tick.elem;
  5789. } ),
  5790. tick = function() {
  5791. if ( stopped ) {
  5792. return false;
  5793. }
  5794. var currentTime = fxNow || createFxNow(),
  5795. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  5796. // Support: Android 2.3 only
  5797. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  5798. temp = remaining / animation.duration || 0,
  5799. percent = 1 - temp,
  5800. index = 0,
  5801. length = animation.tweens.length;
  5802. for ( ; index < length; index++ ) {
  5803. animation.tweens[ index ].run( percent );
  5804. }
  5805. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  5806. // If there's more to do, yield
  5807. if ( percent < 1 && length ) {
  5808. return remaining;
  5809. }
  5810. // If this was an empty animation, synthesize a final progress notification
  5811. if ( !length ) {
  5812. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  5813. }
  5814. // Resolve the animation and report its conclusion
  5815. deferred.resolveWith( elem, [ animation ] );
  5816. return false;
  5817. },
  5818. animation = deferred.promise( {
  5819. elem: elem,
  5820. props: jQuery.extend( {}, properties ),
  5821. opts: jQuery.extend( true, {
  5822. specialEasing: {},
  5823. easing: jQuery.easing._default
  5824. }, options ),
  5825. originalProperties: properties,
  5826. originalOptions: options,
  5827. startTime: fxNow || createFxNow(),
  5828. duration: options.duration,
  5829. tweens: [],
  5830. createTween: function( prop, end ) {
  5831. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  5832. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  5833. animation.tweens.push( tween );
  5834. return tween;
  5835. },
  5836. stop: function( gotoEnd ) {
  5837. var index = 0,
  5838. // If we are going to the end, we want to run all the tweens
  5839. // otherwise we skip this part
  5840. length = gotoEnd ? animation.tweens.length : 0;
  5841. if ( stopped ) {
  5842. return this;
  5843. }
  5844. stopped = true;
  5845. for ( ; index < length; index++ ) {
  5846. animation.tweens[ index ].run( 1 );
  5847. }
  5848. // Resolve when we played the last frame; otherwise, reject
  5849. if ( gotoEnd ) {
  5850. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  5851. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  5852. } else {
  5853. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  5854. }
  5855. return this;
  5856. }
  5857. } ),
  5858. props = animation.props;
  5859. propFilter( props, animation.opts.specialEasing );
  5860. for ( ; index < length; index++ ) {
  5861. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  5862. if ( result ) {
  5863. if ( isFunction( result.stop ) ) {
  5864. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  5865. result.stop.bind( result );
  5866. }
  5867. return result;
  5868. }
  5869. }
  5870. jQuery.map( props, createTween, animation );
  5871. if ( isFunction( animation.opts.start ) ) {
  5872. animation.opts.start.call( elem, animation );
  5873. }
  5874. // Attach callbacks from options
  5875. animation
  5876. .progress( animation.opts.progress )
  5877. .done( animation.opts.done, animation.opts.complete )
  5878. .fail( animation.opts.fail )
  5879. .always( animation.opts.always );
  5880. jQuery.fx.timer(
  5881. jQuery.extend( tick, {
  5882. elem: elem,
  5883. anim: animation,
  5884. queue: animation.opts.queue
  5885. } )
  5886. );
  5887. return animation;
  5888. }
  5889. jQuery.Animation = jQuery.extend( Animation, {
  5890. tweeners: {
  5891. "*": [ function( prop, value ) {
  5892. var tween = this.createTween( prop, value );
  5893. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  5894. return tween;
  5895. } ]
  5896. },
  5897. tweener: function( props, callback ) {
  5898. if ( isFunction( props ) ) {
  5899. callback = props;
  5900. props = [ "*" ];
  5901. } else {
  5902. props = props.match( rnothtmlwhite );
  5903. }
  5904. var prop,
  5905. index = 0,
  5906. length = props.length;
  5907. for ( ; index < length; index++ ) {
  5908. prop = props[ index ];
  5909. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  5910. Animation.tweeners[ prop ].unshift( callback );
  5911. }
  5912. },
  5913. prefilters: [ defaultPrefilter ],
  5914. prefilter: function( callback, prepend ) {
  5915. if ( prepend ) {
  5916. Animation.prefilters.unshift( callback );
  5917. } else {
  5918. Animation.prefilters.push( callback );
  5919. }
  5920. }
  5921. } );
  5922. jQuery.speed = function( speed, easing, fn ) {
  5923. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  5924. complete: fn || !fn && easing ||
  5925. isFunction( speed ) && speed,
  5926. duration: speed,
  5927. easing: fn && easing || easing && !isFunction( easing ) && easing
  5928. };
  5929. // Go to the end state if fx are off
  5930. if ( jQuery.fx.off ) {
  5931. opt.duration = 0;
  5932. } else {
  5933. if ( typeof opt.duration !== "number" ) {
  5934. if ( opt.duration in jQuery.fx.speeds ) {
  5935. opt.duration = jQuery.fx.speeds[ opt.duration ];
  5936. } else {
  5937. opt.duration = jQuery.fx.speeds._default;
  5938. }
  5939. }
  5940. }
  5941. // Normalize opt.queue - true/undefined/null -> "fx"
  5942. if ( opt.queue == null || opt.queue === true ) {
  5943. opt.queue = "fx";
  5944. }
  5945. // Queueing
  5946. opt.old = opt.complete;
  5947. opt.complete = function() {
  5948. if ( isFunction( opt.old ) ) {
  5949. opt.old.call( this );
  5950. }
  5951. if ( opt.queue ) {
  5952. jQuery.dequeue( this, opt.queue );
  5953. }
  5954. };
  5955. return opt;
  5956. };
  5957. jQuery.fn.extend( {
  5958. fadeTo: function( speed, to, easing, callback ) {
  5959. // Show any hidden elements after setting opacity to 0
  5960. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  5961. // Animate to the value specified
  5962. .end().animate( { opacity: to }, speed, easing, callback );
  5963. },
  5964. animate: function( prop, speed, easing, callback ) {
  5965. var empty = jQuery.isEmptyObject( prop ),
  5966. optall = jQuery.speed( speed, easing, callback ),
  5967. doAnimation = function() {
  5968. // Operate on a copy of prop so per-property easing won't be lost
  5969. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  5970. // Empty animations, or finishing resolves immediately
  5971. if ( empty || dataPriv.get( this, "finish" ) ) {
  5972. anim.stop( true );
  5973. }
  5974. };
  5975. doAnimation.finish = doAnimation;
  5976. return empty || optall.queue === false ?
  5977. this.each( doAnimation ) :
  5978. this.queue( optall.queue, doAnimation );
  5979. },
  5980. stop: function( type, clearQueue, gotoEnd ) {
  5981. var stopQueue = function( hooks ) {
  5982. var stop = hooks.stop;
  5983. delete hooks.stop;
  5984. stop( gotoEnd );
  5985. };
  5986. if ( typeof type !== "string" ) {
  5987. gotoEnd = clearQueue;
  5988. clearQueue = type;
  5989. type = undefined;
  5990. }
  5991. if ( clearQueue && type !== false ) {
  5992. this.queue( type || "fx", [] );
  5993. }
  5994. return this.each( function() {
  5995. var dequeue = true,
  5996. index = type != null && type + "queueHooks",
  5997. timers = jQuery.timers,
  5998. data = dataPriv.get( this );
  5999. if ( index ) {
  6000. if ( data[ index ] && data[ index ].stop ) {
  6001. stopQueue( data[ index ] );
  6002. }
  6003. } else {
  6004. for ( index in data ) {
  6005. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  6006. stopQueue( data[ index ] );
  6007. }
  6008. }
  6009. }
  6010. for ( index = timers.length; index--; ) {
  6011. if ( timers[ index ].elem === this &&
  6012. ( type == null || timers[ index ].queue === type ) ) {
  6013. timers[ index ].anim.stop( gotoEnd );
  6014. dequeue = false;
  6015. timers.splice( index, 1 );
  6016. }
  6017. }
  6018. // Start the next in the queue if the last step wasn't forced.
  6019. // Timers currently will call their complete callbacks, which
  6020. // will dequeue but only if they were gotoEnd.
  6021. if ( dequeue || !gotoEnd ) {
  6022. jQuery.dequeue( this, type );
  6023. }
  6024. } );
  6025. },
  6026. finish: function( type ) {
  6027. if ( type !== false ) {
  6028. type = type || "fx";
  6029. }
  6030. return this.each( function() {
  6031. var index,
  6032. data = dataPriv.get( this ),
  6033. queue = data[ type + "queue" ],
  6034. hooks = data[ type + "queueHooks" ],
  6035. timers = jQuery.timers,
  6036. length = queue ? queue.length : 0;
  6037. // Enable finishing flag on private data
  6038. data.finish = true;
  6039. // Empty the queue first
  6040. jQuery.queue( this, type, [] );
  6041. if ( hooks && hooks.stop ) {
  6042. hooks.stop.call( this, true );
  6043. }
  6044. // Look for any active animations, and finish them
  6045. for ( index = timers.length; index--; ) {
  6046. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6047. timers[ index ].anim.stop( true );
  6048. timers.splice( index, 1 );
  6049. }
  6050. }
  6051. // Look for any animations in the old queue and finish them
  6052. for ( index = 0; index < length; index++ ) {
  6053. if ( queue[ index ] && queue[ index ].finish ) {
  6054. queue[ index ].finish.call( this );
  6055. }
  6056. }
  6057. // Turn off finishing flag
  6058. delete data.finish;
  6059. } );
  6060. }
  6061. } );
  6062. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6063. var cssFn = jQuery.fn[ name ];
  6064. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6065. return speed == null || typeof speed === "boolean" ?
  6066. cssFn.apply( this, arguments ) :
  6067. this.animate( genFx( name, true ), speed, easing, callback );
  6068. };
  6069. } );
  6070. // Generate shortcuts for custom animations
  6071. jQuery.each( {
  6072. slideDown: genFx( "show" ),
  6073. slideUp: genFx( "hide" ),
  6074. slideToggle: genFx( "toggle" ),
  6075. fadeIn: { opacity: "show" },
  6076. fadeOut: { opacity: "hide" },
  6077. fadeToggle: { opacity: "toggle" }
  6078. }, function( name, props ) {
  6079. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6080. return this.animate( props, speed, easing, callback );
  6081. };
  6082. } );
  6083. jQuery.timers = [];
  6084. jQuery.fx.tick = function() {
  6085. var timer,
  6086. i = 0,
  6087. timers = jQuery.timers;
  6088. fxNow = Date.now();
  6089. for ( ; i < timers.length; i++ ) {
  6090. timer = timers[ i ];
  6091. // Run the timer and safely remove it when done (allowing for external removal)
  6092. if ( !timer() && timers[ i ] === timer ) {
  6093. timers.splice( i--, 1 );
  6094. }
  6095. }
  6096. if ( !timers.length ) {
  6097. jQuery.fx.stop();
  6098. }
  6099. fxNow = undefined;
  6100. };
  6101. jQuery.fx.timer = function( timer ) {
  6102. jQuery.timers.push( timer );
  6103. jQuery.fx.start();
  6104. };
  6105. jQuery.fx.interval = 13;
  6106. jQuery.fx.start = function() {
  6107. if ( inProgress ) {
  6108. return;
  6109. }
  6110. inProgress = true;
  6111. schedule();
  6112. };
  6113. jQuery.fx.stop = function() {
  6114. inProgress = null;
  6115. };
  6116. jQuery.fx.speeds = {
  6117. slow: 600,
  6118. fast: 200,
  6119. // Default speed
  6120. _default: 400
  6121. };
  6122. // Based off of the plugin by Clint Helfers, with permission.
  6123. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6124. jQuery.fn.delay = function( time, type ) {
  6125. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6126. type = type || "fx";
  6127. return this.queue( type, function( next, hooks ) {
  6128. var timeout = window.setTimeout( next, time );
  6129. hooks.stop = function() {
  6130. window.clearTimeout( timeout );
  6131. };
  6132. } );
  6133. };
  6134. ( function() {
  6135. var input = document.createElement( "input" ),
  6136. select = document.createElement( "select" ),
  6137. opt = select.appendChild( document.createElement( "option" ) );
  6138. input.type = "checkbox";
  6139. // Support: Android <=4.3 only
  6140. // Default value for a checkbox should be "on"
  6141. support.checkOn = input.value !== "";
  6142. // Support: IE <=11 only
  6143. // Must access selectedIndex to make default options select
  6144. support.optSelected = opt.selected;
  6145. // Support: IE <=11 only
  6146. // An input loses its value after becoming a radio
  6147. input = document.createElement( "input" );
  6148. input.value = "t";
  6149. input.type = "radio";
  6150. support.radioValue = input.value === "t";
  6151. } )();
  6152. var boolHook,
  6153. attrHandle = jQuery.expr.attrHandle;
  6154. jQuery.fn.extend( {
  6155. attr: function( name, value ) {
  6156. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6157. },
  6158. removeAttr: function( name ) {
  6159. return this.each( function() {
  6160. jQuery.removeAttr( this, name );
  6161. } );
  6162. }
  6163. } );
  6164. jQuery.extend( {
  6165. attr: function( elem, name, value ) {
  6166. var ret, hooks,
  6167. nType = elem.nodeType;
  6168. // Don't get/set attributes on text, comment and attribute nodes
  6169. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6170. return;
  6171. }
  6172. // Fallback to prop when attributes are not supported
  6173. if ( typeof elem.getAttribute === "undefined" ) {
  6174. return jQuery.prop( elem, name, value );
  6175. }
  6176. // Attribute hooks are determined by the lowercase version
  6177. // Grab necessary hook if one is defined
  6178. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6179. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  6180. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  6181. }
  6182. if ( value !== undefined ) {
  6183. if ( value === null ) {
  6184. jQuery.removeAttr( elem, name );
  6185. return;
  6186. }
  6187. if ( hooks && "set" in hooks &&
  6188. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6189. return ret;
  6190. }
  6191. elem.setAttribute( name, value + "" );
  6192. return value;
  6193. }
  6194. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6195. return ret;
  6196. }
  6197. ret = jQuery.find.attr( elem, name );
  6198. // Non-existent attributes return null, we normalize to undefined
  6199. return ret == null ? undefined : ret;
  6200. },
  6201. attrHooks: {
  6202. type: {
  6203. set: function( elem, value ) {
  6204. if ( !support.radioValue && value === "radio" &&
  6205. nodeName( elem, "input" ) ) {
  6206. var val = elem.value;
  6207. elem.setAttribute( "type", value );
  6208. if ( val ) {
  6209. elem.value = val;
  6210. }
  6211. return value;
  6212. }
  6213. }
  6214. }
  6215. },
  6216. removeAttr: function( elem, value ) {
  6217. var name,
  6218. i = 0,
  6219. // Attribute names can contain non-HTML whitespace characters
  6220. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  6221. attrNames = value && value.match( rnothtmlwhite );
  6222. if ( attrNames && elem.nodeType === 1 ) {
  6223. while ( ( name = attrNames[ i++ ] ) ) {
  6224. elem.removeAttribute( name );
  6225. }
  6226. }
  6227. }
  6228. } );
  6229. // Hooks for boolean attributes
  6230. boolHook = {
  6231. set: function( elem, value, name ) {
  6232. if ( value === false ) {
  6233. // Remove boolean attributes when set to false
  6234. jQuery.removeAttr( elem, name );
  6235. } else {
  6236. elem.setAttribute( name, name );
  6237. }
  6238. return name;
  6239. }
  6240. };
  6241. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6242. var getter = attrHandle[ name ] || jQuery.find.attr;
  6243. attrHandle[ name ] = function( elem, name, isXML ) {
  6244. var ret, handle,
  6245. lowercaseName = name.toLowerCase();
  6246. if ( !isXML ) {
  6247. // Avoid an infinite loop by temporarily removing this function from the getter
  6248. handle = attrHandle[ lowercaseName ];
  6249. attrHandle[ lowercaseName ] = ret;
  6250. ret = getter( elem, name, isXML ) != null ?
  6251. lowercaseName :
  6252. null;
  6253. attrHandle[ lowercaseName ] = handle;
  6254. }
  6255. return ret;
  6256. };
  6257. } );
  6258. var rfocusable = /^(?:input|select|textarea|button)$/i,
  6259. rclickable = /^(?:a|area)$/i;
  6260. jQuery.fn.extend( {
  6261. prop: function( name, value ) {
  6262. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  6263. },
  6264. removeProp: function( name ) {
  6265. return this.each( function() {
  6266. delete this[ jQuery.propFix[ name ] || name ];
  6267. } );
  6268. }
  6269. } );
  6270. jQuery.extend( {
  6271. prop: function( elem, name, value ) {
  6272. var ret, hooks,
  6273. nType = elem.nodeType;
  6274. // Don't get/set properties on text, comment and attribute nodes
  6275. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6276. return;
  6277. }
  6278. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6279. // Fix name and attach hooks
  6280. name = jQuery.propFix[ name ] || name;
  6281. hooks = jQuery.propHooks[ name ];
  6282. }
  6283. if ( value !== undefined ) {
  6284. if ( hooks && "set" in hooks &&
  6285. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6286. return ret;
  6287. }
  6288. return ( elem[ name ] = value );
  6289. }
  6290. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6291. return ret;
  6292. }
  6293. return elem[ name ];
  6294. },
  6295. propHooks: {
  6296. tabIndex: {
  6297. get: function( elem ) {
  6298. // Support: IE <=9 - 11 only
  6299. // elem.tabIndex doesn't always return the
  6300. // correct value when it hasn't been explicitly set
  6301. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  6302. // Use proper attribute retrieval(#12072)
  6303. var tabindex = jQuery.find.attr( elem, "tabindex" );
  6304. if ( tabindex ) {
  6305. return parseInt( tabindex, 10 );
  6306. }
  6307. if (
  6308. rfocusable.test( elem.nodeName ) ||
  6309. rclickable.test( elem.nodeName ) &&
  6310. elem.href
  6311. ) {
  6312. return 0;
  6313. }
  6314. return -1;
  6315. }
  6316. }
  6317. },
  6318. propFix: {
  6319. "for": "htmlFor",
  6320. "class": "className"
  6321. }
  6322. } );
  6323. // Support: IE <=11 only
  6324. // Accessing the selectedIndex property
  6325. // forces the browser to respect setting selected
  6326. // on the option
  6327. // The getter ensures a default option is selected
  6328. // when in an optgroup
  6329. // eslint rule "no-unused-expressions" is disabled for this code
  6330. // since it considers such accessions noop
  6331. if ( !support.optSelected ) {
  6332. jQuery.propHooks.selected = {
  6333. get: function( elem ) {
  6334. /* eslint no-unused-expressions: "off" */
  6335. var parent = elem.parentNode;
  6336. if ( parent && parent.parentNode ) {
  6337. parent.parentNode.selectedIndex;
  6338. }
  6339. return null;
  6340. },
  6341. set: function( elem ) {
  6342. /* eslint no-unused-expressions: "off" */
  6343. var parent = elem.parentNode;
  6344. if ( parent ) {
  6345. parent.selectedIndex;
  6346. if ( parent.parentNode ) {
  6347. parent.parentNode.selectedIndex;
  6348. }
  6349. }
  6350. }
  6351. };
  6352. }
  6353. jQuery.each( [
  6354. "tabIndex",
  6355. "readOnly",
  6356. "maxLength",
  6357. "cellSpacing",
  6358. "cellPadding",
  6359. "rowSpan",
  6360. "colSpan",
  6361. "useMap",
  6362. "frameBorder",
  6363. "contentEditable"
  6364. ], function() {
  6365. jQuery.propFix[ this.toLowerCase() ] = this;
  6366. } );
  6367. // Strip and collapse whitespace according to HTML spec
  6368. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  6369. function stripAndCollapse( value ) {
  6370. var tokens = value.match( rnothtmlwhite ) || [];
  6371. return tokens.join( " " );
  6372. }
  6373. function getClass( elem ) {
  6374. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  6375. }
  6376. function classesToArray( value ) {
  6377. if ( Array.isArray( value ) ) {
  6378. return value;
  6379. }
  6380. if ( typeof value === "string" ) {
  6381. return value.match( rnothtmlwhite ) || [];
  6382. }
  6383. return [];
  6384. }
  6385. jQuery.fn.extend( {
  6386. addClass: function( value ) {
  6387. var classes, elem, cur, curValue, clazz, j, finalValue,
  6388. i = 0;
  6389. if ( isFunction( value ) ) {
  6390. return this.each( function( j ) {
  6391. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  6392. } );
  6393. }
  6394. classes = classesToArray( value );
  6395. if ( classes.length ) {
  6396. while ( ( elem = this[ i++ ] ) ) {
  6397. curValue = getClass( elem );
  6398. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6399. if ( cur ) {
  6400. j = 0;
  6401. while ( ( clazz = classes[ j++ ] ) ) {
  6402. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  6403. cur += clazz + " ";
  6404. }
  6405. }
  6406. // Only assign if different to avoid unneeded rendering.
  6407. finalValue = stripAndCollapse( cur );
  6408. if ( curValue !== finalValue ) {
  6409. elem.setAttribute( "class", finalValue );
  6410. }
  6411. }
  6412. }
  6413. }
  6414. return this;
  6415. },
  6416. removeClass: function( value ) {
  6417. var classes, elem, cur, curValue, clazz, j, finalValue,
  6418. i = 0;
  6419. if ( isFunction( value ) ) {
  6420. return this.each( function( j ) {
  6421. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  6422. } );
  6423. }
  6424. if ( !arguments.length ) {
  6425. return this.attr( "class", "" );
  6426. }
  6427. classes = classesToArray( value );
  6428. if ( classes.length ) {
  6429. while ( ( elem = this[ i++ ] ) ) {
  6430. curValue = getClass( elem );
  6431. // This expression is here for better compressibility (see addClass)
  6432. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6433. if ( cur ) {
  6434. j = 0;
  6435. while ( ( clazz = classes[ j++ ] ) ) {
  6436. // Remove *all* instances
  6437. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  6438. cur = cur.replace( " " + clazz + " ", " " );
  6439. }
  6440. }
  6441. // Only assign if different to avoid unneeded rendering.
  6442. finalValue = stripAndCollapse( cur );
  6443. if ( curValue !== finalValue ) {
  6444. elem.setAttribute( "class", finalValue );
  6445. }
  6446. }
  6447. }
  6448. }
  6449. return this;
  6450. },
  6451. toggleClass: function( value, stateVal ) {
  6452. var type = typeof value,
  6453. isValidValue = type === "string" || Array.isArray( value );
  6454. if ( typeof stateVal === "boolean" && isValidValue ) {
  6455. return stateVal ? this.addClass( value ) : this.removeClass( value );
  6456. }
  6457. if ( isFunction( value ) ) {
  6458. return this.each( function( i ) {
  6459. jQuery( this ).toggleClass(
  6460. value.call( this, i, getClass( this ), stateVal ),
  6461. stateVal
  6462. );
  6463. } );
  6464. }
  6465. return this.each( function() {
  6466. var className, i, self, classNames;
  6467. if ( isValidValue ) {
  6468. // Toggle individual class names
  6469. i = 0;
  6470. self = jQuery( this );
  6471. classNames = classesToArray( value );
  6472. while ( ( className = classNames[ i++ ] ) ) {
  6473. // Check each className given, space separated list
  6474. if ( self.hasClass( className ) ) {
  6475. self.removeClass( className );
  6476. } else {
  6477. self.addClass( className );
  6478. }
  6479. }
  6480. // Toggle whole class name
  6481. } else if ( value === undefined || type === "boolean" ) {
  6482. className = getClass( this );
  6483. if ( className ) {
  6484. // Store className if set
  6485. dataPriv.set( this, "__className__", className );
  6486. }
  6487. // If the element has a class name or if we're passed `false`,
  6488. // then remove the whole classname (if there was one, the above saved it).
  6489. // Otherwise bring back whatever was previously saved (if anything),
  6490. // falling back to the empty string if nothing was stored.
  6491. if ( this.setAttribute ) {
  6492. this.setAttribute( "class",
  6493. className || value === false ?
  6494. "" :
  6495. dataPriv.get( this, "__className__" ) || ""
  6496. );
  6497. }
  6498. }
  6499. } );
  6500. },
  6501. hasClass: function( selector ) {
  6502. var className, elem,
  6503. i = 0;
  6504. className = " " + selector + " ";
  6505. while ( ( elem = this[ i++ ] ) ) {
  6506. if ( elem.nodeType === 1 &&
  6507. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  6508. return true;
  6509. }
  6510. }
  6511. return false;
  6512. }
  6513. } );
  6514. var rreturn = /\r/g;
  6515. jQuery.fn.extend( {
  6516. val: function( value ) {
  6517. var hooks, ret, valueIsFunction,
  6518. elem = this[ 0 ];
  6519. if ( !arguments.length ) {
  6520. if ( elem ) {
  6521. hooks = jQuery.valHooks[ elem.type ] ||
  6522. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6523. if ( hooks &&
  6524. "get" in hooks &&
  6525. ( ret = hooks.get( elem, "value" ) ) !== undefined
  6526. ) {
  6527. return ret;
  6528. }
  6529. ret = elem.value;
  6530. // Handle most common string cases
  6531. if ( typeof ret === "string" ) {
  6532. return ret.replace( rreturn, "" );
  6533. }
  6534. // Handle cases where value is null/undef or number
  6535. return ret == null ? "" : ret;
  6536. }
  6537. return;
  6538. }
  6539. valueIsFunction = isFunction( value );
  6540. return this.each( function( i ) {
  6541. var val;
  6542. if ( this.nodeType !== 1 ) {
  6543. return;
  6544. }
  6545. if ( valueIsFunction ) {
  6546. val = value.call( this, i, jQuery( this ).val() );
  6547. } else {
  6548. val = value;
  6549. }
  6550. // Treat null/undefined as ""; convert numbers to string
  6551. if ( val == null ) {
  6552. val = "";
  6553. } else if ( typeof val === "number" ) {
  6554. val += "";
  6555. } else if ( Array.isArray( val ) ) {
  6556. val = jQuery.map( val, function( value ) {
  6557. return value == null ? "" : value + "";
  6558. } );
  6559. }
  6560. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6561. // If set returns undefined, fall back to normal setting
  6562. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  6563. this.value = val;
  6564. }
  6565. } );
  6566. }
  6567. } );
  6568. jQuery.extend( {
  6569. valHooks: {
  6570. option: {
  6571. get: function( elem ) {
  6572. var val = jQuery.find.attr( elem, "value" );
  6573. return val != null ?
  6574. val :
  6575. // Support: IE <=10 - 11 only
  6576. // option.text throws exceptions (#14686, #14858)
  6577. // Strip and collapse whitespace
  6578. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  6579. stripAndCollapse( jQuery.text( elem ) );
  6580. }
  6581. },
  6582. select: {
  6583. get: function( elem ) {
  6584. var value, option, i,
  6585. options = elem.options,
  6586. index = elem.selectedIndex,
  6587. one = elem.type === "select-one",
  6588. values = one ? null : [],
  6589. max = one ? index + 1 : options.length;
  6590. if ( index < 0 ) {
  6591. i = max;
  6592. } else {
  6593. i = one ? index : 0;
  6594. }
  6595. // Loop through all the selected options
  6596. for ( ; i < max; i++ ) {
  6597. option = options[ i ];
  6598. // Support: IE <=9 only
  6599. // IE8-9 doesn't update selected after form reset (#2551)
  6600. if ( ( option.selected || i === index ) &&
  6601. // Don't return options that are disabled or in a disabled optgroup
  6602. !option.disabled &&
  6603. ( !option.parentNode.disabled ||
  6604. !nodeName( option.parentNode, "optgroup" ) ) ) {
  6605. // Get the specific value for the option
  6606. value = jQuery( option ).val();
  6607. // We don't need an array for one selects
  6608. if ( one ) {
  6609. return value;
  6610. }
  6611. // Multi-Selects return an array
  6612. values.push( value );
  6613. }
  6614. }
  6615. return values;
  6616. },
  6617. set: function( elem, value ) {
  6618. var optionSet, option,
  6619. options = elem.options,
  6620. values = jQuery.makeArray( value ),
  6621. i = options.length;
  6622. while ( i-- ) {
  6623. option = options[ i ];
  6624. /* eslint-disable no-cond-assign */
  6625. if ( option.selected =
  6626. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  6627. ) {
  6628. optionSet = true;
  6629. }
  6630. /* eslint-enable no-cond-assign */
  6631. }
  6632. // Force browsers to behave consistently when non-matching value is set
  6633. if ( !optionSet ) {
  6634. elem.selectedIndex = -1;
  6635. }
  6636. return values;
  6637. }
  6638. }
  6639. }
  6640. } );
  6641. // Radios and checkboxes getter/setter
  6642. jQuery.each( [ "radio", "checkbox" ], function() {
  6643. jQuery.valHooks[ this ] = {
  6644. set: function( elem, value ) {
  6645. if ( Array.isArray( value ) ) {
  6646. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  6647. }
  6648. }
  6649. };
  6650. if ( !support.checkOn ) {
  6651. jQuery.valHooks[ this ].get = function( elem ) {
  6652. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  6653. };
  6654. }
  6655. } );
  6656. // Return jQuery for attributes-only inclusion
  6657. support.focusin = "onfocusin" in window;
  6658. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  6659. stopPropagationCallback = function( e ) {
  6660. e.stopPropagation();
  6661. };
  6662. jQuery.extend( jQuery.event, {
  6663. trigger: function( event, data, elem, onlyHandlers ) {
  6664. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  6665. eventPath = [ elem || document ],
  6666. type = hasOwn.call( event, "type" ) ? event.type : event,
  6667. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  6668. cur = lastElement = tmp = elem = elem || document;
  6669. // Don't do events on text and comment nodes
  6670. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  6671. return;
  6672. }
  6673. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  6674. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  6675. return;
  6676. }
  6677. if ( type.indexOf( "." ) > -1 ) {
  6678. // Namespaced trigger; create a regexp to match event type in handle()
  6679. namespaces = type.split( "." );
  6680. type = namespaces.shift();
  6681. namespaces.sort();
  6682. }
  6683. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  6684. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  6685. event = event[ jQuery.expando ] ?
  6686. event :
  6687. new jQuery.Event( type, typeof event === "object" && event );
  6688. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  6689. event.isTrigger = onlyHandlers ? 2 : 3;
  6690. event.namespace = namespaces.join( "." );
  6691. event.rnamespace = event.namespace ?
  6692. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  6693. null;
  6694. // Clean up the event in case it is being reused
  6695. event.result = undefined;
  6696. if ( !event.target ) {
  6697. event.target = elem;
  6698. }
  6699. // Clone any incoming data and prepend the event, creating the handler arg list
  6700. data = data == null ?
  6701. [ event ] :
  6702. jQuery.makeArray( data, [ event ] );
  6703. // Allow special events to draw outside the lines
  6704. special = jQuery.event.special[ type ] || {};
  6705. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  6706. return;
  6707. }
  6708. // Determine event propagation path in advance, per W3C events spec (#9951)
  6709. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  6710. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  6711. bubbleType = special.delegateType || type;
  6712. if ( !rfocusMorph.test( bubbleType + type ) ) {
  6713. cur = cur.parentNode;
  6714. }
  6715. for ( ; cur; cur = cur.parentNode ) {
  6716. eventPath.push( cur );
  6717. tmp = cur;
  6718. }
  6719. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  6720. if ( tmp === ( elem.ownerDocument || document ) ) {
  6721. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  6722. }
  6723. }
  6724. // Fire handlers on the event path
  6725. i = 0;
  6726. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  6727. lastElement = cur;
  6728. event.type = i > 1 ?
  6729. bubbleType :
  6730. special.bindType || type;
  6731. // jQuery handler
  6732. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  6733. dataPriv.get( cur, "handle" );
  6734. if ( handle ) {
  6735. handle.apply( cur, data );
  6736. }
  6737. // Native handler
  6738. handle = ontype && cur[ ontype ];
  6739. if ( handle && handle.apply && acceptData( cur ) ) {
  6740. event.result = handle.apply( cur, data );
  6741. if ( event.result === false ) {
  6742. event.preventDefault();
  6743. }
  6744. }
  6745. }
  6746. event.type = type;
  6747. // If nobody prevented the default action, do it now
  6748. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  6749. if ( ( !special._default ||
  6750. special._default.apply( eventPath.pop(), data ) === false ) &&
  6751. acceptData( elem ) ) {
  6752. // Call a native DOM method on the target with the same name as the event.
  6753. // Don't do default actions on window, that's where global variables be (#6170)
  6754. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  6755. // Don't re-trigger an onFOO event when we call its FOO() method
  6756. tmp = elem[ ontype ];
  6757. if ( tmp ) {
  6758. elem[ ontype ] = null;
  6759. }
  6760. // Prevent re-triggering of the same event, since we already bubbled it above
  6761. jQuery.event.triggered = type;
  6762. if ( event.isPropagationStopped() ) {
  6763. lastElement.addEventListener( type, stopPropagationCallback );
  6764. }
  6765. elem[ type ]();
  6766. if ( event.isPropagationStopped() ) {
  6767. lastElement.removeEventListener( type, stopPropagationCallback );
  6768. }
  6769. jQuery.event.triggered = undefined;
  6770. if ( tmp ) {
  6771. elem[ ontype ] = tmp;
  6772. }
  6773. }
  6774. }
  6775. }
  6776. return event.result;
  6777. },
  6778. // Piggyback on a donor event to simulate a different one
  6779. // Used only for `focus(in | out)` events
  6780. simulate: function( type, elem, event ) {
  6781. var e = jQuery.extend(
  6782. new jQuery.Event(),
  6783. event,
  6784. {
  6785. type: type,
  6786. isSimulated: true
  6787. }
  6788. );
  6789. jQuery.event.trigger( e, null, elem );
  6790. }
  6791. } );
  6792. jQuery.fn.extend( {
  6793. trigger: function( type, data ) {
  6794. return this.each( function() {
  6795. jQuery.event.trigger( type, data, this );
  6796. } );
  6797. },
  6798. triggerHandler: function( type, data ) {
  6799. var elem = this[ 0 ];
  6800. if ( elem ) {
  6801. return jQuery.event.trigger( type, data, elem, true );
  6802. }
  6803. }
  6804. } );
  6805. // Support: Firefox <=44
  6806. // Firefox doesn't have focus(in | out) events
  6807. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  6808. //
  6809. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  6810. // focus(in | out) events fire after focus & blur events,
  6811. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  6812. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  6813. if ( !support.focusin ) {
  6814. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  6815. // Attach a single capturing handler on the document while someone wants focusin/focusout
  6816. var handler = function( event ) {
  6817. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  6818. };
  6819. jQuery.event.special[ fix ] = {
  6820. setup: function() {
  6821. var doc = this.ownerDocument || this,
  6822. attaches = dataPriv.access( doc, fix );
  6823. if ( !attaches ) {
  6824. doc.addEventListener( orig, handler, true );
  6825. }
  6826. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  6827. },
  6828. teardown: function() {
  6829. var doc = this.ownerDocument || this,
  6830. attaches = dataPriv.access( doc, fix ) - 1;
  6831. if ( !attaches ) {
  6832. doc.removeEventListener( orig, handler, true );
  6833. dataPriv.remove( doc, fix );
  6834. } else {
  6835. dataPriv.access( doc, fix, attaches );
  6836. }
  6837. }
  6838. };
  6839. } );
  6840. }
  6841. var location = window.location;
  6842. var nonce = Date.now();
  6843. var rquery = ( /\?/ );
  6844. // Cross-browser xml parsing
  6845. jQuery.parseXML = function( data ) {
  6846. var xml;
  6847. if ( !data || typeof data !== "string" ) {
  6848. return null;
  6849. }
  6850. // Support: IE 9 - 11 only
  6851. // IE throws on parseFromString with invalid input.
  6852. try {
  6853. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  6854. } catch ( e ) {
  6855. xml = undefined;
  6856. }
  6857. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  6858. jQuery.error( "Invalid XML: " + data );
  6859. }
  6860. return xml;
  6861. };
  6862. var
  6863. rbracket = /\[\]$/,
  6864. rCRLF = /\r?\n/g,
  6865. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  6866. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  6867. function buildParams( prefix, obj, traditional, add ) {
  6868. var name;
  6869. if ( Array.isArray( obj ) ) {
  6870. // Serialize array item.
  6871. jQuery.each( obj, function( i, v ) {
  6872. if ( traditional || rbracket.test( prefix ) ) {
  6873. // Treat each array item as a scalar.
  6874. add( prefix, v );
  6875. } else {
  6876. // Item is non-scalar (array or object), encode its numeric index.
  6877. buildParams(
  6878. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  6879. v,
  6880. traditional,
  6881. add
  6882. );
  6883. }
  6884. } );
  6885. } else if ( !traditional && toType( obj ) === "object" ) {
  6886. // Serialize object item.
  6887. for ( name in obj ) {
  6888. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  6889. }
  6890. } else {
  6891. // Serialize scalar item.
  6892. add( prefix, obj );
  6893. }
  6894. }
  6895. // Serialize an array of form elements or a set of
  6896. // key/values into a query string
  6897. jQuery.param = function( a, traditional ) {
  6898. var prefix,
  6899. s = [],
  6900. add = function( key, valueOrFunction ) {
  6901. // If value is a function, invoke it and use its return value
  6902. var value = isFunction( valueOrFunction ) ?
  6903. valueOrFunction() :
  6904. valueOrFunction;
  6905. s[ s.length ] = encodeURIComponent( key ) + "=" +
  6906. encodeURIComponent( value == null ? "" : value );
  6907. };
  6908. // If an array was passed in, assume that it is an array of form elements.
  6909. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  6910. // Serialize the form elements
  6911. jQuery.each( a, function() {
  6912. add( this.name, this.value );
  6913. } );
  6914. } else {
  6915. // If traditional, encode the "old" way (the way 1.3.2 or older
  6916. // did it), otherwise encode params recursively.
  6917. for ( prefix in a ) {
  6918. buildParams( prefix, a[ prefix ], traditional, add );
  6919. }
  6920. }
  6921. // Return the resulting serialization
  6922. return s.join( "&" );
  6923. };
  6924. jQuery.fn.extend( {
  6925. serialize: function() {
  6926. return jQuery.param( this.serializeArray() );
  6927. },
  6928. serializeArray: function() {
  6929. return this.map( function() {
  6930. // Can add propHook for "elements" to filter or add form elements
  6931. var elements = jQuery.prop( this, "elements" );
  6932. return elements ? jQuery.makeArray( elements ) : this;
  6933. } )
  6934. .filter( function() {
  6935. var type = this.type;
  6936. // Use .is( ":disabled" ) so that fieldset[disabled] works
  6937. return this.name && !jQuery( this ).is( ":disabled" ) &&
  6938. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  6939. ( this.checked || !rcheckableType.test( type ) );
  6940. } )
  6941. .map( function( i, elem ) {
  6942. var val = jQuery( this ).val();
  6943. if ( val == null ) {
  6944. return null;
  6945. }
  6946. if ( Array.isArray( val ) ) {
  6947. return jQuery.map( val, function( val ) {
  6948. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6949. } );
  6950. }
  6951. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6952. } ).get();
  6953. }
  6954. } );
  6955. var
  6956. r20 = /%20/g,
  6957. rhash = /#.*$/,
  6958. rantiCache = /([?&])_=[^&]*/,
  6959. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  6960. // #7653, #8125, #8152: local protocol detection
  6961. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  6962. rnoContent = /^(?:GET|HEAD)$/,
  6963. rprotocol = /^\/\//,
  6964. /* Prefilters
  6965. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  6966. * 2) These are called:
  6967. * - BEFORE asking for a transport
  6968. * - AFTER param serialization (s.data is a string if s.processData is true)
  6969. * 3) key is the dataType
  6970. * 4) the catchall symbol "*" can be used
  6971. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  6972. */
  6973. prefilters = {},
  6974. /* Transports bindings
  6975. * 1) key is the dataType
  6976. * 2) the catchall symbol "*" can be used
  6977. * 3) selection will start with transport dataType and THEN go to "*" if needed
  6978. */
  6979. transports = {},
  6980. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  6981. allTypes = "*/".concat( "*" ),
  6982. // Anchor tag for parsing the document origin
  6983. originAnchor = document.createElement( "a" );
  6984. originAnchor.href = location.href;
  6985. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  6986. function addToPrefiltersOrTransports( structure ) {
  6987. // dataTypeExpression is optional and defaults to "*"
  6988. return function( dataTypeExpression, func ) {
  6989. if ( typeof dataTypeExpression !== "string" ) {
  6990. func = dataTypeExpression;
  6991. dataTypeExpression = "*";
  6992. }
  6993. var dataType,
  6994. i = 0,
  6995. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  6996. if ( isFunction( func ) ) {
  6997. // For each dataType in the dataTypeExpression
  6998. while ( ( dataType = dataTypes[ i++ ] ) ) {
  6999. // Prepend if requested
  7000. if ( dataType[ 0 ] === "+" ) {
  7001. dataType = dataType.slice( 1 ) || "*";
  7002. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  7003. // Otherwise append
  7004. } else {
  7005. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  7006. }
  7007. }
  7008. }
  7009. };
  7010. }
  7011. // Base inspection function for prefilters and transports
  7012. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  7013. var inspected = {},
  7014. seekingTransport = ( structure === transports );
  7015. function inspect( dataType ) {
  7016. var selected;
  7017. inspected[ dataType ] = true;
  7018. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  7019. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  7020. if ( typeof dataTypeOrTransport === "string" &&
  7021. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  7022. options.dataTypes.unshift( dataTypeOrTransport );
  7023. inspect( dataTypeOrTransport );
  7024. return false;
  7025. } else if ( seekingTransport ) {
  7026. return !( selected = dataTypeOrTransport );
  7027. }
  7028. } );
  7029. return selected;
  7030. }
  7031. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  7032. }
  7033. // A special extend for ajax options
  7034. // that takes "flat" options (not to be deep extended)
  7035. // Fixes #9887
  7036. function ajaxExtend( target, src ) {
  7037. var key, deep,
  7038. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7039. for ( key in src ) {
  7040. if ( src[ key ] !== undefined ) {
  7041. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  7042. }
  7043. }
  7044. if ( deep ) {
  7045. jQuery.extend( true, target, deep );
  7046. }
  7047. return target;
  7048. }
  7049. /* Handles responses to an ajax request:
  7050. * - finds the right dataType (mediates between content-type and expected dataType)
  7051. * - returns the corresponding response
  7052. */
  7053. function ajaxHandleResponses( s, jqXHR, responses ) {
  7054. var ct, type, finalDataType, firstDataType,
  7055. contents = s.contents,
  7056. dataTypes = s.dataTypes;
  7057. // Remove auto dataType and get content-type in the process
  7058. while ( dataTypes[ 0 ] === "*" ) {
  7059. dataTypes.shift();
  7060. if ( ct === undefined ) {
  7061. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7062. }
  7063. }
  7064. // Check if we're dealing with a known content-type
  7065. if ( ct ) {
  7066. for ( type in contents ) {
  7067. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7068. dataTypes.unshift( type );
  7069. break;
  7070. }
  7071. }
  7072. }
  7073. // Check to see if we have a response for the expected dataType
  7074. if ( dataTypes[ 0 ] in responses ) {
  7075. finalDataType = dataTypes[ 0 ];
  7076. } else {
  7077. // Try convertible dataTypes
  7078. for ( type in responses ) {
  7079. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7080. finalDataType = type;
  7081. break;
  7082. }
  7083. if ( !firstDataType ) {
  7084. firstDataType = type;
  7085. }
  7086. }
  7087. // Or just use first one
  7088. finalDataType = finalDataType || firstDataType;
  7089. }
  7090. // If we found a dataType
  7091. // We add the dataType to the list if needed
  7092. // and return the corresponding response
  7093. if ( finalDataType ) {
  7094. if ( finalDataType !== dataTypes[ 0 ] ) {
  7095. dataTypes.unshift( finalDataType );
  7096. }
  7097. return responses[ finalDataType ];
  7098. }
  7099. }
  7100. /* Chain conversions given the request and the original response
  7101. * Also sets the responseXXX fields on the jqXHR instance
  7102. */
  7103. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7104. var conv2, current, conv, tmp, prev,
  7105. converters = {},
  7106. // Work with a copy of dataTypes in case we need to modify it for conversion
  7107. dataTypes = s.dataTypes.slice();
  7108. // Create converters map with lowercased keys
  7109. if ( dataTypes[ 1 ] ) {
  7110. for ( conv in s.converters ) {
  7111. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7112. }
  7113. }
  7114. current = dataTypes.shift();
  7115. // Convert to each sequential dataType
  7116. while ( current ) {
  7117. if ( s.responseFields[ current ] ) {
  7118. jqXHR[ s.responseFields[ current ] ] = response;
  7119. }
  7120. // Apply the dataFilter if provided
  7121. if ( !prev && isSuccess && s.dataFilter ) {
  7122. response = s.dataFilter( response, s.dataType );
  7123. }
  7124. prev = current;
  7125. current = dataTypes.shift();
  7126. if ( current ) {
  7127. // There's only work to do if current dataType is non-auto
  7128. if ( current === "*" ) {
  7129. current = prev;
  7130. // Convert response if prev dataType is non-auto and differs from current
  7131. } else if ( prev !== "*" && prev !== current ) {
  7132. // Seek a direct converter
  7133. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7134. // If none found, seek a pair
  7135. if ( !conv ) {
  7136. for ( conv2 in converters ) {
  7137. // If conv2 outputs current
  7138. tmp = conv2.split( " " );
  7139. if ( tmp[ 1 ] === current ) {
  7140. // If prev can be converted to accepted input
  7141. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7142. converters[ "* " + tmp[ 0 ] ];
  7143. if ( conv ) {
  7144. // Condense equivalence converters
  7145. if ( conv === true ) {
  7146. conv = converters[ conv2 ];
  7147. // Otherwise, insert the intermediate dataType
  7148. } else if ( converters[ conv2 ] !== true ) {
  7149. current = tmp[ 0 ];
  7150. dataTypes.unshift( tmp[ 1 ] );
  7151. }
  7152. break;
  7153. }
  7154. }
  7155. }
  7156. }
  7157. // Apply converter (if not an equivalence)
  7158. if ( conv !== true ) {
  7159. // Unless errors are allowed to bubble, catch and return them
  7160. if ( conv && s.throws ) {
  7161. response = conv( response );
  7162. } else {
  7163. try {
  7164. response = conv( response );
  7165. } catch ( e ) {
  7166. return {
  7167. state: "parsererror",
  7168. error: conv ? e : "No conversion from " + prev + " to " + current
  7169. };
  7170. }
  7171. }
  7172. }
  7173. }
  7174. }
  7175. }
  7176. return { state: "success", data: response };
  7177. }
  7178. jQuery.extend( {
  7179. // Counter for holding the number of active queries
  7180. active: 0,
  7181. // Last-Modified header cache for next request
  7182. lastModified: {},
  7183. etag: {},
  7184. ajaxSettings: {
  7185. url: location.href,
  7186. type: "GET",
  7187. isLocal: rlocalProtocol.test( location.protocol ),
  7188. global: true,
  7189. processData: true,
  7190. async: true,
  7191. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7192. /*
  7193. timeout: 0,
  7194. data: null,
  7195. dataType: null,
  7196. username: null,
  7197. password: null,
  7198. cache: null,
  7199. throws: false,
  7200. traditional: false,
  7201. headers: {},
  7202. */
  7203. accepts: {
  7204. "*": allTypes,
  7205. text: "text/plain",
  7206. html: "text/html",
  7207. xml: "application/xml, text/xml",
  7208. json: "application/json, text/javascript"
  7209. },
  7210. contents: {
  7211. xml: /\bxml\b/,
  7212. html: /\bhtml/,
  7213. json: /\bjson\b/
  7214. },
  7215. responseFields: {
  7216. xml: "responseXML",
  7217. text: "responseText",
  7218. json: "responseJSON"
  7219. },
  7220. // Data converters
  7221. // Keys separate source (or catchall "*") and destination types with a single space
  7222. converters: {
  7223. // Convert anything to text
  7224. "* text": String,
  7225. // Text to html (true = no transformation)
  7226. "text html": true,
  7227. // Evaluate text as a json expression
  7228. "text json": JSON.parse,
  7229. // Parse text as xml
  7230. "text xml": jQuery.parseXML
  7231. },
  7232. // For options that shouldn't be deep extended:
  7233. // you can add your own custom options here if
  7234. // and when you create one that shouldn't be
  7235. // deep extended (see ajaxExtend)
  7236. flatOptions: {
  7237. url: true,
  7238. context: true
  7239. }
  7240. },
  7241. // Creates a full fledged settings object into target
  7242. // with both ajaxSettings and settings fields.
  7243. // If target is omitted, writes into ajaxSettings.
  7244. ajaxSetup: function( target, settings ) {
  7245. return settings ?
  7246. // Building a settings object
  7247. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  7248. // Extending ajaxSettings
  7249. ajaxExtend( jQuery.ajaxSettings, target );
  7250. },
  7251. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  7252. ajaxTransport: addToPrefiltersOrTransports( transports ),
  7253. // Main method
  7254. ajax: function( url, options ) {
  7255. // If url is an object, simulate pre-1.5 signature
  7256. if ( typeof url === "object" ) {
  7257. options = url;
  7258. url = undefined;
  7259. }
  7260. // Force options to be an object
  7261. options = options || {};
  7262. var transport,
  7263. // URL without anti-cache param
  7264. cacheURL,
  7265. // Response headers
  7266. responseHeadersString,
  7267. responseHeaders,
  7268. // timeout handle
  7269. timeoutTimer,
  7270. // Url cleanup var
  7271. urlAnchor,
  7272. // Request state (becomes false upon send and true upon completion)
  7273. completed,
  7274. // To know if global events are to be dispatched
  7275. fireGlobals,
  7276. // Loop variable
  7277. i,
  7278. // uncached part of the url
  7279. uncached,
  7280. // Create the final options object
  7281. s = jQuery.ajaxSetup( {}, options ),
  7282. // Callbacks context
  7283. callbackContext = s.context || s,
  7284. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7285. globalEventContext = s.context &&
  7286. ( callbackContext.nodeType || callbackContext.jquery ) ?
  7287. jQuery( callbackContext ) :
  7288. jQuery.event,
  7289. // Deferreds
  7290. deferred = jQuery.Deferred(),
  7291. completeDeferred = jQuery.Callbacks( "once memory" ),
  7292. // Status-dependent callbacks
  7293. statusCode = s.statusCode || {},
  7294. // Headers (they are sent all at once)
  7295. requestHeaders = {},
  7296. requestHeadersNames = {},
  7297. // Default abort message
  7298. strAbort = "canceled",
  7299. // Fake xhr
  7300. jqXHR = {
  7301. readyState: 0,
  7302. // Builds headers hashtable if needed
  7303. getResponseHeader: function( key ) {
  7304. var match;
  7305. if ( completed ) {
  7306. if ( !responseHeaders ) {
  7307. responseHeaders = {};
  7308. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  7309. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  7310. }
  7311. }
  7312. match = responseHeaders[ key.toLowerCase() ];
  7313. }
  7314. return match == null ? null : match;
  7315. },
  7316. // Raw string
  7317. getAllResponseHeaders: function() {
  7318. return completed ? responseHeadersString : null;
  7319. },
  7320. // Caches the header
  7321. setRequestHeader: function( name, value ) {
  7322. if ( completed == null ) {
  7323. name = requestHeadersNames[ name.toLowerCase() ] =
  7324. requestHeadersNames[ name.toLowerCase() ] || name;
  7325. requestHeaders[ name ] = value;
  7326. }
  7327. return this;
  7328. },
  7329. // Overrides response content-type header
  7330. overrideMimeType: function( type ) {
  7331. if ( completed == null ) {
  7332. s.mimeType = type;
  7333. }
  7334. return this;
  7335. },
  7336. // Status-dependent callbacks
  7337. statusCode: function( map ) {
  7338. var code;
  7339. if ( map ) {
  7340. if ( completed ) {
  7341. // Execute the appropriate callbacks
  7342. jqXHR.always( map[ jqXHR.status ] );
  7343. } else {
  7344. // Lazy-add the new callbacks in a way that preserves old ones
  7345. for ( code in map ) {
  7346. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  7347. }
  7348. }
  7349. }
  7350. return this;
  7351. },
  7352. // Cancel the request
  7353. abort: function( statusText ) {
  7354. var finalText = statusText || strAbort;
  7355. if ( transport ) {
  7356. transport.abort( finalText );
  7357. }
  7358. done( 0, finalText );
  7359. return this;
  7360. }
  7361. };
  7362. // Attach deferreds
  7363. deferred.promise( jqXHR );
  7364. // Add protocol if not provided (prefilters might expect it)
  7365. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7366. // We also use the url parameter if available
  7367. s.url = ( ( url || s.url || location.href ) + "" )
  7368. .replace( rprotocol, location.protocol + "//" );
  7369. // Alias method option to type as per ticket #12004
  7370. s.type = options.method || options.type || s.method || s.type;
  7371. // Extract dataTypes list
  7372. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  7373. // A cross-domain request is in order when the origin doesn't match the current origin.
  7374. if ( s.crossDomain == null ) {
  7375. urlAnchor = document.createElement( "a" );
  7376. // Support: IE <=8 - 11, Edge 12 - 15
  7377. // IE throws exception on accessing the href property if url is malformed,
  7378. // e.g. http://example.com:80x/
  7379. try {
  7380. urlAnchor.href = s.url;
  7381. // Support: IE <=8 - 11 only
  7382. // Anchor's host property isn't correctly set when s.url is relative
  7383. urlAnchor.href = urlAnchor.href;
  7384. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  7385. urlAnchor.protocol + "//" + urlAnchor.host;
  7386. } catch ( e ) {
  7387. // If there is an error parsing the URL, assume it is crossDomain,
  7388. // it can be rejected by the transport if it is invalid
  7389. s.crossDomain = true;
  7390. }
  7391. }
  7392. // Convert data if not already a string
  7393. if ( s.data && s.processData && typeof s.data !== "string" ) {
  7394. s.data = jQuery.param( s.data, s.traditional );
  7395. }
  7396. // Apply prefilters
  7397. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  7398. // If request was aborted inside a prefilter, stop there
  7399. if ( completed ) {
  7400. return jqXHR;
  7401. }
  7402. // We can fire global events as of now if asked to
  7403. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  7404. fireGlobals = jQuery.event && s.global;
  7405. // Watch for a new set of requests
  7406. if ( fireGlobals && jQuery.active++ === 0 ) {
  7407. jQuery.event.trigger( "ajaxStart" );
  7408. }
  7409. // Uppercase the type
  7410. s.type = s.type.toUpperCase();
  7411. // Determine if request has content
  7412. s.hasContent = !rnoContent.test( s.type );
  7413. // Save the URL in case we're toying with the If-Modified-Since
  7414. // and/or If-None-Match header later on
  7415. // Remove hash to simplify url manipulation
  7416. cacheURL = s.url.replace( rhash, "" );
  7417. // More options handling for requests with no content
  7418. if ( !s.hasContent ) {
  7419. // Remember the hash so we can put it back
  7420. uncached = s.url.slice( cacheURL.length );
  7421. // If data is available and should be processed, append data to url
  7422. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  7423. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  7424. // #9682: remove data so that it's not used in an eventual retry
  7425. delete s.data;
  7426. }
  7427. // Add or update anti-cache param if needed
  7428. if ( s.cache === false ) {
  7429. cacheURL = cacheURL.replace( rantiCache, "$1" );
  7430. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  7431. }
  7432. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  7433. s.url = cacheURL + uncached;
  7434. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  7435. } else if ( s.data && s.processData &&
  7436. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  7437. s.data = s.data.replace( r20, "+" );
  7438. }
  7439. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7440. if ( s.ifModified ) {
  7441. if ( jQuery.lastModified[ cacheURL ] ) {
  7442. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  7443. }
  7444. if ( jQuery.etag[ cacheURL ] ) {
  7445. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  7446. }
  7447. }
  7448. // Set the correct header, if data is being sent
  7449. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  7450. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  7451. }
  7452. // Set the Accepts header for the server, depending on the dataType
  7453. jqXHR.setRequestHeader(
  7454. "Accept",
  7455. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  7456. s.accepts[ s.dataTypes[ 0 ] ] +
  7457. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  7458. s.accepts[ "*" ]
  7459. );
  7460. // Check for headers option
  7461. for ( i in s.headers ) {
  7462. jqXHR.setRequestHeader( i, s.headers[ i ] );
  7463. }
  7464. // Allow custom headers/mimetypes and early abort
  7465. if ( s.beforeSend &&
  7466. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  7467. // Abort if not done already and return
  7468. return jqXHR.abort();
  7469. }
  7470. // Aborting is no longer a cancellation
  7471. strAbort = "abort";
  7472. // Install callbacks on deferreds
  7473. completeDeferred.add( s.complete );
  7474. jqXHR.done( s.success );
  7475. jqXHR.fail( s.error );
  7476. // Get transport
  7477. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  7478. // If no transport, we auto-abort
  7479. if ( !transport ) {
  7480. done( -1, "No Transport" );
  7481. } else {
  7482. jqXHR.readyState = 1;
  7483. // Send global event
  7484. if ( fireGlobals ) {
  7485. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  7486. }
  7487. // If request was aborted inside ajaxSend, stop there
  7488. if ( completed ) {
  7489. return jqXHR;
  7490. }
  7491. // Timeout
  7492. if ( s.async && s.timeout > 0 ) {
  7493. timeoutTimer = window.setTimeout( function() {
  7494. jqXHR.abort( "timeout" );
  7495. }, s.timeout );
  7496. }
  7497. try {
  7498. completed = false;
  7499. transport.send( requestHeaders, done );
  7500. } catch ( e ) {
  7501. // Rethrow post-completion exceptions
  7502. if ( completed ) {
  7503. throw e;
  7504. }
  7505. // Propagate others as results
  7506. done( -1, e );
  7507. }
  7508. }
  7509. // Callback for when everything is done
  7510. function done( status, nativeStatusText, responses, headers ) {
  7511. var isSuccess, success, error, response, modified,
  7512. statusText = nativeStatusText;
  7513. // Ignore repeat invocations
  7514. if ( completed ) {
  7515. return;
  7516. }
  7517. completed = true;
  7518. // Clear timeout if it exists
  7519. if ( timeoutTimer ) {
  7520. window.clearTimeout( timeoutTimer );
  7521. }
  7522. // Dereference transport for early garbage collection
  7523. // (no matter how long the jqXHR object will be used)
  7524. transport = undefined;
  7525. // Cache response headers
  7526. responseHeadersString = headers || "";
  7527. // Set readyState
  7528. jqXHR.readyState = status > 0 ? 4 : 0;
  7529. // Determine if successful
  7530. isSuccess = status >= 200 && status < 300 || status === 304;
  7531. // Get response data
  7532. if ( responses ) {
  7533. response = ajaxHandleResponses( s, jqXHR, responses );
  7534. }
  7535. // Convert no matter what (that way responseXXX fields are always set)
  7536. response = ajaxConvert( s, response, jqXHR, isSuccess );
  7537. // If successful, handle type chaining
  7538. if ( isSuccess ) {
  7539. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7540. if ( s.ifModified ) {
  7541. modified = jqXHR.getResponseHeader( "Last-Modified" );
  7542. if ( modified ) {
  7543. jQuery.lastModified[ cacheURL ] = modified;
  7544. }
  7545. modified = jqXHR.getResponseHeader( "etag" );
  7546. if ( modified ) {
  7547. jQuery.etag[ cacheURL ] = modified;
  7548. }
  7549. }
  7550. // if no content
  7551. if ( status === 204 || s.type === "HEAD" ) {
  7552. statusText = "nocontent";
  7553. // if not modified
  7554. } else if ( status === 304 ) {
  7555. statusText = "notmodified";
  7556. // If we have data, let's convert it
  7557. } else {
  7558. statusText = response.state;
  7559. success = response.data;
  7560. error = response.error;
  7561. isSuccess = !error;
  7562. }
  7563. } else {
  7564. // Extract error from statusText and normalize for non-aborts
  7565. error = statusText;
  7566. if ( status || !statusText ) {
  7567. statusText = "error";
  7568. if ( status < 0 ) {
  7569. status = 0;
  7570. }
  7571. }
  7572. }
  7573. // Set data for the fake xhr object
  7574. jqXHR.status = status;
  7575. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  7576. // Success/Error
  7577. if ( isSuccess ) {
  7578. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  7579. } else {
  7580. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  7581. }
  7582. // Status-dependent callbacks
  7583. jqXHR.statusCode( statusCode );
  7584. statusCode = undefined;
  7585. if ( fireGlobals ) {
  7586. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  7587. [ jqXHR, s, isSuccess ? success : error ] );
  7588. }
  7589. // Complete
  7590. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  7591. if ( fireGlobals ) {
  7592. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  7593. // Handle the global AJAX counter
  7594. if ( !( --jQuery.active ) ) {
  7595. jQuery.event.trigger( "ajaxStop" );
  7596. }
  7597. }
  7598. }
  7599. return jqXHR;
  7600. },
  7601. getJSON: function( url, data, callback ) {
  7602. return jQuery.get( url, data, callback, "json" );
  7603. },
  7604. getScript: function( url, callback ) {
  7605. return jQuery.get( url, undefined, callback, "script" );
  7606. }
  7607. } );
  7608. jQuery.each( [ "get", "post" ], function( i, method ) {
  7609. jQuery[ method ] = function( url, data, callback, type ) {
  7610. // Shift arguments if data argument was omitted
  7611. if ( isFunction( data ) ) {
  7612. type = type || callback;
  7613. callback = data;
  7614. data = undefined;
  7615. }
  7616. // The url can be an options object (which then must have .url)
  7617. return jQuery.ajax( jQuery.extend( {
  7618. url: url,
  7619. type: method,
  7620. dataType: type,
  7621. data: data,
  7622. success: callback
  7623. }, jQuery.isPlainObject( url ) && url ) );
  7624. };
  7625. } );
  7626. jQuery._evalUrl = function( url ) {
  7627. return jQuery.ajax( {
  7628. url: url,
  7629. // Make this explicit, since user can override this through ajaxSetup (#11264)
  7630. type: "GET",
  7631. dataType: "script",
  7632. cache: true,
  7633. async: false,
  7634. global: false,
  7635. "throws": true
  7636. } );
  7637. };
  7638. jQuery.fn.extend( {
  7639. wrapAll: function( html ) {
  7640. var wrap;
  7641. if ( this[ 0 ] ) {
  7642. if ( isFunction( html ) ) {
  7643. html = html.call( this[ 0 ] );
  7644. }
  7645. // The elements to wrap the target around
  7646. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  7647. if ( this[ 0 ].parentNode ) {
  7648. wrap.insertBefore( this[ 0 ] );
  7649. }
  7650. wrap.map( function() {
  7651. var elem = this;
  7652. while ( elem.firstElementChild ) {
  7653. elem = elem.firstElementChild;
  7654. }
  7655. return elem;
  7656. } ).append( this );
  7657. }
  7658. return this;
  7659. },
  7660. wrapInner: function( html ) {
  7661. if ( isFunction( html ) ) {
  7662. return this.each( function( i ) {
  7663. jQuery( this ).wrapInner( html.call( this, i ) );
  7664. } );
  7665. }
  7666. return this.each( function() {
  7667. var self = jQuery( this ),
  7668. contents = self.contents();
  7669. if ( contents.length ) {
  7670. contents.wrapAll( html );
  7671. } else {
  7672. self.append( html );
  7673. }
  7674. } );
  7675. },
  7676. wrap: function( html ) {
  7677. var htmlIsFunction = isFunction( html );
  7678. return this.each( function( i ) {
  7679. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  7680. } );
  7681. },
  7682. unwrap: function( selector ) {
  7683. this.parent( selector ).not( "body" ).each( function() {
  7684. jQuery( this ).replaceWith( this.childNodes );
  7685. } );
  7686. return this;
  7687. }
  7688. } );
  7689. jQuery.expr.pseudos.hidden = function( elem ) {
  7690. return !jQuery.expr.pseudos.visible( elem );
  7691. };
  7692. jQuery.expr.pseudos.visible = function( elem ) {
  7693. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  7694. };
  7695. jQuery.ajaxSettings.xhr = function() {
  7696. try {
  7697. return new window.XMLHttpRequest();
  7698. } catch ( e ) {}
  7699. };
  7700. var xhrSuccessStatus = {
  7701. // File protocol always yields status code 0, assume 200
  7702. 0: 200,
  7703. // Support: IE <=9 only
  7704. // #1450: sometimes IE returns 1223 when it should be 204
  7705. 1223: 204
  7706. },
  7707. xhrSupported = jQuery.ajaxSettings.xhr();
  7708. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  7709. support.ajax = xhrSupported = !!xhrSupported;
  7710. jQuery.ajaxTransport( function( options ) {
  7711. var callback, errorCallback;
  7712. // Cross domain only allowed if supported through XMLHttpRequest
  7713. if ( support.cors || xhrSupported && !options.crossDomain ) {
  7714. return {
  7715. send: function( headers, complete ) {
  7716. var i,
  7717. xhr = options.xhr();
  7718. xhr.open(
  7719. options.type,
  7720. options.url,
  7721. options.async,
  7722. options.username,
  7723. options.password
  7724. );
  7725. // Apply custom fields if provided
  7726. if ( options.xhrFields ) {
  7727. for ( i in options.xhrFields ) {
  7728. xhr[ i ] = options.xhrFields[ i ];
  7729. }
  7730. }
  7731. // Override mime type if needed
  7732. if ( options.mimeType && xhr.overrideMimeType ) {
  7733. xhr.overrideMimeType( options.mimeType );
  7734. }
  7735. // X-Requested-With header
  7736. // For cross-domain requests, seeing as conditions for a preflight are
  7737. // akin to a jigsaw puzzle, we simply never set it to be sure.
  7738. // (it can always be set on a per-request basis or even using ajaxSetup)
  7739. // For same-domain requests, won't change header if already provided.
  7740. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  7741. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  7742. }
  7743. // Set headers
  7744. for ( i in headers ) {
  7745. xhr.setRequestHeader( i, headers[ i ] );
  7746. }
  7747. // Callback
  7748. callback = function( type ) {
  7749. return function() {
  7750. if ( callback ) {
  7751. callback = errorCallback = xhr.onload =
  7752. xhr.onerror = xhr.onabort = xhr.ontimeout =
  7753. xhr.onreadystatechange = null;
  7754. if ( type === "abort" ) {
  7755. xhr.abort();
  7756. } else if ( type === "error" ) {
  7757. // Support: IE <=9 only
  7758. // On a manual native abort, IE9 throws
  7759. // errors on any property access that is not readyState
  7760. if ( typeof xhr.status !== "number" ) {
  7761. complete( 0, "error" );
  7762. } else {
  7763. complete(
  7764. // File: protocol always yields status 0; see #8605, #14207
  7765. xhr.status,
  7766. xhr.statusText
  7767. );
  7768. }
  7769. } else {
  7770. complete(
  7771. xhrSuccessStatus[ xhr.status ] || xhr.status,
  7772. xhr.statusText,
  7773. // Support: IE <=9 only
  7774. // IE9 has no XHR2 but throws on binary (trac-11426)
  7775. // For XHR2 non-text, let the caller handle it (gh-2498)
  7776. ( xhr.responseType || "text" ) !== "text" ||
  7777. typeof xhr.responseText !== "string" ?
  7778. { binary: xhr.response } :
  7779. { text: xhr.responseText },
  7780. xhr.getAllResponseHeaders()
  7781. );
  7782. }
  7783. }
  7784. };
  7785. };
  7786. // Listen to events
  7787. xhr.onload = callback();
  7788. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  7789. // Support: IE 9 only
  7790. // Use onreadystatechange to replace onabort
  7791. // to handle uncaught aborts
  7792. if ( xhr.onabort !== undefined ) {
  7793. xhr.onabort = errorCallback;
  7794. } else {
  7795. xhr.onreadystatechange = function() {
  7796. // Check readyState before timeout as it changes
  7797. if ( xhr.readyState === 4 ) {
  7798. // Allow onerror to be called first,
  7799. // but that will not handle a native abort
  7800. // Also, save errorCallback to a variable
  7801. // as xhr.onerror cannot be accessed
  7802. window.setTimeout( function() {
  7803. if ( callback ) {
  7804. errorCallback();
  7805. }
  7806. } );
  7807. }
  7808. };
  7809. }
  7810. // Create the abort callback
  7811. callback = callback( "abort" );
  7812. try {
  7813. // Do send the request (this may raise an exception)
  7814. xhr.send( options.hasContent && options.data || null );
  7815. } catch ( e ) {
  7816. // #14683: Only rethrow if this hasn't been notified as an error yet
  7817. if ( callback ) {
  7818. throw e;
  7819. }
  7820. }
  7821. },
  7822. abort: function() {
  7823. if ( callback ) {
  7824. callback();
  7825. }
  7826. }
  7827. };
  7828. }
  7829. } );
  7830. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  7831. jQuery.ajaxPrefilter( function( s ) {
  7832. if ( s.crossDomain ) {
  7833. s.contents.script = false;
  7834. }
  7835. } );
  7836. // Install script dataType
  7837. jQuery.ajaxSetup( {
  7838. accepts: {
  7839. script: "text/javascript, application/javascript, " +
  7840. "application/ecmascript, application/x-ecmascript"
  7841. },
  7842. contents: {
  7843. script: /\b(?:java|ecma)script\b/
  7844. },
  7845. converters: {
  7846. "text script": function( text ) {
  7847. jQuery.globalEval( text );
  7848. return text;
  7849. }
  7850. }
  7851. } );
  7852. // Handle cache's special case and crossDomain
  7853. jQuery.ajaxPrefilter( "script", function( s ) {
  7854. if ( s.cache === undefined ) {
  7855. s.cache = false;
  7856. }
  7857. if ( s.crossDomain ) {
  7858. s.type = "GET";
  7859. }
  7860. } );
  7861. // Bind script tag hack transport
  7862. jQuery.ajaxTransport( "script", function( s ) {
  7863. // This transport only deals with cross domain requests
  7864. if ( s.crossDomain ) {
  7865. var script, callback;
  7866. return {
  7867. send: function( _, complete ) {
  7868. script = jQuery( "<script>" ).prop( {
  7869. charset: s.scriptCharset,
  7870. src: s.url
  7871. } ).on(
  7872. "load error",
  7873. callback = function( evt ) {
  7874. script.remove();
  7875. callback = null;
  7876. if ( evt ) {
  7877. complete( evt.type === "error" ? 404 : 200, evt.type );
  7878. }
  7879. }
  7880. );
  7881. // Use native DOM manipulation to avoid our domManip AJAX trickery
  7882. document.head.appendChild( script[ 0 ] );
  7883. },
  7884. abort: function() {
  7885. if ( callback ) {
  7886. callback();
  7887. }
  7888. }
  7889. };
  7890. }
  7891. } );
  7892. var oldCallbacks = [],
  7893. rjsonp = /(=)\?(?=&|$)|\?\?/;
  7894. // Default jsonp settings
  7895. jQuery.ajaxSetup( {
  7896. jsonp: "callback",
  7897. jsonpCallback: function() {
  7898. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  7899. this[ callback ] = true;
  7900. return callback;
  7901. }
  7902. } );
  7903. // Detect, normalize options and install callbacks for jsonp requests
  7904. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  7905. var callbackName, overwritten, responseContainer,
  7906. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  7907. "url" :
  7908. typeof s.data === "string" &&
  7909. ( s.contentType || "" )
  7910. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  7911. rjsonp.test( s.data ) && "data"
  7912. );
  7913. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  7914. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  7915. // Get callback name, remembering preexisting value associated with it
  7916. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  7917. s.jsonpCallback() :
  7918. s.jsonpCallback;
  7919. // Insert callback into url or form data
  7920. if ( jsonProp ) {
  7921. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  7922. } else if ( s.jsonp !== false ) {
  7923. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  7924. }
  7925. // Use data converter to retrieve json after script execution
  7926. s.converters[ "script json" ] = function() {
  7927. if ( !responseContainer ) {
  7928. jQuery.error( callbackName + " was not called" );
  7929. }
  7930. return responseContainer[ 0 ];
  7931. };
  7932. // Force json dataType
  7933. s.dataTypes[ 0 ] = "json";
  7934. // Install callback
  7935. overwritten = window[ callbackName ];
  7936. window[ callbackName ] = function() {
  7937. responseContainer = arguments;
  7938. };
  7939. // Clean-up function (fires after converters)
  7940. jqXHR.always( function() {
  7941. // If previous value didn't exist - remove it
  7942. if ( overwritten === undefined ) {
  7943. jQuery( window ).removeProp( callbackName );
  7944. // Otherwise restore preexisting value
  7945. } else {
  7946. window[ callbackName ] = overwritten;
  7947. }
  7948. // Save back as free
  7949. if ( s[ callbackName ] ) {
  7950. // Make sure that re-using the options doesn't screw things around
  7951. s.jsonpCallback = originalSettings.jsonpCallback;
  7952. // Save the callback name for future use
  7953. oldCallbacks.push( callbackName );
  7954. }
  7955. // Call if it was a function and we have a response
  7956. if ( responseContainer && isFunction( overwritten ) ) {
  7957. overwritten( responseContainer[ 0 ] );
  7958. }
  7959. responseContainer = overwritten = undefined;
  7960. } );
  7961. // Delegate to script
  7962. return "script";
  7963. }
  7964. } );
  7965. // Support: Safari 8 only
  7966. // In Safari 8 documents created via document.implementation.createHTMLDocument
  7967. // collapse sibling forms: the second one becomes a child of the first one.
  7968. // Because of that, this security measure has to be disabled in Safari 8.
  7969. // https://bugs.webkit.org/show_bug.cgi?id=137337
  7970. support.createHTMLDocument = ( function() {
  7971. var body = document.implementation.createHTMLDocument( "" ).body;
  7972. body.innerHTML = "<form></form><form></form>";
  7973. return body.childNodes.length === 2;
  7974. } )();
  7975. // Argument "data" should be string of html
  7976. // context (optional): If specified, the fragment will be created in this context,
  7977. // defaults to document
  7978. // keepScripts (optional): If true, will include scripts passed in the html string
  7979. jQuery.parseHTML = function( data, context, keepScripts ) {
  7980. if ( typeof data !== "string" ) {
  7981. return [];
  7982. }
  7983. if ( typeof context === "boolean" ) {
  7984. keepScripts = context;
  7985. context = false;
  7986. }
  7987. var base, parsed, scripts;
  7988. if ( !context ) {
  7989. // Stop scripts or inline event handlers from being executed immediately
  7990. // by using document.implementation
  7991. if ( support.createHTMLDocument ) {
  7992. context = document.implementation.createHTMLDocument( "" );
  7993. // Set the base href for the created document
  7994. // so any parsed elements with URLs
  7995. // are based on the document's URL (gh-2965)
  7996. base = context.createElement( "base" );
  7997. base.href = document.location.href;
  7998. context.head.appendChild( base );
  7999. } else {
  8000. context = document;
  8001. }
  8002. }
  8003. parsed = rsingleTag.exec( data );
  8004. scripts = !keepScripts && [];
  8005. // Single tag
  8006. if ( parsed ) {
  8007. return [ context.createElement( parsed[ 1 ] ) ];
  8008. }
  8009. parsed = buildFragment( [ data ], context, scripts );
  8010. if ( scripts && scripts.length ) {
  8011. jQuery( scripts ).remove();
  8012. }
  8013. return jQuery.merge( [], parsed.childNodes );
  8014. };
  8015. /**
  8016. * Load a url into a page
  8017. */
  8018. jQuery.fn.load = function( url, params, callback ) {
  8019. var selector, type, response,
  8020. self = this,
  8021. off = url.indexOf( " " );
  8022. if ( off > -1 ) {
  8023. selector = stripAndCollapse( url.slice( off ) );
  8024. url = url.slice( 0, off );
  8025. }
  8026. // If it's a function
  8027. if ( isFunction( params ) ) {
  8028. // We assume that it's the callback
  8029. callback = params;
  8030. params = undefined;
  8031. // Otherwise, build a param string
  8032. } else if ( params && typeof params === "object" ) {
  8033. type = "POST";
  8034. }
  8035. // If we have elements to modify, make the request
  8036. if ( self.length > 0 ) {
  8037. jQuery.ajax( {
  8038. url: url,
  8039. // If "type" variable is undefined, then "GET" method will be used.
  8040. // Make value of this field explicit since
  8041. // user can override it through ajaxSetup method
  8042. type: type || "GET",
  8043. dataType: "html",
  8044. data: params
  8045. } ).done( function( responseText ) {
  8046. // Save response for use in complete callback
  8047. response = arguments;
  8048. self.html( selector ?
  8049. // If a selector was specified, locate the right elements in a dummy div
  8050. // Exclude scripts to avoid IE 'Permission Denied' errors
  8051. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  8052. // Otherwise use the full result
  8053. responseText );
  8054. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8055. // but they are ignored because response was set above.
  8056. // If it fails, this function gets "jqXHR", "status", "error"
  8057. } ).always( callback && function( jqXHR, status ) {
  8058. self.each( function() {
  8059. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  8060. } );
  8061. } );
  8062. }
  8063. return this;
  8064. };
  8065. // Attach a bunch of functions for handling common AJAX events
  8066. jQuery.each( [
  8067. "ajaxStart",
  8068. "ajaxStop",
  8069. "ajaxComplete",
  8070. "ajaxError",
  8071. "ajaxSuccess",
  8072. "ajaxSend"
  8073. ], function( i, type ) {
  8074. jQuery.fn[ type ] = function( fn ) {
  8075. return this.on( type, fn );
  8076. };
  8077. } );
  8078. jQuery.expr.pseudos.animated = function( elem ) {
  8079. return jQuery.grep( jQuery.timers, function( fn ) {
  8080. return elem === fn.elem;
  8081. } ).length;
  8082. };
  8083. jQuery.offset = {
  8084. setOffset: function( elem, options, i ) {
  8085. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8086. position = jQuery.css( elem, "position" ),
  8087. curElem = jQuery( elem ),
  8088. props = {};
  8089. // Set position first, in-case top/left are set even on static elem
  8090. if ( position === "static" ) {
  8091. elem.style.position = "relative";
  8092. }
  8093. curOffset = curElem.offset();
  8094. curCSSTop = jQuery.css( elem, "top" );
  8095. curCSSLeft = jQuery.css( elem, "left" );
  8096. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8097. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8098. // Need to be able to calculate position if either
  8099. // top or left is auto and position is either absolute or fixed
  8100. if ( calculatePosition ) {
  8101. curPosition = curElem.position();
  8102. curTop = curPosition.top;
  8103. curLeft = curPosition.left;
  8104. } else {
  8105. curTop = parseFloat( curCSSTop ) || 0;
  8106. curLeft = parseFloat( curCSSLeft ) || 0;
  8107. }
  8108. if ( isFunction( options ) ) {
  8109. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8110. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8111. }
  8112. if ( options.top != null ) {
  8113. props.top = ( options.top - curOffset.top ) + curTop;
  8114. }
  8115. if ( options.left != null ) {
  8116. props.left = ( options.left - curOffset.left ) + curLeft;
  8117. }
  8118. if ( "using" in options ) {
  8119. options.using.call( elem, props );
  8120. } else {
  8121. curElem.css( props );
  8122. }
  8123. }
  8124. };
  8125. jQuery.fn.extend( {
  8126. // offset() relates an element's border box to the document origin
  8127. offset: function( options ) {
  8128. // Preserve chaining for setter
  8129. if ( arguments.length ) {
  8130. return options === undefined ?
  8131. this :
  8132. this.each( function( i ) {
  8133. jQuery.offset.setOffset( this, options, i );
  8134. } );
  8135. }
  8136. var rect, win,
  8137. elem = this[ 0 ];
  8138. if ( !elem ) {
  8139. return;
  8140. }
  8141. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8142. // Support: IE <=11 only
  8143. // Running getBoundingClientRect on a
  8144. // disconnected node in IE throws an error
  8145. if ( !elem.getClientRects().length ) {
  8146. return { top: 0, left: 0 };
  8147. }
  8148. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  8149. rect = elem.getBoundingClientRect();
  8150. win = elem.ownerDocument.defaultView;
  8151. return {
  8152. top: rect.top + win.pageYOffset,
  8153. left: rect.left + win.pageXOffset
  8154. };
  8155. },
  8156. // position() relates an element's margin box to its offset parent's padding box
  8157. // This corresponds to the behavior of CSS absolute positioning
  8158. position: function() {
  8159. if ( !this[ 0 ] ) {
  8160. return;
  8161. }
  8162. var offsetParent, offset, doc,
  8163. elem = this[ 0 ],
  8164. parentOffset = { top: 0, left: 0 };
  8165. // position:fixed elements are offset from the viewport, which itself always has zero offset
  8166. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8167. // Assume position:fixed implies availability of getBoundingClientRect
  8168. offset = elem.getBoundingClientRect();
  8169. } else {
  8170. offset = this.offset();
  8171. // Account for the *real* offset parent, which can be the document or its root element
  8172. // when a statically positioned element is identified
  8173. doc = elem.ownerDocument;
  8174. offsetParent = elem.offsetParent || doc.documentElement;
  8175. while ( offsetParent &&
  8176. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  8177. jQuery.css( offsetParent, "position" ) === "static" ) {
  8178. offsetParent = offsetParent.parentNode;
  8179. }
  8180. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  8181. // Incorporate borders into its offset, since they are outside its content origin
  8182. parentOffset = jQuery( offsetParent ).offset();
  8183. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  8184. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  8185. }
  8186. }
  8187. // Subtract parent offsets and element margins
  8188. return {
  8189. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8190. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8191. };
  8192. },
  8193. // This method will return documentElement in the following cases:
  8194. // 1) For the element inside the iframe without offsetParent, this method will return
  8195. // documentElement of the parent window
  8196. // 2) For the hidden or detached element
  8197. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8198. //
  8199. // but those exceptions were never presented as a real life use-cases
  8200. // and might be considered as more preferable results.
  8201. //
  8202. // This logic, however, is not guaranteed and can change at any point in the future
  8203. offsetParent: function() {
  8204. return this.map( function() {
  8205. var offsetParent = this.offsetParent;
  8206. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8207. offsetParent = offsetParent.offsetParent;
  8208. }
  8209. return offsetParent || documentElement;
  8210. } );
  8211. }
  8212. } );
  8213. // Create scrollLeft and scrollTop methods
  8214. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8215. var top = "pageYOffset" === prop;
  8216. jQuery.fn[ method ] = function( val ) {
  8217. return access( this, function( elem, method, val ) {
  8218. // Coalesce documents and windows
  8219. var win;
  8220. if ( isWindow( elem ) ) {
  8221. win = elem;
  8222. } else if ( elem.nodeType === 9 ) {
  8223. win = elem.defaultView;
  8224. }
  8225. if ( val === undefined ) {
  8226. return win ? win[ prop ] : elem[ method ];
  8227. }
  8228. if ( win ) {
  8229. win.scrollTo(
  8230. !top ? val : win.pageXOffset,
  8231. top ? val : win.pageYOffset
  8232. );
  8233. } else {
  8234. elem[ method ] = val;
  8235. }
  8236. }, method, val, arguments.length );
  8237. };
  8238. } );
  8239. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8240. // Add the top/left cssHooks using jQuery.fn.position
  8241. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8242. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8243. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8244. // rather than make the css module depend on the offset module, just check for it here
  8245. jQuery.each( [ "top", "left" ], function( i, prop ) {
  8246. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8247. function( elem, computed ) {
  8248. if ( computed ) {
  8249. computed = curCSS( elem, prop );
  8250. // If curCSS returns percentage, fallback to offset
  8251. return rnumnonpx.test( computed ) ?
  8252. jQuery( elem ).position()[ prop ] + "px" :
  8253. computed;
  8254. }
  8255. }
  8256. );
  8257. } );
  8258. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8259. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8260. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  8261. function( defaultExtra, funcName ) {
  8262. // Margin is only for outerHeight, outerWidth
  8263. jQuery.fn[ funcName ] = function( margin, value ) {
  8264. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8265. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8266. return access( this, function( elem, type, value ) {
  8267. var doc;
  8268. if ( isWindow( elem ) ) {
  8269. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8270. return funcName.indexOf( "outer" ) === 0 ?
  8271. elem[ "inner" + name ] :
  8272. elem.document.documentElement[ "client" + name ];
  8273. }
  8274. // Get document width or height
  8275. if ( elem.nodeType === 9 ) {
  8276. doc = elem.documentElement;
  8277. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8278. // whichever is greatest
  8279. return Math.max(
  8280. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8281. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8282. doc[ "client" + name ]
  8283. );
  8284. }
  8285. return value === undefined ?
  8286. // Get width or height on the element, requesting but not forcing parseFloat
  8287. jQuery.css( elem, type, extra ) :
  8288. // Set width or height on the element
  8289. jQuery.style( elem, type, value, extra );
  8290. }, type, chainable ? margin : undefined, chainable );
  8291. };
  8292. } );
  8293. } );
  8294. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  8295. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  8296. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  8297. function( i, name ) {
  8298. // Handle event binding
  8299. jQuery.fn[ name ] = function( data, fn ) {
  8300. return arguments.length > 0 ?
  8301. this.on( name, null, data, fn ) :
  8302. this.trigger( name );
  8303. };
  8304. } );
  8305. jQuery.fn.extend( {
  8306. hover: function( fnOver, fnOut ) {
  8307. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  8308. }
  8309. } );
  8310. jQuery.fn.extend( {
  8311. bind: function( types, data, fn ) {
  8312. return this.on( types, null, data, fn );
  8313. },
  8314. unbind: function( types, fn ) {
  8315. return this.off( types, null, fn );
  8316. },
  8317. delegate: function( selector, types, data, fn ) {
  8318. return this.on( types, selector, data, fn );
  8319. },
  8320. undelegate: function( selector, types, fn ) {
  8321. // ( namespace ) or ( selector, types [, fn] )
  8322. return arguments.length === 1 ?
  8323. this.off( selector, "**" ) :
  8324. this.off( types, selector || "**", fn );
  8325. }
  8326. } );
  8327. // Bind a function to a context, optionally partially applying any
  8328. // arguments.
  8329. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  8330. // However, it is not slated for removal any time soon
  8331. jQuery.proxy = function( fn, context ) {
  8332. var tmp, args, proxy;
  8333. if ( typeof context === "string" ) {
  8334. tmp = fn[ context ];
  8335. context = fn;
  8336. fn = tmp;
  8337. }
  8338. // Quick check to determine if target is callable, in the spec
  8339. // this throws a TypeError, but we will just return undefined.
  8340. if ( !isFunction( fn ) ) {
  8341. return undefined;
  8342. }
  8343. // Simulated bind
  8344. args = slice.call( arguments, 2 );
  8345. proxy = function() {
  8346. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  8347. };
  8348. // Set the guid of unique handler to the same of original handler, so it can be removed
  8349. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  8350. return proxy;
  8351. };
  8352. jQuery.holdReady = function( hold ) {
  8353. if ( hold ) {
  8354. jQuery.readyWait++;
  8355. } else {
  8356. jQuery.ready( true );
  8357. }
  8358. };
  8359. jQuery.isArray = Array.isArray;
  8360. jQuery.parseJSON = JSON.parse;
  8361. jQuery.nodeName = nodeName;
  8362. jQuery.isFunction = isFunction;
  8363. jQuery.isWindow = isWindow;
  8364. jQuery.camelCase = camelCase;
  8365. jQuery.type = toType;
  8366. jQuery.now = Date.now;
  8367. jQuery.isNumeric = function( obj ) {
  8368. // As of jQuery 3.0, isNumeric is limited to
  8369. // strings and numbers (primitives or objects)
  8370. // that can be coerced to finite numbers (gh-2662)
  8371. var type = jQuery.type( obj );
  8372. return ( type === "number" || type === "string" ) &&
  8373. // parseFloat NaNs numeric-cast false positives ("")
  8374. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  8375. // subtraction forces infinities to NaN
  8376. !isNaN( obj - parseFloat( obj ) );
  8377. };
  8378. // Register as a named AMD module, since jQuery can be concatenated with other
  8379. // files that may use define, but not via a proper concatenation script that
  8380. // understands anonymous AMD modules. A named AMD is safest and most robust
  8381. // way to register. Lowercase jquery is used because AMD module names are
  8382. // derived from file names, and jQuery is normally delivered in a lowercase
  8383. // file name. Do this after creating the global so that if an AMD module wants
  8384. // to call noConflict to hide this version of jQuery, it will work.
  8385. // Note that for maximum portability, libraries that are not jQuery should
  8386. // declare themselves as anonymous modules, and avoid setting a global if an
  8387. // AMD loader is present. jQuery is a special case. For more information, see
  8388. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8389. if ( typeof define === "function" && define.amd ) {
  8390. define( "jquery", [], function() {
  8391. return jQuery;
  8392. } );
  8393. }
  8394. var
  8395. // Map over jQuery in case of overwrite
  8396. _jQuery = window.jQuery,
  8397. // Map over the $ in case of overwrite
  8398. _$ = window.$;
  8399. jQuery.noConflict = function( deep ) {
  8400. if ( window.$ === jQuery ) {
  8401. window.$ = _$;
  8402. }
  8403. if ( deep && window.jQuery === jQuery ) {
  8404. window.jQuery = _jQuery;
  8405. }
  8406. return jQuery;
  8407. };
  8408. // Expose jQuery and $ identifiers, even in AMD
  8409. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8410. // and CommonJS for browser emulators (#13566)
  8411. if ( !noGlobal ) {
  8412. window.jQuery = window.$ = jQuery;
  8413. }
  8414. return jQuery;
  8415. } );