Python Library Stringtools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jquery.js 262KB

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