lib.js 266 KB

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