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.

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