require-backend.min.js 743 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231
  1. /*! jQuery v2.2.4 | (c) jQuery Foundation | jquery.org/license */
  2. !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c;
  3. }catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=N.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=/^(?:checkbox|radio)$/i,Y=/<([\w:-]+)/,Z=/^$|\/(?:java|ecma)script/i,$={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||d,e=c.documentElement,f=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ea.test(f)?this.mouseHooks:da.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=d),3===a.target.nodeType&&(a.target=a.target.parentNode),h.filter?h.filter(a,g):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==ia()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===ia()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ga:ha):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:ha,isPropagationStopped:ha,isImmediatePropagationStopped:ha,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ga,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ga,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ga,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),n.fn.extend({on:function(a,b,c,d){return ja(this,a,b,c,d)},one:function(a,b,c,d){return ja(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=ha),this.each(function(){n.event.remove(this,a,c,b)})}});var ka=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,la=/<script|<style|<link/i,ma=/checked\s*(?:[^=]|=\s*.checked.)/i,na=/^true\/(.*)/,oa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=wa[0].contentDocument,b.write(),b.close(),c=ya(a,b),wa.detach()),xa[a]=c),c}var Aa=/^margin/,Ba=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ca=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Ea=d.documentElement;!function(){var b,c,e,f,g=d.createElement("div"),h=d.createElement("div");if(h.style){h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",g.appendChild(h);function i(){h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",h.innerHTML="",Ea.appendChild(g);var d=a.getComputedStyle(h);b="1%"!==d.top,f="2px"===d.marginLeft,c="4px"===d.width,h.style.marginRight="50%",e="4px"===d.marginRight,Ea.removeChild(g)}n.extend(l,{pixelPosition:function(){return i(),b},boxSizingReliable:function(){return null==c&&i(),c},pixelMarginRight:function(){return null==c&&i(),e},reliableMarginLeft:function(){return null==c&&i(),f},reliableMarginRight:function(){var b,c=h.appendChild(d.createElement("div"));return c.style.cssText=h.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",h.style.width="1px",Ea.appendChild(g),b=!parseFloat(a.getComputedStyle(c).marginRight),Ea.removeChild(g),h.removeChild(c),b}})}}();function Fa(a,b,c){var d,e,f,g,h=a.style;return c=c||Ca(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Ba.test(g)&&Aa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0!==g?g+"":g}function Ga(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Ha=/^(none|table(?!-c[ea]).+)/,Ia={position:"absolute",visibility:"hidden",display:"block"},Ja={letterSpacing:"0",fontWeight:"400"},Ka=["Webkit","O","Moz","ms"],La=d.createElement("div").style;function Ma(a){if(a in La)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ka.length;while(c--)if(a=Ka[c]+b,a in La)return a}function Na(a,b,c){var d=T.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Oa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Pa(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ca(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Fa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ba.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Oa(a,b,c||(g?"border":"content"),d,f)+"px"}function Qa(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=N.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=N.access(d,"olddisplay",za(d.nodeName)))):(e=V(d),"none"===c&&e||N.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Fa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=T.exec(c))&&e[1]&&(c=W(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Fa(a,b,d)),"normal"===e&&b in Ja&&(e=Ja[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Ha.test(n.css(a,"display"))&&0===a.offsetWidth?Da(a,Ia,function(){return Pa(a,b,d)}):Pa(a,b,d):void 0},set:function(a,c,d){var e,f=d&&Ca(a),g=d&&Oa(a,b,d,"border-box"===n.css(a,"boxSizing",!1,f),f);return g&&(e=T.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=n.css(a,b)),Na(a,c,g)}}}),n.cssHooks.marginLeft=Ga(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Fa(a,"marginLeft"))||a.getBoundingClientRect().left-Da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),n.cssHooks.marginRight=Ga(l.reliableMarginRight,function(a,b){return b?Da(a,{display:"inline-block"},Fa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Aa.test(a)||(n.cssHooks[a+b].set=Na)}),n.fn.extend({css:function(a,b){return K(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ca(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Qa(this,!0)},hide:function(){return Qa(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function Ra(a,b,c,d,e){return new Ra.prototype.init(a,b,c,d,e)}n.Tween=Ra,Ra.prototype={constructor:Ra,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ra.propHooks[this.prop];return a&&a.get?a.get(this):Ra.propHooks._default.get(this)},run:function(a){var b,c=Ra.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ra.propHooks._default.set(this),this}},Ra.prototype.init.prototype=Ra.prototype,Ra.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},Ra.propHooks.scrollTop=Ra.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=Ra.prototype.init,n.fx.step={};var Sa,Ta,Ua=/^(?:toggle|show|hide)$/,Va=/queueHooks$/;function Wa(){return a.setTimeout(function(){Sa=void 0}),Sa=n.now()}function Xa(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=U[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ya(a,b,c){for(var d,e=(_a.tweeners[b]||[]).concat(_a.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Za(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&V(a),q=N.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?N.get(a,"olddisplay")||za(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Ua.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?za(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=N.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;N.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ya(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function $a(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function _a(a,b,c){var d,e,f=0,g=_a.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Sa||Wa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:Sa||Wa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for($a(k,j.opts.specialEasing);g>f;f++)if(d=_a.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,Ya,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(_a,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return W(c.elem,a,T.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],_a.tweeners[c]=_a.tweeners[c]||[],_a.tweeners[c].unshift(b)},prefilters:[Za],prefilter:function(a,b){b?_a.prefilters.unshift(a):_a.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=_a(this,n.extend({},a),f);(e||N.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=N.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Va.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=N.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Xa(b,!0),a,d,e)}}),n.each({slideDown:Xa("show"),slideUp:Xa("hide"),slideToggle:Xa("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Sa=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Sa=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ta||(Ta=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(Ta),Ta=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var ab,bb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return K(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ab:void 0)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}),ab={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=bb[b]||n.find.attr;bb[b]=function(a,b,d){var e,f;return d||(f=bb[b],bb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,bb[b]=f),e}});var cb=/^(?:input|select|textarea|button)$/i,db=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return K(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),
  4. void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):cb.test(a.nodeName)||db.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var eb=/[\t\r\n\f]/g;function fb(a){return a.getAttribute&&a.getAttribute("class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,fb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,fb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,fb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=fb(this),b&&N.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":N.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+fb(c)+" ").replace(eb," ").indexOf(b)>-1)return!0;return!1}});var gb=/\r/g,hb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(gb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(hb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var ib=/^(?:focusinfocus|focusoutblur)$/;n.extend(n.event,{trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!ib.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),l=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},f||!o.trigger||o.trigger.apply(e,c)!==!1)){if(!f&&!o.noBubble&&!n.isWindow(e)){for(j=o.delegateType||q,ib.test(j+q)||(h=h.parentNode);h;h=h.parentNode)p.push(h),i=h;i===(e.ownerDocument||d)&&p.push(i.defaultView||i.parentWindow||a)}g=0;while((h=p[g++])&&!b.isPropagationStopped())b.type=g>1?j:o.bindType||q,m=(N.get(h,"events")||{})[b.type]&&N.get(h,"handle"),m&&m.apply(h,c),m=l&&h[l],m&&m.apply&&L(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=q,f||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!L(e)||l&&n.isFunction(e[q])&&!n.isWindow(e)&&(i=e[l],i&&(e[l]=null),n.event.triggered=q,e[q](),n.event.triggered=void 0,i&&(e[l]=i)),b.result}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b)}}),n.fn.extend({trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),l.focusin="onfocusin"in a,l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=N.access(d,b);e||d.addEventListener(a,c,!0),N.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=N.access(d,b)-1;e?N.access(d,b,e):(d.removeEventListener(a,c,!0),N.remove(d,b))}}});var jb=a.location,kb=n.now(),lb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var mb=/#.*$/,nb=/([?&])_=[^&]*/,ob=/^(.*?):[ \t]*([^\r\n]*)$/gm,pb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,qb=/^(?:GET|HEAD)$/,rb=/^\/\//,sb={},tb={},ub="*/".concat("*"),vb=d.createElement("a");vb.href=jb.href;function wb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function xb(a,b,c,d){var e={},f=a===tb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function yb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function zb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Ab(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:jb.href,type:"GET",isLocal:pb.test(jb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ub,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?yb(yb(a,n.ajaxSettings),b):yb(n.ajaxSettings,a)},ajaxPrefilter:wb(sb),ajaxTransport:wb(tb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m=n.ajaxSetup({},c),o=m.context||m,p=m.context&&(o.nodeType||o.jquery)?n(o):n.event,q=n.Deferred(),r=n.Callbacks("once memory"),s=m.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,getResponseHeader:function(a){var b;if(2===v){if(!h){h={};while(b=ob.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===v?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return v||(a=u[c]=u[c]||a,t[a]=b),this},overrideMimeType:function(a){return v||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>v)for(b in a)s[b]=[s[b],a[b]];else x.always(a[x.status]);return this},abort:function(a){var b=a||w;return e&&e.abort(b),z(0,b),this}};if(q.promise(x).complete=r.add,x.success=x.done,x.error=x.fail,m.url=((b||m.url||jb.href)+"").replace(mb,"").replace(rb,jb.protocol+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=n.trim(m.dataType||"*").toLowerCase().match(G)||[""],null==m.crossDomain){j=d.createElement("a");try{j.href=m.url,j.href=j.href,m.crossDomain=vb.protocol+"//"+vb.host!=j.protocol+"//"+j.host}catch(y){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=n.param(m.data,m.traditional)),xb(sb,m,c,x),2===v)return x;k=n.event&&m.global,k&&0===n.active++&&n.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!qb.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(lb.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=nb.test(f)?f.replace(nb,"$1_="+kb++):f+(lb.test(f)?"&":"?")+"_="+kb++)),m.ifModified&&(n.lastModified[f]&&x.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&x.setRequestHeader("If-None-Match",n.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",m.contentType),x.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+ub+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)x.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(o,x,m)===!1||2===v))return x.abort();w="abort";for(l in{success:1,error:1,complete:1})x[l](m[l]);if(e=xb(tb,m,c,x)){if(x.readyState=1,k&&p.trigger("ajaxSend",[x,m]),2===v)return x;m.async&&m.timeout>0&&(i=a.setTimeout(function(){x.abort("timeout")},m.timeout));try{v=1,e.send(t,z)}catch(y){if(!(2>v))throw y;z(-1,y)}}else z(-1,"No Transport");function z(b,c,d,h){var j,l,t,u,w,y=c;2!==v&&(v=2,i&&a.clearTimeout(i),e=void 0,g=h||"",x.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(u=zb(m,x,d)),u=Ab(m,u,x,j),j?(m.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(n.lastModified[f]=w),w=x.getResponseHeader("etag"),w&&(n.etag[f]=w)),204===b||"HEAD"===m.type?y="nocontent":304===b?y="notmodified":(y=u.state,l=u.data,t=u.error,j=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),x.status=b,x.statusText=(c||y)+"",j?q.resolveWith(o,[l,y,x]):q.rejectWith(o,[x,y,t]),x.statusCode(s),s=void 0,k&&p.trigger(j?"ajaxSuccess":"ajaxError",[x,m,j?l:t]),r.fireWith(o,[x,y]),k&&(p.trigger("ajaxComplete",[x,m]),--n.active||n.event.trigger("ajaxStop")))}return x},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return!n.expr.filters.visible(a)},n.expr.filters.visible=function(a){return a.offsetWidth>0||a.offsetHeight>0||a.getClientRects().length>0};var Bb=/%20/g,Cb=/\[\]$/,Db=/\r?\n/g,Eb=/^(?:submit|button|image|reset|file)$/i,Fb=/^(?:input|select|textarea|keygen)/i;function Gb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Cb.test(a)?d(a,e):Gb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Gb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Gb(c,a[c],b,e);return d.join("&").replace(Bb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Fb.test(this.nodeName)&&!Eb.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Db,"\r\n")}}):{name:b.name,value:c.replace(Db,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Hb={0:200,1223:204},Ib=n.ajaxSettings.xhr();l.cors=!!Ib&&"withCredentials"in Ib,l.ajax=Ib=!!Ib,n.ajaxTransport(function(b){var c,d;return l.cors||Ib&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Hb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Jb=[],Kb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Jb.pop()||n.expando+"_"+kb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Kb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Kb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Kb,"$1"+e):b.jsonp!==!1&&(b.url+=(lb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Jb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ca([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var Lb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Lb)return Lb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function Mb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(e=d.getBoundingClientRect(),c=Mb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ea})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;n.fn[a]=function(d){return K(this,function(a,d,e){var f=Mb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ga(l.pixelPosition,function(a,c){return c?(c=Fa(a,b),Ba.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return K(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function(){return this.length}}),n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Nb=a.jQuery,Ob=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Ob),b&&a.jQuery===n&&(a.jQuery=Nb),n},b||(a.jQuery=a.$=n),n});
  5. /*!
  6. * Bootstrap v3.3.7 (http://getbootstrap.com)
  7. * Copyright 2011-2016 Twitter, Inc.
  8. * Licensed under the MIT license
  9. */
  10. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
  11. this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
  12. define("bootstrap", ["jquery"], function(){});
  13. require.config({
  14. urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
  15. packages: [{
  16. name: 'moment',
  17. location: '../libs/moment',
  18. main: 'moment'
  19. }],
  20. //在打包压缩时将会把include中的模块合并到主文件中
  21. include: ['css', 'layer', 'toastr', 'backend', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs'],
  22. paths: {
  23. 'lang': "empty:",
  24. 'form': 'require-form',
  25. 'table': 'require-table',
  26. 'upload': 'require-upload',
  27. 'validator': 'require-validator',
  28. 'drag': 'jquery.drag.min',
  29. 'drop': 'jquery.drop.min',
  30. 'echarts': 'echarts.min',
  31. 'echarts-theme': 'echarts-theme',
  32. 'adminlte': 'adminlte',
  33. 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  34. //
  35. // 以下的包从bower的libs目录加载
  36. 'jquery': '../libs/jquery/dist/jquery.min',
  37. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  38. 'bootstrap-validator': '../libs/bootstrap-validator/dist/validator.min',
  39. 'bootstrap-typeahead': '../libs/bootstrap3-typeahead/bootstrap3-typeahead.min',
  40. 'bootstrap-tagsinput': '../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput.min',
  41. 'bootstrap-dialog': '../libs/bootstrap3-dialog/dist/js/bootstrap-dialog.min',
  42. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  43. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  44. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  45. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  46. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  47. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  48. 'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',
  49. 'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',
  50. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  51. 'dropzone': '../libs/dropzone/dist/min/dropzone-amd-module.min',
  52. 'less': '../libs/less/dist/less.min',
  53. 'dragsort': '../libs/dragsort/jquery.dragsort',
  54. 'sortable': '../libs/Sortable/Sortable.min',
  55. 'addtabs': '../libs/jquery-addtabs/jquery.addtabs',
  56. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  57. 'crontab': '../libs/jqcron/src/jqCron.cn',
  58. 'summernote': '../libs/summernote/dist/lang/summernote-zh-CN.min',
  59. 'validator-core': '../libs/nice-validator/dist/jquery.validator',
  60. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  61. 'plupload': '../libs/plupload/js/plupload.min',
  62. 'toastr': '../libs/toastr/toastr',
  63. 'jstree': '../libs/jstree/dist/jstree.min',
  64. 'layer': '../libs/layer/src/layer',
  65. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  66. 'cxselect': '../libs/jquery-cxselect/js/jquery.cxselect',
  67. 'template': '../libs/art-template/dist/template-native',
  68. },
  69. // shim依赖配置
  70. shim: {
  71. 'bootstrap': ['jquery'],
  72. 'bootstrap-table': {
  73. deps: [
  74. 'bootstrap',
  75. // 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'
  76. ],
  77. exports: '$.fn.bootstrapTable'
  78. },
  79. 'bootstrap-table-lang': {
  80. deps: ['bootstrap-table'],
  81. exports: '$.fn.bootstrapTable.defaults'
  82. },
  83. 'bootstrap-table-export': {
  84. deps: ['bootstrap-table', 'tableexport'],
  85. exports: '$.fn.bootstrapTable.defaults'
  86. },
  87. 'bootstrap-table-mobile': {
  88. deps: ['bootstrap-table'],
  89. exports: '$.fn.bootstrapTable.defaults'
  90. },
  91. 'bootstrap-table-advancedsearch': {
  92. deps: ['bootstrap-table'],
  93. exports: '$.fn.bootstrapTable.defaults'
  94. },
  95. 'bootstrap-table-commonsearch': {
  96. deps: ['bootstrap-table'],
  97. exports: '$.fn.bootstrapTable.defaults'
  98. },
  99. 'tableexport': {
  100. deps: ['jquery'],
  101. exports: '$.fn.extend'
  102. },
  103. 'slimscroll': {
  104. deps: ['jquery'],
  105. exports: '$.fn.extend'
  106. },
  107. 'adminlte': {
  108. deps: ['bootstrap', 'slimscroll'],
  109. exports: '$.AdminLTE'
  110. },
  111. 'typeahead': {
  112. deps: ['jquery'],
  113. init: function ($) {
  114. return require.s.contexts._.registry['typeahead.js'].factory($);
  115. }
  116. },
  117. 'crontab': ['../libs/jqcron/src/jqCron', 'css!../libs/jqcron/src/jqCron.css'],
  118. 'bootstrap-checkbox': ['jquery'],
  119. 'bootstrap-radio': ['jquery'],
  120. 'bootstrap-switch': ['jquery'],
  121. 'bootstrap-dialog': ['css!../libs/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css'],
  122. 'bootstrap-datetimepicker': [
  123. 'moment/locale/zh-cn',
  124. // 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
  125. ],
  126. 'bootstrap-tagsinput': [
  127. 'css!../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css',
  128. 'css!../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput.css',
  129. 'jquery',
  130. 'typeahead'
  131. ],
  132. 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],
  133. 'summernote': ['../libs/summernote/dist/summernote.min', 'css!../libs/summernote/dist/summernote.css'],
  134. // 'toastr': ['css!../libs/toastr/toastr.min.css'],
  135. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],
  136. 'plupload': {
  137. deps: ['../libs/plupload/js/moxie.min'],
  138. exports: "plupload"
  139. },
  140. // 'layer': ['css!../libs/layer/build/skin/default/layer.css'],
  141. // 'validator-core': ['css!../libs/nice-validator/dist/jquery.validator.css'],
  142. 'validator-lang': ['validator-core'],
  143. },
  144. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  145. map: {
  146. '*': {
  147. 'css': '../libs/require-css/css.min'
  148. }
  149. },
  150. charset: 'utf-8' // 文件编码
  151. });
  152. require(['jquery', 'bootstrap'], function ($, undefined) {
  153. //初始配置
  154. var Config = requirejs.s.contexts._.config.config;
  155. //将Config渲染到全局
  156. window.Config = Config;
  157. // 配置语言包的路径
  158. var paths = {};
  159. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
  160. // 避免目录冲突
  161. paths['backend/'] = 'backend/';
  162. require.config({paths: paths});
  163. // 初始化
  164. $(function () {
  165. require(['backend'], function (Module) {
  166. // 对相对地址进行处理
  167. $.ajaxSetup({
  168. beforeSend: function (xhr, setting) {
  169. setting.url = Module.api.fixurl(setting.url);
  170. }
  171. });
  172. // 绑定ESC关闭窗口事件
  173. $(window).keyup(function (e) {
  174. if (e.keyCode == 27) {
  175. if ($(".layui-layer").size() > 0) {
  176. var index = 0;
  177. $(".layui-layer").each(function () {
  178. index = Math.max(index, parseInt($(this).attr("times")));
  179. });
  180. if (index) {
  181. Module.api.layer.close(index);
  182. }
  183. }
  184. }
  185. });
  186. //加载相应模块
  187. require([Config.jsname], function (Controller) {
  188. Controller[Config.actionname] != undefined && Controller[Config.actionname]();
  189. }, function (e) {
  190. console.error(e);
  191. // 这里可捕获模块加载的错误
  192. });
  193. });
  194. });
  195. });
  196. define("require-backend", function(){});
  197. define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window)return{load:function(a,b,c){c()}};var a=document.getElementsByTagName("head")[0],b=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/)||0,c=!1,d=!0;b[1]||b[7]?c=parseInt(b[1])<6||parseInt(b[7])<=9:b[2]||b[8]?d=!1:b[4]&&(c=parseInt(b[4])<18);var e={};e.pluginBuilder="./css-builder";var f,g,h,i=function(){f=document.createElement("style"),a.appendChild(f),g=f.styleSheet||f.sheet},j=0,k=[],l=function(a){g.addImport(a),f.onload=function(){m()},j++,31==j&&(i(),j=0)},m=function(){h();var a=k.shift();return a?(h=a[1],void l(a[0])):void(h=null)},n=function(a,b){if(g&&g.addImport||i(),g&&g.addImport)h?k.push([a,b]):(l(a),h=b);else{f.textContent='@import "'+a+'";';var c=setInterval(function(){try{f.sheet.cssRules,clearInterval(c),b()}catch(a){}},10)}},o=function(b,c){var e=document.createElement("link");if(e.type="text/css",e.rel="stylesheet",d)e.onload=function(){e.onload=function(){},setTimeout(c,7)};else var f=setInterval(function(){for(var a=0;a<document.styleSheets.length;a++){var b=document.styleSheets[a];if(b.href==e.href)return clearInterval(f),c()}},10);e.href=b,a.appendChild(e)};return e.normalize=function(a,b){return".css"==a.substr(a.length-4,4)&&(a=a.substr(0,a.length-4)),b(a)},e.load=function(a,b,d,e){(c?n:o)(b.toUrl(a+".css"),d)},e});
  198. /**
  199. @Name:layer v3.0.3 Web弹层组件
  200. @Author:贤心
  201. @Site:http://layer.layui.com
  202. @License:MIT
  203. */
  204. ;!function(window, undefined){
  205. "use strict";
  206. var isLayui = window.layui && layui.define, $, win, ready = {
  207. getPath: function(){
  208. var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
  209. if(script.getAttribute('merge')) return;
  210. return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
  211. }(),
  212. config: {}, end: {}, minIndex: 0, minLeft: [],
  213. btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
  214. //五种原始层模式
  215. type: ['dialog', 'page', 'iframe', 'loading', 'tips']
  216. };
  217. //默认内置方法。
  218. var layer = {
  219. v: '3.0.3',
  220. ie: function(){ //ie版本
  221. var agent = navigator.userAgent.toLowerCase();
  222. return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
  223. (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
  224. ) : false;
  225. }(),
  226. index: (window.layer && window.layer.v) ? 100000 : 0,
  227. path: ready.getPath,
  228. config: function(options, fn){
  229. options = options || {};
  230. layer.cache = ready.config = $.extend({}, ready.config, options);
  231. layer.path = ready.config.path || layer.path;
  232. typeof options.extend === 'string' && (options.extend = [options.extend]);
  233. if(ready.config.path) layer.ready();
  234. if(!options.extend) return this;
  235. isLayui
  236. ? layui.addcss('modules/layer/' + options.extend)
  237. : layer.link('skin/' + options.extend);
  238. return this;
  239. },
  240. //载入CSS配件
  241. link: function(href, fn, cssname){
  242. //未设置路径,则不主动加载css
  243. if(!layer.path) return;
  244. var head = $('head')[0], link = document.createElement('link');
  245. if(typeof fn === 'string') cssname = fn;
  246. var app = (cssname || href).replace(/\.|\//g, '');
  247. var id = 'layuicss-'+app, timeout = 0;
  248. link.rel = 'stylesheet';
  249. link.href = layer.path + href;
  250. link.id = id;
  251. if(!$('#'+ id)[0]){
  252. head.appendChild(link);
  253. }
  254. if(typeof fn !== 'function') return;
  255. //轮询css是否加载完毕
  256. (function poll() {
  257. if(++timeout > 8 * 1000 / 100){
  258. return window.console && console.error('layer.css: Invalid');
  259. };
  260. parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
  261. }());
  262. },
  263. ready: function(callback){
  264. var cssname = 'skinlayercss', ver = '303';
  265. isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
  266. : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);
  267. return this;
  268. },
  269. //各种快捷引用
  270. alert: function(content, options, yes){
  271. var type = typeof options === 'function';
  272. if(type) yes = options;
  273. return layer.open($.extend({
  274. content: content,
  275. yes: yes
  276. }, type ? {} : options));
  277. },
  278. confirm: function(content, options, yes, cancel){
  279. var type = typeof options === 'function';
  280. if(type){
  281. cancel = yes;
  282. yes = options;
  283. }
  284. return layer.open($.extend({
  285. content: content,
  286. btn: ready.btn,
  287. yes: yes,
  288. btn2: cancel
  289. }, type ? {} : options));
  290. },
  291. msg: function(content, options, end){ //最常用提示层
  292. var type = typeof options === 'function', rskin = ready.config.skin;
  293. var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
  294. var anim = doms.anim.length - 1;
  295. if(type) end = options;
  296. return layer.open($.extend({
  297. content: content,
  298. time: 3000,
  299. shade: false,
  300. skin: skin,
  301. title: false,
  302. closeBtn: false,
  303. btn: false,
  304. resize: false,
  305. end: end
  306. }, (type && !ready.config.skin) ? {
  307. skin: skin + ' layui-layer-hui',
  308. anim: anim
  309. } : function(){
  310. options = options || {};
  311. if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
  312. options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
  313. }
  314. return options;
  315. }()));
  316. },
  317. load: function(icon, options){
  318. return layer.open($.extend({
  319. type: 3,
  320. icon: icon || 0,
  321. resize: false,
  322. shade: 0.01
  323. }, options));
  324. },
  325. tips: function(content, follow, options){
  326. return layer.open($.extend({
  327. type: 4,
  328. content: [content, follow],
  329. closeBtn: false,
  330. time: 3000,
  331. shade: false,
  332. resize: false,
  333. fixed: false,
  334. maxWidth: 210
  335. }, options));
  336. }
  337. };
  338. var Class = function(setings){
  339. var that = this;
  340. that.index = ++layer.index;
  341. that.config = $.extend({}, that.config, ready.config, setings);
  342. document.body ? that.creat() : setTimeout(function(){
  343. that.creat();
  344. }, 30);
  345. };
  346. Class.pt = Class.prototype;
  347. //缓存常用字符
  348. var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
  349. doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
  350. //默认配置
  351. Class.pt.config = {
  352. type: 0,
  353. shade: 0.3,
  354. fixed: true,
  355. move: doms[1],
  356. title: '&#x4FE1;&#x606F;',
  357. offset: 'auto',
  358. area: 'auto',
  359. closeBtn: 1,
  360. time: 0, //0表示不自动关闭
  361. zIndex: 19891014,
  362. maxWidth: 360,
  363. anim: 0,
  364. isOutAnim: true,
  365. icon: -1,
  366. moveType: 1,
  367. resize: true,
  368. scrollbar: true, //是否允许浏览器滚动条
  369. tips: 2
  370. };
  371. //容器
  372. Class.pt.vessel = function(conType, callback){
  373. var that = this, times = that.index, config = that.config;
  374. var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
  375. var ismax = config.maxmin && (config.type === 1 || config.type === 2);
  376. var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
  377. + (titype ? config.title[0] : config.title)
  378. + '</div>' : '');
  379. config.zIndex = zIndex;
  380. callback([
  381. //遮罩
  382. config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
  383. //主体
  384. '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
  385. + (conType && config.type != 2 ? '' : titleHTML)
  386. + '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
  387. + (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
  388. + (config.type == 1 && conType ? '' : (config.content||''))
  389. + '</div>'
  390. + '<span class="layui-layer-setwin">'+ function(){
  391. var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
  392. config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
  393. return closebtn;
  394. }() + '</span>'
  395. + (config.btn ? function(){
  396. var button = '';
  397. typeof config.btn === 'string' && (config.btn = [config.btn]);
  398. for(var i = 0, len = config.btn.length; i < len; i++){
  399. button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
  400. }
  401. return '<div class="'+ doms[6] +' layui-layer-btn-'+ (config.btnAlign||'') +'">'+ button +'</div>'
  402. }() : '')
  403. + (config.resize ? '<span class="layui-layer-resize"></span>' : '')
  404. + '</div>'
  405. ], titleHTML, $('<div class="layui-layer-move"></div>'));
  406. return that;
  407. };
  408. //创建骨架
  409. Class.pt.creat = function(){
  410. var that = this
  411. ,config = that.config
  412. ,times = that.index, nodeIndex
  413. ,content = config.content
  414. ,conType = typeof content === 'object'
  415. ,body = $('body');
  416. if(config.id && $('#'+config.id)[0]) return;
  417. if(typeof config.area === 'string'){
  418. config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
  419. }
  420. //anim兼容旧版shift
  421. if(config.shift){
  422. config.anim = config.shift;
  423. }
  424. if(layer.ie == 6){
  425. config.fixed = false;
  426. }
  427. switch(config.type){
  428. case 0:
  429. config.btn = ('btn' in config) ? config.btn : ready.btn[0];
  430. layer.closeAll('dialog');
  431. break;
  432. case 2:
  433. var content = config.content = conType ? config.content : [config.content||'http://layer.layui.com', 'auto'];
  434. config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
  435. break;
  436. case 3:
  437. delete config.title;
  438. delete config.closeBtn;
  439. config.icon === -1 && (config.icon === 0);
  440. layer.closeAll('loading');
  441. break;
  442. case 4:
  443. conType || (config.content = [config.content, 'body']);
  444. config.follow = config.content[1];
  445. config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
  446. delete config.title;
  447. config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
  448. config.tipsMore || layer.closeAll('tips');
  449. break;
  450. }
  451. //建立容器
  452. that.vessel(conType, function(html, titleHTML, moveElem){
  453. body.append(html[0]);
  454. conType ? function(){
  455. (config.type == 2 || config.type == 4) ? function(){
  456. $('body').append(html[1]);
  457. }() : function(){
  458. if(!content.parents('.'+doms[0])[0]){
  459. content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
  460. $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
  461. }
  462. }();
  463. }() : body.append(html[1]);
  464. $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
  465. that.layero = $('#'+ doms[0] + times);
  466. config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
  467. }).auto(times);
  468. config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
  469. //坐标自适应浏览器窗口尺寸
  470. config.type == 4 ? that.tips() : that.offset();
  471. if(config.fixed){
  472. win.on('resize', function(){
  473. that.offset();
  474. (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
  475. config.type == 4 && that.tips();
  476. });
  477. }
  478. config.time <= 0 || setTimeout(function(){
  479. layer.close(that.index)
  480. }, config.time);
  481. that.move().callback();
  482. //为兼容jQuery3.0的css动画影响元素尺寸计算
  483. if(doms.anim[config.anim]){
  484. that.layero.addClass(doms.anim[config.anim]);
  485. };
  486. //记录关闭动画
  487. if(config.isOutAnim){
  488. that.layero.data('isOutAnim', true);
  489. }
  490. };
  491. //自适应
  492. Class.pt.auto = function(index){
  493. var that = this, config = that.config, layero = $('#'+ doms[0] + index);
  494. if(config.area[0] === '' && config.maxWidth > 0){
  495. //为了修复IE7下一个让人难以理解的bug
  496. if(layer.ie && layer.ie < 8 && config.btn){
  497. layero.width(layero.innerWidth());
  498. }
  499. layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
  500. }
  501. var area = [layero.innerWidth(), layero.innerHeight()];
  502. var titHeight = layero.find(doms[1]).outerHeight() || 0;
  503. var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  504. function setHeight(elem){
  505. elem = layero.find(elem);
  506. elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));
  507. }
  508. switch(config.type){
  509. case 2:
  510. setHeight('iframe');
  511. break;
  512. default:
  513. if(config.area[1] === ''){
  514. if(config.fixed && area[1] >= win.height()){
  515. area[1] = win.height();
  516. setHeight('.'+doms[5]);
  517. }
  518. } else {
  519. setHeight('.'+doms[5]);
  520. }
  521. break;
  522. }
  523. return that;
  524. };
  525. //计算坐标
  526. Class.pt.offset = function(){
  527. var that = this, config = that.config, layero = that.layero;
  528. var area = [layero.outerWidth(), layero.outerHeight()];
  529. var type = typeof config.offset === 'object';
  530. that.offsetTop = (win.height() - area[1])/2;
  531. that.offsetLeft = (win.width() - area[0])/2;
  532. if(type){
  533. that.offsetTop = config.offset[0];
  534. that.offsetLeft = config.offset[1]||that.offsetLeft;
  535. } else if(config.offset !== 'auto'){
  536. if(config.offset === 't'){ //上
  537. that.offsetTop = 0;
  538. } else if(config.offset === 'r'){ //右
  539. that.offsetLeft = win.width() - area[0];
  540. } else if(config.offset === 'b'){ //下
  541. that.offsetTop = win.height() - area[1];
  542. } else if(config.offset === 'l'){ //左
  543. that.offsetLeft = 0;
  544. } else if(config.offset === 'lt'){ //左上角
  545. that.offsetTop = 0;
  546. that.offsetLeft = 0;
  547. } else if(config.offset === 'lb'){ //左下角
  548. that.offsetTop = win.height() - area[1];
  549. that.offsetLeft = 0;
  550. } else if(config.offset === 'rt'){ //右上角
  551. that.offsetTop = 0;
  552. that.offsetLeft = win.width() - area[0];
  553. } else if(config.offset === 'rb'){ //右下角
  554. that.offsetTop = win.height() - area[1];
  555. that.offsetLeft = win.width() - area[0];
  556. } else {
  557. that.offsetTop = config.offset;
  558. }
  559. }
  560. if(!config.fixed){
  561. that.offsetTop = /%$/.test(that.offsetTop) ?
  562. win.height()*parseFloat(that.offsetTop)/100
  563. : parseFloat(that.offsetTop);
  564. that.offsetLeft = /%$/.test(that.offsetLeft) ?
  565. win.width()*parseFloat(that.offsetLeft)/100
  566. : parseFloat(that.offsetLeft);
  567. that.offsetTop += win.scrollTop();
  568. that.offsetLeft += win.scrollLeft();
  569. }
  570. if(layero.attr('minLeft')){
  571. that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
  572. that.offsetLeft = layero.css('left');
  573. }
  574. layero.css({top: that.offsetTop, left: that.offsetLeft});
  575. };
  576. //Tips
  577. Class.pt.tips = function(){
  578. var that = this, config = that.config, layero = that.layero;
  579. var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);
  580. if(!follow[0]) follow = $('body');
  581. var goal = {
  582. width: follow.outerWidth(),
  583. height: follow.outerHeight(),
  584. top: follow.offset().top,
  585. left: follow.offset().left
  586. }, tipsG = layero.find('.layui-layer-TipsG');
  587. var guide = config.tips[0];
  588. config.tips[1] || tipsG.remove();
  589. goal.autoLeft = function(){
  590. if(goal.left + layArea[0] - win.width() > 0){
  591. goal.tipLeft = goal.left + goal.width - layArea[0];
  592. tipsG.css({right: 12, left: 'auto'});
  593. } else {
  594. goal.tipLeft = goal.left;
  595. };
  596. };
  597. //辨别tips的方位
  598. goal.where = [function(){ //上
  599. goal.autoLeft();
  600. goal.tipTop = goal.top - layArea[1] - 10;
  601. tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
  602. }, function(){ //右
  603. goal.tipLeft = goal.left + goal.width + 10;
  604. goal.tipTop = goal.top;
  605. tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
  606. }, function(){ //下
  607. goal.autoLeft();
  608. goal.tipTop = goal.top + goal.height + 10;
  609. tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
  610. }, function(){ //左
  611. goal.tipLeft = goal.left - layArea[0] - 10;
  612. goal.tipTop = goal.top;
  613. tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
  614. }];
  615. goal.where[guide-1]();
  616. /* 8*2为小三角形占据的空间 */
  617. if(guide === 1){
  618. goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
  619. } else if(guide === 2){
  620. win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()
  621. } else if(guide === 3){
  622. (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();
  623. } else if(guide === 4){
  624. layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()
  625. }
  626. layero.find('.'+doms[5]).css({
  627. 'background-color': config.tips[1],
  628. 'padding-right': (config.closeBtn ? '30px' : '')
  629. });
  630. layero.css({
  631. left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
  632. top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
  633. });
  634. }
  635. //拖拽层
  636. Class.pt.move = function(){
  637. var that = this
  638. ,config = that.config
  639. ,_DOC = $(document)
  640. ,layero = that.layero
  641. ,moveElem = layero.find(config.move)
  642. ,resizeElem = layero.find('.layui-layer-resize')
  643. ,dict = {};
  644. if(config.move){
  645. moveElem.css('cursor', 'move');
  646. }
  647. moveElem.on('mousedown', function(e){
  648. e.preventDefault();
  649. if(config.move){
  650. dict.moveStart = true;
  651. dict.offset = [
  652. e.clientX - parseFloat(layero.css('left'))
  653. ,e.clientY - parseFloat(layero.css('top'))
  654. ];
  655. ready.moveElem.css('cursor', 'move').show();
  656. }
  657. });
  658. resizeElem.on('mousedown', function(e){
  659. e.preventDefault();
  660. dict.resizeStart = true;
  661. dict.offset = [e.clientX, e.clientY];
  662. dict.area = [
  663. layero.outerWidth()
  664. ,layero.outerHeight()
  665. ];
  666. ready.moveElem.css('cursor', 'se-resize').show();
  667. });
  668. _DOC.on('mousemove', function(e){
  669. //拖拽移动
  670. if(dict.moveStart){
  671. var X = e.clientX - dict.offset[0]
  672. ,Y = e.clientY - dict.offset[1]
  673. ,fixed = layero.css('position') === 'fixed';
  674. e.preventDefault();
  675. dict.stX = fixed ? 0 : win.scrollLeft();
  676. dict.stY = fixed ? 0 : win.scrollTop();
  677. //控制元素不被拖出窗口外
  678. if(!config.moveOut){
  679. var setRig = win.width() - layero.outerWidth() + dict.stX
  680. ,setBot = win.height() - layero.outerHeight() + dict.stY;
  681. X < dict.stX && (X = dict.stX);
  682. X > setRig && (X = setRig);
  683. Y < dict.stY && (Y = dict.stY);
  684. Y > setBot && (Y = setBot);
  685. }
  686. layero.css({
  687. left: X
  688. ,top: Y
  689. });
  690. }
  691. //Resize
  692. if(config.resize && dict.resizeStart){
  693. var X = e.clientX - dict.offset[0]
  694. ,Y = e.clientY - dict.offset[1];
  695. e.preventDefault();
  696. layer.style(that.index, {
  697. width: dict.area[0] + X
  698. ,height: dict.area[1] + Y
  699. })
  700. dict.isResize = true;
  701. config.resizing && config.resizing(layero);
  702. }
  703. }).on('mouseup', function(e){
  704. if(dict.moveStart){
  705. delete dict.moveStart;
  706. ready.moveElem.hide();
  707. config.moveEnd && config.moveEnd(layero);
  708. }
  709. if(dict.resizeStart){
  710. delete dict.resizeStart;
  711. ready.moveElem.hide();
  712. }
  713. });
  714. return that;
  715. };
  716. Class.pt.callback = function(){
  717. var that = this, layero = that.layero, config = that.config;
  718. that.openLayer();
  719. if(config.success){
  720. if(config.type == 2){
  721. layero.find('iframe').on('load', function(){
  722. config.success(layero, that.index);
  723. });
  724. } else {
  725. config.success(layero, that.index);
  726. }
  727. }
  728. layer.ie == 6 && that.IE6(layero);
  729. //按钮
  730. layero.find('.'+ doms[6]).children('a').on('click', function(){
  731. var index = $(this).index();
  732. if(index === 0){
  733. if(config.yes){
  734. config.yes(that.index, layero)
  735. } else if(config['btn1']){
  736. config['btn1'](that.index, layero)
  737. } else {
  738. layer.close(that.index);
  739. }
  740. } else {
  741. var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
  742. close === false || layer.close(that.index);
  743. }
  744. });
  745. //取消
  746. function cancel(){
  747. var close = config.cancel && config.cancel(that.index, layero);
  748. close === false || layer.close(that.index);
  749. }
  750. //右上角关闭回调
  751. layero.find('.'+ doms[7]).on('click', cancel);
  752. //点遮罩关闭
  753. if(config.shadeClose){
  754. $('#layui-layer-shade'+ that.index).on('click', function(){
  755. layer.close(that.index);
  756. });
  757. }
  758. //最小化
  759. layero.find('.layui-layer-min').on('click', function(){
  760. var min = config.min && config.min(layero);
  761. min === false || layer.min(that.index, config);
  762. });
  763. //全屏/还原
  764. layero.find('.layui-layer-max').on('click', function(){
  765. if($(this).hasClass('layui-layer-maxmin')){
  766. layer.restore(that.index);
  767. config.restore && config.restore(layero);
  768. } else {
  769. layer.full(that.index, config);
  770. setTimeout(function(){
  771. config.full && config.full(layero);
  772. }, 100);
  773. }
  774. });
  775. config.end && (ready.end[that.index] = config.end);
  776. };
  777. //for ie6 恢复select
  778. ready.reselect = function(){
  779. $.each($('select'), function(index , value){
  780. var sthis = $(this);
  781. if(!sthis.parents('.'+doms[0])[0]){
  782. (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
  783. }
  784. sthis = null;
  785. });
  786. };
  787. Class.pt.IE6 = function(layero){
  788. //隐藏select
  789. $('select').each(function(index , value){
  790. var sthis = $(this);
  791. if(!sthis.parents('.'+doms[0])[0]){
  792. sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();
  793. }
  794. sthis = null;
  795. });
  796. };
  797. //需依赖原型的对外方法
  798. Class.pt.openLayer = function(){
  799. var that = this;
  800. //置顶当前窗口
  801. layer.zIndex = that.config.zIndex;
  802. layer.setTop = function(layero){
  803. var setZindex = function(){
  804. layer.zIndex++;
  805. layero.css('z-index', layer.zIndex + 1);
  806. };
  807. layer.zIndex = parseInt(layero[0].style.zIndex);
  808. layero.on('mousedown', setZindex);
  809. return layer.zIndex;
  810. };
  811. };
  812. ready.record = function(layero){
  813. var area = [
  814. layero.width(),
  815. layero.height(),
  816. layero.position().top,
  817. layero.position().left + parseFloat(layero.css('margin-left'))
  818. ];
  819. layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
  820. layero.attr({area: area});
  821. };
  822. ready.rescollbar = function(index){
  823. if(doms.html.attr('layer-full') == index){
  824. if(doms.html[0].style.removeProperty){
  825. doms.html[0].style.removeProperty('overflow');
  826. } else {
  827. doms.html[0].style.removeAttribute('overflow');
  828. }
  829. doms.html.removeAttr('layer-full');
  830. }
  831. };
  832. /** 内置成员 */
  833. window.layer = layer;
  834. //获取子iframe的DOM
  835. layer.getChildFrame = function(selector, index){
  836. index = index || $('.'+doms[4]).attr('times');
  837. return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
  838. };
  839. //得到当前iframe层的索引,子iframe时使用
  840. layer.getFrameIndex = function(name){
  841. return $('#'+ name).parents('.'+doms[4]).attr('times');
  842. };
  843. //iframe层自适应宽高
  844. layer.iframeAuto = function(index){
  845. if(!index) return;
  846. var heg = layer.getChildFrame('html', index).outerHeight();
  847. var layero = $('#'+ doms[0] + index);
  848. var titHeight = layero.find(doms[1]).outerHeight() || 0;
  849. var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  850. layero.css({height: heg + titHeight + btnHeight});
  851. layero.find('iframe').css({height: heg});
  852. };
  853. //重置iframe url
  854. layer.iframeSrc = function(index, url){
  855. $('#'+ doms[0] + index).find('iframe').attr('src', url);
  856. };
  857. //设定层的样式
  858. layer.style = function(index, options, limit){
  859. var layero = $('#'+ doms[0] + index)
  860. ,contElem = layero.find('.layui-layer-content')
  861. ,type = layero.attr('type')
  862. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  863. ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
  864. ,minLeft = layero.attr('minLeft');
  865. if(type === ready.type[3] || type === ready.type[4]){
  866. return;
  867. }
  868. if(!limit){
  869. if(parseFloat(options.width) <= 260){
  870. options.width = 260;
  871. };
  872. if(parseFloat(options.height) - titHeight - btnHeight <= 64){
  873. options.height = 64 + titHeight + btnHeight;
  874. };
  875. }
  876. layero.css(options);
  877. btnHeight = layero.find('.'+doms[6]).outerHeight();
  878. if(type === ready.type[2]){
  879. layero.find('iframe').css({
  880. height: parseFloat(options.height) - titHeight - btnHeight
  881. });
  882. } else {
  883. contElem.css({
  884. height: parseFloat(options.height) - titHeight - btnHeight
  885. - parseFloat(contElem.css('padding-top'))
  886. - parseFloat(contElem.css('padding-bottom'))
  887. })
  888. }
  889. };
  890. //最小化
  891. layer.min = function(index, options){
  892. var layero = $('#'+ doms[0] + index)
  893. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  894. ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
  895. ,position = layero.css('position');
  896. ready.record(layero);
  897. if(ready.minLeft[0]){
  898. left = ready.minLeft[0];
  899. ready.minLeft.shift();
  900. }
  901. layero.attr('position', position);
  902. layer.style(index, {
  903. width: 180
  904. ,height: titHeight
  905. ,left: left
  906. ,top: win.height() - titHeight
  907. ,position: 'fixed'
  908. ,overflow: 'hidden'
  909. }, true);
  910. layero.find('.layui-layer-min').hide();
  911. layero.attr('type') === 'page' && layero.find(doms[4]).hide();
  912. ready.rescollbar(index);
  913. if(!layero.attr('minLeft')){
  914. ready.minIndex++;
  915. }
  916. layero.attr('minLeft', left);
  917. };
  918. //还原
  919. layer.restore = function(index){
  920. var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
  921. var type = layero.attr('type');
  922. layer.style(index, {
  923. width: parseFloat(area[0]),
  924. height: parseFloat(area[1]),
  925. top: parseFloat(area[2]),
  926. left: parseFloat(area[3]),
  927. position: layero.attr('position'),
  928. overflow: 'visible'
  929. }, true);
  930. layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
  931. layero.find('.layui-layer-min').show();
  932. layero.attr('type') === 'page' && layero.find(doms[4]).show();
  933. ready.rescollbar(index);
  934. };
  935. //全屏
  936. layer.full = function(index){
  937. var layero = $('#'+ doms[0] + index), timer;
  938. ready.record(layero);
  939. if(!doms.html.attr('layer-full')){
  940. doms.html.css('overflow','hidden').attr('layer-full', index);
  941. }
  942. clearTimeout(timer);
  943. timer = setTimeout(function(){
  944. var isfix = layero.css('position') === 'fixed';
  945. layer.style(index, {
  946. top: isfix ? 0 : win.scrollTop(),
  947. left: isfix ? 0 : win.scrollLeft(),
  948. width: win.width(),
  949. height: win.height()
  950. }, true);
  951. layero.find('.layui-layer-min').hide();
  952. }, 100);
  953. };
  954. //改变title
  955. layer.title = function(name, index){
  956. var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
  957. title.html(name);
  958. };
  959. //关闭layer总方法
  960. layer.close = function(index){
  961. var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
  962. if(!layero[0]) return;
  963. var WRAP = 'layui-layer-wrap', remove = function(){
  964. if(type === ready.type[1] && layero.attr('conType') === 'object'){
  965. layero.children(':not(.'+ doms[5] +')').remove();
  966. var wrap = layero.find('.'+WRAP);
  967. for(var i = 0; i < 2; i++){
  968. wrap.unwrap();
  969. }
  970. wrap.css('display', wrap.data('display')).removeClass(WRAP);
  971. } else {
  972. //低版本IE 回收 iframe
  973. if(type === ready.type[2]){
  974. try {
  975. var iframe = $('#'+doms[4]+index)[0];
  976. iframe.contentWindow.document.write('');
  977. iframe.contentWindow.close();
  978. layero.find('.'+doms[5])[0].removeChild(iframe);
  979. } catch(e){}
  980. }
  981. layero[0].innerHTML = '';
  982. layero.remove();
  983. }
  984. typeof ready.end[index] === 'function' && ready.end[index]();
  985. delete ready.end[index];
  986. };
  987. if(layero.data('isOutAnim')){
  988. layero.addClass(closeAnim);
  989. }
  990. $('#layui-layer-moves, #layui-layer-shade' + index).remove();
  991. layer.ie == 6 && ready.reselect();
  992. ready.rescollbar(index);
  993. if(layero.attr('minLeft')){
  994. ready.minIndex--;
  995. ready.minLeft.push(layero.attr('minLeft'));
  996. }
  997. if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){
  998. remove()
  999. } else {
  1000. setTimeout(function(){
  1001. remove();
  1002. }, 200);
  1003. }
  1004. };
  1005. //关闭所有层
  1006. layer.closeAll = function(type){
  1007. $.each($('.'+doms[0]), function(){
  1008. var othis = $(this);
  1009. var is = type ? (othis.attr('type') === type) : 1;
  1010. is && layer.close(othis.attr('times'));
  1011. is = null;
  1012. });
  1013. };
  1014. /**
  1015. 拓展模块,layui开始合并在一起
  1016. */
  1017. var cache = layer.cache||{}, skin = function(type){
  1018. return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
  1019. };
  1020. //仿系统prompt
  1021. layer.prompt = function(options, yes){
  1022. var style = '';
  1023. options = options || {};
  1024. if(typeof options === 'function') yes = options;
  1025. if(options.area){
  1026. var area = options.area;
  1027. style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
  1028. delete options.area;
  1029. }
  1030. var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
  1031. return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
  1032. }();
  1033. var success = options.success;
  1034. delete options.success;
  1035. return layer.open($.extend({
  1036. type: 1
  1037. ,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
  1038. ,content: content
  1039. ,skin: 'layui-layer-prompt' + skin('prompt')
  1040. ,maxWidth: win.width()
  1041. ,success: function(layero){
  1042. prompt = layero.find('.layui-layer-input');
  1043. prompt.focus();
  1044. typeof success === 'function' && success(layero);
  1045. }
  1046. ,resize: false
  1047. ,yes: function(index){
  1048. var value = prompt.val();
  1049. if(value === ''){
  1050. prompt.focus();
  1051. } else if(value.length > (options.maxlength||500)) {
  1052. layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});
  1053. } else {
  1054. yes && yes(value, index, prompt);
  1055. }
  1056. }
  1057. }, options));
  1058. };
  1059. //tab层
  1060. layer.tab = function(options){
  1061. options = options || {};
  1062. var tab = options.tab || {}
  1063. ,success = options.success;
  1064. delete options.success;
  1065. return layer.open($.extend({
  1066. type: 1,
  1067. skin: 'layui-layer-tab' + skin('tab'),
  1068. resize: false,
  1069. title: function(){
  1070. var len = tab.length, ii = 1, str = '';
  1071. if(len > 0){
  1072. str = '<span class="layui-layer-tabnow">'+ tab[0].title +'</span>';
  1073. for(; ii < len; ii++){
  1074. str += '<span>'+ tab[ii].title +'</span>';
  1075. }
  1076. }
  1077. return str;
  1078. }(),
  1079. content: '<ul class="layui-layer-tabmain">'+ function(){
  1080. var len = tab.length, ii = 1, str = '';
  1081. if(len > 0){
  1082. str = '<li class="layui-layer-tabli xubox_tab_layer">'+ (tab[0].content || 'no content') +'</li>';
  1083. for(; ii < len; ii++){
  1084. str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';
  1085. }
  1086. }
  1087. return str;
  1088. }() +'</ul>',
  1089. success: function(layero){
  1090. var btn = layero.find('.layui-layer-title').children();
  1091. var main = layero.find('.layui-layer-tabmain').children();
  1092. btn.on('mousedown', function(e){
  1093. e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
  1094. var othis = $(this), index = othis.index();
  1095. othis.addClass('layui-layer-tabnow').siblings().removeClass('layui-layer-tabnow');
  1096. main.eq(index).show().siblings().hide();
  1097. typeof options.change === 'function' && options.change(index);
  1098. });
  1099. typeof success === 'function' && success(layero);
  1100. }
  1101. }, options));
  1102. };
  1103. //相册层
  1104. layer.photos = function(options, loop, key){
  1105. var dict = {};
  1106. options = options || {};
  1107. if(!options.photos) return;
  1108. var type = options.photos.constructor === Object;
  1109. var photos = type ? options.photos : {}, data = photos.data || [];
  1110. var start = photos.start || 0;
  1111. dict.imgIndex = (start|0) + 1;
  1112. options.img = options.img || 'img';
  1113. var success = options.success;
  1114. delete options.success;
  1115. if(!type){ //页面直接获取
  1116. var parent = $(options.photos), pushData = function(){
  1117. data = [];
  1118. parent.find(options.img).each(function(index){
  1119. var othis = $(this);
  1120. othis.attr('layer-index', index);
  1121. data.push({
  1122. alt: othis.attr('alt'),
  1123. pid: othis.attr('layer-pid'),
  1124. src: othis.attr('layer-src') || othis.attr('src'),
  1125. thumb: othis.attr('src')
  1126. });
  1127. })
  1128. };
  1129. pushData();
  1130. if (data.length === 0) return;
  1131. loop || parent.on('click', options.img, function(){
  1132. var othis = $(this), index = othis.attr('layer-index');
  1133. layer.photos($.extend(options, {
  1134. photos: {
  1135. start: index,
  1136. data: data,
  1137. tab: options.tab
  1138. },
  1139. full: options.full
  1140. }), true);
  1141. pushData();
  1142. })
  1143. //不直接弹出
  1144. if(!loop) return;
  1145. } else if (data.length === 0){
  1146. return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');
  1147. }
  1148. //上一张
  1149. dict.imgprev = function(key){
  1150. dict.imgIndex--;
  1151. if(dict.imgIndex < 1){
  1152. dict.imgIndex = data.length;
  1153. }
  1154. dict.tabimg(key);
  1155. };
  1156. //下一张
  1157. dict.imgnext = function(key,errorMsg){
  1158. dict.imgIndex++;
  1159. if(dict.imgIndex > data.length){
  1160. dict.imgIndex = 1;
  1161. if (errorMsg) {return};
  1162. }
  1163. dict.tabimg(key)
  1164. };
  1165. //方向键
  1166. dict.keyup = function(event){
  1167. if(!dict.end){
  1168. var code = event.keyCode;
  1169. event.preventDefault();
  1170. if(code === 37){
  1171. dict.imgprev(true);
  1172. } else if(code === 39) {
  1173. dict.imgnext(true);
  1174. } else if(code === 27) {
  1175. layer.close(dict.index);
  1176. }
  1177. }
  1178. }
  1179. //切换
  1180. dict.tabimg = function(key){
  1181. if(data.length <= 1) return;
  1182. photos.start = dict.imgIndex - 1;
  1183. layer.close(dict.index);
  1184. return layer.photos(options, true, key);
  1185. setTimeout(function(){
  1186. layer.photos(options, true, key);
  1187. }, 200);
  1188. }
  1189. //一些动作
  1190. dict.event = function(){
  1191. dict.bigimg.hover(function(){
  1192. dict.imgsee.show();
  1193. }, function(){
  1194. dict.imgsee.hide();
  1195. });
  1196. dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
  1197. event.preventDefault();
  1198. dict.imgprev();
  1199. });
  1200. dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
  1201. event.preventDefault();
  1202. dict.imgnext();
  1203. });
  1204. $(document).on('keyup', dict.keyup);
  1205. };
  1206. //图片预加载
  1207. function loadImage(url, callback, error) {
  1208. var img = new Image();
  1209. img.src = url;
  1210. if(img.complete){
  1211. return callback(img);
  1212. }
  1213. img.onload = function(){
  1214. img.onload = null;
  1215. callback(img);
  1216. };
  1217. img.onerror = function(e){
  1218. img.onerror = null;
  1219. error(e);
  1220. };
  1221. };
  1222. dict.loadi = layer.load(1, {
  1223. shade: 'shade' in options ? false : 0.9,
  1224. scrollbar: false
  1225. });
  1226. loadImage(data[start].src, function(img){
  1227. layer.close(dict.loadi);
  1228. dict.index = layer.open($.extend({
  1229. type: 1,
  1230. id: 'layui-layer-photos',
  1231. area: function(){
  1232. var imgarea = [img.width, img.height];
  1233. var winarea = [$(window).width() - 100, $(window).height() - 100];
  1234. //如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
  1235. if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
  1236. var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
  1237. if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
  1238. imgarea[0] = imgarea[0]/wh[0];
  1239. imgarea[1] = imgarea[1]/wh[0];
  1240. } else if(wh[0] < wh[1]){
  1241. imgarea[0] = imgarea[0]/wh[1];
  1242. imgarea[1] = imgarea[1]/wh[1];
  1243. }
  1244. }
  1245. return [imgarea[0]+'px', imgarea[1]+'px'];
  1246. }(),
  1247. title: false,
  1248. shade: 0.9,
  1249. shadeClose: true,
  1250. closeBtn: false,
  1251. move: '.layui-layer-phimg img',
  1252. moveType: 1,
  1253. scrollbar: false,
  1254. moveOut: true,
  1255. //anim: Math.random()*5|0,
  1256. isOutAnim: false,
  1257. skin: 'layui-layer-photos' + skin('photos'),
  1258. content: '<div class="layui-layer-phimg">'
  1259. +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
  1260. +'<div class="layui-layer-imgsee">'
  1261. +(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')
  1262. +'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
  1263. +'</div>'
  1264. +'</div>',
  1265. success: function(layero, index){
  1266. dict.bigimg = layero.find('.layui-layer-phimg');
  1267. dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
  1268. dict.event(layero);
  1269. options.tab && options.tab(data[start], layero);
  1270. typeof success === 'function' && success(layero);
  1271. }, end: function(){
  1272. dict.end = true;
  1273. $(document).off('keyup', dict.keyup);
  1274. }
  1275. }, options));
  1276. }, function(){
  1277. layer.close(dict.loadi);
  1278. layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {
  1279. time: 30000,
  1280. btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],
  1281. yes: function(){
  1282. data.length > 1 && dict.imgnext(true,true);
  1283. }
  1284. });
  1285. });
  1286. };
  1287. //主入口
  1288. ready.run = function(_$){
  1289. $ = _$;
  1290. win = $(window);
  1291. doms.html = $('html');
  1292. layer.open = function(deliver){
  1293. var o = new Class(deliver);
  1294. return o.index;
  1295. };
  1296. };
  1297. //加载方式
  1298. window.layui && layui.define ? (
  1299. layer.ready()
  1300. ,layui.define('jquery', function(exports){ //layui加载
  1301. layer.path = layui.cache.dir;
  1302. ready.run(layui.jquery);
  1303. //暴露模块
  1304. window.layer = layer;
  1305. exports('layer', layer);
  1306. })
  1307. ) : (
  1308. (typeof define === 'function' && define.amd) ? define('layer',['jquery'], function(){ //requirejs加载
  1309. ready.run(window.jQuery);
  1310. return layer;
  1311. }) : function(){ //普通script标签加载
  1312. ready.run(window.jQuery);
  1313. layer.ready();
  1314. }()
  1315. );
  1316. }(window);
  1317. /*
  1318. * Toastr
  1319. * Copyright 2012-2015
  1320. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  1321. * All Rights Reserved.
  1322. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  1323. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  1324. *
  1325. * ARIA Support: Greta Krafsig
  1326. *
  1327. * Project: https://github.com/CodeSeven/toastr
  1328. */
  1329. /* global define */
  1330. (function (define) {
  1331. define('toastr',['jquery'], function ($) {
  1332. return (function () {
  1333. var $container;
  1334. var listener;
  1335. var toastId = 0;
  1336. var toastType = {
  1337. error: 'error',
  1338. info: 'info',
  1339. success: 'success',
  1340. warning: 'warning'
  1341. };
  1342. var toastr = {
  1343. clear: clear,
  1344. remove: remove,
  1345. error: error,
  1346. getContainer: getContainer,
  1347. info: info,
  1348. options: {},
  1349. subscribe: subscribe,
  1350. success: success,
  1351. version: '2.1.3',
  1352. warning: warning
  1353. };
  1354. var previousToast;
  1355. return toastr;
  1356. ////////////////
  1357. function error(message, title, optionsOverride) {
  1358. return notify({
  1359. type: toastType.error,
  1360. iconClass: getOptions().iconClasses.error,
  1361. message: message,
  1362. optionsOverride: optionsOverride,
  1363. title: title
  1364. });
  1365. }
  1366. function getContainer(options, create) {
  1367. if (!options) { options = getOptions(); }
  1368. $container = $('#' + options.containerId);
  1369. if ($container.length) {
  1370. return $container;
  1371. }
  1372. if (create) {
  1373. $container = createContainer(options);
  1374. }
  1375. return $container;
  1376. }
  1377. function info(message, title, optionsOverride) {
  1378. return notify({
  1379. type: toastType.info,
  1380. iconClass: getOptions().iconClasses.info,
  1381. message: message,
  1382. optionsOverride: optionsOverride,
  1383. title: title
  1384. });
  1385. }
  1386. function subscribe(callback) {
  1387. listener = callback;
  1388. }
  1389. function success(message, title, optionsOverride) {
  1390. return notify({
  1391. type: toastType.success,
  1392. iconClass: getOptions().iconClasses.success,
  1393. message: message,
  1394. optionsOverride: optionsOverride,
  1395. title: title
  1396. });
  1397. }
  1398. function warning(message, title, optionsOverride) {
  1399. return notify({
  1400. type: toastType.warning,
  1401. iconClass: getOptions().iconClasses.warning,
  1402. message: message,
  1403. optionsOverride: optionsOverride,
  1404. title: title
  1405. });
  1406. }
  1407. function clear($toastElement, clearOptions) {
  1408. var options = getOptions();
  1409. if (!$container) { getContainer(options); }
  1410. if (!clearToast($toastElement, options, clearOptions)) {
  1411. clearContainer(options);
  1412. }
  1413. }
  1414. function remove($toastElement) {
  1415. var options = getOptions();
  1416. if (!$container) { getContainer(options); }
  1417. if ($toastElement && $(':focus', $toastElement).length === 0) {
  1418. removeToast($toastElement);
  1419. return;
  1420. }
  1421. if ($container.children().length) {
  1422. $container.remove();
  1423. }
  1424. }
  1425. // internal functions
  1426. function clearContainer (options) {
  1427. var toastsToClear = $container.children();
  1428. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  1429. clearToast($(toastsToClear[i]), options);
  1430. }
  1431. }
  1432. function clearToast ($toastElement, options, clearOptions) {
  1433. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  1434. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  1435. $toastElement[options.hideMethod]({
  1436. duration: options.hideDuration,
  1437. easing: options.hideEasing,
  1438. complete: function () { removeToast($toastElement); }
  1439. });
  1440. return true;
  1441. }
  1442. return false;
  1443. }
  1444. function createContainer(options) {
  1445. $container = $('<div/>')
  1446. .attr('id', options.containerId)
  1447. .addClass(options.positionClass);
  1448. $container.appendTo($(options.target));
  1449. return $container;
  1450. }
  1451. function getDefaults() {
  1452. return {
  1453. tapToDismiss: true,
  1454. toastClass: 'toast',
  1455. containerId: 'toast-container',
  1456. debug: false,
  1457. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  1458. showDuration: 300,
  1459. showEasing: 'swing', //swing and linear are built into jQuery
  1460. onShown: undefined,
  1461. hideMethod: 'fadeOut',
  1462. hideDuration: 1000,
  1463. hideEasing: 'swing',
  1464. onHidden: undefined,
  1465. closeMethod: false,
  1466. closeDuration: false,
  1467. closeEasing: false,
  1468. closeOnHover: true,
  1469. extendedTimeOut: 1000,
  1470. iconClasses: {
  1471. error: 'toast-error',
  1472. info: 'toast-info',
  1473. success: 'toast-success',
  1474. warning: 'toast-warning'
  1475. },
  1476. iconClass: 'toast-info',
  1477. positionClass: 'toast-top-right',
  1478. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  1479. titleClass: 'toast-title',
  1480. messageClass: 'toast-message',
  1481. escapeHtml: false,
  1482. target: 'body',
  1483. closeHtml: '<button type="button">&times;</button>',
  1484. closeClass: 'toast-close-button',
  1485. newestOnTop: true,
  1486. preventDuplicates: false,
  1487. progressBar: false,
  1488. progressClass: 'toast-progress',
  1489. rtl: false
  1490. };
  1491. }
  1492. function publish(args) {
  1493. if (!listener) { return; }
  1494. listener(args);
  1495. }
  1496. function notify(map) {
  1497. var options = getOptions();
  1498. var iconClass = map.iconClass || options.iconClass;
  1499. if (typeof (map.optionsOverride) !== 'undefined') {
  1500. options = $.extend(options, map.optionsOverride);
  1501. iconClass = map.optionsOverride.iconClass || iconClass;
  1502. }
  1503. if (shouldExit(options, map)) { return; }
  1504. toastId++;
  1505. $container = getContainer(options, true);
  1506. var intervalId = null;
  1507. var $toastElement = $('<div/>');
  1508. var $titleElement = $('<div/>');
  1509. var $messageElement = $('<div/>');
  1510. var $progressElement = $('<div/>');
  1511. var $closeElement = $(options.closeHtml);
  1512. var progressBar = {
  1513. intervalId: null,
  1514. hideEta: null,
  1515. maxHideTime: null
  1516. };
  1517. var response = {
  1518. toastId: toastId,
  1519. state: 'visible',
  1520. startTime: new Date(),
  1521. options: options,
  1522. map: map
  1523. };
  1524. personalizeToast();
  1525. displayToast();
  1526. handleEvents();
  1527. publish(response);
  1528. if (options.debug && console) {
  1529. console.log(response);
  1530. }
  1531. return $toastElement;
  1532. function escapeHtml(source) {
  1533. if (source == null) {
  1534. source = '';
  1535. }
  1536. return source
  1537. .replace(/&/g, '&amp;')
  1538. .replace(/"/g, '&quot;')
  1539. .replace(/'/g, '&#39;')
  1540. .replace(/</g, '&lt;')
  1541. .replace(/>/g, '&gt;');
  1542. }
  1543. function personalizeToast() {
  1544. setIcon();
  1545. setTitle();
  1546. setMessage();
  1547. setCloseButton();
  1548. setProgressBar();
  1549. setRTL();
  1550. setSequence();
  1551. setAria();
  1552. }
  1553. function setAria() {
  1554. var ariaValue = '';
  1555. switch (map.iconClass) {
  1556. case 'toast-success':
  1557. case 'toast-info':
  1558. ariaValue = 'polite';
  1559. break;
  1560. default:
  1561. ariaValue = 'assertive';
  1562. }
  1563. $toastElement.attr('aria-live', ariaValue);
  1564. }
  1565. function handleEvents() {
  1566. if (options.closeOnHover) {
  1567. $toastElement.hover(stickAround, delayedHideToast);
  1568. }
  1569. if (!options.onclick && options.tapToDismiss) {
  1570. $toastElement.click(hideToast);
  1571. }
  1572. if (options.closeButton && $closeElement) {
  1573. $closeElement.click(function (event) {
  1574. if (event.stopPropagation) {
  1575. event.stopPropagation();
  1576. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  1577. event.cancelBubble = true;
  1578. }
  1579. if (options.onCloseClick) {
  1580. options.onCloseClick(event);
  1581. }
  1582. hideToast(true);
  1583. });
  1584. }
  1585. if (options.onclick) {
  1586. $toastElement.click(function (event) {
  1587. options.onclick(event);
  1588. hideToast();
  1589. });
  1590. }
  1591. }
  1592. function displayToast() {
  1593. $toastElement.hide();
  1594. $toastElement[options.showMethod](
  1595. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  1596. );
  1597. if (options.timeOut > 0) {
  1598. intervalId = setTimeout(hideToast, options.timeOut);
  1599. progressBar.maxHideTime = parseFloat(options.timeOut);
  1600. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  1601. if (options.progressBar) {
  1602. progressBar.intervalId = setInterval(updateProgress, 10);
  1603. }
  1604. }
  1605. }
  1606. function setIcon() {
  1607. if (map.iconClass) {
  1608. $toastElement.addClass(options.toastClass).addClass(iconClass);
  1609. }
  1610. }
  1611. function setSequence() {
  1612. if (options.newestOnTop) {
  1613. $container.prepend($toastElement);
  1614. } else {
  1615. $container.append($toastElement);
  1616. }
  1617. }
  1618. function setTitle() {
  1619. if (map.title) {
  1620. var suffix = map.title;
  1621. if (options.escapeHtml) {
  1622. suffix = escapeHtml(map.title);
  1623. }
  1624. $titleElement.append(suffix).addClass(options.titleClass);
  1625. $toastElement.append($titleElement);
  1626. }
  1627. }
  1628. function setMessage() {
  1629. if (map.message) {
  1630. var suffix = map.message;
  1631. if (options.escapeHtml) {
  1632. suffix = escapeHtml(map.message);
  1633. }
  1634. $messageElement.append(suffix).addClass(options.messageClass);
  1635. $toastElement.append($messageElement);
  1636. }
  1637. }
  1638. function setCloseButton() {
  1639. if (options.closeButton) {
  1640. $closeElement.addClass(options.closeClass).attr('role', 'button');
  1641. $toastElement.prepend($closeElement);
  1642. }
  1643. }
  1644. function setProgressBar() {
  1645. if (options.progressBar) {
  1646. $progressElement.addClass(options.progressClass);
  1647. $toastElement.prepend($progressElement);
  1648. }
  1649. }
  1650. function setRTL() {
  1651. if (options.rtl) {
  1652. $toastElement.addClass('rtl');
  1653. }
  1654. }
  1655. function shouldExit(options, map) {
  1656. if (options.preventDuplicates) {
  1657. if (map.message === previousToast) {
  1658. return true;
  1659. } else {
  1660. previousToast = map.message;
  1661. }
  1662. }
  1663. return false;
  1664. }
  1665. function hideToast(override) {
  1666. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  1667. var duration = override && options.closeDuration !== false ?
  1668. options.closeDuration : options.hideDuration;
  1669. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  1670. if ($(':focus', $toastElement).length && !override) {
  1671. return;
  1672. }
  1673. clearTimeout(progressBar.intervalId);
  1674. return $toastElement[method]({
  1675. duration: duration,
  1676. easing: easing,
  1677. complete: function () {
  1678. removeToast($toastElement);
  1679. clearTimeout(intervalId);
  1680. if (options.onHidden && response.state !== 'hidden') {
  1681. options.onHidden();
  1682. }
  1683. response.state = 'hidden';
  1684. response.endTime = new Date();
  1685. publish(response);
  1686. }
  1687. });
  1688. }
  1689. function delayedHideToast() {
  1690. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  1691. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  1692. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  1693. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  1694. }
  1695. }
  1696. function stickAround() {
  1697. clearTimeout(intervalId);
  1698. progressBar.hideEta = 0;
  1699. $toastElement.stop(true, true)[options.showMethod](
  1700. {duration: options.showDuration, easing: options.showEasing}
  1701. );
  1702. }
  1703. function updateProgress() {
  1704. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  1705. $progressElement.width(percentage + '%');
  1706. }
  1707. }
  1708. function getOptions() {
  1709. return $.extend({}, getDefaults(), toastr.options);
  1710. }
  1711. function removeToast($toastElement) {
  1712. if (!$container) { $container = getContainer(); }
  1713. if ($toastElement.is(':visible')) {
  1714. return;
  1715. }
  1716. $toastElement.remove();
  1717. $toastElement = null;
  1718. if ($container.children().length === 0) {
  1719. $container.remove();
  1720. previousToast = undefined;
  1721. }
  1722. }
  1723. })();
  1724. });
  1725. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  1726. if (typeof module !== 'undefined' && module.exports) { //Node
  1727. module.exports = factory(require('jquery'));
  1728. } else {
  1729. window.toastr = factory(window.jQuery);
  1730. }
  1731. }));
  1732. //! moment.js
  1733. //! version : 2.18.1
  1734. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  1735. //! license : MIT
  1736. //! momentjs.com
  1737. ;(function (global, factory) {
  1738. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  1739. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  1740. global.moment = factory()
  1741. }(this, (function () { 'use strict';
  1742. var hookCallback;
  1743. function hooks () {
  1744. return hookCallback.apply(null, arguments);
  1745. }
  1746. // This is done to register the method called with moment()
  1747. // without creating circular dependencies.
  1748. function setHookCallback (callback) {
  1749. hookCallback = callback;
  1750. }
  1751. function isArray(input) {
  1752. return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
  1753. }
  1754. function isObject(input) {
  1755. // IE8 will treat undefined and null as object if it wasn't for
  1756. // input != null
  1757. return input != null && Object.prototype.toString.call(input) === '[object Object]';
  1758. }
  1759. function isObjectEmpty(obj) {
  1760. var k;
  1761. for (k in obj) {
  1762. // even if its not own property I'd still call it non-empty
  1763. return false;
  1764. }
  1765. return true;
  1766. }
  1767. function isUndefined(input) {
  1768. return input === void 0;
  1769. }
  1770. function isNumber(input) {
  1771. return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
  1772. }
  1773. function isDate(input) {
  1774. return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
  1775. }
  1776. function map(arr, fn) {
  1777. var res = [], i;
  1778. for (i = 0; i < arr.length; ++i) {
  1779. res.push(fn(arr[i], i));
  1780. }
  1781. return res;
  1782. }
  1783. function hasOwnProp(a, b) {
  1784. return Object.prototype.hasOwnProperty.call(a, b);
  1785. }
  1786. function extend(a, b) {
  1787. for (var i in b) {
  1788. if (hasOwnProp(b, i)) {
  1789. a[i] = b[i];
  1790. }
  1791. }
  1792. if (hasOwnProp(b, 'toString')) {
  1793. a.toString = b.toString;
  1794. }
  1795. if (hasOwnProp(b, 'valueOf')) {
  1796. a.valueOf = b.valueOf;
  1797. }
  1798. return a;
  1799. }
  1800. function createUTC (input, format, locale, strict) {
  1801. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1802. }
  1803. function defaultParsingFlags() {
  1804. // We need to deep clone this object.
  1805. return {
  1806. empty : false,
  1807. unusedTokens : [],
  1808. unusedInput : [],
  1809. overflow : -2,
  1810. charsLeftOver : 0,
  1811. nullInput : false,
  1812. invalidMonth : null,
  1813. invalidFormat : false,
  1814. userInvalidated : false,
  1815. iso : false,
  1816. parsedDateParts : [],
  1817. meridiem : null,
  1818. rfc2822 : false,
  1819. weekdayMismatch : false
  1820. };
  1821. }
  1822. function getParsingFlags(m) {
  1823. if (m._pf == null) {
  1824. m._pf = defaultParsingFlags();
  1825. }
  1826. return m._pf;
  1827. }
  1828. var some;
  1829. if (Array.prototype.some) {
  1830. some = Array.prototype.some;
  1831. } else {
  1832. some = function (fun) {
  1833. var t = Object(this);
  1834. var len = t.length >>> 0;
  1835. for (var i = 0; i < len; i++) {
  1836. if (i in t && fun.call(this, t[i], i, t)) {
  1837. return true;
  1838. }
  1839. }
  1840. return false;
  1841. };
  1842. }
  1843. var some$1 = some;
  1844. function isValid(m) {
  1845. if (m._isValid == null) {
  1846. var flags = getParsingFlags(m);
  1847. var parsedParts = some$1.call(flags.parsedDateParts, function (i) {
  1848. return i != null;
  1849. });
  1850. var isNowValid = !isNaN(m._d.getTime()) &&
  1851. flags.overflow < 0 &&
  1852. !flags.empty &&
  1853. !flags.invalidMonth &&
  1854. !flags.invalidWeekday &&
  1855. !flags.nullInput &&
  1856. !flags.invalidFormat &&
  1857. !flags.userInvalidated &&
  1858. (!flags.meridiem || (flags.meridiem && parsedParts));
  1859. if (m._strict) {
  1860. isNowValid = isNowValid &&
  1861. flags.charsLeftOver === 0 &&
  1862. flags.unusedTokens.length === 0 &&
  1863. flags.bigHour === undefined;
  1864. }
  1865. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1866. m._isValid = isNowValid;
  1867. }
  1868. else {
  1869. return isNowValid;
  1870. }
  1871. }
  1872. return m._isValid;
  1873. }
  1874. function createInvalid (flags) {
  1875. var m = createUTC(NaN);
  1876. if (flags != null) {
  1877. extend(getParsingFlags(m), flags);
  1878. }
  1879. else {
  1880. getParsingFlags(m).userInvalidated = true;
  1881. }
  1882. return m;
  1883. }
  1884. // Plugins that add properties should also add the key here (null value),
  1885. // so we can properly clone ourselves.
  1886. var momentProperties = hooks.momentProperties = [];
  1887. function copyConfig(to, from) {
  1888. var i, prop, val;
  1889. if (!isUndefined(from._isAMomentObject)) {
  1890. to._isAMomentObject = from._isAMomentObject;
  1891. }
  1892. if (!isUndefined(from._i)) {
  1893. to._i = from._i;
  1894. }
  1895. if (!isUndefined(from._f)) {
  1896. to._f = from._f;
  1897. }
  1898. if (!isUndefined(from._l)) {
  1899. to._l = from._l;
  1900. }
  1901. if (!isUndefined(from._strict)) {
  1902. to._strict = from._strict;
  1903. }
  1904. if (!isUndefined(from._tzm)) {
  1905. to._tzm = from._tzm;
  1906. }
  1907. if (!isUndefined(from._isUTC)) {
  1908. to._isUTC = from._isUTC;
  1909. }
  1910. if (!isUndefined(from._offset)) {
  1911. to._offset = from._offset;
  1912. }
  1913. if (!isUndefined(from._pf)) {
  1914. to._pf = getParsingFlags(from);
  1915. }
  1916. if (!isUndefined(from._locale)) {
  1917. to._locale = from._locale;
  1918. }
  1919. if (momentProperties.length > 0) {
  1920. for (i = 0; i < momentProperties.length; i++) {
  1921. prop = momentProperties[i];
  1922. val = from[prop];
  1923. if (!isUndefined(val)) {
  1924. to[prop] = val;
  1925. }
  1926. }
  1927. }
  1928. return to;
  1929. }
  1930. var updateInProgress = false;
  1931. // Moment prototype object
  1932. function Moment(config) {
  1933. copyConfig(this, config);
  1934. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1935. if (!this.isValid()) {
  1936. this._d = new Date(NaN);
  1937. }
  1938. // Prevent infinite loop in case updateOffset creates new moment
  1939. // objects.
  1940. if (updateInProgress === false) {
  1941. updateInProgress = true;
  1942. hooks.updateOffset(this);
  1943. updateInProgress = false;
  1944. }
  1945. }
  1946. function isMoment (obj) {
  1947. return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
  1948. }
  1949. function absFloor (number) {
  1950. if (number < 0) {
  1951. // -0 -> 0
  1952. return Math.ceil(number) || 0;
  1953. } else {
  1954. return Math.floor(number);
  1955. }
  1956. }
  1957. function toInt(argumentForCoercion) {
  1958. var coercedNumber = +argumentForCoercion,
  1959. value = 0;
  1960. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1961. value = absFloor(coercedNumber);
  1962. }
  1963. return value;
  1964. }
  1965. // compare two arrays, return the number of differences
  1966. function compareArrays(array1, array2, dontConvert) {
  1967. var len = Math.min(array1.length, array2.length),
  1968. lengthDiff = Math.abs(array1.length - array2.length),
  1969. diffs = 0,
  1970. i;
  1971. for (i = 0; i < len; i++) {
  1972. if ((dontConvert && array1[i] !== array2[i]) ||
  1973. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
  1974. diffs++;
  1975. }
  1976. }
  1977. return diffs + lengthDiff;
  1978. }
  1979. function warn(msg) {
  1980. if (hooks.suppressDeprecationWarnings === false &&
  1981. (typeof console !== 'undefined') && console.warn) {
  1982. console.warn('Deprecation warning: ' + msg);
  1983. }
  1984. }
  1985. function deprecate(msg, fn) {
  1986. var firstTime = true;
  1987. return extend(function () {
  1988. if (hooks.deprecationHandler != null) {
  1989. hooks.deprecationHandler(null, msg);
  1990. }
  1991. if (firstTime) {
  1992. var args = [];
  1993. var arg;
  1994. for (var i = 0; i < arguments.length; i++) {
  1995. arg = '';
  1996. if (typeof arguments[i] === 'object') {
  1997. arg += '\n[' + i + '] ';
  1998. for (var key in arguments[0]) {
  1999. arg += key + ': ' + arguments[0][key] + ', ';
  2000. }
  2001. arg = arg.slice(0, -2); // Remove trailing comma and space
  2002. } else {
  2003. arg = arguments[i];
  2004. }
  2005. args.push(arg);
  2006. }
  2007. warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
  2008. firstTime = false;
  2009. }
  2010. return fn.apply(this, arguments);
  2011. }, fn);
  2012. }
  2013. var deprecations = {};
  2014. function deprecateSimple(name, msg) {
  2015. if (hooks.deprecationHandler != null) {
  2016. hooks.deprecationHandler(name, msg);
  2017. }
  2018. if (!deprecations[name]) {
  2019. warn(msg);
  2020. deprecations[name] = true;
  2021. }
  2022. }
  2023. hooks.suppressDeprecationWarnings = false;
  2024. hooks.deprecationHandler = null;
  2025. function isFunction(input) {
  2026. return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
  2027. }
  2028. function set (config) {
  2029. var prop, i;
  2030. for (i in config) {
  2031. prop = config[i];
  2032. if (isFunction(prop)) {
  2033. this[i] = prop;
  2034. } else {
  2035. this['_' + i] = prop;
  2036. }
  2037. }
  2038. this._config = config;
  2039. // Lenient ordinal parsing accepts just a number in addition to
  2040. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  2041. // TODO: Remove "ordinalParse" fallback in next major release.
  2042. this._dayOfMonthOrdinalParseLenient = new RegExp(
  2043. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  2044. '|' + (/\d{1,2}/).source);
  2045. }
  2046. function mergeConfigs(parentConfig, childConfig) {
  2047. var res = extend({}, parentConfig), prop;
  2048. for (prop in childConfig) {
  2049. if (hasOwnProp(childConfig, prop)) {
  2050. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  2051. res[prop] = {};
  2052. extend(res[prop], parentConfig[prop]);
  2053. extend(res[prop], childConfig[prop]);
  2054. } else if (childConfig[prop] != null) {
  2055. res[prop] = childConfig[prop];
  2056. } else {
  2057. delete res[prop];
  2058. }
  2059. }
  2060. }
  2061. for (prop in parentConfig) {
  2062. if (hasOwnProp(parentConfig, prop) &&
  2063. !hasOwnProp(childConfig, prop) &&
  2064. isObject(parentConfig[prop])) {
  2065. // make sure changes to properties don't modify parent config
  2066. res[prop] = extend({}, res[prop]);
  2067. }
  2068. }
  2069. return res;
  2070. }
  2071. function Locale(config) {
  2072. if (config != null) {
  2073. this.set(config);
  2074. }
  2075. }
  2076. var keys;
  2077. if (Object.keys) {
  2078. keys = Object.keys;
  2079. } else {
  2080. keys = function (obj) {
  2081. var i, res = [];
  2082. for (i in obj) {
  2083. if (hasOwnProp(obj, i)) {
  2084. res.push(i);
  2085. }
  2086. }
  2087. return res;
  2088. };
  2089. }
  2090. var keys$1 = keys;
  2091. var defaultCalendar = {
  2092. sameDay : '[Today at] LT',
  2093. nextDay : '[Tomorrow at] LT',
  2094. nextWeek : 'dddd [at] LT',
  2095. lastDay : '[Yesterday at] LT',
  2096. lastWeek : '[Last] dddd [at] LT',
  2097. sameElse : 'L'
  2098. };
  2099. function calendar (key, mom, now) {
  2100. var output = this._calendar[key] || this._calendar['sameElse'];
  2101. return isFunction(output) ? output.call(mom, now) : output;
  2102. }
  2103. var defaultLongDateFormat = {
  2104. LTS : 'h:mm:ss A',
  2105. LT : 'h:mm A',
  2106. L : 'MM/DD/YYYY',
  2107. LL : 'MMMM D, YYYY',
  2108. LLL : 'MMMM D, YYYY h:mm A',
  2109. LLLL : 'dddd, MMMM D, YYYY h:mm A'
  2110. };
  2111. function longDateFormat (key) {
  2112. var format = this._longDateFormat[key],
  2113. formatUpper = this._longDateFormat[key.toUpperCase()];
  2114. if (format || !formatUpper) {
  2115. return format;
  2116. }
  2117. this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
  2118. return val.slice(1);
  2119. });
  2120. return this._longDateFormat[key];
  2121. }
  2122. var defaultInvalidDate = 'Invalid date';
  2123. function invalidDate () {
  2124. return this._invalidDate;
  2125. }
  2126. var defaultOrdinal = '%d';
  2127. var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  2128. function ordinal (number) {
  2129. return this._ordinal.replace('%d', number);
  2130. }
  2131. var defaultRelativeTime = {
  2132. future : 'in %s',
  2133. past : '%s ago',
  2134. s : 'a few seconds',
  2135. ss : '%d seconds',
  2136. m : 'a minute',
  2137. mm : '%d minutes',
  2138. h : 'an hour',
  2139. hh : '%d hours',
  2140. d : 'a day',
  2141. dd : '%d days',
  2142. M : 'a month',
  2143. MM : '%d months',
  2144. y : 'a year',
  2145. yy : '%d years'
  2146. };
  2147. function relativeTime (number, withoutSuffix, string, isFuture) {
  2148. var output = this._relativeTime[string];
  2149. return (isFunction(output)) ?
  2150. output(number, withoutSuffix, string, isFuture) :
  2151. output.replace(/%d/i, number);
  2152. }
  2153. function pastFuture (diff, output) {
  2154. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  2155. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  2156. }
  2157. var aliases = {};
  2158. function addUnitAlias (unit, shorthand) {
  2159. var lowerCase = unit.toLowerCase();
  2160. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  2161. }
  2162. function normalizeUnits(units) {
  2163. return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
  2164. }
  2165. function normalizeObjectUnits(inputObject) {
  2166. var normalizedInput = {},
  2167. normalizedProp,
  2168. prop;
  2169. for (prop in inputObject) {
  2170. if (hasOwnProp(inputObject, prop)) {
  2171. normalizedProp = normalizeUnits(prop);
  2172. if (normalizedProp) {
  2173. normalizedInput[normalizedProp] = inputObject[prop];
  2174. }
  2175. }
  2176. }
  2177. return normalizedInput;
  2178. }
  2179. var priorities = {};
  2180. function addUnitPriority(unit, priority) {
  2181. priorities[unit] = priority;
  2182. }
  2183. function getPrioritizedUnits(unitsObj) {
  2184. var units = [];
  2185. for (var u in unitsObj) {
  2186. units.push({unit: u, priority: priorities[u]});
  2187. }
  2188. units.sort(function (a, b) {
  2189. return a.priority - b.priority;
  2190. });
  2191. return units;
  2192. }
  2193. function makeGetSet (unit, keepTime) {
  2194. return function (value) {
  2195. if (value != null) {
  2196. set$1(this, unit, value);
  2197. hooks.updateOffset(this, keepTime);
  2198. return this;
  2199. } else {
  2200. return get(this, unit);
  2201. }
  2202. };
  2203. }
  2204. function get (mom, unit) {
  2205. return mom.isValid() ?
  2206. mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
  2207. }
  2208. function set$1 (mom, unit, value) {
  2209. if (mom.isValid()) {
  2210. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  2211. }
  2212. }
  2213. // MOMENTS
  2214. function stringGet (units) {
  2215. units = normalizeUnits(units);
  2216. if (isFunction(this[units])) {
  2217. return this[units]();
  2218. }
  2219. return this;
  2220. }
  2221. function stringSet (units, value) {
  2222. if (typeof units === 'object') {
  2223. units = normalizeObjectUnits(units);
  2224. var prioritized = getPrioritizedUnits(units);
  2225. for (var i = 0; i < prioritized.length; i++) {
  2226. this[prioritized[i].unit](units[prioritized[i].unit]);
  2227. }
  2228. } else {
  2229. units = normalizeUnits(units);
  2230. if (isFunction(this[units])) {
  2231. return this[units](value);
  2232. }
  2233. }
  2234. return this;
  2235. }
  2236. function zeroFill(number, targetLength, forceSign) {
  2237. var absNumber = '' + Math.abs(number),
  2238. zerosToFill = targetLength - absNumber.length,
  2239. sign = number >= 0;
  2240. return (sign ? (forceSign ? '+' : '') : '-') +
  2241. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  2242. }
  2243. var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
  2244. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  2245. var formatFunctions = {};
  2246. var formatTokenFunctions = {};
  2247. // token: 'M'
  2248. // padded: ['MM', 2]
  2249. // ordinal: 'Mo'
  2250. // callback: function () { this.month() + 1 }
  2251. function addFormatToken (token, padded, ordinal, callback) {
  2252. var func = callback;
  2253. if (typeof callback === 'string') {
  2254. func = function () {
  2255. return this[callback]();
  2256. };
  2257. }
  2258. if (token) {
  2259. formatTokenFunctions[token] = func;
  2260. }
  2261. if (padded) {
  2262. formatTokenFunctions[padded[0]] = function () {
  2263. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  2264. };
  2265. }
  2266. if (ordinal) {
  2267. formatTokenFunctions[ordinal] = function () {
  2268. return this.localeData().ordinal(func.apply(this, arguments), token);
  2269. };
  2270. }
  2271. }
  2272. function removeFormattingTokens(input) {
  2273. if (input.match(/\[[\s\S]/)) {
  2274. return input.replace(/^\[|\]$/g, '');
  2275. }
  2276. return input.replace(/\\/g, '');
  2277. }
  2278. function makeFormatFunction(format) {
  2279. var array = format.match(formattingTokens), i, length;
  2280. for (i = 0, length = array.length; i < length; i++) {
  2281. if (formatTokenFunctions[array[i]]) {
  2282. array[i] = formatTokenFunctions[array[i]];
  2283. } else {
  2284. array[i] = removeFormattingTokens(array[i]);
  2285. }
  2286. }
  2287. return function (mom) {
  2288. var output = '', i;
  2289. for (i = 0; i < length; i++) {
  2290. output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
  2291. }
  2292. return output;
  2293. };
  2294. }
  2295. // format date using native date object
  2296. function formatMoment(m, format) {
  2297. if (!m.isValid()) {
  2298. return m.localeData().invalidDate();
  2299. }
  2300. format = expandFormat(format, m.localeData());
  2301. formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
  2302. return formatFunctions[format](m);
  2303. }
  2304. function expandFormat(format, locale) {
  2305. var i = 5;
  2306. function replaceLongDateFormatTokens(input) {
  2307. return locale.longDateFormat(input) || input;
  2308. }
  2309. localFormattingTokens.lastIndex = 0;
  2310. while (i >= 0 && localFormattingTokens.test(format)) {
  2311. format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
  2312. localFormattingTokens.lastIndex = 0;
  2313. i -= 1;
  2314. }
  2315. return format;
  2316. }
  2317. var match1 = /\d/; // 0 - 9
  2318. var match2 = /\d\d/; // 00 - 99
  2319. var match3 = /\d{3}/; // 000 - 999
  2320. var match4 = /\d{4}/; // 0000 - 9999
  2321. var match6 = /[+-]?\d{6}/; // -999999 - 999999
  2322. var match1to2 = /\d\d?/; // 0 - 99
  2323. var match3to4 = /\d\d\d\d?/; // 999 - 9999
  2324. var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
  2325. var match1to3 = /\d{1,3}/; // 0 - 999
  2326. var match1to4 = /\d{1,4}/; // 0 - 9999
  2327. var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
  2328. var matchUnsigned = /\d+/; // 0 - inf
  2329. var matchSigned = /[+-]?\d+/; // -inf - inf
  2330. var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
  2331. var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  2332. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  2333. // any word (or two) characters or numbers including two/three word month in arabic.
  2334. // includes scottish gaelic two word and hyphenated months
  2335. var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
  2336. var regexes = {};
  2337. function addRegexToken (token, regex, strictRegex) {
  2338. regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
  2339. return (isStrict && strictRegex) ? strictRegex : regex;
  2340. };
  2341. }
  2342. function getParseRegexForToken (token, config) {
  2343. if (!hasOwnProp(regexes, token)) {
  2344. return new RegExp(unescapeFormat(token));
  2345. }
  2346. return regexes[token](config._strict, config._locale);
  2347. }
  2348. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  2349. function unescapeFormat(s) {
  2350. return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
  2351. return p1 || p2 || p3 || p4;
  2352. }));
  2353. }
  2354. function regexEscape(s) {
  2355. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  2356. }
  2357. var tokens = {};
  2358. function addParseToken (token, callback) {
  2359. var i, func = callback;
  2360. if (typeof token === 'string') {
  2361. token = [token];
  2362. }
  2363. if (isNumber(callback)) {
  2364. func = function (input, array) {
  2365. array[callback] = toInt(input);
  2366. };
  2367. }
  2368. for (i = 0; i < token.length; i++) {
  2369. tokens[token[i]] = func;
  2370. }
  2371. }
  2372. function addWeekParseToken (token, callback) {
  2373. addParseToken(token, function (input, array, config, token) {
  2374. config._w = config._w || {};
  2375. callback(input, config._w, config, token);
  2376. });
  2377. }
  2378. function addTimeToArrayFromToken(token, input, config) {
  2379. if (input != null && hasOwnProp(tokens, token)) {
  2380. tokens[token](input, config._a, config, token);
  2381. }
  2382. }
  2383. var YEAR = 0;
  2384. var MONTH = 1;
  2385. var DATE = 2;
  2386. var HOUR = 3;
  2387. var MINUTE = 4;
  2388. var SECOND = 5;
  2389. var MILLISECOND = 6;
  2390. var WEEK = 7;
  2391. var WEEKDAY = 8;
  2392. var indexOf;
  2393. if (Array.prototype.indexOf) {
  2394. indexOf = Array.prototype.indexOf;
  2395. } else {
  2396. indexOf = function (o) {
  2397. // I know
  2398. var i;
  2399. for (i = 0; i < this.length; ++i) {
  2400. if (this[i] === o) {
  2401. return i;
  2402. }
  2403. }
  2404. return -1;
  2405. };
  2406. }
  2407. var indexOf$1 = indexOf;
  2408. function daysInMonth(year, month) {
  2409. return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
  2410. }
  2411. // FORMATTING
  2412. addFormatToken('M', ['MM', 2], 'Mo', function () {
  2413. return this.month() + 1;
  2414. });
  2415. addFormatToken('MMM', 0, 0, function (format) {
  2416. return this.localeData().monthsShort(this, format);
  2417. });
  2418. addFormatToken('MMMM', 0, 0, function (format) {
  2419. return this.localeData().months(this, format);
  2420. });
  2421. // ALIASES
  2422. addUnitAlias('month', 'M');
  2423. // PRIORITY
  2424. addUnitPriority('month', 8);
  2425. // PARSING
  2426. addRegexToken('M', match1to2);
  2427. addRegexToken('MM', match1to2, match2);
  2428. addRegexToken('MMM', function (isStrict, locale) {
  2429. return locale.monthsShortRegex(isStrict);
  2430. });
  2431. addRegexToken('MMMM', function (isStrict, locale) {
  2432. return locale.monthsRegex(isStrict);
  2433. });
  2434. addParseToken(['M', 'MM'], function (input, array) {
  2435. array[MONTH] = toInt(input) - 1;
  2436. });
  2437. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  2438. var month = config._locale.monthsParse(input, token, config._strict);
  2439. // if we didn't find a month name, mark the date as invalid.
  2440. if (month != null) {
  2441. array[MONTH] = month;
  2442. } else {
  2443. getParsingFlags(config).invalidMonth = input;
  2444. }
  2445. });
  2446. // LOCALES
  2447. var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
  2448. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
  2449. function localeMonths (m, format) {
  2450. if (!m) {
  2451. return isArray(this._months) ? this._months :
  2452. this._months['standalone'];
  2453. }
  2454. return isArray(this._months) ? this._months[m.month()] :
  2455. this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
  2456. }
  2457. var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
  2458. function localeMonthsShort (m, format) {
  2459. if (!m) {
  2460. return isArray(this._monthsShort) ? this._monthsShort :
  2461. this._monthsShort['standalone'];
  2462. }
  2463. return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
  2464. this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
  2465. }
  2466. function handleStrictParse(monthName, format, strict) {
  2467. var i, ii, mom, llc = monthName.toLocaleLowerCase();
  2468. if (!this._monthsParse) {
  2469. // this is not used
  2470. this._monthsParse = [];
  2471. this._longMonthsParse = [];
  2472. this._shortMonthsParse = [];
  2473. for (i = 0; i < 12; ++i) {
  2474. mom = createUTC([2000, i]);
  2475. this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
  2476. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  2477. }
  2478. }
  2479. if (strict) {
  2480. if (format === 'MMM') {
  2481. ii = indexOf$1.call(this._shortMonthsParse, llc);
  2482. return ii !== -1 ? ii : null;
  2483. } else {
  2484. ii = indexOf$1.call(this._longMonthsParse, llc);
  2485. return ii !== -1 ? ii : null;
  2486. }
  2487. } else {
  2488. if (format === 'MMM') {
  2489. ii = indexOf$1.call(this._shortMonthsParse, llc);
  2490. if (ii !== -1) {
  2491. return ii;
  2492. }
  2493. ii = indexOf$1.call(this._longMonthsParse, llc);
  2494. return ii !== -1 ? ii : null;
  2495. } else {
  2496. ii = indexOf$1.call(this._longMonthsParse, llc);
  2497. if (ii !== -1) {
  2498. return ii;
  2499. }
  2500. ii = indexOf$1.call(this._shortMonthsParse, llc);
  2501. return ii !== -1 ? ii : null;
  2502. }
  2503. }
  2504. }
  2505. function localeMonthsParse (monthName, format, strict) {
  2506. var i, mom, regex;
  2507. if (this._monthsParseExact) {
  2508. return handleStrictParse.call(this, monthName, format, strict);
  2509. }
  2510. if (!this._monthsParse) {
  2511. this._monthsParse = [];
  2512. this._longMonthsParse = [];
  2513. this._shortMonthsParse = [];
  2514. }
  2515. // TODO: add sorting
  2516. // Sorting makes sure if one month (or abbr) is a prefix of another
  2517. // see sorting in computeMonthsParse
  2518. for (i = 0; i < 12; i++) {
  2519. // make the regex if we don't have it already
  2520. mom = createUTC([2000, i]);
  2521. if (strict && !this._longMonthsParse[i]) {
  2522. this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
  2523. this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
  2524. }
  2525. if (!strict && !this._monthsParse[i]) {
  2526. regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  2527. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2528. }
  2529. // test the regex
  2530. if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
  2531. return i;
  2532. } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
  2533. return i;
  2534. } else if (!strict && this._monthsParse[i].test(monthName)) {
  2535. return i;
  2536. }
  2537. }
  2538. }
  2539. // MOMENTS
  2540. function setMonth (mom, value) {
  2541. var dayOfMonth;
  2542. if (!mom.isValid()) {
  2543. // No op
  2544. return mom;
  2545. }
  2546. if (typeof value === 'string') {
  2547. if (/^\d+$/.test(value)) {
  2548. value = toInt(value);
  2549. } else {
  2550. value = mom.localeData().monthsParse(value);
  2551. // TODO: Another silent failure?
  2552. if (!isNumber(value)) {
  2553. return mom;
  2554. }
  2555. }
  2556. }
  2557. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  2558. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  2559. return mom;
  2560. }
  2561. function getSetMonth (value) {
  2562. if (value != null) {
  2563. setMonth(this, value);
  2564. hooks.updateOffset(this, true);
  2565. return this;
  2566. } else {
  2567. return get(this, 'Month');
  2568. }
  2569. }
  2570. function getDaysInMonth () {
  2571. return daysInMonth(this.year(), this.month());
  2572. }
  2573. var defaultMonthsShortRegex = matchWord;
  2574. function monthsShortRegex (isStrict) {
  2575. if (this._monthsParseExact) {
  2576. if (!hasOwnProp(this, '_monthsRegex')) {
  2577. computeMonthsParse.call(this);
  2578. }
  2579. if (isStrict) {
  2580. return this._monthsShortStrictRegex;
  2581. } else {
  2582. return this._monthsShortRegex;
  2583. }
  2584. } else {
  2585. if (!hasOwnProp(this, '_monthsShortRegex')) {
  2586. this._monthsShortRegex = defaultMonthsShortRegex;
  2587. }
  2588. return this._monthsShortStrictRegex && isStrict ?
  2589. this._monthsShortStrictRegex : this._monthsShortRegex;
  2590. }
  2591. }
  2592. var defaultMonthsRegex = matchWord;
  2593. function monthsRegex (isStrict) {
  2594. if (this._monthsParseExact) {
  2595. if (!hasOwnProp(this, '_monthsRegex')) {
  2596. computeMonthsParse.call(this);
  2597. }
  2598. if (isStrict) {
  2599. return this._monthsStrictRegex;
  2600. } else {
  2601. return this._monthsRegex;
  2602. }
  2603. } else {
  2604. if (!hasOwnProp(this, '_monthsRegex')) {
  2605. this._monthsRegex = defaultMonthsRegex;
  2606. }
  2607. return this._monthsStrictRegex && isStrict ?
  2608. this._monthsStrictRegex : this._monthsRegex;
  2609. }
  2610. }
  2611. function computeMonthsParse () {
  2612. function cmpLenRev(a, b) {
  2613. return b.length - a.length;
  2614. }
  2615. var shortPieces = [], longPieces = [], mixedPieces = [],
  2616. i, mom;
  2617. for (i = 0; i < 12; i++) {
  2618. // make the regex if we don't have it already
  2619. mom = createUTC([2000, i]);
  2620. shortPieces.push(this.monthsShort(mom, ''));
  2621. longPieces.push(this.months(mom, ''));
  2622. mixedPieces.push(this.months(mom, ''));
  2623. mixedPieces.push(this.monthsShort(mom, ''));
  2624. }
  2625. // Sorting makes sure if one month (or abbr) is a prefix of another it
  2626. // will match the longer piece.
  2627. shortPieces.sort(cmpLenRev);
  2628. longPieces.sort(cmpLenRev);
  2629. mixedPieces.sort(cmpLenRev);
  2630. for (i = 0; i < 12; i++) {
  2631. shortPieces[i] = regexEscape(shortPieces[i]);
  2632. longPieces[i] = regexEscape(longPieces[i]);
  2633. }
  2634. for (i = 0; i < 24; i++) {
  2635. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2636. }
  2637. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2638. this._monthsShortRegex = this._monthsRegex;
  2639. this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  2640. this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  2641. }
  2642. // FORMATTING
  2643. addFormatToken('Y', 0, 0, function () {
  2644. var y = this.year();
  2645. return y <= 9999 ? '' + y : '+' + y;
  2646. });
  2647. addFormatToken(0, ['YY', 2], 0, function () {
  2648. return this.year() % 100;
  2649. });
  2650. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2651. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2652. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2653. // ALIASES
  2654. addUnitAlias('year', 'y');
  2655. // PRIORITIES
  2656. addUnitPriority('year', 1);
  2657. // PARSING
  2658. addRegexToken('Y', matchSigned);
  2659. addRegexToken('YY', match1to2, match2);
  2660. addRegexToken('YYYY', match1to4, match4);
  2661. addRegexToken('YYYYY', match1to6, match6);
  2662. addRegexToken('YYYYYY', match1to6, match6);
  2663. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2664. addParseToken('YYYY', function (input, array) {
  2665. array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2666. });
  2667. addParseToken('YY', function (input, array) {
  2668. array[YEAR] = hooks.parseTwoDigitYear(input);
  2669. });
  2670. addParseToken('Y', function (input, array) {
  2671. array[YEAR] = parseInt(input, 10);
  2672. });
  2673. // HELPERS
  2674. function daysInYear(year) {
  2675. return isLeapYear(year) ? 366 : 365;
  2676. }
  2677. function isLeapYear(year) {
  2678. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  2679. }
  2680. // HOOKS
  2681. hooks.parseTwoDigitYear = function (input) {
  2682. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2683. };
  2684. // MOMENTS
  2685. var getSetYear = makeGetSet('FullYear', true);
  2686. function getIsLeapYear () {
  2687. return isLeapYear(this.year());
  2688. }
  2689. function createDate (y, m, d, h, M, s, ms) {
  2690. // can't just apply() to create a date:
  2691. // https://stackoverflow.com/q/181348
  2692. var date = new Date(y, m, d, h, M, s, ms);
  2693. // the date constructor remaps years 0-99 to 1900-1999
  2694. if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
  2695. date.setFullYear(y);
  2696. }
  2697. return date;
  2698. }
  2699. function createUTCDate (y) {
  2700. var date = new Date(Date.UTC.apply(null, arguments));
  2701. // the Date.UTC function remaps years 0-99 to 1900-1999
  2702. if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
  2703. date.setUTCFullYear(y);
  2704. }
  2705. return date;
  2706. }
  2707. // start-of-first-week - start-of-year
  2708. function firstWeekOffset(year, dow, doy) {
  2709. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2710. fwd = 7 + dow - doy,
  2711. // first-week day local weekday -- which local weekday is fwd
  2712. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  2713. return -fwdlw + fwd - 1;
  2714. }
  2715. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  2716. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  2717. var localWeekday = (7 + weekday - dow) % 7,
  2718. weekOffset = firstWeekOffset(year, dow, doy),
  2719. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  2720. resYear, resDayOfYear;
  2721. if (dayOfYear <= 0) {
  2722. resYear = year - 1;
  2723. resDayOfYear = daysInYear(resYear) + dayOfYear;
  2724. } else if (dayOfYear > daysInYear(year)) {
  2725. resYear = year + 1;
  2726. resDayOfYear = dayOfYear - daysInYear(year);
  2727. } else {
  2728. resYear = year;
  2729. resDayOfYear = dayOfYear;
  2730. }
  2731. return {
  2732. year: resYear,
  2733. dayOfYear: resDayOfYear
  2734. };
  2735. }
  2736. function weekOfYear(mom, dow, doy) {
  2737. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  2738. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  2739. resWeek, resYear;
  2740. if (week < 1) {
  2741. resYear = mom.year() - 1;
  2742. resWeek = week + weeksInYear(resYear, dow, doy);
  2743. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  2744. resWeek = week - weeksInYear(mom.year(), dow, doy);
  2745. resYear = mom.year() + 1;
  2746. } else {
  2747. resYear = mom.year();
  2748. resWeek = week;
  2749. }
  2750. return {
  2751. week: resWeek,
  2752. year: resYear
  2753. };
  2754. }
  2755. function weeksInYear(year, dow, doy) {
  2756. var weekOffset = firstWeekOffset(year, dow, doy),
  2757. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  2758. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  2759. }
  2760. // FORMATTING
  2761. addFormatToken('w', ['ww', 2], 'wo', 'week');
  2762. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  2763. // ALIASES
  2764. addUnitAlias('week', 'w');
  2765. addUnitAlias('isoWeek', 'W');
  2766. // PRIORITIES
  2767. addUnitPriority('week', 5);
  2768. addUnitPriority('isoWeek', 5);
  2769. // PARSING
  2770. addRegexToken('w', match1to2);
  2771. addRegexToken('ww', match1to2, match2);
  2772. addRegexToken('W', match1to2);
  2773. addRegexToken('WW', match1to2, match2);
  2774. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
  2775. week[token.substr(0, 1)] = toInt(input);
  2776. });
  2777. // HELPERS
  2778. // LOCALES
  2779. function localeWeek (mom) {
  2780. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2781. }
  2782. var defaultLocaleWeek = {
  2783. dow : 0, // Sunday is the first day of the week.
  2784. doy : 6 // The week that contains Jan 1st is the first week of the year.
  2785. };
  2786. function localeFirstDayOfWeek () {
  2787. return this._week.dow;
  2788. }
  2789. function localeFirstDayOfYear () {
  2790. return this._week.doy;
  2791. }
  2792. // MOMENTS
  2793. function getSetWeek (input) {
  2794. var week = this.localeData().week(this);
  2795. return input == null ? week : this.add((input - week) * 7, 'd');
  2796. }
  2797. function getSetISOWeek (input) {
  2798. var week = weekOfYear(this, 1, 4).week;
  2799. return input == null ? week : this.add((input - week) * 7, 'd');
  2800. }
  2801. // FORMATTING
  2802. addFormatToken('d', 0, 'do', 'day');
  2803. addFormatToken('dd', 0, 0, function (format) {
  2804. return this.localeData().weekdaysMin(this, format);
  2805. });
  2806. addFormatToken('ddd', 0, 0, function (format) {
  2807. return this.localeData().weekdaysShort(this, format);
  2808. });
  2809. addFormatToken('dddd', 0, 0, function (format) {
  2810. return this.localeData().weekdays(this, format);
  2811. });
  2812. addFormatToken('e', 0, 0, 'weekday');
  2813. addFormatToken('E', 0, 0, 'isoWeekday');
  2814. // ALIASES
  2815. addUnitAlias('day', 'd');
  2816. addUnitAlias('weekday', 'e');
  2817. addUnitAlias('isoWeekday', 'E');
  2818. // PRIORITY
  2819. addUnitPriority('day', 11);
  2820. addUnitPriority('weekday', 11);
  2821. addUnitPriority('isoWeekday', 11);
  2822. // PARSING
  2823. addRegexToken('d', match1to2);
  2824. addRegexToken('e', match1to2);
  2825. addRegexToken('E', match1to2);
  2826. addRegexToken('dd', function (isStrict, locale) {
  2827. return locale.weekdaysMinRegex(isStrict);
  2828. });
  2829. addRegexToken('ddd', function (isStrict, locale) {
  2830. return locale.weekdaysShortRegex(isStrict);
  2831. });
  2832. addRegexToken('dddd', function (isStrict, locale) {
  2833. return locale.weekdaysRegex(isStrict);
  2834. });
  2835. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2836. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2837. // if we didn't get a weekday name, mark the date as invalid
  2838. if (weekday != null) {
  2839. week.d = weekday;
  2840. } else {
  2841. getParsingFlags(config).invalidWeekday = input;
  2842. }
  2843. });
  2844. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2845. week[token] = toInt(input);
  2846. });
  2847. // HELPERS
  2848. function parseWeekday(input, locale) {
  2849. if (typeof input !== 'string') {
  2850. return input;
  2851. }
  2852. if (!isNaN(input)) {
  2853. return parseInt(input, 10);
  2854. }
  2855. input = locale.weekdaysParse(input);
  2856. if (typeof input === 'number') {
  2857. return input;
  2858. }
  2859. return null;
  2860. }
  2861. function parseIsoWeekday(input, locale) {
  2862. if (typeof input === 'string') {
  2863. return locale.weekdaysParse(input) % 7 || 7;
  2864. }
  2865. return isNaN(input) ? null : input;
  2866. }
  2867. // LOCALES
  2868. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
  2869. function localeWeekdays (m, format) {
  2870. if (!m) {
  2871. return isArray(this._weekdays) ? this._weekdays :
  2872. this._weekdays['standalone'];
  2873. }
  2874. return isArray(this._weekdays) ? this._weekdays[m.day()] :
  2875. this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
  2876. }
  2877. var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
  2878. function localeWeekdaysShort (m) {
  2879. return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
  2880. }
  2881. var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
  2882. function localeWeekdaysMin (m) {
  2883. return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
  2884. }
  2885. function handleStrictParse$1(weekdayName, format, strict) {
  2886. var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
  2887. if (!this._weekdaysParse) {
  2888. this._weekdaysParse = [];
  2889. this._shortWeekdaysParse = [];
  2890. this._minWeekdaysParse = [];
  2891. for (i = 0; i < 7; ++i) {
  2892. mom = createUTC([2000, 1]).day(i);
  2893. this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
  2894. this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
  2895. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2896. }
  2897. }
  2898. if (strict) {
  2899. if (format === 'dddd') {
  2900. ii = indexOf$1.call(this._weekdaysParse, llc);
  2901. return ii !== -1 ? ii : null;
  2902. } else if (format === 'ddd') {
  2903. ii = indexOf$1.call(this._shortWeekdaysParse, llc);
  2904. return ii !== -1 ? ii : null;
  2905. } else {
  2906. ii = indexOf$1.call(this._minWeekdaysParse, llc);
  2907. return ii !== -1 ? ii : null;
  2908. }
  2909. } else {
  2910. if (format === 'dddd') {
  2911. ii = indexOf$1.call(this._weekdaysParse, llc);
  2912. if (ii !== -1) {
  2913. return ii;
  2914. }
  2915. ii = indexOf$1.call(this._shortWeekdaysParse, llc);
  2916. if (ii !== -1) {
  2917. return ii;
  2918. }
  2919. ii = indexOf$1.call(this._minWeekdaysParse, llc);
  2920. return ii !== -1 ? ii : null;
  2921. } else if (format === 'ddd') {
  2922. ii = indexOf$1.call(this._shortWeekdaysParse, llc);
  2923. if (ii !== -1) {
  2924. return ii;
  2925. }
  2926. ii = indexOf$1.call(this._weekdaysParse, llc);
  2927. if (ii !== -1) {
  2928. return ii;
  2929. }
  2930. ii = indexOf$1.call(this._minWeekdaysParse, llc);
  2931. return ii !== -1 ? ii : null;
  2932. } else {
  2933. ii = indexOf$1.call(this._minWeekdaysParse, llc);
  2934. if (ii !== -1) {
  2935. return ii;
  2936. }
  2937. ii = indexOf$1.call(this._weekdaysParse, llc);
  2938. if (ii !== -1) {
  2939. return ii;
  2940. }
  2941. ii = indexOf$1.call(this._shortWeekdaysParse, llc);
  2942. return ii !== -1 ? ii : null;
  2943. }
  2944. }
  2945. }
  2946. function localeWeekdaysParse (weekdayName, format, strict) {
  2947. var i, mom, regex;
  2948. if (this._weekdaysParseExact) {
  2949. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2950. }
  2951. if (!this._weekdaysParse) {
  2952. this._weekdaysParse = [];
  2953. this._minWeekdaysParse = [];
  2954. this._shortWeekdaysParse = [];
  2955. this._fullWeekdaysParse = [];
  2956. }
  2957. for (i = 0; i < 7; i++) {
  2958. // make the regex if we don't have it already
  2959. mom = createUTC([2000, 1]).day(i);
  2960. if (strict && !this._fullWeekdaysParse[i]) {
  2961. this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
  2962. this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
  2963. this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
  2964. }
  2965. if (!this._weekdaysParse[i]) {
  2966. regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
  2967. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2968. }
  2969. // test the regex
  2970. if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
  2971. return i;
  2972. } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
  2973. return i;
  2974. } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
  2975. return i;
  2976. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2977. return i;
  2978. }
  2979. }
  2980. }
  2981. // MOMENTS
  2982. function getSetDayOfWeek (input) {
  2983. if (!this.isValid()) {
  2984. return input != null ? this : NaN;
  2985. }
  2986. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2987. if (input != null) {
  2988. input = parseWeekday(input, this.localeData());
  2989. return this.add(input - day, 'd');
  2990. } else {
  2991. return day;
  2992. }
  2993. }
  2994. function getSetLocaleDayOfWeek (input) {
  2995. if (!this.isValid()) {
  2996. return input != null ? this : NaN;
  2997. }
  2998. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2999. return input == null ? weekday : this.add(input - weekday, 'd');
  3000. }
  3001. function getSetISODayOfWeek (input) {
  3002. if (!this.isValid()) {
  3003. return input != null ? this : NaN;
  3004. }
  3005. // behaves the same as moment#day except
  3006. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  3007. // as a setter, sunday should belong to the previous week.
  3008. if (input != null) {
  3009. var weekday = parseIsoWeekday(input, this.localeData());
  3010. return this.day(this.day() % 7 ? weekday : weekday - 7);
  3011. } else {
  3012. return this.day() || 7;
  3013. }
  3014. }
  3015. var defaultWeekdaysRegex = matchWord;
  3016. function weekdaysRegex (isStrict) {
  3017. if (this._weekdaysParseExact) {
  3018. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3019. computeWeekdaysParse.call(this);
  3020. }
  3021. if (isStrict) {
  3022. return this._weekdaysStrictRegex;
  3023. } else {
  3024. return this._weekdaysRegex;
  3025. }
  3026. } else {
  3027. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3028. this._weekdaysRegex = defaultWeekdaysRegex;
  3029. }
  3030. return this._weekdaysStrictRegex && isStrict ?
  3031. this._weekdaysStrictRegex : this._weekdaysRegex;
  3032. }
  3033. }
  3034. var defaultWeekdaysShortRegex = matchWord;
  3035. function weekdaysShortRegex (isStrict) {
  3036. if (this._weekdaysParseExact) {
  3037. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3038. computeWeekdaysParse.call(this);
  3039. }
  3040. if (isStrict) {
  3041. return this._weekdaysShortStrictRegex;
  3042. } else {
  3043. return this._weekdaysShortRegex;
  3044. }
  3045. } else {
  3046. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  3047. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  3048. }
  3049. return this._weekdaysShortStrictRegex && isStrict ?
  3050. this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  3051. }
  3052. }
  3053. var defaultWeekdaysMinRegex = matchWord;
  3054. function weekdaysMinRegex (isStrict) {
  3055. if (this._weekdaysParseExact) {
  3056. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3057. computeWeekdaysParse.call(this);
  3058. }
  3059. if (isStrict) {
  3060. return this._weekdaysMinStrictRegex;
  3061. } else {
  3062. return this._weekdaysMinRegex;
  3063. }
  3064. } else {
  3065. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  3066. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  3067. }
  3068. return this._weekdaysMinStrictRegex && isStrict ?
  3069. this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  3070. }
  3071. }
  3072. function computeWeekdaysParse () {
  3073. function cmpLenRev(a, b) {
  3074. return b.length - a.length;
  3075. }
  3076. var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
  3077. i, mom, minp, shortp, longp;
  3078. for (i = 0; i < 7; i++) {
  3079. // make the regex if we don't have it already
  3080. mom = createUTC([2000, 1]).day(i);
  3081. minp = this.weekdaysMin(mom, '');
  3082. shortp = this.weekdaysShort(mom, '');
  3083. longp = this.weekdays(mom, '');
  3084. minPieces.push(minp);
  3085. shortPieces.push(shortp);
  3086. longPieces.push(longp);
  3087. mixedPieces.push(minp);
  3088. mixedPieces.push(shortp);
  3089. mixedPieces.push(longp);
  3090. }
  3091. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  3092. // will match the longer piece.
  3093. minPieces.sort(cmpLenRev);
  3094. shortPieces.sort(cmpLenRev);
  3095. longPieces.sort(cmpLenRev);
  3096. mixedPieces.sort(cmpLenRev);
  3097. for (i = 0; i < 7; i++) {
  3098. shortPieces[i] = regexEscape(shortPieces[i]);
  3099. longPieces[i] = regexEscape(longPieces[i]);
  3100. mixedPieces[i] = regexEscape(mixedPieces[i]);
  3101. }
  3102. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  3103. this._weekdaysShortRegex = this._weekdaysRegex;
  3104. this._weekdaysMinRegex = this._weekdaysRegex;
  3105. this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  3106. this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  3107. this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
  3108. }
  3109. // FORMATTING
  3110. function hFormat() {
  3111. return this.hours() % 12 || 12;
  3112. }
  3113. function kFormat() {
  3114. return this.hours() || 24;
  3115. }
  3116. addFormatToken('H', ['HH', 2], 0, 'hour');
  3117. addFormatToken('h', ['hh', 2], 0, hFormat);
  3118. addFormatToken('k', ['kk', 2], 0, kFormat);
  3119. addFormatToken('hmm', 0, 0, function () {
  3120. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  3121. });
  3122. addFormatToken('hmmss', 0, 0, function () {
  3123. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
  3124. zeroFill(this.seconds(), 2);
  3125. });
  3126. addFormatToken('Hmm', 0, 0, function () {
  3127. return '' + this.hours() + zeroFill(this.minutes(), 2);
  3128. });
  3129. addFormatToken('Hmmss', 0, 0, function () {
  3130. return '' + this.hours() + zeroFill(this.minutes(), 2) +
  3131. zeroFill(this.seconds(), 2);
  3132. });
  3133. function meridiem (token, lowercase) {
  3134. addFormatToken(token, 0, 0, function () {
  3135. return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
  3136. });
  3137. }
  3138. meridiem('a', true);
  3139. meridiem('A', false);
  3140. // ALIASES
  3141. addUnitAlias('hour', 'h');
  3142. // PRIORITY
  3143. addUnitPriority('hour', 13);
  3144. // PARSING
  3145. function matchMeridiem (isStrict, locale) {
  3146. return locale._meridiemParse;
  3147. }
  3148. addRegexToken('a', matchMeridiem);
  3149. addRegexToken('A', matchMeridiem);
  3150. addRegexToken('H', match1to2);
  3151. addRegexToken('h', match1to2);
  3152. addRegexToken('k', match1to2);
  3153. addRegexToken('HH', match1to2, match2);
  3154. addRegexToken('hh', match1to2, match2);
  3155. addRegexToken('kk', match1to2, match2);
  3156. addRegexToken('hmm', match3to4);
  3157. addRegexToken('hmmss', match5to6);
  3158. addRegexToken('Hmm', match3to4);
  3159. addRegexToken('Hmmss', match5to6);
  3160. addParseToken(['H', 'HH'], HOUR);
  3161. addParseToken(['k', 'kk'], function (input, array, config) {
  3162. var kInput = toInt(input);
  3163. array[HOUR] = kInput === 24 ? 0 : kInput;
  3164. });
  3165. addParseToken(['a', 'A'], function (input, array, config) {
  3166. config._isPm = config._locale.isPM(input);
  3167. config._meridiem = input;
  3168. });
  3169. addParseToken(['h', 'hh'], function (input, array, config) {
  3170. array[HOUR] = toInt(input);
  3171. getParsingFlags(config).bigHour = true;
  3172. });
  3173. addParseToken('hmm', function (input, array, config) {
  3174. var pos = input.length - 2;
  3175. array[HOUR] = toInt(input.substr(0, pos));
  3176. array[MINUTE] = toInt(input.substr(pos));
  3177. getParsingFlags(config).bigHour = true;
  3178. });
  3179. addParseToken('hmmss', function (input, array, config) {
  3180. var pos1 = input.length - 4;
  3181. var pos2 = input.length - 2;
  3182. array[HOUR] = toInt(input.substr(0, pos1));
  3183. array[MINUTE] = toInt(input.substr(pos1, 2));
  3184. array[SECOND] = toInt(input.substr(pos2));
  3185. getParsingFlags(config).bigHour = true;
  3186. });
  3187. addParseToken('Hmm', function (input, array, config) {
  3188. var pos = input.length - 2;
  3189. array[HOUR] = toInt(input.substr(0, pos));
  3190. array[MINUTE] = toInt(input.substr(pos));
  3191. });
  3192. addParseToken('Hmmss', function (input, array, config) {
  3193. var pos1 = input.length - 4;
  3194. var pos2 = input.length - 2;
  3195. array[HOUR] = toInt(input.substr(0, pos1));
  3196. array[MINUTE] = toInt(input.substr(pos1, 2));
  3197. array[SECOND] = toInt(input.substr(pos2));
  3198. });
  3199. // LOCALES
  3200. function localeIsPM (input) {
  3201. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  3202. // Using charAt should be more compatible.
  3203. return ((input + '').toLowerCase().charAt(0) === 'p');
  3204. }
  3205. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  3206. function localeMeridiem (hours, minutes, isLower) {
  3207. if (hours > 11) {
  3208. return isLower ? 'pm' : 'PM';
  3209. } else {
  3210. return isLower ? 'am' : 'AM';
  3211. }
  3212. }
  3213. // MOMENTS
  3214. // Setting the hour should keep the time, because the user explicitly
  3215. // specified which hour he wants. So trying to maintain the same hour (in
  3216. // a new timezone) makes sense. Adding/subtracting hours does not follow
  3217. // this rule.
  3218. var getSetHour = makeGetSet('Hours', true);
  3219. // months
  3220. // week
  3221. // weekdays
  3222. // meridiem
  3223. var baseConfig = {
  3224. calendar: defaultCalendar,
  3225. longDateFormat: defaultLongDateFormat,
  3226. invalidDate: defaultInvalidDate,
  3227. ordinal: defaultOrdinal,
  3228. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  3229. relativeTime: defaultRelativeTime,
  3230. months: defaultLocaleMonths,
  3231. monthsShort: defaultLocaleMonthsShort,
  3232. week: defaultLocaleWeek,
  3233. weekdays: defaultLocaleWeekdays,
  3234. weekdaysMin: defaultLocaleWeekdaysMin,
  3235. weekdaysShort: defaultLocaleWeekdaysShort,
  3236. meridiemParse: defaultLocaleMeridiemParse
  3237. };
  3238. // internal storage for locale config files
  3239. var locales = {};
  3240. var localeFamilies = {};
  3241. var globalLocale;
  3242. function normalizeLocale(key) {
  3243. return key ? key.toLowerCase().replace('_', '-') : key;
  3244. }
  3245. // pick the locale from the array
  3246. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  3247. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  3248. function chooseLocale(names) {
  3249. var i = 0, j, next, locale, split;
  3250. while (i < names.length) {
  3251. split = normalizeLocale(names[i]).split('-');
  3252. j = split.length;
  3253. next = normalizeLocale(names[i + 1]);
  3254. next = next ? next.split('-') : null;
  3255. while (j > 0) {
  3256. locale = loadLocale(split.slice(0, j).join('-'));
  3257. if (locale) {
  3258. return locale;
  3259. }
  3260. if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
  3261. //the next array item is better than a shallower substring of this one
  3262. break;
  3263. }
  3264. j--;
  3265. }
  3266. i++;
  3267. }
  3268. return null;
  3269. }
  3270. function loadLocale(name) {
  3271. var oldLocale = null;
  3272. // TODO: Find a better way to register and load all the locales in Node
  3273. if (!locales[name] && (typeof module !== 'undefined') &&
  3274. module && module.exports) {
  3275. try {
  3276. oldLocale = globalLocale._abbr;
  3277. require('./locale/' + name);
  3278. // because defineLocale currently also sets the global locale, we
  3279. // want to undo that for lazy loaded locales
  3280. getSetGlobalLocale(oldLocale);
  3281. } catch (e) { }
  3282. }
  3283. return locales[name];
  3284. }
  3285. // This function will load locale and then set the global locale. If
  3286. // no arguments are passed in, it will simply return the current global
  3287. // locale key.
  3288. function getSetGlobalLocale (key, values) {
  3289. var data;
  3290. if (key) {
  3291. if (isUndefined(values)) {
  3292. data = getLocale(key);
  3293. }
  3294. else {
  3295. data = defineLocale(key, values);
  3296. }
  3297. if (data) {
  3298. // moment.duration._locale = moment._locale = data;
  3299. globalLocale = data;
  3300. }
  3301. }
  3302. return globalLocale._abbr;
  3303. }
  3304. function defineLocale (name, config) {
  3305. if (config !== null) {
  3306. var parentConfig = baseConfig;
  3307. config.abbr = name;
  3308. if (locales[name] != null) {
  3309. deprecateSimple('defineLocaleOverride',
  3310. 'use moment.updateLocale(localeName, config) to change ' +
  3311. 'an existing locale. moment.defineLocale(localeName, ' +
  3312. 'config) should only be used for creating a new locale ' +
  3313. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
  3314. parentConfig = locales[name]._config;
  3315. } else if (config.parentLocale != null) {
  3316. if (locales[config.parentLocale] != null) {
  3317. parentConfig = locales[config.parentLocale]._config;
  3318. } else {
  3319. if (!localeFamilies[config.parentLocale]) {
  3320. localeFamilies[config.parentLocale] = [];
  3321. }
  3322. localeFamilies[config.parentLocale].push({
  3323. name: name,
  3324. config: config
  3325. });
  3326. return null;
  3327. }
  3328. }
  3329. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  3330. if (localeFamilies[name]) {
  3331. localeFamilies[name].forEach(function (x) {
  3332. defineLocale(x.name, x.config);
  3333. });
  3334. }
  3335. // backwards compat for now: also set the locale
  3336. // make sure we set the locale AFTER all child locales have been
  3337. // created, so we won't end up with the child locale set.
  3338. getSetGlobalLocale(name);
  3339. return locales[name];
  3340. } else {
  3341. // useful for testing
  3342. delete locales[name];
  3343. return null;
  3344. }
  3345. }
  3346. function updateLocale(name, config) {
  3347. if (config != null) {
  3348. var locale, parentConfig = baseConfig;
  3349. // MERGE
  3350. if (locales[name] != null) {
  3351. parentConfig = locales[name]._config;
  3352. }
  3353. config = mergeConfigs(parentConfig, config);
  3354. locale = new Locale(config);
  3355. locale.parentLocale = locales[name];
  3356. locales[name] = locale;
  3357. // backwards compat for now: also set the locale
  3358. getSetGlobalLocale(name);
  3359. } else {
  3360. // pass null for config to unupdate, useful for tests
  3361. if (locales[name] != null) {
  3362. if (locales[name].parentLocale != null) {
  3363. locales[name] = locales[name].parentLocale;
  3364. } else if (locales[name] != null) {
  3365. delete locales[name];
  3366. }
  3367. }
  3368. }
  3369. return locales[name];
  3370. }
  3371. // returns locale data
  3372. function getLocale (key) {
  3373. var locale;
  3374. if (key && key._locale && key._locale._abbr) {
  3375. key = key._locale._abbr;
  3376. }
  3377. if (!key) {
  3378. return globalLocale;
  3379. }
  3380. if (!isArray(key)) {
  3381. //short-circuit everything else
  3382. locale = loadLocale(key);
  3383. if (locale) {
  3384. return locale;
  3385. }
  3386. key = [key];
  3387. }
  3388. return chooseLocale(key);
  3389. }
  3390. function listLocales() {
  3391. return keys$1(locales);
  3392. }
  3393. function checkOverflow (m) {
  3394. var overflow;
  3395. var a = m._a;
  3396. if (a && getParsingFlags(m).overflow === -2) {
  3397. overflow =
  3398. a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
  3399. a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
  3400. a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
  3401. a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
  3402. a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
  3403. a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
  3404. -1;
  3405. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  3406. overflow = DATE;
  3407. }
  3408. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  3409. overflow = WEEK;
  3410. }
  3411. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  3412. overflow = WEEKDAY;
  3413. }
  3414. getParsingFlags(m).overflow = overflow;
  3415. }
  3416. return m;
  3417. }
  3418. // iso 8601 regex
  3419. // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
  3420. var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
  3421. var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
  3422. var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
  3423. var isoDates = [
  3424. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  3425. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  3426. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  3427. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  3428. ['YYYY-DDD', /\d{4}-\d{3}/],
  3429. ['YYYY-MM', /\d{4}-\d\d/, false],
  3430. ['YYYYYYMMDD', /[+-]\d{10}/],
  3431. ['YYYYMMDD', /\d{8}/],
  3432. // YYYYMM is NOT allowed by the standard
  3433. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  3434. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  3435. ['YYYYDDD', /\d{7}/]
  3436. ];
  3437. // iso time formats and regexes
  3438. var isoTimes = [
  3439. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  3440. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  3441. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  3442. ['HH:mm', /\d\d:\d\d/],
  3443. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  3444. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  3445. ['HHmmss', /\d\d\d\d\d\d/],
  3446. ['HHmm', /\d\d\d\d/],
  3447. ['HH', /\d\d/]
  3448. ];
  3449. var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
  3450. // date from iso format
  3451. function configFromISO(config) {
  3452. var i, l,
  3453. string = config._i,
  3454. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3455. allowTime, dateFormat, timeFormat, tzFormat;
  3456. if (match) {
  3457. getParsingFlags(config).iso = true;
  3458. for (i = 0, l = isoDates.length; i < l; i++) {
  3459. if (isoDates[i][1].exec(match[1])) {
  3460. dateFormat = isoDates[i][0];
  3461. allowTime = isoDates[i][2] !== false;
  3462. break;
  3463. }
  3464. }
  3465. if (dateFormat == null) {
  3466. config._isValid = false;
  3467. return;
  3468. }
  3469. if (match[3]) {
  3470. for (i = 0, l = isoTimes.length; i < l; i++) {
  3471. if (isoTimes[i][1].exec(match[3])) {
  3472. // match[2] should be 'T' or space
  3473. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3474. break;
  3475. }
  3476. }
  3477. if (timeFormat == null) {
  3478. config._isValid = false;
  3479. return;
  3480. }
  3481. }
  3482. if (!allowTime && timeFormat != null) {
  3483. config._isValid = false;
  3484. return;
  3485. }
  3486. if (match[4]) {
  3487. if (tzRegex.exec(match[4])) {
  3488. tzFormat = 'Z';
  3489. } else {
  3490. config._isValid = false;
  3491. return;
  3492. }
  3493. }
  3494. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3495. configFromStringAndFormat(config);
  3496. } else {
  3497. config._isValid = false;
  3498. }
  3499. }
  3500. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  3501. var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;
  3502. // date and time from ref 2822 format
  3503. function configFromRFC2822(config) {
  3504. var string, match, dayFormat,
  3505. dateFormat, timeFormat, tzFormat;
  3506. var timezones = {
  3507. ' GMT': ' +0000',
  3508. ' EDT': ' -0400',
  3509. ' EST': ' -0500',
  3510. ' CDT': ' -0500',
  3511. ' CST': ' -0600',
  3512. ' MDT': ' -0600',
  3513. ' MST': ' -0700',
  3514. ' PDT': ' -0700',
  3515. ' PST': ' -0800'
  3516. };
  3517. var military = 'YXWVUTSRQPONZABCDEFGHIKLM';
  3518. var timezone, timezoneIndex;
  3519. string = config._i
  3520. .replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace
  3521. .replace(/(\s\s+)/g, ' ') // Replace multiple-spaces with a single space
  3522. .replace(/^\s|\s$/g, ''); // Remove leading and trailing spaces
  3523. match = basicRfcRegex.exec(string);
  3524. if (match) {
  3525. dayFormat = match[1] ? 'ddd' + ((match[1].length === 5) ? ', ' : ' ') : '';
  3526. dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY ');
  3527. timeFormat = 'HH:mm' + (match[4] ? ':ss' : '');
  3528. // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
  3529. if (match[1]) { // day of week given
  3530. var momentDate = new Date(match[2]);
  3531. var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()];
  3532. if (match[1].substr(0,3) !== momentDay) {
  3533. getParsingFlags(config).weekdayMismatch = true;
  3534. config._isValid = false;
  3535. return;
  3536. }
  3537. }
  3538. switch (match[5].length) {
  3539. case 2: // military
  3540. if (timezoneIndex === 0) {
  3541. timezone = ' +0000';
  3542. } else {
  3543. timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12;
  3544. timezone = ((timezoneIndex < 0) ? ' -' : ' +') +
  3545. (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00';
  3546. }
  3547. break;
  3548. case 4: // Zone
  3549. timezone = timezones[match[5]];
  3550. break;
  3551. default: // UT or +/-9999
  3552. timezone = timezones[' GMT'];
  3553. }
  3554. match[5] = timezone;
  3555. config._i = match.splice(1).join('');
  3556. tzFormat = ' ZZ';
  3557. config._f = dayFormat + dateFormat + timeFormat + tzFormat;
  3558. configFromStringAndFormat(config);
  3559. getParsingFlags(config).rfc2822 = true;
  3560. } else {
  3561. config._isValid = false;
  3562. }
  3563. }
  3564. // date from iso format or fallback
  3565. function configFromString(config) {
  3566. var matched = aspNetJsonRegex.exec(config._i);
  3567. if (matched !== null) {
  3568. config._d = new Date(+matched[1]);
  3569. return;
  3570. }
  3571. configFromISO(config);
  3572. if (config._isValid === false) {
  3573. delete config._isValid;
  3574. } else {
  3575. return;
  3576. }
  3577. configFromRFC2822(config);
  3578. if (config._isValid === false) {
  3579. delete config._isValid;
  3580. } else {
  3581. return;
  3582. }
  3583. // Final attempt, use Input Fallback
  3584. hooks.createFromInputFallback(config);
  3585. }
  3586. hooks.createFromInputFallback = deprecate(
  3587. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  3588. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  3589. 'discouraged and will be removed in an upcoming major release. Please refer to ' +
  3590. 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3591. function (config) {
  3592. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3593. }
  3594. );
  3595. // Pick the first defined of two or three arguments.
  3596. function defaults(a, b, c) {
  3597. if (a != null) {
  3598. return a;
  3599. }
  3600. if (b != null) {
  3601. return b;
  3602. }
  3603. return c;
  3604. }
  3605. function currentDateArray(config) {
  3606. // hooks is actually the exported moment object
  3607. var nowValue = new Date(hooks.now());
  3608. if (config._useUTC) {
  3609. return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
  3610. }
  3611. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3612. }
  3613. // convert an array to a date.
  3614. // the array should mirror the parameters below
  3615. // note: all values past the year are optional and will default to the lowest possible value.
  3616. // [year, month, day , hour, minute, second, millisecond]
  3617. function configFromArray (config) {
  3618. var i, date, input = [], currentDate, yearToUse;
  3619. if (config._d) {
  3620. return;
  3621. }
  3622. currentDate = currentDateArray(config);
  3623. //compute day of the year from weeks and weekdays
  3624. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3625. dayOfYearFromWeekInfo(config);
  3626. }
  3627. //if the day of the year is set, figure out what it is
  3628. if (config._dayOfYear != null) {
  3629. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3630. if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
  3631. getParsingFlags(config)._overflowDayOfYear = true;
  3632. }
  3633. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3634. config._a[MONTH] = date.getUTCMonth();
  3635. config._a[DATE] = date.getUTCDate();
  3636. }
  3637. // Default to current date.
  3638. // * if no year, month, day of month are given, default to today
  3639. // * if day of month is given, default month and year
  3640. // * if month is given, default only year
  3641. // * if year is given, don't default anything
  3642. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3643. config._a[i] = input[i] = currentDate[i];
  3644. }
  3645. // Zero out whatever was not defaulted, including time
  3646. for (; i < 7; i++) {
  3647. config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
  3648. }
  3649. // Check for 24:00:00.000
  3650. if (config._a[HOUR] === 24 &&
  3651. config._a[MINUTE] === 0 &&
  3652. config._a[SECOND] === 0 &&
  3653. config._a[MILLISECOND] === 0) {
  3654. config._nextDay = true;
  3655. config._a[HOUR] = 0;
  3656. }
  3657. config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
  3658. // Apply timezone offset from input. The actual utcOffset can be changed
  3659. // with parseZone.
  3660. if (config._tzm != null) {
  3661. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3662. }
  3663. if (config._nextDay) {
  3664. config._a[HOUR] = 24;
  3665. }
  3666. }
  3667. function dayOfYearFromWeekInfo(config) {
  3668. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
  3669. w = config._w;
  3670. if (w.GG != null || w.W != null || w.E != null) {
  3671. dow = 1;
  3672. doy = 4;
  3673. // TODO: We need to take the current isoWeekYear, but that depends on
  3674. // how we interpret now (local, utc, fixed offset). So create
  3675. // a now version of current config (take local/utc/offset flags, and
  3676. // create now).
  3677. weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
  3678. week = defaults(w.W, 1);
  3679. weekday = defaults(w.E, 1);
  3680. if (weekday < 1 || weekday > 7) {
  3681. weekdayOverflow = true;
  3682. }
  3683. } else {
  3684. dow = config._locale._week.dow;
  3685. doy = config._locale._week.doy;
  3686. var curWeek = weekOfYear(createLocal(), dow, doy);
  3687. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3688. // Default to current week.
  3689. week = defaults(w.w, curWeek.week);
  3690. if (w.d != null) {
  3691. // weekday -- low day numbers are considered next week
  3692. weekday = w.d;
  3693. if (weekday < 0 || weekday > 6) {
  3694. weekdayOverflow = true;
  3695. }
  3696. } else if (w.e != null) {
  3697. // local weekday -- counting starts from begining of week
  3698. weekday = w.e + dow;
  3699. if (w.e < 0 || w.e > 6) {
  3700. weekdayOverflow = true;
  3701. }
  3702. } else {
  3703. // default to begining of week
  3704. weekday = dow;
  3705. }
  3706. }
  3707. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3708. getParsingFlags(config)._overflowWeeks = true;
  3709. } else if (weekdayOverflow != null) {
  3710. getParsingFlags(config)._overflowWeekday = true;
  3711. } else {
  3712. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3713. config._a[YEAR] = temp.year;
  3714. config._dayOfYear = temp.dayOfYear;
  3715. }
  3716. }
  3717. // constant that refers to the ISO standard
  3718. hooks.ISO_8601 = function () {};
  3719. // constant that refers to the RFC 2822 form
  3720. hooks.RFC_2822 = function () {};
  3721. // date from string and format string
  3722. function configFromStringAndFormat(config) {
  3723. // TODO: Move this to another part of the creation flow to prevent circular deps
  3724. if (config._f === hooks.ISO_8601) {
  3725. configFromISO(config);
  3726. return;
  3727. }
  3728. if (config._f === hooks.RFC_2822) {
  3729. configFromRFC2822(config);
  3730. return;
  3731. }
  3732. config._a = [];
  3733. getParsingFlags(config).empty = true;
  3734. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3735. var string = '' + config._i,
  3736. i, parsedInput, tokens, token, skipped,
  3737. stringLength = string.length,
  3738. totalParsedInputLength = 0;
  3739. tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3740. for (i = 0; i < tokens.length; i++) {
  3741. token = tokens[i];
  3742. parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
  3743. // console.log('token', token, 'parsedInput', parsedInput,
  3744. // 'regex', getParseRegexForToken(token, config));
  3745. if (parsedInput) {
  3746. skipped = string.substr(0, string.indexOf(parsedInput));
  3747. if (skipped.length > 0) {
  3748. getParsingFlags(config).unusedInput.push(skipped);
  3749. }
  3750. string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
  3751. totalParsedInputLength += parsedInput.length;
  3752. }
  3753. // don't parse if it's not a known token
  3754. if (formatTokenFunctions[token]) {
  3755. if (parsedInput) {
  3756. getParsingFlags(config).empty = false;
  3757. }
  3758. else {
  3759. getParsingFlags(config).unusedTokens.push(token);
  3760. }
  3761. addTimeToArrayFromToken(token, parsedInput, config);
  3762. }
  3763. else if (config._strict && !parsedInput) {
  3764. getParsingFlags(config).unusedTokens.push(token);
  3765. }
  3766. }
  3767. // add remaining unparsed input length to the string
  3768. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  3769. if (string.length > 0) {
  3770. getParsingFlags(config).unusedInput.push(string);
  3771. }
  3772. // clear _12h flag if hour is <= 12
  3773. if (config._a[HOUR] <= 12 &&
  3774. getParsingFlags(config).bigHour === true &&
  3775. config._a[HOUR] > 0) {
  3776. getParsingFlags(config).bigHour = undefined;
  3777. }
  3778. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3779. getParsingFlags(config).meridiem = config._meridiem;
  3780. // handle meridiem
  3781. config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
  3782. configFromArray(config);
  3783. checkOverflow(config);
  3784. }
  3785. function meridiemFixWrap (locale, hour, meridiem) {
  3786. var isPm;
  3787. if (meridiem == null) {
  3788. // nothing to do
  3789. return hour;
  3790. }
  3791. if (locale.meridiemHour != null) {
  3792. return locale.meridiemHour(hour, meridiem);
  3793. } else if (locale.isPM != null) {
  3794. // Fallback
  3795. isPm = locale.isPM(meridiem);
  3796. if (isPm && hour < 12) {
  3797. hour += 12;
  3798. }
  3799. if (!isPm && hour === 12) {
  3800. hour = 0;
  3801. }
  3802. return hour;
  3803. } else {
  3804. // this is not supposed to happen
  3805. return hour;
  3806. }
  3807. }
  3808. // date from string and array of format strings
  3809. function configFromStringAndArray(config) {
  3810. var tempConfig,
  3811. bestMoment,
  3812. scoreToBeat,
  3813. i,
  3814. currentScore;
  3815. if (config._f.length === 0) {
  3816. getParsingFlags(config).invalidFormat = true;
  3817. config._d = new Date(NaN);
  3818. return;
  3819. }
  3820. for (i = 0; i < config._f.length; i++) {
  3821. currentScore = 0;
  3822. tempConfig = copyConfig({}, config);
  3823. if (config._useUTC != null) {
  3824. tempConfig._useUTC = config._useUTC;
  3825. }
  3826. tempConfig._f = config._f[i];
  3827. configFromStringAndFormat(tempConfig);
  3828. if (!isValid(tempConfig)) {
  3829. continue;
  3830. }
  3831. // if there is any input that was not parsed add a penalty for that format
  3832. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3833. //or tokens
  3834. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3835. getParsingFlags(tempConfig).score = currentScore;
  3836. if (scoreToBeat == null || currentScore < scoreToBeat) {
  3837. scoreToBeat = currentScore;
  3838. bestMoment = tempConfig;
  3839. }
  3840. }
  3841. extend(config, bestMoment || tempConfig);
  3842. }
  3843. function configFromObject(config) {
  3844. if (config._d) {
  3845. return;
  3846. }
  3847. var i = normalizeObjectUnits(config._i);
  3848. config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
  3849. return obj && parseInt(obj, 10);
  3850. });
  3851. configFromArray(config);
  3852. }
  3853. function createFromConfig (config) {
  3854. var res = new Moment(checkOverflow(prepareConfig(config)));
  3855. if (res._nextDay) {
  3856. // Adding is smart enough around DST
  3857. res.add(1, 'd');
  3858. res._nextDay = undefined;
  3859. }
  3860. return res;
  3861. }
  3862. function prepareConfig (config) {
  3863. var input = config._i,
  3864. format = config._f;
  3865. config._locale = config._locale || getLocale(config._l);
  3866. if (input === null || (format === undefined && input === '')) {
  3867. return createInvalid({nullInput: true});
  3868. }
  3869. if (typeof input === 'string') {
  3870. config._i = input = config._locale.preparse(input);
  3871. }
  3872. if (isMoment(input)) {
  3873. return new Moment(checkOverflow(input));
  3874. } else if (isDate(input)) {
  3875. config._d = input;
  3876. } else if (isArray(format)) {
  3877. configFromStringAndArray(config);
  3878. } else if (format) {
  3879. configFromStringAndFormat(config);
  3880. } else {
  3881. configFromInput(config);
  3882. }
  3883. if (!isValid(config)) {
  3884. config._d = null;
  3885. }
  3886. return config;
  3887. }
  3888. function configFromInput(config) {
  3889. var input = config._i;
  3890. if (isUndefined(input)) {
  3891. config._d = new Date(hooks.now());
  3892. } else if (isDate(input)) {
  3893. config._d = new Date(input.valueOf());
  3894. } else if (typeof input === 'string') {
  3895. configFromString(config);
  3896. } else if (isArray(input)) {
  3897. config._a = map(input.slice(0), function (obj) {
  3898. return parseInt(obj, 10);
  3899. });
  3900. configFromArray(config);
  3901. } else if (isObject(input)) {
  3902. configFromObject(config);
  3903. } else if (isNumber(input)) {
  3904. // from milliseconds
  3905. config._d = new Date(input);
  3906. } else {
  3907. hooks.createFromInputFallback(config);
  3908. }
  3909. }
  3910. function createLocalOrUTC (input, format, locale, strict, isUTC) {
  3911. var c = {};
  3912. if (locale === true || locale === false) {
  3913. strict = locale;
  3914. locale = undefined;
  3915. }
  3916. if ((isObject(input) && isObjectEmpty(input)) ||
  3917. (isArray(input) && input.length === 0)) {
  3918. input = undefined;
  3919. }
  3920. // object construction must be done this way.
  3921. // https://github.com/moment/moment/issues/1423
  3922. c._isAMomentObject = true;
  3923. c._useUTC = c._isUTC = isUTC;
  3924. c._l = locale;
  3925. c._i = input;
  3926. c._f = format;
  3927. c._strict = strict;
  3928. return createFromConfig(c);
  3929. }
  3930. function createLocal (input, format, locale, strict) {
  3931. return createLocalOrUTC(input, format, locale, strict, false);
  3932. }
  3933. var prototypeMin = deprecate(
  3934. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3935. function () {
  3936. var other = createLocal.apply(null, arguments);
  3937. if (this.isValid() && other.isValid()) {
  3938. return other < this ? this : other;
  3939. } else {
  3940. return createInvalid();
  3941. }
  3942. }
  3943. );
  3944. var prototypeMax = deprecate(
  3945. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3946. function () {
  3947. var other = createLocal.apply(null, arguments);
  3948. if (this.isValid() && other.isValid()) {
  3949. return other > this ? this : other;
  3950. } else {
  3951. return createInvalid();
  3952. }
  3953. }
  3954. );
  3955. // Pick a moment m from moments so that m[fn](other) is true for all
  3956. // other. This relies on the function fn to be transitive.
  3957. //
  3958. // moments should either be an array of moment objects or an array, whose
  3959. // first element is an array of moment objects.
  3960. function pickBy(fn, moments) {
  3961. var res, i;
  3962. if (moments.length === 1 && isArray(moments[0])) {
  3963. moments = moments[0];
  3964. }
  3965. if (!moments.length) {
  3966. return createLocal();
  3967. }
  3968. res = moments[0];
  3969. for (i = 1; i < moments.length; ++i) {
  3970. if (!moments[i].isValid() || moments[i][fn](res)) {
  3971. res = moments[i];
  3972. }
  3973. }
  3974. return res;
  3975. }
  3976. // TODO: Use [].sort instead?
  3977. function min () {
  3978. var args = [].slice.call(arguments, 0);
  3979. return pickBy('isBefore', args);
  3980. }
  3981. function max () {
  3982. var args = [].slice.call(arguments, 0);
  3983. return pickBy('isAfter', args);
  3984. }
  3985. var now = function () {
  3986. return Date.now ? Date.now() : +(new Date());
  3987. };
  3988. var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
  3989. function isDurationValid(m) {
  3990. for (var key in m) {
  3991. if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
  3992. return false;
  3993. }
  3994. }
  3995. var unitHasDecimal = false;
  3996. for (var i = 0; i < ordering.length; ++i) {
  3997. if (m[ordering[i]]) {
  3998. if (unitHasDecimal) {
  3999. return false; // only allow non-integers for smallest unit
  4000. }
  4001. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  4002. unitHasDecimal = true;
  4003. }
  4004. }
  4005. }
  4006. return true;
  4007. }
  4008. function isValid$1() {
  4009. return this._isValid;
  4010. }
  4011. function createInvalid$1() {
  4012. return createDuration(NaN);
  4013. }
  4014. function Duration (duration) {
  4015. var normalizedInput = normalizeObjectUnits(duration),
  4016. years = normalizedInput.year || 0,
  4017. quarters = normalizedInput.quarter || 0,
  4018. months = normalizedInput.month || 0,
  4019. weeks = normalizedInput.week || 0,
  4020. days = normalizedInput.day || 0,
  4021. hours = normalizedInput.hour || 0,
  4022. minutes = normalizedInput.minute || 0,
  4023. seconds = normalizedInput.second || 0,
  4024. milliseconds = normalizedInput.millisecond || 0;
  4025. this._isValid = isDurationValid(normalizedInput);
  4026. // representation for dateAddRemove
  4027. this._milliseconds = +milliseconds +
  4028. seconds * 1e3 + // 1000
  4029. minutes * 6e4 + // 1000 * 60
  4030. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  4031. // Because of dateAddRemove treats 24 hours as different from a
  4032. // day when working around DST, we need to store them separately
  4033. this._days = +days +
  4034. weeks * 7;
  4035. // It is impossible translate months into days without knowing
  4036. // which months you are are talking about, so we have to store
  4037. // it separately.
  4038. this._months = +months +
  4039. quarters * 3 +
  4040. years * 12;
  4041. this._data = {};
  4042. this._locale = getLocale();
  4043. this._bubble();
  4044. }
  4045. function isDuration (obj) {
  4046. return obj instanceof Duration;
  4047. }
  4048. function absRound (number) {
  4049. if (number < 0) {
  4050. return Math.round(-1 * number) * -1;
  4051. } else {
  4052. return Math.round(number);
  4053. }
  4054. }
  4055. // FORMATTING
  4056. function offset (token, separator) {
  4057. addFormatToken(token, 0, 0, function () {
  4058. var offset = this.utcOffset();
  4059. var sign = '+';
  4060. if (offset < 0) {
  4061. offset = -offset;
  4062. sign = '-';
  4063. }
  4064. return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
  4065. });
  4066. }
  4067. offset('Z', ':');
  4068. offset('ZZ', '');
  4069. // PARSING
  4070. addRegexToken('Z', matchShortOffset);
  4071. addRegexToken('ZZ', matchShortOffset);
  4072. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  4073. config._useUTC = true;
  4074. config._tzm = offsetFromString(matchShortOffset, input);
  4075. });
  4076. // HELPERS
  4077. // timezone chunker
  4078. // '+10:00' > ['10', '00']
  4079. // '-1530' > ['-15', '30']
  4080. var chunkOffset = /([\+\-]|\d\d)/gi;
  4081. function offsetFromString(matcher, string) {
  4082. var matches = (string || '').match(matcher);
  4083. if (matches === null) {
  4084. return null;
  4085. }
  4086. var chunk = matches[matches.length - 1] || [];
  4087. var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  4088. var minutes = +(parts[1] * 60) + toInt(parts[2]);
  4089. return minutes === 0 ?
  4090. 0 :
  4091. parts[0] === '+' ? minutes : -minutes;
  4092. }
  4093. // Return a moment from input, that is local/utc/zone equivalent to model.
  4094. function cloneWithOffset(input, model) {
  4095. var res, diff;
  4096. if (model._isUTC) {
  4097. res = model.clone();
  4098. diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
  4099. // Use low-level api, because this fn is low-level api.
  4100. res._d.setTime(res._d.valueOf() + diff);
  4101. hooks.updateOffset(res, false);
  4102. return res;
  4103. } else {
  4104. return createLocal(input).local();
  4105. }
  4106. }
  4107. function getDateOffset (m) {
  4108. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  4109. // https://github.com/moment/moment/pull/1871
  4110. return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
  4111. }
  4112. // HOOKS
  4113. // This function will be called whenever a moment is mutated.
  4114. // It is intended to keep the offset in sync with the timezone.
  4115. hooks.updateOffset = function () {};
  4116. // MOMENTS
  4117. // keepLocalTime = true means only change the timezone, without
  4118. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  4119. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  4120. // +0200, so we adjust the time as needed, to be valid.
  4121. //
  4122. // Keeping the time actually adds/subtracts (one hour)
  4123. // from the actual represented time. That is why we call updateOffset
  4124. // a second time. In case it wants us to change the offset again
  4125. // _changeInProgress == true case, then we have to adjust, because
  4126. // there is no such time in the given timezone.
  4127. function getSetOffset (input, keepLocalTime, keepMinutes) {
  4128. var offset = this._offset || 0,
  4129. localAdjust;
  4130. if (!this.isValid()) {
  4131. return input != null ? this : NaN;
  4132. }
  4133. if (input != null) {
  4134. if (typeof input === 'string') {
  4135. input = offsetFromString(matchShortOffset, input);
  4136. if (input === null) {
  4137. return this;
  4138. }
  4139. } else if (Math.abs(input) < 16 && !keepMinutes) {
  4140. input = input * 60;
  4141. }
  4142. if (!this._isUTC && keepLocalTime) {
  4143. localAdjust = getDateOffset(this);
  4144. }
  4145. this._offset = input;
  4146. this._isUTC = true;
  4147. if (localAdjust != null) {
  4148. this.add(localAdjust, 'm');
  4149. }
  4150. if (offset !== input) {
  4151. if (!keepLocalTime || this._changeInProgress) {
  4152. addSubtract(this, createDuration(input - offset, 'm'), 1, false);
  4153. } else if (!this._changeInProgress) {
  4154. this._changeInProgress = true;
  4155. hooks.updateOffset(this, true);
  4156. this._changeInProgress = null;
  4157. }
  4158. }
  4159. return this;
  4160. } else {
  4161. return this._isUTC ? offset : getDateOffset(this);
  4162. }
  4163. }
  4164. function getSetZone (input, keepLocalTime) {
  4165. if (input != null) {
  4166. if (typeof input !== 'string') {
  4167. input = -input;
  4168. }
  4169. this.utcOffset(input, keepLocalTime);
  4170. return this;
  4171. } else {
  4172. return -this.utcOffset();
  4173. }
  4174. }
  4175. function setOffsetToUTC (keepLocalTime) {
  4176. return this.utcOffset(0, keepLocalTime);
  4177. }
  4178. function setOffsetToLocal (keepLocalTime) {
  4179. if (this._isUTC) {
  4180. this.utcOffset(0, keepLocalTime);
  4181. this._isUTC = false;
  4182. if (keepLocalTime) {
  4183. this.subtract(getDateOffset(this), 'm');
  4184. }
  4185. }
  4186. return this;
  4187. }
  4188. function setOffsetToParsedOffset () {
  4189. if (this._tzm != null) {
  4190. this.utcOffset(this._tzm, false, true);
  4191. } else if (typeof this._i === 'string') {
  4192. var tZone = offsetFromString(matchOffset, this._i);
  4193. if (tZone != null) {
  4194. this.utcOffset(tZone);
  4195. }
  4196. else {
  4197. this.utcOffset(0, true);
  4198. }
  4199. }
  4200. return this;
  4201. }
  4202. function hasAlignedHourOffset (input) {
  4203. if (!this.isValid()) {
  4204. return false;
  4205. }
  4206. input = input ? createLocal(input).utcOffset() : 0;
  4207. return (this.utcOffset() - input) % 60 === 0;
  4208. }
  4209. function isDaylightSavingTime () {
  4210. return (
  4211. this.utcOffset() > this.clone().month(0).utcOffset() ||
  4212. this.utcOffset() > this.clone().month(5).utcOffset()
  4213. );
  4214. }
  4215. function isDaylightSavingTimeShifted () {
  4216. if (!isUndefined(this._isDSTShifted)) {
  4217. return this._isDSTShifted;
  4218. }
  4219. var c = {};
  4220. copyConfig(c, this);
  4221. c = prepareConfig(c);
  4222. if (c._a) {
  4223. var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  4224. this._isDSTShifted = this.isValid() &&
  4225. compareArrays(c._a, other.toArray()) > 0;
  4226. } else {
  4227. this._isDSTShifted = false;
  4228. }
  4229. return this._isDSTShifted;
  4230. }
  4231. function isLocal () {
  4232. return this.isValid() ? !this._isUTC : false;
  4233. }
  4234. function isUtcOffset () {
  4235. return this.isValid() ? this._isUTC : false;
  4236. }
  4237. function isUtc () {
  4238. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  4239. }
  4240. // ASP.NET json date format regex
  4241. var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
  4242. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  4243. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  4244. // and further modified to allow for strings containing both week and day
  4245. var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;
  4246. function createDuration (input, key) {
  4247. var duration = input,
  4248. // matching against regexp is expensive, do it on demand
  4249. match = null,
  4250. sign,
  4251. ret,
  4252. diffRes;
  4253. if (isDuration(input)) {
  4254. duration = {
  4255. ms : input._milliseconds,
  4256. d : input._days,
  4257. M : input._months
  4258. };
  4259. } else if (isNumber(input)) {
  4260. duration = {};
  4261. if (key) {
  4262. duration[key] = input;
  4263. } else {
  4264. duration.milliseconds = input;
  4265. }
  4266. } else if (!!(match = aspNetRegex.exec(input))) {
  4267. sign = (match[1] === '-') ? -1 : 1;
  4268. duration = {
  4269. y : 0,
  4270. d : toInt(match[DATE]) * sign,
  4271. h : toInt(match[HOUR]) * sign,
  4272. m : toInt(match[MINUTE]) * sign,
  4273. s : toInt(match[SECOND]) * sign,
  4274. ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
  4275. };
  4276. } else if (!!(match = isoRegex.exec(input))) {
  4277. sign = (match[1] === '-') ? -1 : 1;
  4278. duration = {
  4279. y : parseIso(match[2], sign),
  4280. M : parseIso(match[3], sign),
  4281. w : parseIso(match[4], sign),
  4282. d : parseIso(match[5], sign),
  4283. h : parseIso(match[6], sign),
  4284. m : parseIso(match[7], sign),
  4285. s : parseIso(match[8], sign)
  4286. };
  4287. } else if (duration == null) {// checks for null or undefined
  4288. duration = {};
  4289. } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
  4290. diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
  4291. duration = {};
  4292. duration.ms = diffRes.milliseconds;
  4293. duration.M = diffRes.months;
  4294. }
  4295. ret = new Duration(duration);
  4296. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4297. ret._locale = input._locale;
  4298. }
  4299. return ret;
  4300. }
  4301. createDuration.fn = Duration.prototype;
  4302. createDuration.invalid = createInvalid$1;
  4303. function parseIso (inp, sign) {
  4304. // We'd normally use ~~inp for this, but unfortunately it also
  4305. // converts floats to ints.
  4306. // inp may be undefined, so careful calling replace on it.
  4307. var res = inp && parseFloat(inp.replace(',', '.'));
  4308. // apply sign while we're at it
  4309. return (isNaN(res) ? 0 : res) * sign;
  4310. }
  4311. function positiveMomentsDifference(base, other) {
  4312. var res = {milliseconds: 0, months: 0};
  4313. res.months = other.month() - base.month() +
  4314. (other.year() - base.year()) * 12;
  4315. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4316. --res.months;
  4317. }
  4318. res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
  4319. return res;
  4320. }
  4321. function momentsDifference(base, other) {
  4322. var res;
  4323. if (!(base.isValid() && other.isValid())) {
  4324. return {milliseconds: 0, months: 0};
  4325. }
  4326. other = cloneWithOffset(other, base);
  4327. if (base.isBefore(other)) {
  4328. res = positiveMomentsDifference(base, other);
  4329. } else {
  4330. res = positiveMomentsDifference(other, base);
  4331. res.milliseconds = -res.milliseconds;
  4332. res.months = -res.months;
  4333. }
  4334. return res;
  4335. }
  4336. // TODO: remove 'name' arg after deprecation is removed
  4337. function createAdder(direction, name) {
  4338. return function (val, period) {
  4339. var dur, tmp;
  4340. //invert the arguments, but complain about it
  4341. if (period !== null && !isNaN(+period)) {
  4342. deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
  4343. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
  4344. tmp = val; val = period; period = tmp;
  4345. }
  4346. val = typeof val === 'string' ? +val : val;
  4347. dur = createDuration(val, period);
  4348. addSubtract(this, dur, direction);
  4349. return this;
  4350. };
  4351. }
  4352. function addSubtract (mom, duration, isAdding, updateOffset) {
  4353. var milliseconds = duration._milliseconds,
  4354. days = absRound(duration._days),
  4355. months = absRound(duration._months);
  4356. if (!mom.isValid()) {
  4357. // No op
  4358. return;
  4359. }
  4360. updateOffset = updateOffset == null ? true : updateOffset;
  4361. if (milliseconds) {
  4362. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4363. }
  4364. if (days) {
  4365. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4366. }
  4367. if (months) {
  4368. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4369. }
  4370. if (updateOffset) {
  4371. hooks.updateOffset(mom, days || months);
  4372. }
  4373. }
  4374. var add = createAdder(1, 'add');
  4375. var subtract = createAdder(-1, 'subtract');
  4376. function getCalendarFormat(myMoment, now) {
  4377. var diff = myMoment.diff(now, 'days', true);
  4378. return diff < -6 ? 'sameElse' :
  4379. diff < -1 ? 'lastWeek' :
  4380. diff < 0 ? 'lastDay' :
  4381. diff < 1 ? 'sameDay' :
  4382. diff < 2 ? 'nextDay' :
  4383. diff < 7 ? 'nextWeek' : 'sameElse';
  4384. }
  4385. function calendar$1 (time, formats) {
  4386. // We want to compare the start of today, vs this.
  4387. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4388. var now = time || createLocal(),
  4389. sod = cloneWithOffset(now, this).startOf('day'),
  4390. format = hooks.calendarFormat(this, sod) || 'sameElse';
  4391. var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
  4392. return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
  4393. }
  4394. function clone () {
  4395. return new Moment(this);
  4396. }
  4397. function isAfter (input, units) {
  4398. var localInput = isMoment(input) ? input : createLocal(input);
  4399. if (!(this.isValid() && localInput.isValid())) {
  4400. return false;
  4401. }
  4402. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  4403. if (units === 'millisecond') {
  4404. return this.valueOf() > localInput.valueOf();
  4405. } else {
  4406. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4407. }
  4408. }
  4409. function isBefore (input, units) {
  4410. var localInput = isMoment(input) ? input : createLocal(input);
  4411. if (!(this.isValid() && localInput.isValid())) {
  4412. return false;
  4413. }
  4414. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  4415. if (units === 'millisecond') {
  4416. return this.valueOf() < localInput.valueOf();
  4417. } else {
  4418. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4419. }
  4420. }
  4421. function isBetween (from, to, units, inclusivity) {
  4422. inclusivity = inclusivity || '()';
  4423. return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
  4424. (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
  4425. }
  4426. function isSame (input, units) {
  4427. var localInput = isMoment(input) ? input : createLocal(input),
  4428. inputMs;
  4429. if (!(this.isValid() && localInput.isValid())) {
  4430. return false;
  4431. }
  4432. units = normalizeUnits(units || 'millisecond');
  4433. if (units === 'millisecond') {
  4434. return this.valueOf() === localInput.valueOf();
  4435. } else {
  4436. inputMs = localInput.valueOf();
  4437. return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  4438. }
  4439. }
  4440. function isSameOrAfter (input, units) {
  4441. return this.isSame(input, units) || this.isAfter(input,units);
  4442. }
  4443. function isSameOrBefore (input, units) {
  4444. return this.isSame(input, units) || this.isBefore(input,units);
  4445. }
  4446. function diff (input, units, asFloat) {
  4447. var that,
  4448. zoneDelta,
  4449. delta, output;
  4450. if (!this.isValid()) {
  4451. return NaN;
  4452. }
  4453. that = cloneWithOffset(input, this);
  4454. if (!that.isValid()) {
  4455. return NaN;
  4456. }
  4457. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4458. units = normalizeUnits(units);
  4459. if (units === 'year' || units === 'month' || units === 'quarter') {
  4460. output = monthDiff(this, that);
  4461. if (units === 'quarter') {
  4462. output = output / 3;
  4463. } else if (units === 'year') {
  4464. output = output / 12;
  4465. }
  4466. } else {
  4467. delta = this - that;
  4468. output = units === 'second' ? delta / 1e3 : // 1000
  4469. units === 'minute' ? delta / 6e4 : // 1000 * 60
  4470. units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
  4471. units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
  4472. units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
  4473. delta;
  4474. }
  4475. return asFloat ? output : absFloor(output);
  4476. }
  4477. function monthDiff (a, b) {
  4478. // difference in months
  4479. var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
  4480. // b is in (anchor - 1 month, anchor + 1 month)
  4481. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4482. anchor2, adjust;
  4483. if (b - anchor < 0) {
  4484. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4485. // linear across the month
  4486. adjust = (b - anchor) / (anchor - anchor2);
  4487. } else {
  4488. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4489. // linear across the month
  4490. adjust = (b - anchor) / (anchor2 - anchor);
  4491. }
  4492. //check for negative zero, return zero if negative zero
  4493. return -(wholeMonthDiff + adjust) || 0;
  4494. }
  4495. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4496. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4497. function toString () {
  4498. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4499. }
  4500. function toISOString() {
  4501. if (!this.isValid()) {
  4502. return null;
  4503. }
  4504. var m = this.clone().utc();
  4505. if (m.year() < 0 || m.year() > 9999) {
  4506. return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  4507. }
  4508. if (isFunction(Date.prototype.toISOString)) {
  4509. // native implementation is ~50x faster, use it when we can
  4510. return this.toDate().toISOString();
  4511. }
  4512. return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  4513. }
  4514. /**
  4515. * Return a human readable representation of a moment that can
  4516. * also be evaluated to get a new moment which is the same
  4517. *
  4518. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4519. */
  4520. function inspect () {
  4521. if (!this.isValid()) {
  4522. return 'moment.invalid(/* ' + this._i + ' */)';
  4523. }
  4524. var func = 'moment';
  4525. var zone = '';
  4526. if (!this.isLocal()) {
  4527. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4528. zone = 'Z';
  4529. }
  4530. var prefix = '[' + func + '("]';
  4531. var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
  4532. var datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4533. var suffix = zone + '[")]';
  4534. return this.format(prefix + year + datetime + suffix);
  4535. }
  4536. function format (inputString) {
  4537. if (!inputString) {
  4538. inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
  4539. }
  4540. var output = formatMoment(this, inputString);
  4541. return this.localeData().postformat(output);
  4542. }
  4543. function from (time, withoutSuffix) {
  4544. if (this.isValid() &&
  4545. ((isMoment(time) && time.isValid()) ||
  4546. createLocal(time).isValid())) {
  4547. return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
  4548. } else {
  4549. return this.localeData().invalidDate();
  4550. }
  4551. }
  4552. function fromNow (withoutSuffix) {
  4553. return this.from(createLocal(), withoutSuffix);
  4554. }
  4555. function to (time, withoutSuffix) {
  4556. if (this.isValid() &&
  4557. ((isMoment(time) && time.isValid()) ||
  4558. createLocal(time).isValid())) {
  4559. return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
  4560. } else {
  4561. return this.localeData().invalidDate();
  4562. }
  4563. }
  4564. function toNow (withoutSuffix) {
  4565. return this.to(createLocal(), withoutSuffix);
  4566. }
  4567. // If passed a locale key, it will set the locale for this
  4568. // instance. Otherwise, it will return the locale configuration
  4569. // variables for this instance.
  4570. function locale (key) {
  4571. var newLocaleData;
  4572. if (key === undefined) {
  4573. return this._locale._abbr;
  4574. } else {
  4575. newLocaleData = getLocale(key);
  4576. if (newLocaleData != null) {
  4577. this._locale = newLocaleData;
  4578. }
  4579. return this;
  4580. }
  4581. }
  4582. var lang = deprecate(
  4583. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4584. function (key) {
  4585. if (key === undefined) {
  4586. return this.localeData();
  4587. } else {
  4588. return this.locale(key);
  4589. }
  4590. }
  4591. );
  4592. function localeData () {
  4593. return this._locale;
  4594. }
  4595. function startOf (units) {
  4596. units = normalizeUnits(units);
  4597. // the following switch intentionally omits break keywords
  4598. // to utilize falling through the cases.
  4599. switch (units) {
  4600. case 'year':
  4601. this.month(0);
  4602. /* falls through */
  4603. case 'quarter':
  4604. case 'month':
  4605. this.date(1);
  4606. /* falls through */
  4607. case 'week':
  4608. case 'isoWeek':
  4609. case 'day':
  4610. case 'date':
  4611. this.hours(0);
  4612. /* falls through */
  4613. case 'hour':
  4614. this.minutes(0);
  4615. /* falls through */
  4616. case 'minute':
  4617. this.seconds(0);
  4618. /* falls through */
  4619. case 'second':
  4620. this.milliseconds(0);
  4621. }
  4622. // weeks are a special case
  4623. if (units === 'week') {
  4624. this.weekday(0);
  4625. }
  4626. if (units === 'isoWeek') {
  4627. this.isoWeekday(1);
  4628. }
  4629. // quarters are also special
  4630. if (units === 'quarter') {
  4631. this.month(Math.floor(this.month() / 3) * 3);
  4632. }
  4633. return this;
  4634. }
  4635. function endOf (units) {
  4636. units = normalizeUnits(units);
  4637. if (units === undefined || units === 'millisecond') {
  4638. return this;
  4639. }
  4640. // 'date' is an alias for 'day', so it should be considered as such.
  4641. if (units === 'date') {
  4642. units = 'day';
  4643. }
  4644. return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
  4645. }
  4646. function valueOf () {
  4647. return this._d.valueOf() - ((this._offset || 0) * 60000);
  4648. }
  4649. function unix () {
  4650. return Math.floor(this.valueOf() / 1000);
  4651. }
  4652. function toDate () {
  4653. return new Date(this.valueOf());
  4654. }
  4655. function toArray () {
  4656. var m = this;
  4657. return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
  4658. }
  4659. function toObject () {
  4660. var m = this;
  4661. return {
  4662. years: m.year(),
  4663. months: m.month(),
  4664. date: m.date(),
  4665. hours: m.hours(),
  4666. minutes: m.minutes(),
  4667. seconds: m.seconds(),
  4668. milliseconds: m.milliseconds()
  4669. };
  4670. }
  4671. function toJSON () {
  4672. // new Date(NaN).toJSON() === null
  4673. return this.isValid() ? this.toISOString() : null;
  4674. }
  4675. function isValid$2 () {
  4676. return isValid(this);
  4677. }
  4678. function parsingFlags () {
  4679. return extend({}, getParsingFlags(this));
  4680. }
  4681. function invalidAt () {
  4682. return getParsingFlags(this).overflow;
  4683. }
  4684. function creationData() {
  4685. return {
  4686. input: this._i,
  4687. format: this._f,
  4688. locale: this._locale,
  4689. isUTC: this._isUTC,
  4690. strict: this._strict
  4691. };
  4692. }
  4693. // FORMATTING
  4694. addFormatToken(0, ['gg', 2], 0, function () {
  4695. return this.weekYear() % 100;
  4696. });
  4697. addFormatToken(0, ['GG', 2], 0, function () {
  4698. return this.isoWeekYear() % 100;
  4699. });
  4700. function addWeekYearFormatToken (token, getter) {
  4701. addFormatToken(0, [token, token.length], 0, getter);
  4702. }
  4703. addWeekYearFormatToken('gggg', 'weekYear');
  4704. addWeekYearFormatToken('ggggg', 'weekYear');
  4705. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4706. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4707. // ALIASES
  4708. addUnitAlias('weekYear', 'gg');
  4709. addUnitAlias('isoWeekYear', 'GG');
  4710. // PRIORITY
  4711. addUnitPriority('weekYear', 1);
  4712. addUnitPriority('isoWeekYear', 1);
  4713. // PARSING
  4714. addRegexToken('G', matchSigned);
  4715. addRegexToken('g', matchSigned);
  4716. addRegexToken('GG', match1to2, match2);
  4717. addRegexToken('gg', match1to2, match2);
  4718. addRegexToken('GGGG', match1to4, match4);
  4719. addRegexToken('gggg', match1to4, match4);
  4720. addRegexToken('GGGGG', match1to6, match6);
  4721. addRegexToken('ggggg', match1to6, match6);
  4722. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
  4723. week[token.substr(0, 2)] = toInt(input);
  4724. });
  4725. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4726. week[token] = hooks.parseTwoDigitYear(input);
  4727. });
  4728. // MOMENTS
  4729. function getSetWeekYear (input) {
  4730. return getSetWeekYearHelper.call(this,
  4731. input,
  4732. this.week(),
  4733. this.weekday(),
  4734. this.localeData()._week.dow,
  4735. this.localeData()._week.doy);
  4736. }
  4737. function getSetISOWeekYear (input) {
  4738. return getSetWeekYearHelper.call(this,
  4739. input, this.isoWeek(), this.isoWeekday(), 1, 4);
  4740. }
  4741. function getISOWeeksInYear () {
  4742. return weeksInYear(this.year(), 1, 4);
  4743. }
  4744. function getWeeksInYear () {
  4745. var weekInfo = this.localeData()._week;
  4746. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  4747. }
  4748. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  4749. var weeksTarget;
  4750. if (input == null) {
  4751. return weekOfYear(this, dow, doy).year;
  4752. } else {
  4753. weeksTarget = weeksInYear(input, dow, doy);
  4754. if (week > weeksTarget) {
  4755. week = weeksTarget;
  4756. }
  4757. return setWeekAll.call(this, input, week, weekday, dow, doy);
  4758. }
  4759. }
  4760. function setWeekAll(weekYear, week, weekday, dow, doy) {
  4761. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  4762. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  4763. this.year(date.getUTCFullYear());
  4764. this.month(date.getUTCMonth());
  4765. this.date(date.getUTCDate());
  4766. return this;
  4767. }
  4768. // FORMATTING
  4769. addFormatToken('Q', 0, 'Qo', 'quarter');
  4770. // ALIASES
  4771. addUnitAlias('quarter', 'Q');
  4772. // PRIORITY
  4773. addUnitPriority('quarter', 7);
  4774. // PARSING
  4775. addRegexToken('Q', match1);
  4776. addParseToken('Q', function (input, array) {
  4777. array[MONTH] = (toInt(input) - 1) * 3;
  4778. });
  4779. // MOMENTS
  4780. function getSetQuarter (input) {
  4781. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  4782. }
  4783. // FORMATTING
  4784. addFormatToken('D', ['DD', 2], 'Do', 'date');
  4785. // ALIASES
  4786. addUnitAlias('date', 'D');
  4787. // PRIOROITY
  4788. addUnitPriority('date', 9);
  4789. // PARSING
  4790. addRegexToken('D', match1to2);
  4791. addRegexToken('DD', match1to2, match2);
  4792. addRegexToken('Do', function (isStrict, locale) {
  4793. // TODO: Remove "ordinalParse" fallback in next major release.
  4794. return isStrict ?
  4795. (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
  4796. locale._dayOfMonthOrdinalParseLenient;
  4797. });
  4798. addParseToken(['D', 'DD'], DATE);
  4799. addParseToken('Do', function (input, array) {
  4800. array[DATE] = toInt(input.match(match1to2)[0], 10);
  4801. });
  4802. // MOMENTS
  4803. var getSetDayOfMonth = makeGetSet('Date', true);
  4804. // FORMATTING
  4805. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  4806. // ALIASES
  4807. addUnitAlias('dayOfYear', 'DDD');
  4808. // PRIORITY
  4809. addUnitPriority('dayOfYear', 4);
  4810. // PARSING
  4811. addRegexToken('DDD', match1to3);
  4812. addRegexToken('DDDD', match3);
  4813. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  4814. config._dayOfYear = toInt(input);
  4815. });
  4816. // HELPERS
  4817. // MOMENTS
  4818. function getSetDayOfYear (input) {
  4819. var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
  4820. return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
  4821. }
  4822. // FORMATTING
  4823. addFormatToken('m', ['mm', 2], 0, 'minute');
  4824. // ALIASES
  4825. addUnitAlias('minute', 'm');
  4826. // PRIORITY
  4827. addUnitPriority('minute', 14);
  4828. // PARSING
  4829. addRegexToken('m', match1to2);
  4830. addRegexToken('mm', match1to2, match2);
  4831. addParseToken(['m', 'mm'], MINUTE);
  4832. // MOMENTS
  4833. var getSetMinute = makeGetSet('Minutes', false);
  4834. // FORMATTING
  4835. addFormatToken('s', ['ss', 2], 0, 'second');
  4836. // ALIASES
  4837. addUnitAlias('second', 's');
  4838. // PRIORITY
  4839. addUnitPriority('second', 15);
  4840. // PARSING
  4841. addRegexToken('s', match1to2);
  4842. addRegexToken('ss', match1to2, match2);
  4843. addParseToken(['s', 'ss'], SECOND);
  4844. // MOMENTS
  4845. var getSetSecond = makeGetSet('Seconds', false);
  4846. // FORMATTING
  4847. addFormatToken('S', 0, 0, function () {
  4848. return ~~(this.millisecond() / 100);
  4849. });
  4850. addFormatToken(0, ['SS', 2], 0, function () {
  4851. return ~~(this.millisecond() / 10);
  4852. });
  4853. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  4854. addFormatToken(0, ['SSSS', 4], 0, function () {
  4855. return this.millisecond() * 10;
  4856. });
  4857. addFormatToken(0, ['SSSSS', 5], 0, function () {
  4858. return this.millisecond() * 100;
  4859. });
  4860. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  4861. return this.millisecond() * 1000;
  4862. });
  4863. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  4864. return this.millisecond() * 10000;
  4865. });
  4866. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  4867. return this.millisecond() * 100000;
  4868. });
  4869. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  4870. return this.millisecond() * 1000000;
  4871. });
  4872. // ALIASES
  4873. addUnitAlias('millisecond', 'ms');
  4874. // PRIORITY
  4875. addUnitPriority('millisecond', 16);
  4876. // PARSING
  4877. addRegexToken('S', match1to3, match1);
  4878. addRegexToken('SS', match1to3, match2);
  4879. addRegexToken('SSS', match1to3, match3);
  4880. var token;
  4881. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  4882. addRegexToken(token, matchUnsigned);
  4883. }
  4884. function parseMs(input, array) {
  4885. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  4886. }
  4887. for (token = 'S'; token.length <= 9; token += 'S') {
  4888. addParseToken(token, parseMs);
  4889. }
  4890. // MOMENTS
  4891. var getSetMillisecond = makeGetSet('Milliseconds', false);
  4892. // FORMATTING
  4893. addFormatToken('z', 0, 0, 'zoneAbbr');
  4894. addFormatToken('zz', 0, 0, 'zoneName');
  4895. // MOMENTS
  4896. function getZoneAbbr () {
  4897. return this._isUTC ? 'UTC' : '';
  4898. }
  4899. function getZoneName () {
  4900. return this._isUTC ? 'Coordinated Universal Time' : '';
  4901. }
  4902. var proto = Moment.prototype;
  4903. proto.add = add;
  4904. proto.calendar = calendar$1;
  4905. proto.clone = clone;
  4906. proto.diff = diff;
  4907. proto.endOf = endOf;
  4908. proto.format = format;
  4909. proto.from = from;
  4910. proto.fromNow = fromNow;
  4911. proto.to = to;
  4912. proto.toNow = toNow;
  4913. proto.get = stringGet;
  4914. proto.invalidAt = invalidAt;
  4915. proto.isAfter = isAfter;
  4916. proto.isBefore = isBefore;
  4917. proto.isBetween = isBetween;
  4918. proto.isSame = isSame;
  4919. proto.isSameOrAfter = isSameOrAfter;
  4920. proto.isSameOrBefore = isSameOrBefore;
  4921. proto.isValid = isValid$2;
  4922. proto.lang = lang;
  4923. proto.locale = locale;
  4924. proto.localeData = localeData;
  4925. proto.max = prototypeMax;
  4926. proto.min = prototypeMin;
  4927. proto.parsingFlags = parsingFlags;
  4928. proto.set = stringSet;
  4929. proto.startOf = startOf;
  4930. proto.subtract = subtract;
  4931. proto.toArray = toArray;
  4932. proto.toObject = toObject;
  4933. proto.toDate = toDate;
  4934. proto.toISOString = toISOString;
  4935. proto.inspect = inspect;
  4936. proto.toJSON = toJSON;
  4937. proto.toString = toString;
  4938. proto.unix = unix;
  4939. proto.valueOf = valueOf;
  4940. proto.creationData = creationData;
  4941. // Year
  4942. proto.year = getSetYear;
  4943. proto.isLeapYear = getIsLeapYear;
  4944. // Week Year
  4945. proto.weekYear = getSetWeekYear;
  4946. proto.isoWeekYear = getSetISOWeekYear;
  4947. // Quarter
  4948. proto.quarter = proto.quarters = getSetQuarter;
  4949. // Month
  4950. proto.month = getSetMonth;
  4951. proto.daysInMonth = getDaysInMonth;
  4952. // Week
  4953. proto.week = proto.weeks = getSetWeek;
  4954. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  4955. proto.weeksInYear = getWeeksInYear;
  4956. proto.isoWeeksInYear = getISOWeeksInYear;
  4957. // Day
  4958. proto.date = getSetDayOfMonth;
  4959. proto.day = proto.days = getSetDayOfWeek;
  4960. proto.weekday = getSetLocaleDayOfWeek;
  4961. proto.isoWeekday = getSetISODayOfWeek;
  4962. proto.dayOfYear = getSetDayOfYear;
  4963. // Hour
  4964. proto.hour = proto.hours = getSetHour;
  4965. // Minute
  4966. proto.minute = proto.minutes = getSetMinute;
  4967. // Second
  4968. proto.second = proto.seconds = getSetSecond;
  4969. // Millisecond
  4970. proto.millisecond = proto.milliseconds = getSetMillisecond;
  4971. // Offset
  4972. proto.utcOffset = getSetOffset;
  4973. proto.utc = setOffsetToUTC;
  4974. proto.local = setOffsetToLocal;
  4975. proto.parseZone = setOffsetToParsedOffset;
  4976. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  4977. proto.isDST = isDaylightSavingTime;
  4978. proto.isLocal = isLocal;
  4979. proto.isUtcOffset = isUtcOffset;
  4980. proto.isUtc = isUtc;
  4981. proto.isUTC = isUtc;
  4982. // Timezone
  4983. proto.zoneAbbr = getZoneAbbr;
  4984. proto.zoneName = getZoneName;
  4985. // Deprecations
  4986. proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  4987. proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  4988. proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  4989. proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
  4990. proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
  4991. function createUnix (input) {
  4992. return createLocal(input * 1000);
  4993. }
  4994. function createInZone () {
  4995. return createLocal.apply(null, arguments).parseZone();
  4996. }
  4997. function preParsePostFormat (string) {
  4998. return string;
  4999. }
  5000. var proto$1 = Locale.prototype;
  5001. proto$1.calendar = calendar;
  5002. proto$1.longDateFormat = longDateFormat;
  5003. proto$1.invalidDate = invalidDate;
  5004. proto$1.ordinal = ordinal;
  5005. proto$1.preparse = preParsePostFormat;
  5006. proto$1.postformat = preParsePostFormat;
  5007. proto$1.relativeTime = relativeTime;
  5008. proto$1.pastFuture = pastFuture;
  5009. proto$1.set = set;
  5010. // Month
  5011. proto$1.months = localeMonths;
  5012. proto$1.monthsShort = localeMonthsShort;
  5013. proto$1.monthsParse = localeMonthsParse;
  5014. proto$1.monthsRegex = monthsRegex;
  5015. proto$1.monthsShortRegex = monthsShortRegex;
  5016. // Week
  5017. proto$1.week = localeWeek;
  5018. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5019. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5020. // Day of Week
  5021. proto$1.weekdays = localeWeekdays;
  5022. proto$1.weekdaysMin = localeWeekdaysMin;
  5023. proto$1.weekdaysShort = localeWeekdaysShort;
  5024. proto$1.weekdaysParse = localeWeekdaysParse;
  5025. proto$1.weekdaysRegex = weekdaysRegex;
  5026. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5027. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5028. // Hours
  5029. proto$1.isPM = localeIsPM;
  5030. proto$1.meridiem = localeMeridiem;
  5031. function get$1 (format, index, field, setter) {
  5032. var locale = getLocale();
  5033. var utc = createUTC().set(setter, index);
  5034. return locale[field](utc, format);
  5035. }
  5036. function listMonthsImpl (format, index, field) {
  5037. if (isNumber(format)) {
  5038. index = format;
  5039. format = undefined;
  5040. }
  5041. format = format || '';
  5042. if (index != null) {
  5043. return get$1(format, index, field, 'month');
  5044. }
  5045. var i;
  5046. var out = [];
  5047. for (i = 0; i < 12; i++) {
  5048. out[i] = get$1(format, i, field, 'month');
  5049. }
  5050. return out;
  5051. }
  5052. // ()
  5053. // (5)
  5054. // (fmt, 5)
  5055. // (fmt)
  5056. // (true)
  5057. // (true, 5)
  5058. // (true, fmt, 5)
  5059. // (true, fmt)
  5060. function listWeekdaysImpl (localeSorted, format, index, field) {
  5061. if (typeof localeSorted === 'boolean') {
  5062. if (isNumber(format)) {
  5063. index = format;
  5064. format = undefined;
  5065. }
  5066. format = format || '';
  5067. } else {
  5068. format = localeSorted;
  5069. index = format;
  5070. localeSorted = false;
  5071. if (isNumber(format)) {
  5072. index = format;
  5073. format = undefined;
  5074. }
  5075. format = format || '';
  5076. }
  5077. var locale = getLocale(),
  5078. shift = localeSorted ? locale._week.dow : 0;
  5079. if (index != null) {
  5080. return get$1(format, (index + shift) % 7, field, 'day');
  5081. }
  5082. var i;
  5083. var out = [];
  5084. for (i = 0; i < 7; i++) {
  5085. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5086. }
  5087. return out;
  5088. }
  5089. function listMonths (format, index) {
  5090. return listMonthsImpl(format, index, 'months');
  5091. }
  5092. function listMonthsShort (format, index) {
  5093. return listMonthsImpl(format, index, 'monthsShort');
  5094. }
  5095. function listWeekdays (localeSorted, format, index) {
  5096. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5097. }
  5098. function listWeekdaysShort (localeSorted, format, index) {
  5099. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5100. }
  5101. function listWeekdaysMin (localeSorted, format, index) {
  5102. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5103. }
  5104. getSetGlobalLocale('en', {
  5105. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5106. ordinal : function (number) {
  5107. var b = number % 10,
  5108. output = (toInt(number % 100 / 10) === 1) ? 'th' :
  5109. (b === 1) ? 'st' :
  5110. (b === 2) ? 'nd' :
  5111. (b === 3) ? 'rd' : 'th';
  5112. return number + output;
  5113. }
  5114. });
  5115. // Side effect imports
  5116. hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
  5117. hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
  5118. var mathAbs = Math.abs;
  5119. function abs () {
  5120. var data = this._data;
  5121. this._milliseconds = mathAbs(this._milliseconds);
  5122. this._days = mathAbs(this._days);
  5123. this._months = mathAbs(this._months);
  5124. data.milliseconds = mathAbs(data.milliseconds);
  5125. data.seconds = mathAbs(data.seconds);
  5126. data.minutes = mathAbs(data.minutes);
  5127. data.hours = mathAbs(data.hours);
  5128. data.months = mathAbs(data.months);
  5129. data.years = mathAbs(data.years);
  5130. return this;
  5131. }
  5132. function addSubtract$1 (duration, input, value, direction) {
  5133. var other = createDuration(input, value);
  5134. duration._milliseconds += direction * other._milliseconds;
  5135. duration._days += direction * other._days;
  5136. duration._months += direction * other._months;
  5137. return duration._bubble();
  5138. }
  5139. // supports only 2.0-style add(1, 's') or add(duration)
  5140. function add$1 (input, value) {
  5141. return addSubtract$1(this, input, value, 1);
  5142. }
  5143. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5144. function subtract$1 (input, value) {
  5145. return addSubtract$1(this, input, value, -1);
  5146. }
  5147. function absCeil (number) {
  5148. if (number < 0) {
  5149. return Math.floor(number);
  5150. } else {
  5151. return Math.ceil(number);
  5152. }
  5153. }
  5154. function bubble () {
  5155. var milliseconds = this._milliseconds;
  5156. var days = this._days;
  5157. var months = this._months;
  5158. var data = this._data;
  5159. var seconds, minutes, hours, years, monthsFromDays;
  5160. // if we have a mix of positive and negative values, bubble down first
  5161. // check: https://github.com/moment/moment/issues/2166
  5162. if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
  5163. (milliseconds <= 0 && days <= 0 && months <= 0))) {
  5164. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5165. days = 0;
  5166. months = 0;
  5167. }
  5168. // The following code bubbles up values, see the tests for
  5169. // examples of what that means.
  5170. data.milliseconds = milliseconds % 1000;
  5171. seconds = absFloor(milliseconds / 1000);
  5172. data.seconds = seconds % 60;
  5173. minutes = absFloor(seconds / 60);
  5174. data.minutes = minutes % 60;
  5175. hours = absFloor(minutes / 60);
  5176. data.hours = hours % 24;
  5177. days += absFloor(hours / 24);
  5178. // convert days to months
  5179. monthsFromDays = absFloor(daysToMonths(days));
  5180. months += monthsFromDays;
  5181. days -= absCeil(monthsToDays(monthsFromDays));
  5182. // 12 months -> 1 year
  5183. years = absFloor(months / 12);
  5184. months %= 12;
  5185. data.days = days;
  5186. data.months = months;
  5187. data.years = years;
  5188. return this;
  5189. }
  5190. function daysToMonths (days) {
  5191. // 400 years have 146097 days (taking into account leap year rules)
  5192. // 400 years have 12 months === 4800
  5193. return days * 4800 / 146097;
  5194. }
  5195. function monthsToDays (months) {
  5196. // the reverse of daysToMonths
  5197. return months * 146097 / 4800;
  5198. }
  5199. function as (units) {
  5200. if (!this.isValid()) {
  5201. return NaN;
  5202. }
  5203. var days;
  5204. var months;
  5205. var milliseconds = this._milliseconds;
  5206. units = normalizeUnits(units);
  5207. if (units === 'month' || units === 'year') {
  5208. days = this._days + milliseconds / 864e5;
  5209. months = this._months + daysToMonths(days);
  5210. return units === 'month' ? months : months / 12;
  5211. } else {
  5212. // handle milliseconds separately because of floating point math errors (issue #1867)
  5213. days = this._days + Math.round(monthsToDays(this._months));
  5214. switch (units) {
  5215. case 'week' : return days / 7 + milliseconds / 6048e5;
  5216. case 'day' : return days + milliseconds / 864e5;
  5217. case 'hour' : return days * 24 + milliseconds / 36e5;
  5218. case 'minute' : return days * 1440 + milliseconds / 6e4;
  5219. case 'second' : return days * 86400 + milliseconds / 1000;
  5220. // Math.floor prevents floating point math errors here
  5221. case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
  5222. default: throw new Error('Unknown unit ' + units);
  5223. }
  5224. }
  5225. }
  5226. // TODO: Use this.as('ms')?
  5227. function valueOf$1 () {
  5228. if (!this.isValid()) {
  5229. return NaN;
  5230. }
  5231. return (
  5232. this._milliseconds +
  5233. this._days * 864e5 +
  5234. (this._months % 12) * 2592e6 +
  5235. toInt(this._months / 12) * 31536e6
  5236. );
  5237. }
  5238. function makeAs (alias) {
  5239. return function () {
  5240. return this.as(alias);
  5241. };
  5242. }
  5243. var asMilliseconds = makeAs('ms');
  5244. var asSeconds = makeAs('s');
  5245. var asMinutes = makeAs('m');
  5246. var asHours = makeAs('h');
  5247. var asDays = makeAs('d');
  5248. var asWeeks = makeAs('w');
  5249. var asMonths = makeAs('M');
  5250. var asYears = makeAs('y');
  5251. function get$2 (units) {
  5252. units = normalizeUnits(units);
  5253. return this.isValid() ? this[units + 's']() : NaN;
  5254. }
  5255. function makeGetter(name) {
  5256. return function () {
  5257. return this.isValid() ? this._data[name] : NaN;
  5258. };
  5259. }
  5260. var milliseconds = makeGetter('milliseconds');
  5261. var seconds = makeGetter('seconds');
  5262. var minutes = makeGetter('minutes');
  5263. var hours = makeGetter('hours');
  5264. var days = makeGetter('days');
  5265. var months = makeGetter('months');
  5266. var years = makeGetter('years');
  5267. function weeks () {
  5268. return absFloor(this.days() / 7);
  5269. }
  5270. var round = Math.round;
  5271. var thresholds = {
  5272. ss: 44, // a few seconds to seconds
  5273. s : 45, // seconds to minute
  5274. m : 45, // minutes to hour
  5275. h : 22, // hours to day
  5276. d : 26, // days to month
  5277. M : 11 // months to year
  5278. };
  5279. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5280. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5281. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5282. }
  5283. function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
  5284. var duration = createDuration(posNegDuration).abs();
  5285. var seconds = round(duration.as('s'));
  5286. var minutes = round(duration.as('m'));
  5287. var hours = round(duration.as('h'));
  5288. var days = round(duration.as('d'));
  5289. var months = round(duration.as('M'));
  5290. var years = round(duration.as('y'));
  5291. var a = seconds <= thresholds.ss && ['s', seconds] ||
  5292. seconds < thresholds.s && ['ss', seconds] ||
  5293. minutes <= 1 && ['m'] ||
  5294. minutes < thresholds.m && ['mm', minutes] ||
  5295. hours <= 1 && ['h'] ||
  5296. hours < thresholds.h && ['hh', hours] ||
  5297. days <= 1 && ['d'] ||
  5298. days < thresholds.d && ['dd', days] ||
  5299. months <= 1 && ['M'] ||
  5300. months < thresholds.M && ['MM', months] ||
  5301. years <= 1 && ['y'] || ['yy', years];
  5302. a[2] = withoutSuffix;
  5303. a[3] = +posNegDuration > 0;
  5304. a[4] = locale;
  5305. return substituteTimeAgo.apply(null, a);
  5306. }
  5307. // This function allows you to set the rounding function for relative time strings
  5308. function getSetRelativeTimeRounding (roundingFunction) {
  5309. if (roundingFunction === undefined) {
  5310. return round;
  5311. }
  5312. if (typeof(roundingFunction) === 'function') {
  5313. round = roundingFunction;
  5314. return true;
  5315. }
  5316. return false;
  5317. }
  5318. // This function allows you to set a threshold for relative time strings
  5319. function getSetRelativeTimeThreshold (threshold, limit) {
  5320. if (thresholds[threshold] === undefined) {
  5321. return false;
  5322. }
  5323. if (limit === undefined) {
  5324. return thresholds[threshold];
  5325. }
  5326. thresholds[threshold] = limit;
  5327. if (threshold === 's') {
  5328. thresholds.ss = limit - 1;
  5329. }
  5330. return true;
  5331. }
  5332. function humanize (withSuffix) {
  5333. if (!this.isValid()) {
  5334. return this.localeData().invalidDate();
  5335. }
  5336. var locale = this.localeData();
  5337. var output = relativeTime$1(this, !withSuffix, locale);
  5338. if (withSuffix) {
  5339. output = locale.pastFuture(+this, output);
  5340. }
  5341. return locale.postformat(output);
  5342. }
  5343. var abs$1 = Math.abs;
  5344. function toISOString$1() {
  5345. // for ISO strings we do not use the normal bubbling rules:
  5346. // * milliseconds bubble up until they become hours
  5347. // * days do not bubble at all
  5348. // * months bubble up until they become years
  5349. // This is because there is no context-free conversion between hours and days
  5350. // (think of clock changes)
  5351. // and also not between days and months (28-31 days per month)
  5352. if (!this.isValid()) {
  5353. return this.localeData().invalidDate();
  5354. }
  5355. var seconds = abs$1(this._milliseconds) / 1000;
  5356. var days = abs$1(this._days);
  5357. var months = abs$1(this._months);
  5358. var minutes, hours, years;
  5359. // 3600 seconds -> 60 minutes -> 1 hour
  5360. minutes = absFloor(seconds / 60);
  5361. hours = absFloor(minutes / 60);
  5362. seconds %= 60;
  5363. minutes %= 60;
  5364. // 12 months -> 1 year
  5365. years = absFloor(months / 12);
  5366. months %= 12;
  5367. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5368. var Y = years;
  5369. var M = months;
  5370. var D = days;
  5371. var h = hours;
  5372. var m = minutes;
  5373. var s = seconds;
  5374. var total = this.asSeconds();
  5375. if (!total) {
  5376. // this is the same as C#'s (Noda) and python (isodate)...
  5377. // but not other JS (goog.date)
  5378. return 'P0D';
  5379. }
  5380. return (total < 0 ? '-' : '') +
  5381. 'P' +
  5382. (Y ? Y + 'Y' : '') +
  5383. (M ? M + 'M' : '') +
  5384. (D ? D + 'D' : '') +
  5385. ((h || m || s) ? 'T' : '') +
  5386. (h ? h + 'H' : '') +
  5387. (m ? m + 'M' : '') +
  5388. (s ? s + 'S' : '');
  5389. }
  5390. var proto$2 = Duration.prototype;
  5391. proto$2.isValid = isValid$1;
  5392. proto$2.abs = abs;
  5393. proto$2.add = add$1;
  5394. proto$2.subtract = subtract$1;
  5395. proto$2.as = as;
  5396. proto$2.asMilliseconds = asMilliseconds;
  5397. proto$2.asSeconds = asSeconds;
  5398. proto$2.asMinutes = asMinutes;
  5399. proto$2.asHours = asHours;
  5400. proto$2.asDays = asDays;
  5401. proto$2.asWeeks = asWeeks;
  5402. proto$2.asMonths = asMonths;
  5403. proto$2.asYears = asYears;
  5404. proto$2.valueOf = valueOf$1;
  5405. proto$2._bubble = bubble;
  5406. proto$2.get = get$2;
  5407. proto$2.milliseconds = milliseconds;
  5408. proto$2.seconds = seconds;
  5409. proto$2.minutes = minutes;
  5410. proto$2.hours = hours;
  5411. proto$2.days = days;
  5412. proto$2.weeks = weeks;
  5413. proto$2.months = months;
  5414. proto$2.years = years;
  5415. proto$2.humanize = humanize;
  5416. proto$2.toISOString = toISOString$1;
  5417. proto$2.toString = toISOString$1;
  5418. proto$2.toJSON = toISOString$1;
  5419. proto$2.locale = locale;
  5420. proto$2.localeData = localeData;
  5421. // Deprecations
  5422. proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
  5423. proto$2.lang = lang;
  5424. // Side effect imports
  5425. // FORMATTING
  5426. addFormatToken('X', 0, 0, 'unix');
  5427. addFormatToken('x', 0, 0, 'valueOf');
  5428. // PARSING
  5429. addRegexToken('x', matchSigned);
  5430. addRegexToken('X', matchTimestamp);
  5431. addParseToken('X', function (input, array, config) {
  5432. config._d = new Date(parseFloat(input, 10) * 1000);
  5433. });
  5434. addParseToken('x', function (input, array, config) {
  5435. config._d = new Date(toInt(input));
  5436. });
  5437. // Side effect imports
  5438. hooks.version = '2.18.1';
  5439. setHookCallback(createLocal);
  5440. hooks.fn = proto;
  5441. hooks.min = min;
  5442. hooks.max = max;
  5443. hooks.now = now;
  5444. hooks.utc = createUTC;
  5445. hooks.unix = createUnix;
  5446. hooks.months = listMonths;
  5447. hooks.isDate = isDate;
  5448. hooks.locale = getSetGlobalLocale;
  5449. hooks.invalid = createInvalid;
  5450. hooks.duration = createDuration;
  5451. hooks.isMoment = isMoment;
  5452. hooks.weekdays = listWeekdays;
  5453. hooks.parseZone = createInZone;
  5454. hooks.localeData = getLocale;
  5455. hooks.isDuration = isDuration;
  5456. hooks.monthsShort = listMonthsShort;
  5457. hooks.weekdaysMin = listWeekdaysMin;
  5458. hooks.defineLocale = defineLocale;
  5459. hooks.updateLocale = updateLocale;
  5460. hooks.locales = listLocales;
  5461. hooks.weekdaysShort = listWeekdaysShort;
  5462. hooks.normalizeUnits = normalizeUnits;
  5463. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5464. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5465. hooks.calendarFormat = getCalendarFormat;
  5466. hooks.prototype = proto;
  5467. return hooks;
  5468. })));
  5469. define('moment', ['moment/moment'], function (main) { return main; });
  5470. define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], function ($, undefined, Toastr, Layer, Lang, Moment) {
  5471. var Backend = {
  5472. config: {
  5473. //toastr默认配置
  5474. toastr: {
  5475. "closeButton": true,
  5476. "debug": false,
  5477. "newestOnTop": false,
  5478. "progressBar": false,
  5479. "positionClass": "toast-top-right",
  5480. "preventDuplicates": false,
  5481. "onclick": null,
  5482. "showDuration": "300",
  5483. "hideDuration": "1000",
  5484. "timeOut": "5000",
  5485. "extendedTimeOut": "1000",
  5486. "showEasing": "swing",
  5487. "hideEasing": "linear",
  5488. "showMethod": "fadeIn",
  5489. "hideMethod": "fadeOut"
  5490. }
  5491. },
  5492. api: {
  5493. ajax: function (options, success, failure) {
  5494. var index = Backend.api.layer.load();
  5495. options = $.extend({
  5496. type: "POST",
  5497. dataType: 'json',
  5498. success: function (ret) {
  5499. Backend.api.layer.close(index);
  5500. if (ret.hasOwnProperty("code")) {
  5501. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  5502. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  5503. if (ret.code === 1) {
  5504. if (typeof success == 'function') {
  5505. var onAfterResult = success.call(undefined, data);
  5506. if (!onAfterResult) {
  5507. return false;
  5508. }
  5509. }
  5510. Toastr.success(msg ? msg : __('Operation completed'));
  5511. } else {
  5512. Toastr.error(msg ? msg : __('Operation failed'));
  5513. }
  5514. } else {
  5515. Toastr.error(__('Unknown data format'));
  5516. }
  5517. }, error: function () {
  5518. Backend.api.layer.close(index);
  5519. Toastr.error(__('Network error'));
  5520. }
  5521. }, options);
  5522. $.ajax(options);
  5523. },
  5524. //修复URL
  5525. fixurl: function (url) {
  5526. if (url.substr(0, 1) !== "/") {
  5527. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  5528. if (!r.test(url)) {
  5529. url = Config.moduleurl + "/" + url;
  5530. }
  5531. }
  5532. return url;
  5533. },
  5534. //查询Url参数
  5535. query: function (name, url) {
  5536. if (!url) {
  5537. url = window.location.href;
  5538. }
  5539. name = name.replace(/[\[\]]/g, "\\$&");
  5540. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  5541. results = regex.exec(url);
  5542. if (!results)
  5543. return null;
  5544. if (!results[2])
  5545. return '';
  5546. return decodeURIComponent(results[2].replace(/\+/g, " "));
  5547. },
  5548. //上传文件
  5549. upload: function (file, callback) {
  5550. var data = new FormData();
  5551. data.append("file", file);
  5552. $.ajax({
  5553. url: "ajax/upload",
  5554. data: data,
  5555. cache: false,
  5556. contentType: false,
  5557. processData: false,
  5558. type: 'POST',
  5559. dataType: 'json',
  5560. success: function (ret) {
  5561. if (ret.hasOwnProperty("code")) {
  5562. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  5563. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  5564. if (ret.code === 1) {
  5565. if (typeof callback == 'function') {
  5566. var onAfterResult = success.call(undefined, data);
  5567. if (!onAfterResult) {
  5568. return false;
  5569. }
  5570. }
  5571. if ($('.summernote').size() > 0 && data && typeof data.url !== 'undefined') {
  5572. $('.summernote').summernote("insertImage", data.url, 'filename');
  5573. }
  5574. Toastr.success(__('Operation completed'));
  5575. } else {
  5576. Toastr.error(msg ? msg : __('Operation failed'));
  5577. }
  5578. } else {
  5579. Toastr.error(__('Unknown data format'));
  5580. }
  5581. }, error: function () {
  5582. Toastr.error(__('Network error'));
  5583. }
  5584. });
  5585. },
  5586. open: function (url, title, options) {
  5587. title = title == undefined ? "" : title;
  5588. url = Backend.api.fixurl(url);
  5589. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  5590. var area;
  5591. if ($(window).width() < 800) {
  5592. area = ["95%", "95%"];
  5593. } else {
  5594. area = ['800px', '600px'];
  5595. }
  5596. Backend.api.layer.open($.extend({
  5597. type: 2,
  5598. title: title,
  5599. shadeClose: true,
  5600. shade: false,
  5601. maxmin: true,
  5602. moveOut: true,
  5603. area: area,
  5604. content: url,
  5605. zIndex: Backend.api.layer.zIndex,
  5606. skin: 'layui-layer-noborder',
  5607. success: function (layero, index) {
  5608. //$(layero).removeClass("layui-layer-border");
  5609. Backend.api.layer.setTop(layero);
  5610. var frame = Backend.api.layer.getChildFrame('html', index);
  5611. var layerfooter = frame.find(".layer-footer");
  5612. Backend.api.layerfooter(layero, index);
  5613. //绑定事件
  5614. if (layerfooter.size() > 0) {
  5615. // 监听窗口内的元素及属性变化
  5616. // Firefox和Chrome早期版本中带有前缀
  5617. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
  5618. // 选择目标节点
  5619. var target = layerfooter[0];
  5620. // 创建观察者对象
  5621. var observer = new MutationObserver(function (mutations) {
  5622. Backend.api.layerfooter(layero, index);
  5623. mutations.forEach(function (mutation) {
  5624. });
  5625. });
  5626. // 配置观察选项:
  5627. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  5628. // 传入目标节点和观察选项
  5629. observer.observe(target, config);
  5630. // 随后,你还可以停止观察
  5631. // observer.disconnect();
  5632. }
  5633. }
  5634. }, options ? options : {}));
  5635. return false;
  5636. },
  5637. layerfooter: function (layero, index) {
  5638. var frame = Backend.api.layer.getChildFrame('html', index);
  5639. var layerfooter = frame.find(".layer-footer");
  5640. if (layerfooter.size() > 0) {
  5641. $(".layui-layer-footer", layero).remove();
  5642. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  5643. footer.html(layerfooter.html());
  5644. if ($(".row", footer).size() === 0) {
  5645. $(">", footer).wrapAll("<div class='row'></div>");
  5646. }
  5647. footer.insertAfter(layero.find('.layui-layer-content'));
  5648. }
  5649. var heg = frame.outerHeight();
  5650. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  5651. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  5652. var oldheg = heg + titHeight + btnHeight;
  5653. var maxheg = 600;
  5654. if (frame.outerWidth() < 768) {
  5655. maxheg = $(window).height() - 28;
  5656. }
  5657. // 如果有.layer-footer或窗口小于600则重新排
  5658. if (layerfooter.size() > 0 || oldheg < maxheg) {
  5659. var footerHeight = layero.find('.layui-layer-footer').outerHeight() || 0;
  5660. footerHeight = 0;
  5661. if (oldheg >= maxheg) {
  5662. heg = Math.min(maxheg, oldheg) - titHeight - btnHeight - footerHeight;
  5663. }
  5664. layero.css({height: heg + titHeight + btnHeight + footerHeight});
  5665. layero.find("iframe").css({height: heg});
  5666. }
  5667. if (layerfooter.size() > 0) {
  5668. footer.on("click", ".btn", function () {
  5669. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  5670. //return;
  5671. }
  5672. $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click");
  5673. });
  5674. }
  5675. },
  5676. sidebar: function (params) {
  5677. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  5678. $colorNums = colorArr.length;
  5679. badgeList = {};
  5680. $.each(params, function (k, v) {
  5681. if (k.indexOf('/') > -1)
  5682. {
  5683. $url = Backend.api.fixurl(k);
  5684. } else
  5685. {
  5686. $url = k;
  5687. }
  5688. if ($.isArray(v))
  5689. {
  5690. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  5691. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5692. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  5693. } else
  5694. {
  5695. $nums = v;
  5696. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5697. $class = 'label';
  5698. }
  5699. //必须nums大于0才显示
  5700. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  5701. });
  5702. $.each(badgeList, function (k, v) {
  5703. var anchor = top.window.$(".treeview li a[addtabs][url='" + k + "']");
  5704. if (anchor) {
  5705. top.window.$(".pull-right-container", anchor).html(v);
  5706. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  5707. }
  5708. });
  5709. },
  5710. addtabs: function (url, title, icon) {
  5711. var dom = ".sidebar-menu li a[url='{url}']"
  5712. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5713. if (leftlink.size() > 0) {
  5714. leftlink.trigger("click");
  5715. } else {
  5716. url = Backend.api.fixurl(url);
  5717. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5718. if (leftlink.size() > 0) {
  5719. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  5720. leftlink.trigger(event);
  5721. } else {
  5722. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5723. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5724. //能找到相对地址
  5725. if (leftlink.size() > 0) {
  5726. icon = typeof icon != 'undefined' ? icon : leftlink.find("i").attr("class");
  5727. title = typeof title != 'undefined' ? title : leftlink.find("span:first").text();
  5728. leftlink.trigger("fa.event.toggleitem");
  5729. }
  5730. var navnode = $(".nav-tabs ul li a[node-url='" + url + "']");
  5731. if (navnode.size() > 0) {
  5732. navnode.trigger("click");
  5733. } else {
  5734. //追加新的tab
  5735. var id = Math.floor(new Date().valueOf() * Math.random());
  5736. icon = typeof icon != 'undefined' ? icon : 'fa fa-circle-o';
  5737. title = typeof title != 'undefined' ? title : '';
  5738. top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({url: url, addtabs: id}).appendTo(top.window.document.body).trigger("click");
  5739. }
  5740. }
  5741. }
  5742. },
  5743. success: function (options, callback) {
  5744. var type = typeof options === 'function';
  5745. if (type) {
  5746. callback = options;
  5747. }
  5748. return Backend.api.layer.msg(__('Operation completed'), $.extend({
  5749. offset: 0, icon: 1
  5750. }, type ? {} : options), callback);
  5751. },
  5752. error: function (options, callback) {
  5753. var type = typeof options === 'function';
  5754. if (type) {
  5755. callback = options;
  5756. }
  5757. return Backend.api.layer.msg(__('Operation failed'), $.extend({
  5758. offset: 0, icon: 2
  5759. }, type ? {} : options), callback);
  5760. },
  5761. toastr: Toastr,
  5762. layer: Layer
  5763. },
  5764. lang: function () {
  5765. var args = arguments,
  5766. string = args[0],
  5767. i = 1;
  5768. string = string.toLowerCase();
  5769. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  5770. if (typeof Lang[string] != 'undefined') {
  5771. if (typeof Lang[string] == 'object')
  5772. return Lang[string];
  5773. string = Lang[string];
  5774. } else if (string.indexOf('.') !== -1) {
  5775. var arr = string.split('.');
  5776. var current = Lang[arr[0]];
  5777. for (var i = 1; i < arr.length; i++) {
  5778. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  5779. if (typeof current != 'object')
  5780. break;
  5781. }
  5782. if (typeof current == 'object')
  5783. return current;
  5784. string = current;
  5785. } else {
  5786. string = args[0];
  5787. }
  5788. return string.replace(/%((%)|s|d)/g, function (m) {
  5789. // m is the matched format, e.g. %s, %d
  5790. var val = null;
  5791. if (m[2]) {
  5792. val = m[2];
  5793. } else {
  5794. val = args[i];
  5795. // A switch statement so that the formatter can be extended. Default is %s
  5796. switch (m) {
  5797. case '%d':
  5798. val = parseFloat(val);
  5799. if (isNaN(val)) {
  5800. val = 0;
  5801. }
  5802. break;
  5803. }
  5804. i++;
  5805. }
  5806. return val;
  5807. });
  5808. },
  5809. init: function () {
  5810. //公共代码
  5811. //配置Toastr的参数
  5812. Toastr.options = Backend.config.toastr;
  5813. //点击包含.btn-dialog的元素时弹出dialog
  5814. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  5815. Backend.api.open(Backend.api.fixurl($(this).attr('href')), $(this).attr('title'));
  5816. e.preventDefault();
  5817. });
  5818. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  5819. Backend.api.addtabs($(this).attr("href"), $(this).attr("title"));
  5820. e.preventDefault();
  5821. });
  5822. }
  5823. };
  5824. //将Layer暴露到全局中去
  5825. window.Layer = Layer;
  5826. //将Toastr暴露到全局中去
  5827. window.Toastr = Toastr;
  5828. //将语言方法暴露到全局中去
  5829. window.__ = Backend.lang;
  5830. //将Backend渲染至全局,以便于在子框架中调用
  5831. window.Backend = Backend;
  5832. //将Moment方法暴露到全局中去
  5833. window.Moment = Moment;
  5834. Backend.init();
  5835. return Backend;
  5836. });
  5837. /*
  5838. * bootstrap-table - v1.11.1 - 2017-02-22
  5839. * https://github.com/wenzhixin/bootstrap-table
  5840. * Copyright (c) 2017 zhixin wen
  5841. * Licensed MIT License
  5842. */
  5843. !function(a){"use strict";var b=null,c=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},d=function(b,c,d,e){var f="";return a.each(b,function(a,b){return b[c]===e?(f=b[d],!1):!0}),f},e=function(b,c){var d=-1;return a.each(b,function(a,b){return b.field===c?(d=a,!1):!0}),d},f=function(b){var c,d,e,f=0,g=[];for(c=0;c<b[0].length;c++)f+=b[0][c].colspan||1;for(c=0;c<b.length;c++)for(g[c]=[],d=0;f>d;d++)g[c][d]=!1;for(c=0;c<b.length;c++)for(d=0;d<b[c].length;d++){var h=b[c][d],i=h.rowspan||1,j=h.colspan||1,k=a.inArray(!1,g[c]);for(1===j&&(h.fieldIndex=k,"undefined"==typeof h.field&&(h.field=k)),e=0;i>e;e++)g[c+e][k]=!0;for(e=0;j>e;e++)g[c][k+e]=!0}},g=function(){if(null===b){var c,d,e=a("<p/>").addClass("fixed-table-scroll-inner"),f=a("<div/>").addClass("fixed-table-scroll-outer");f.append(e),a("body").append(f),c=e[0].offsetWidth,f.css("overflow","scroll"),d=e[0].offsetWidth,c===d&&(d=f[0].clientWidth),f.remove(),b=c-d}return b},h=function(b,d,e,f){var g=d;if("string"==typeof d){var h=d.split(".");h.length>1?(g=window,a.each(h,function(a,b){g=g[b]})):g=window[d]}return"object"==typeof g?g:"function"==typeof g?g.apply(b,e||[]):!g&&"string"==typeof d&&c.apply(this,[d].concat(e))?c.apply(this,[d].concat(e)):f},i=function(b,c,d){var e=Object.getOwnPropertyNames(b),f=Object.getOwnPropertyNames(c),g="";if(d&&e.length!==f.length)return!1;for(var h=0;h<e.length;h++)if(g=e[h],a.inArray(g,f)>-1&&b[g]!==c[g])return!1;return!0},j=function(a){return"string"==typeof a?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/`/g,"&#x60;"):a},k=function(a){for(var b in a){var c=b.split(/(?=[A-Z])/).join("-").toLowerCase();c!==b&&(a[c]=a[b],delete a[b])}return a},l=function(a,b,c){var d=a;if("string"!=typeof b||a.hasOwnProperty(b))return c?j(a[b]):a[b];var e=b.split(".");for(var f in e)e.hasOwnProperty(f)&&(d=d&&d[e[f]]);return c?j(d):d},m=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},n=function(){Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}())},o=function(b,c){this.options=c,this.$el=a(b),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};o.DEFAULTS={classes:"table table-hover",sortClass:void 0,locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",sortStable:!1,striped:!1,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:void 0,ajax:void 0,cache:!0,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(a){return a},queryParamsType:"limit",responseHandler:function(a){return a},pagination:!1,onlyInfoPagination:!1,paginationLoop:!0,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"&lsaquo;",paginationNextText:"&rsaquo;",search:!1,searchOnEnterKey:!1,strictSearch:!1,searchAlign:"right",selectItemName:"btSelectItem",showHeader:!0,showFooter:!1,showColumns:!1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,buttonsAlign:"right",smartDisplay:!0,escape:!1,minimumCountColumns:1,idField:void 0,uniqueId:void 0,cardView:!1,detailView:!1,detailFormatter:function(){return""},trimOnSearch:!0,clickToSelect:!1,singleSelect:!1,toolbar:void 0,toolbarAlign:"left",checkboxHeader:!0,sortable:!0,silentSort:!0,maintainSelected:!1,searchTimeOut:500,searchText:"",iconSize:void 0,buttonsClass:"default",iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},customSearch:a.noop,customSort:a.noop,rowStyle:function(){return{}},rowAttributes:function(){return{}},footerStyle:function(){return{}},onAll:function(){return!1},onClickCell:function(){return!1},onDblClickCell:function(){return!1},onClickRow:function(){return!1},onDblClickRow:function(){return!1},onSort:function(){return!1},onCheck:function(){return!1},onUncheck:function(){return!1},onCheckAll:function(){return!1},onUncheckAll:function(){return!1},onCheckSome:function(){return!1},onUncheckSome:function(){return!1},onLoadSuccess:function(){return!1},onLoadError:function(){return!1},onColumnSwitch:function(){return!1},onPageChange:function(){return!1},onSearch:function(){return!1},onToggle:function(){return!1},onPreBody:function(){return!1},onPostBody:function(){return!1},onPostHeader:function(){return!1},onExpandRow:function(){return!1},onCollapseRow:function(){return!1},onRefreshOptions:function(){return!1},onRefresh:function(){return!1},onResetView:function(){return!1}},o.LOCALES={},o.LOCALES["en-US"]=o.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(a){return c("%s rows per page",a)},formatShowingRows:function(a,b,d){return c("Showing %s to %s of %s rows",a,b,d)},formatDetailPagination:function(a){return c("Showing %s rows",a)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}},a.extend(o.DEFAULTS,o.LOCALES["en-US"]),o.COLUMN_DEFAULTS={radio:!1,checkbox:!1,checkboxEnabled:!0,field:void 0,title:void 0,titleTooltip:void 0,"class":void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,width:void 0,sortable:!1,order:"asc",visible:!0,switchable:!0,clickToSelect:!0,formatter:void 0,footerFormatter:void 0,events:void 0,sorter:void 0,sortName:void 0,cellStyle:void 0,searchable:!0,searchFormatter:!0,cardVisible:!0,escape:!1},o.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh"},o.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initHiddenRows(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},o.prototype.initLocale=function(){if(this.options.locale){var b=this.options.locale.split(/-|_/);b[0].toLowerCase(),b[1]&&b[1].toUpperCase(),a.fn.bootstrapTable.locales[this.options.locale]?a.extend(this.options,a.fn.bootstrapTable.locales[this.options.locale]):a.fn.bootstrapTable.locales[b.join("-")]?a.extend(this.options,a.fn.bootstrapTable.locales[b.join("-")]):a.fn.bootstrapTable.locales[b[0]]&&a.extend(this.options,a.fn.bootstrapTable.locales[b[0]])}},o.prototype.initContainer=function(){this.$container=a(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination" style="clear: both;"></div>':"",'<div class="fixed-table-container">','<div class="fixed-table-header"><table></table></div>','<div class="fixed-table-body">','<div class="fixed-table-loading">',this.options.formatLoadingMessage(),"</div>","</div>",'<div class="fixed-table-footer"><table><tr></tr></table></div>',"bottom"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination"></div>':"","</div>","</div>"].join("")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$container.find(".fixed-table-footer"),this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('<div class="clearfix"></div>'),this.$el.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),-1!==a.inArray("table-no-bordered",this.options.classes.split(" "))&&this.$tableContainer.addClass("table-no-bordered")},o.prototype.initTable=function(){var b=this,c=[],d=[];if(this.$header=this.$el.find(">thead"),this.$header.length||(this.$header=a("<thead></thead>").appendTo(this.$el)),this.$header.find("tr").each(function(){var b=[];a(this).find("th").each(function(){"undefined"!=typeof a(this).data("field")&&a(this).data("field",a(this).data("field")+""),b.push(a.extend({},{title:a(this).html(),"class":a(this).attr("class"),titleTooltip:a(this).attr("title"),rowspan:a(this).attr("rowspan")?+a(this).attr("rowspan"):void 0,colspan:a(this).attr("colspan")?+a(this).attr("colspan"):void 0},a(this).data()))}),c.push(b)}),a.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=a.extend(!0,[],c,this.options.columns),this.columns=[],f(this.options.columns),a.each(this.options.columns,function(c,d){a.each(d,function(d,e){e=a.extend({},o.COLUMN_DEFAULTS,e),"undefined"!=typeof e.fieldIndex&&(b.columns[e.fieldIndex]=e),b.options.columns[c][d]=e})}),!this.options.data.length){var e=[];this.$el.find(">tbody>tr").each(function(c){var f={};f._id=a(this).attr("id"),f._class=a(this).attr("class"),f._data=k(a(this).data()),a(this).find(">td").each(function(d){for(var g,h,i=a(this),j=+i.attr("colspan")||1,l=+i.attr("rowspan")||1;e[c]&&e[c][d];d++);for(g=d;d+j>g;g++)for(h=c;c+l>h;h++)e[h]||(e[h]=[]),e[h][g]=!0;var m=b.columns[d].field;f[m]=a(this).html(),f["_"+m+"_id"]=a(this).attr("id"),f["_"+m+"_class"]=a(this).attr("class"),f["_"+m+"_rowspan"]=a(this).attr("rowspan"),f["_"+m+"_colspan"]=a(this).attr("colspan"),f["_"+m+"_title"]=a(this).attr("title"),f["_"+m+"_data"]=k(a(this).data())}),d.push(f)}),this.options.data=d,d.length&&(this.fromHtml=!0)}},o.prototype.initHeader=function(){var b=this,d={},e=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]},a.each(this.options.columns,function(f,g){e.push("<tr>"),0===f&&!b.options.cardView&&b.options.detailView&&e.push(c('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',b.options.columns.length)),a.each(g,function(a,f){var g="",h="",i="",k="",l=c(' class="%s"',f["class"]),m=(b.options.sortOrder||f.order,"px"),n=f.width;if(void 0===f.width||b.options.cardView||"string"==typeof f.width&&-1!==f.width.indexOf("%")&&(m="%"),f.width&&"string"==typeof f.width&&(n=f.width.replace("%","").replace("px","")),h=c("text-align: %s; ",f.halign?f.halign:f.align),i=c("text-align: %s; ",f.align),k=c("vertical-align: %s; ",f.valign),k+=c("width: %s; ",!f.checkbox&&!f.radio||n?n?n+m:void 0:"36px"),"undefined"!=typeof f.fieldIndex){if(b.header.fields[f.fieldIndex]=f.field,b.header.styles[f.fieldIndex]=i+k,b.header.classes[f.fieldIndex]=l,b.header.formatters[f.fieldIndex]=f.formatter,b.header.events[f.fieldIndex]=f.events,b.header.sorters[f.fieldIndex]=f.sorter,b.header.sortNames[f.fieldIndex]=f.sortName,b.header.cellStyles[f.fieldIndex]=f.cellStyle,b.header.searchables[f.fieldIndex]=f.searchable,!f.visible)return;if(b.options.cardView&&!f.cardVisible)return;d[f.field]=f}e.push("<th"+c(' title="%s"',f.titleTooltip),f.checkbox||f.radio?c(' class="bs-checkbox %s"',f["class"]||""):l,c(' style="%s"',h+k),c(' rowspan="%s"',f.rowspan),c(' colspan="%s"',f.colspan),c(' data-field="%s"',f.field),">"),e.push(c('<div class="th-inner %s">',b.options.sortable&&f.sortable?"sortable both":"")),g=b.options.escape?j(f.title):f.title,f.checkbox&&(!b.options.singleSelect&&b.options.checkboxHeader&&(g='<input name="btSelectAll" type="checkbox" />'),b.header.stateField=f.field),f.radio&&(g="",b.header.stateField=f.field,b.options.singleSelect=!0),e.push(g),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</th>")}),e.push("</tr>")}),this.$header.html(e.join("")),this.$header.find("th[data-field]").each(function(){a(this).data(d[a(this).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(c){var d=a(this);return b.options.detailView&&d.closest(".bootstrap-table")[0]!==b.$container[0]?!1:void(b.options.sortable&&d.parent().data().sortable&&b.onSort(c))}),this.$header.children().children().off("keypress").on("keypress",function(c){if(b.options.sortable&&a(this).data().sortable){var d=c.keyCode||c.which;13==d&&b.onSort(c)}}),a(window).off("resize.bootstrap-table"),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret(),a(window).on("resize.bootstrap-table",a.proxy(this.resetWidth,this))),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(){var c=a(this).prop("checked");b[c?"checkAll":"uncheckAll"](),b.updateSelected()})},o.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},o.prototype.initData=function(a,b){this.data="append"===b?this.data.concat(a):"prepend"===b?[].concat(a).concat(this.data):a||this.options.data,this.options.data="append"===b?this.options.data.concat(a):"prepend"===b?[].concat(a).concat(this.options.data):this.data,"server"!==this.options.sidePagination&&this.initSort()},o.prototype.initSort=function(){var b=this,d=this.options.sortName,e="desc"===this.options.sortOrder?-1:1,f=a.inArray(this.options.sortName,this.header.fields),g=0;return this.options.customSort!==a.noop?void this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]):void(-1!==f&&(this.options.sortStable&&a.each(this.data,function(a,b){b.hasOwnProperty("_position")||(b._position=a)}),this.data.sort(function(c,g){b.header.sortNames[f]&&(d=b.header.sortNames[f]);var i=l(c,d,b.options.escape),j=l(g,d,b.options.escape),k=h(b.header,b.header.sorters[f],[i,j]);return void 0!==k?e*k:((void 0===i||null===i)&&(i=""),(void 0===j||null===j)&&(j=""),b.options.sortStable&&i===j&&(i=c._position,j=g._position),a.isNumeric(i)&&a.isNumeric(j)?(i=parseFloat(i),j=parseFloat(j),j>i?-1*e:e):i===j?0:("string"!=typeof i&&(i=i.toString()),-1===i.localeCompare(j)?-1*e:e))}),void 0!==this.options.sortClass&&(clearTimeout(g),g=setTimeout(function(){b.$el.removeClass(b.options.sortClass);var a=b.$header.find(c('[data-field="%s"]',b.options.sortName).index()+1);b.$el.find(c("tr td:nth-child(%s)",a)).addClass(b.options.sortClass)},250))))},o.prototype.onSort=function(b){var c="keypress"===b.type?a(b.currentTarget):a(b.currentTarget).parent(),d=this.$header.find("th").eq(c.index());return this.$header.add(this.$header_).find("span.order").remove(),this.options.sortName===c.data("field")?this.options.sortOrder="asc"===this.options.sortOrder?"desc":"asc":(this.options.sortName=c.data("field"),this.options.sortOrder="asc"===c.data("order")?"desc":"asc"),this.trigger("sort",this.options.sortName,this.options.sortOrder),c.add(d).data("order",this.options.sortOrder),this.getCaret(),"server"===this.options.sidePagination?void this.initServer(this.options.silentSort):(this.initSort(),void this.initBody())},o.prototype.initToolbar=function(){var b,d,e=this,f=[],g=0,i=0;this.$toolbar.find(".bs-bars").children().length&&a("body").append(a(this.options.toolbar)),this.$toolbar.html(""),("string"==typeof this.options.toolbar||"object"==typeof this.options.toolbar)&&a(c('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append(a(this.options.toolbar)),f=[c('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)],"string"==typeof this.options.icons&&(this.options.icons=h(null,this.options.icons)),this.options.showPaginationSwitch&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',this.options.formatPaginationSwitch()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>"),this.options.showRefresh&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" aria-label="refresh" title="%s">',this.options.formatRefresh()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>"),this.options.showToggle&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" aria-label="toggle" title="%s">',this.options.formatToggle()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>"),this.options.showColumns&&(f.push(c('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" aria-label="columns" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'),a.each(this.columns,function(a,b){if(!(b.radio||b.checkbox||e.options.cardView&&!b.cardVisible)){var d=b.visible?' checked="checked"':"";b.switchable&&(f.push(c('<li role="menuitem"><label><input type="checkbox" data-field="%s" value="%s"%s> %s</label></li>',b.field,a,d,b.title)),i++)}}),f.push("</ul>","</div>")),f.push("</div>"),(this.showToolbar||f.length>2)&&this.$toolbar.append(f.join("")),this.options.showPaginationSwitch&&this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",a.proxy(this.togglePagination,this)),this.options.showRefresh&&this.$toolbar.find('button[name="refresh"]').off("click").on("click",a.proxy(this.refresh,this)),this.options.showToggle&&this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){e.toggleView()}),this.options.showColumns&&(b=this.$toolbar.find(".keep-open"),i<=this.options.minimumCountColumns&&b.find("input").prop("disabled",!0),b.find("li").off("click").on("click",function(a){a.stopImmediatePropagation()}),b.find("input").off("click").on("click",function(){var b=a(this);e.toggleColumn(a(this).val(),b.prop("checked"),!1),e.trigger("column-switch",a(this).data("field"),b.prop("checked"))})),this.options.search&&(f=[],f.push('<div class="pull-'+this.options.searchAlign+' search">',c('<input class="form-control'+c(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>"),this.$toolbar.append(f.join("")),d=this.$toolbar.find(".search input"),d.off("keyup drop blur").on("keyup drop blur",function(b){e.options.searchOnEnterKey&&13!==b.keyCode||a.inArray(b.keyCode,[37,38,39,40])>-1||(clearTimeout(g),g=setTimeout(function(){e.onSearch(b)},e.options.searchTimeOut))}),m()&&d.off("mouseup").on("mouseup",function(a){clearTimeout(g),g=setTimeout(function(){e.onSearch(a)},e.options.searchTimeOut)}))},o.prototype.onSearch=function(b){var c=a.trim(a(b.currentTarget).val());this.options.trimOnSearch&&a(b.currentTarget).val()!==c&&a(b.currentTarget).val(c),c!==this.searchText&&(this.searchText=c,this.options.searchText=c,this.options.pageNumber=1,this.initSearch(),this.updatePagination(),this.trigger("search",c))},o.prototype.initSearch=function(){var b=this;if("server"!==this.options.sidePagination){if(this.options.customSearch!==a.noop)return void this.options.customSearch.apply(this,[this.searchText]);var c=this.searchText&&(this.options.escape?j(this.searchText):this.searchText).toLowerCase(),d=a.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=d?a.grep(this.options.data,function(b){for(var c in d)if(a.isArray(d[c])&&-1===a.inArray(b[c],d[c])||!a.isArray(d[c])&&b[c]!==d[c])return!1;return!0}):this.options.data,this.data=c?a.grep(this.data,function(d,f){for(var g=0;g<b.header.fields.length;g++)if(b.header.searchables[g]){var i,j=a.isNumeric(b.header.fields[g])?parseInt(b.header.fields[g],10):b.header.fields[g],k=b.columns[e(b.columns,j)];if("string"==typeof j){i=d;for(var l=j.split("."),m=0;m<l.length;m++)i=i[l[m]];k&&k.searchFormatter&&(i=h(k,b.header.formatters[g],[i,d,f],i))}else i=d[j];if("string"==typeof i||"number"==typeof i)if(b.options.strictSearch){if((i+"").toLowerCase()===c)return!0}else if(-1!==(i+"").toLowerCase().indexOf(c))return!0}return!1}):this.data}},o.prototype.initPagination=function(){if(!this.options.pagination)return void this.$pagination.hide();this.$pagination.show();var b,d,e,f,g,h,i,j,k,l=this,m=[],n=!1,o=this.getData(),p=this.options.pageList;if("server"!==this.options.sidePagination&&(this.options.totalRows=o.length),this.totalPages=0,this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows())this.options.pageSize=this.options.totalRows,n=!0;else if(this.options.pageSize===this.options.totalRows){var q="string"==typeof this.options.pageList?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;a.inArray(this.options.formatAllRows().toLowerCase(),q)>-1&&(n=!0)}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1,this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages&&(this.options.pageNumber=this.totalPages),this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1,this.pageTo=this.options.pageNumber*this.options.pageSize,this.pageTo>this.options.totalRows&&(this.pageTo=this.options.totalRows),m.push('<div class="pull-'+this.options.paginationDetailHAlign+' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"</span>"),!this.options.onlyInfoPagination){m.push('<span class="page-list">');var r=[c('<span class="btn-group %s">',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?"dropdown":"dropup"),'<button type="button" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',n?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if("string"==typeof this.options.pageList){var s=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");p=[],a.each(s,function(a,b){p.push(b.toUpperCase()===l.options.formatAllRows().toUpperCase()?l.options.formatAllRows():+b)})}for(a.each(p,function(a,b){if(!l.options.smartDisplay||0===a||p[a-1]<l.options.totalRows){var d;d=n?b===l.options.formatAllRows()?' class="active"':"":b===l.options.pageSize?' class="active"':"",r.push(c('<li role="menuitem"%s><a href="#">%s</a></li>',d,b))}}),r.push("</ul></span>"),m.push(this.options.formatRecordsPerPage(r.join(""))),m.push("</span>"),m.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+c(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="#">'+this.options.paginationPreText+"</a></li>"),this.totalPages<5?(d=1,e=this.totalPages):(d=this.options.pageNumber-2,e=d+4,1>d&&(d=1,e=5),e>this.totalPages&&(e=this.totalPages,d=e-4)),this.totalPages>=6&&(this.options.pageNumber>=3&&(m.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="#">',1,"</a>","</li>"),d++),this.options.pageNumber>=4&&(4==this.options.pageNumber||6==this.totalPages||7==this.totalPages?d--:m.push('<li class="page-first-separator disabled">','<a href="#">...</a>',"</li>"),e--)),this.totalPages>=7&&this.options.pageNumber>=this.totalPages-2&&d--,6==this.totalPages?this.options.pageNumber>=this.totalPages-2&&e++:this.totalPages>=7&&(7==this.totalPages||this.options.pageNumber>=this.totalPages-3)&&e++,b=d;e>=b;b++)m.push('<li class="page-number'+(b===this.options.pageNumber?" active":"")+'">','<a href="#">',b,"</a>","</li>");this.totalPages>=8&&this.options.pageNumber<=this.totalPages-4&&m.push('<li class="page-last-separator disabled">','<a href="#">...</a>',"</li>"),this.totalPages>=6&&this.options.pageNumber<=this.totalPages-3&&m.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="#">',this.totalPages,"</a>","</li>"),m.push('<li class="page-next"><a href="#">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(m.join("")),this.options.onlyInfoPagination||(f=this.$pagination.find(".page-list a"),g=this.$pagination.find(".page-first"),h=this.$pagination.find(".page-pre"),i=this.$pagination.find(".page-next"),j=this.$pagination.find(".page-last"),k=this.$pagination.find(".page-number"),this.options.smartDisplay&&(this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),(p.length<2||this.options.totalRows<=p[0])&&this.$pagination.find("span.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"]()),this.options.paginationLoop||(1===this.options.pageNumber&&h.addClass("disabled"),this.options.pageNumber===this.totalPages&&i.addClass("disabled")),n&&(this.options.pageSize=this.options.formatAllRows()),f.off("click").on("click",a.proxy(this.onPageListChange,this)),g.off("click").on("click",a.proxy(this.onPageFirst,this)),h.off("click").on("click",a.proxy(this.onPagePre,this)),i.off("click").on("click",a.proxy(this.onPageNext,this)),j.off("click").on("click",a.proxy(this.onPageLast,this)),k.off("click").on("click",a.proxy(this.onPageNumber,this)))},o.prototype.updatePagination=function(b){b&&a(b.currentTarget).hasClass("disabled")||(this.options.maintainSelected||this.resetRows(),this.initPagination(),"server"===this.options.sidePagination?this.initServer():this.initBody(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize))},o.prototype.onPageListChange=function(b){var c=a(b.currentTarget);return c.parent().addClass("active").siblings().removeClass("active"),this.options.pageSize=c.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+c.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(b),!1},o.prototype.onPageFirst=function(a){return this.options.pageNumber=1,this.updatePagination(a),!1},o.prototype.onPagePre=function(a){return this.options.pageNumber-1===0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(a),!1},o.prototype.onPageNext=function(a){return this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(a),!1},o.prototype.onPageLast=function(a){return this.options.pageNumber=this.totalPages,this.updatePagination(a),!1},o.prototype.onPageNumber=function(b){return this.options.pageNumber!==+a(b.currentTarget).text()?(this.options.pageNumber=+a(b.currentTarget).text(),this.updatePagination(b),!1):void 0},o.prototype.initRow=function(b,e){var f,g=this,i=[],k={},m=[],n="",o={},p=[];if(!(a.inArray(b,this.hiddenRows)>-1)){if(k=h(this.options,this.options.rowStyle,[b,e],k),k&&k.css)for(f in k.css)m.push(f+": "+k.css[f]);if(o=h(this.options,this.options.rowAttributes,[b,e],o))for(f in o)p.push(c('%s="%s"',f,j(o[f])));return b._data&&!a.isEmptyObject(b._data)&&a.each(b._data,function(a,b){"index"!==a&&(n+=c(' data-%s="%s"',a,b))}),i.push("<tr",c(" %s",p.join(" ")),c(' id="%s"',a.isArray(b)?void 0:b._id),c(' class="%s"',k.classes||(a.isArray(b)?void 0:b._class)),c(' data-index="%s"',e),c(' data-uniqueid="%s"',b[this.options.uniqueId]),c("%s",n),">"),this.options.cardView&&i.push(c('<td colspan="%s"><div class="card-views">',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&i.push("<td>",'<a class="detail-icon" href="#">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>"),a.each(this.header.fields,function(f,n){var o="",p=l(b,n,g.options.escape),q="",r="",s={},t="",u=g.header.classes[f],v="",w="",x="",y="",z=g.columns[f];if(!(g.fromHtml&&"undefined"==typeof p||!z.visible||g.options.cardView&&!z.cardVisible)){if(z.escape&&(p=j(p)),k=c('style="%s"',m.concat(g.header.styles[f]).join("; ")),b["_"+n+"_id"]&&(t=c(' id="%s"',b["_"+n+"_id"])),b["_"+n+"_class"]&&(u=c(' class="%s"',b["_"+n+"_class"])),b["_"+n+"_rowspan"]&&(w=c(' rowspan="%s"',b["_"+n+"_rowspan"])),b["_"+n+"_colspan"]&&(x=c(' colspan="%s"',b["_"+n+"_colspan"])),b["_"+n+"_title"]&&(y=c(' title="%s"',b["_"+n+"_title"])),s=h(g.header,g.header.cellStyles[f],[p,b,e,n],s),s.classes&&(u=c(' class="%s"',s.classes)),s.css){var A=[];for(var B in s.css)A.push(B+": "+s.css[B]);k=c('style="%s"',A.concat(g.header.styles[f]).join("; "))}q=h(z,g.header.formatters[f],[p,b,e],p),b["_"+n+"_data"]&&!a.isEmptyObject(b["_"+n+"_data"])&&a.each(b["_"+n+"_data"],function(a,b){"index"!==a&&(v+=c(' data-%s="%s"',a,b))}),z.checkbox||z.radio?(r=z.checkbox?"checkbox":r,r=z.radio?"radio":r,o=[c(g.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',z["class"]||""),"<input"+c(' data-index="%s"',e)+c(' name="%s"',g.options.selectItemName)+c(' type="%s"',r)+c(' value="%s"',b[g.options.idField])+c(' checked="%s"',q===!0||p||q&&q.checked?"checked":void 0)+c(' disabled="%s"',!z.checkboxEnabled||q&&q.disabled?"disabled":void 0)+" />",g.header.formatters[f]&&"string"==typeof q?q:"",g.options.cardView?"</div>":"</td>"].join(""),b[g.header.stateField]=q===!0||q&&q.checked):(q="undefined"==typeof q||null===q?g.options.undefinedText:q,o=g.options.cardView?['<div class="card-view">',g.options.showHeader?c('<span class="title" %s>%s</span>',k,d(g.columns,"field","title",n)):"",c('<span class="value">%s</span>',q),"</div>"].join(""):[c("<td%s %s %s %s %s %s %s>",t,u,k,v,w,x,y),q,"</td>"].join(""),g.options.cardView&&g.options.smartDisplay&&""===q&&(o='<div class="card-view"></div>')),i.push(o)}}),this.options.cardView&&i.push("</div></td>"),i.push("</tr>"),i.join(" ")}},o.prototype.initBody=function(b){var d=this,f=this.getData();this.trigger("pre-body",f),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=a("<tbody></tbody>").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=f.length);for(var g,i=a(document.createDocumentFragment()),j=this.pageFrom-1;j<this.pageTo;j++){
  5844. var k=f[j],m=this.initRow(k,j,f,i);g=g||!!m,m&&m!==!0&&i.append(m)}g||i.append('<tr class="no-records-found">'+c('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches())+"</tr>"),this.$body.html(i),b||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(b){var f=a(this),g=f.parent(),h=d.data[g.data("index")],i=f[0].cellIndex,j=d.getVisibleFields(),k=j[d.options.detailView&&!d.options.cardView?i-1:i],m=d.columns[e(d.columns,k)],n=l(h,k,d.options.escape);if(!f.find(".detail-icon").length&&(d.trigger("click"===b.type?"click-cell":"dbl-click-cell",k,n,h,f),d.trigger("click"===b.type?"click-row":"dbl-click-row",h,g,k),"click"===b.type&&d.options.clickToSelect&&m.clickToSelect)){var o=g.find(c('[name="%s"]',d.options.selectItemName));o.length&&o[0].click()}}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var b=a(this),e=b.parent().parent(),g=e.data("index"),i=f[g];if(e.next().is("tr.detail-view"))b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailOpen)),d.trigger("collapse-row",g,i),e.next().remove();else{b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailClose)),e.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>',e.find("td").length));var j=e.next().find("td"),k=h(d.options,d.options.detailFormatter,[g,i,j],"");1===j.length&&j.append(k),d.trigger("expand-row",g,i,j)}return d.resetView(),!1}),this.$selectItem=this.$body.find(c('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(b){b.stopImmediatePropagation();var c=a(this),e=c.prop("checked"),f=d.data[c.data("index")];d.options.maintainSelected&&a(this).is(":radio")&&a.each(d.options.data,function(a,b){b[d.header.stateField]=!1}),f[d.header.stateField]=e,d.options.singleSelect&&(d.$selectItem.not(this).each(function(){d.data[a(this).data("index")][d.header.stateField]=!1}),d.$selectItem.filter(":checked").not(this).prop("checked",!1)),d.updateSelected(),d.trigger(e?"check":"uncheck",f,c)}),a.each(this.header.events,function(b,c){if(c){"string"==typeof c&&(c=h(null,c));var e=d.header.fields[b],f=a.inArray(e,d.getVisibleFields());d.options.detailView&&!d.options.cardView&&(f+=1);for(var g in c)d.$body.find(">tr:not(.no-records-found)").each(function(){var b=a(this),h=b.find(d.options.cardView?".card-view":"td").eq(f),i=g.indexOf(" "),j=g.substring(0,i),k=g.substring(i+1),l=c[g];h.find(k).off(j).on(j,function(a){var c=b.data("index"),f=d.data[c],g=f[e];l.apply(this,[a,g,f,c])})})}}),this.updateSelected(),this.resetView(),this.trigger("post-body",f)},o.prototype.initServer=function(b,c,d){var e,f=this,g={},i={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};this.options.pagination&&(i.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,i.pageNumber=this.options.pageNumber),(d||this.options.url||this.options.ajax)&&("limit"===this.options.queryParamsType&&(i={search:i.searchText,sort:i.sortName,order:i.sortOrder},this.options.pagination&&(i.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1),i.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)),a.isEmptyObject(this.filterColumnsPartial)||(i.filter=JSON.stringify(this.filterColumnsPartial,null)),g=h(this.options,this.options.queryParams,[i],g),a.extend(g,c||{}),g!==!1&&(b||this.$tableLoading.show(),e=a.extend({},h(null,this.options.ajaxOptions),{type:this.options.method,url:d||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(g):g,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(a){a=h(f.options,f.options.responseHandler,[a],a),f.load(a),f.trigger("load-success",a),b||f.$tableLoading.hide()},error:function(a){f.trigger("load-error",a.status,a),b||f.$tableLoading.hide()}}),this.options.ajax?h(this,this.options.ajax,[e],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=a.ajax(e))))},o.prototype.initSearchText=function(){if(this.options.search&&""!==this.options.searchText){var a=this.$toolbar.find(".search input");a.val(this.options.searchText),this.onSearch({currentTarget:a})}},o.prototype.getCaret=function(){var b=this;a.each(this.$header.find("th"),function(c,d){a(d).find(".sortable").removeClass("desc asc").addClass(a(d).data("field")===b.options.sortName?b.options.sortOrder:"both")})},o.prototype.updateSelected=function(){var b=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",b),this.$selectItem.each(function(){a(this).closest("tr")[a(this).prop("checked")?"addClass":"removeClass"]("selected")})},o.prototype.updateRows=function(){var b=this;this.$selectItem.each(function(){b.data[a(this).data("index")][b.header.stateField]=a(this).prop("checked")})},o.prototype.resetRows=function(){var b=this;a.each(this.data,function(a,c){b.$selectAll.prop("checked",!1),b.$selectItem.prop("checked",!1),b.header.stateField&&(c[b.header.stateField]=!1)}),this.initHiddenRows()},o.prototype.trigger=function(b){var c=Array.prototype.slice.call(arguments,1);b+=".bs.table",this.options[o.EVENTS[b]].apply(this.options,c),this.$el.trigger(a.Event(b),c),this.options.onAll(b,c),this.$el.trigger(a.Event("all.bs.table"),[b,c])},o.prototype.resetHeader=function(){clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(a.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)},o.prototype.fitHeader=function(){var b,d,e,f,h=this;if(h.$el.is(":hidden"))return void(h.timeoutId_=setTimeout(a.proxy(h.fitHeader,h),100));if(b=this.$tableBody.get(0),d=b.scrollWidth>b.clientWidth&&b.scrollHeight>b.clientHeight+this.$header.outerHeight()?g():0,this.$el.css("margin-top",-this.$header.outerHeight()),e=a(":focus"),e.length>0){var i=e.parents("th");if(i.length>0){var j=i.attr("data-field");if(void 0!==j){var k=this.$header.find("[data-field='"+j+"']");k.length>0&&k.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css({"margin-right":d}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),f=a(".focus-temp:visible:eq(0)"),f.length>0&&(f.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(){h.$header_.find(c('th[data-field="%s"]',a(this).data("field"))).data(a(this).data())});var l=this.getVisibleFields(),m=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(b){var d=a(this),e=b;h.options.detailView&&!h.options.cardView&&(0===b&&h.$header_.find("th.detail").find(".fht-cell").width(d.innerWidth()),e=b-1);var f=h.$header_.find(c('th[data-field="%s"]',l[e]));f.length>1&&(f=a(m[d[0].cellIndex])),f.find(".fht-cell").width(d.innerWidth())}),this.$tableBody.off("scroll").on("scroll",function(){h.$tableHeader.scrollLeft(a(this).scrollLeft()),h.options.showFooter&&!h.options.cardView&&h.$tableFooter.scrollLeft(a(this).scrollLeft())}),h.trigger("post-header")},o.prototype.resetFooter=function(){var b=this,d=b.getData(),e=[];this.options.showFooter&&!this.options.cardView&&(!this.options.cardView&&this.options.detailView&&e.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>'),a.each(this.columns,function(a,f){var g,i="",j="",k=[],l={},m=c(' class="%s"',f["class"]);if(f.visible&&(!b.options.cardView||f.cardVisible)){if(i=c("text-align: %s; ",f.falign?f.falign:f.align),j=c("vertical-align: %s; ",f.valign),l=h(null,b.options.footerStyle),l&&l.css)for(g in l.css)k.push(g+": "+l.css[g]);e.push("<td",m,c(' style="%s"',i+j+k.concat().join("; ")),">"),e.push('<div class="th-inner">'),e.push(h(f,f.footerFormatter,[d],"&nbsp;")||"&nbsp;"),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</td>")}}),this.$tableFooter.find("tr").html(e.join("")),this.$tableFooter.show(),clearTimeout(this.timeoutFooter_),this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0))},o.prototype.fitFooter=function(){var b,c,d;return clearTimeout(this.timeoutFooter_),this.$el.is(":hidden")?void(this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),100)):(c=this.$el.css("width"),d=c>this.$tableBody.width()?g():0,this.$tableFooter.css({"margin-right":d}).find("table").css("width",c).attr("class",this.$el.attr("class")),b=this.$tableFooter.find("td"),void this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(c){var d=a(this);b.eq(c).find(".fht-cell").width(d.innerWidth())}))},o.prototype.toggleColumn=function(a,b,d){if(-1!==a&&(this.columns[a].visible=b,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var e=this.$toolbar.find(".keep-open input").prop("disabled",!1);d&&e.filter(c('[value="%s"]',a)).prop("checked",b),e.filter(":checked").length<=this.options.minimumCountColumns&&e.filter(":checked").prop("disabled",!0)}},o.prototype.getVisibleFields=function(){var b=this,c=[];return a.each(this.header.fields,function(a,d){var f=b.columns[e(b.columns,d)];f.visible&&c.push(d)}),c},o.prototype.resetView=function(a){var b=0;if(a&&a.height&&(this.options.height=a.height),this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length),this.options.height){var c=this.$toolbar.outerHeight(!0),d=this.$pagination.outerHeight(!0),e=this.options.height-c-d;this.$tableContainer.css("height",e+"px")}return this.options.cardView?(this.$el.css("margin-top","0"),this.$tableContainer.css("padding-bottom","0"),void this.$tableFooter.hide()):(this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),b+=this.$header.outerHeight()):(this.$tableHeader.hide(),this.trigger("post-header")),this.options.showFooter&&(this.resetFooter(),this.options.height&&(b+=this.$tableFooter.outerHeight()+1)),this.getCaret(),this.$tableContainer.css("padding-bottom",b+"px"),void this.trigger("reset-view"))},o.prototype.getData=function(b){return!this.searchText&&a.isEmptyObject(this.filterColumns)&&a.isEmptyObject(this.filterColumnsPartial)?b?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data:b?this.data.slice(this.pageFrom-1,this.pageTo):this.data},o.prototype.load=function(b){var c=!1;"server"===this.options.sidePagination?(this.options.totalRows=b[this.options.totalField],c=b.fixedScroll,b=b[this.options.dataField]):a.isArray(b)||(c=b.fixedScroll,b=b.data),this.initData(b),this.initSearch(),this.initPagination(),this.initBody(c)},o.prototype.append=function(a){this.initData(a,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.prepend=function(a){this.initData(a,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.remove=function(b){var c,d,e=this.options.data.length;if(b.hasOwnProperty("field")&&b.hasOwnProperty("values")){for(c=e-1;c>=0;c--)d=this.options.data[c],d.hasOwnProperty(b.field)&&-1!==a.inArray(d[b.field],b.values)&&(this.options.data.splice(c,1),"server"===this.options.sidePagination&&(this.options.totalRows-=1));e!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},o.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.getRowByUniqueId=function(a){var b,c,d,e=this.options.uniqueId,f=this.options.data.length,g=null;for(b=f-1;b>=0;b--){if(c=this.options.data[b],c.hasOwnProperty(e))d=c[e];else{if(!c._data.hasOwnProperty(e))continue;d=c._data[e]}if("string"==typeof d?a=a.toString():"number"==typeof d&&(Number(d)===d&&d%1===0?a=parseInt(a):d===Number(d)&&0!==d&&(a=parseFloat(a))),d===a){g=c;break}}return g},o.prototype.removeByUniqueId=function(a){var b=this.options.data.length,c=this.getRowByUniqueId(a);c&&this.options.data.splice(this.options.data.indexOf(c),1),b!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.updateByUniqueId=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){var e;d.hasOwnProperty("id")&&d.hasOwnProperty("row")&&(e=a.inArray(c.getRowByUniqueId(d.id),c.options.data),-1!==e&&a.extend(c.options.data[e],d.row))}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.insertRow=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("row")&&(this.data.splice(a.index,0,a.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))},o.prototype.updateRow=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){d.hasOwnProperty("index")&&d.hasOwnProperty("row")&&a.extend(c.options.data[d.index],d.row)}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.initHiddenRows=function(){this.hiddenRows=[]},o.prototype.showRow=function(a){this.toggleRow(a,!0)},o.prototype.hideRow=function(a){this.toggleRow(a,!1)},o.prototype.toggleRow=function(b,c){var d,e;b.hasOwnProperty("index")?d=this.getData()[b.index]:b.hasOwnProperty("uniqueId")&&(d=this.getRowByUniqueId(b.uniqueId)),d&&(e=a.inArray(d,this.hiddenRows),c||-1!==e?c&&e>-1&&this.hiddenRows.splice(e,1):this.hiddenRows.push(d),this.initBody(!0))},o.prototype.getHiddenRows=function(){var b=this,c=this.getData(),d=[];return a.each(c,function(c,e){a.inArray(e,b.hiddenRows)>-1&&d.push(e)}),this.hiddenRows=d,d},o.prototype.mergeCells=function(b){var c,d,e,f=b.index,g=a.inArray(b.field,this.getVisibleFields()),h=b.rowspan||1,i=b.colspan||1,j=this.$body.find(">tr");if(this.options.detailView&&!this.options.cardView&&(g+=1),e=j.eq(f).find(">td").eq(g),!(0>f||0>g||f>=this.data.length)){for(c=f;f+h>c;c++)for(d=g;g+i>d;d++)j.eq(c).find(">td").eq(d).hide();e.attr("rowspan",h).attr("colspan",i).show()}},o.prototype.updateCell=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("field")&&a.hasOwnProperty("value")&&(this.data[a.index][a.field]=a.value,a.reinit!==!1&&(this.initSort(),this.initBody(!0)))},o.prototype.getOptions=function(){return this.options},o.prototype.getSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]===!0})},o.prototype.getAllSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},o.prototype.checkAll=function(){this.checkAll_(!0)},o.prototype.uncheckAll=function(){this.checkAll_(!1)},o.prototype.checkInvert=function(){var b=this,c=b.$selectItem.filter(":enabled"),d=c.filter(":checked");c.each(function(){a(this).prop("checked",!a(this).prop("checked"))}),b.updateRows(),b.updateSelected(),b.trigger("uncheck-some",d),d=b.getSelections(),b.trigger("check-some",d)},o.prototype.checkAll_=function(a){var b;a||(b=this.getSelections()),this.$selectAll.add(this.$selectAll_).prop("checked",a),this.$selectItem.filter(":enabled").prop("checked",a),this.updateRows(),a&&(b=this.getSelections()),this.trigger(a?"check-all":"uncheck-all",b)},o.prototype.check=function(a){this.check_(!0,a)},o.prototype.uncheck=function(a){this.check_(!1,a)},o.prototype.check_=function(a,b){var d=this.$selectItem.filter(c('[data-index="%s"]',b)).prop("checked",a);this.data[b][this.header.stateField]=a,this.updateSelected(),this.trigger(a?"check":"uncheck",this.data[b],d)},o.prototype.checkBy=function(a){this.checkBy_(!0,a)},o.prototype.uncheckBy=function(a){this.checkBy_(!1,a)},o.prototype.checkBy_=function(b,d){if(d.hasOwnProperty("field")&&d.hasOwnProperty("values")){var e=this,f=[];a.each(this.options.data,function(g,h){if(!h.hasOwnProperty(d.field))return!1;if(-1!==a.inArray(h[d.field],d.values)){var i=e.$selectItem.filter(":enabled").filter(c('[data-index="%s"]',g)).prop("checked",b);h[e.header.stateField]=b,f.push(h),e.trigger(b?"check":"uncheck",h,i)}}),this.updateSelected(),this.trigger(b?"check-some":"uncheck-some",f)}},o.prototype.destroy=function(){this.$el.insertBefore(this.$container),a(this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")},o.prototype.showLoading=function(){this.$tableLoading.show()},o.prototype.hideLoading=function(){this.$tableLoading.hide()},o.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var a=this.$toolbar.find('button[name="paginationSwitch"] i');this.options.pagination?a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown):a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp),this.updatePagination()},o.prototype.refresh=function(a){a&&a.url&&(this.options.url=a.url),a&&a.pageNumber&&(this.options.pageNumber=a.pageNumber),a&&a.pageSize&&(this.options.pageSize=a.pageSize),this.initServer(a&&a.silent,a&&a.query,a&&a.url),this.trigger("refresh",a)},o.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},o.prototype.showColumn=function(a){this.toggleColumn(e(this.columns,a),!0,!0)},o.prototype.hideColumn=function(a){this.toggleColumn(e(this.columns,a),!1,!0)},o.prototype.getHiddenColumns=function(){return a.grep(this.columns,function(a){return!a.visible})},o.prototype.getVisibleColumns=function(){return a.grep(this.columns,function(a){return a.visible})},o.prototype.toggleAllColumns=function(b){if(a.each(this.columns,function(a){this.columns[a].visible=b}),this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns){var c=this.$toolbar.find(".keep-open input").prop("disabled",!1);c.filter(":checked").length<=this.options.minimumCountColumns&&c.filter(":checked").prop("disabled",!0)}},o.prototype.showAllColumns=function(){this.toggleAllColumns(!0)},o.prototype.hideAllColumns=function(){this.toggleAllColumns(!1)},o.prototype.filterBy=function(b){this.filterColumns=a.isEmptyObject(b)?{}:b,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},o.prototype.scrollTo=function(a){return"string"==typeof a&&(a="bottom"===a?this.$tableBody[0].scrollHeight:0),"number"==typeof a&&this.$tableBody.scrollTop(a),"undefined"==typeof a?this.$tableBody.scrollTop():void 0},o.prototype.getScrollPosition=function(){return this.scrollTo()},o.prototype.selectPage=function(a){a>0&&a<=this.options.totalPages&&(this.options.pageNumber=a,this.updatePagination())},o.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},o.prototype.nextPage=function(){this.options.pageNumber<this.options.totalPages&&(this.options.pageNumber++,this.updatePagination())},o.prototype.toggleView=function(){this.options.cardView=!this.options.cardView,this.initHeader(),this.initBody(),this.trigger("toggle",this.options.cardView)},o.prototype.refreshOptions=function(b){i(this.options,b,!0)||(this.options=a.extend(this.options,b),this.trigger("refresh-options",this.options),this.destroy(),this.init())},o.prototype.resetSearch=function(a){var b=this.$toolbar.find(".search input");b.val(a||""),this.onSearch({currentTarget:b})},o.prototype.expandRow_=function(a,b){var d=this.$body.find(c('> tr[data-index="%s"]',b));d.next().is("tr.detail-view")===(a?!1:!0)&&d.find("> td > .detail-icon").click()},o.prototype.expandRow=function(a){this.expandRow_(!0,a)},o.prototype.collapseRow=function(a){this.expandRow_(!1,a)},o.prototype.expandAllRows=function(b){if(b){var d=this.$body.find(c('> tr[data-index="%s"]',0)),e=this,f=null,g=!1,h=-1;if(d.next().is("tr.detail-view")?d.next().next().is("tr.detail-view")||(d.next().find(".detail-icon").click(),g=!0):(d.find("> td > .detail-icon").click(),g=!0),g)try{h=setInterval(function(){f=e.$body.find("tr.detail-view").last().find(".detail-icon"),f.length>0?f.click():clearInterval(h)},1)}catch(i){clearInterval(h)}}else for(var j=this.$body.children(),k=0;k<j.length;k++)this.expandRow_(!0,a(j[k]).data("index"))},o.prototype.collapseAllRows=function(b){if(b)this.expandRow_(!1,0);else for(var c=this.$body.children(),d=0;d<c.length;d++)this.expandRow_(!1,a(c[d]).data("index"))},o.prototype.updateFormatText=function(a,b){this.options[c("format%s",a)]&&("string"==typeof b?this.options[c("format%s",a)]=function(){return b}:"function"==typeof b&&(this.options[c("format%s",a)]=b)),this.initToolbar(),this.initPagination(),this.initBody()};var p=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getHiddenRows","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","getVisibleColumns","showAllColumns","hideAllColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];a.fn.bootstrapTable=function(b){var c,d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("bootstrap.table"),g=a.extend({},o.DEFAULTS,e.data(),"object"==typeof b&&b);if("string"==typeof b){if(a.inArray(b,p)<0)throw new Error("Unknown method: "+b);if(!f)return;c=f[b].apply(f,d),"destroy"===b&&e.removeData("bootstrap.table")}f||e.data("bootstrap.table",f=new o(this,g))}),"undefined"==typeof c?this:c},a.fn.bootstrapTable.Constructor=o,a.fn.bootstrapTable.defaults=o.DEFAULTS,a.fn.bootstrapTable.columnDefaults=o.COLUMN_DEFAULTS,a.fn.bootstrapTable.locales=o.LOCALES,a.fn.bootstrapTable.methods=p,a.fn.bootstrapTable.utils={sprintf:c,getFieldIndex:e,compareObjects:i,calculateObjectValue:h,getItemField:l,objectKeys:n,isIEBrowser:m},a(function(){a('[data-toggle="table"]').bootstrapTable()})}(jQuery);
  5845. define("bootstrap-table", ["bootstrap"], (function (global) {
  5846. return function () {
  5847. var ret, fn;
  5848. return ret || global.$.fn.bootstrapTable;
  5849. };
  5850. }(this)));
  5851. /**
  5852. * Bootstrap Table Chinese translation
  5853. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  5854. */
  5855. (function ($) {
  5856. 'use strict';
  5857. $.fn.bootstrapTable.locales['zh-CN'] = {
  5858. formatLoadingMessage: function () {
  5859. return '正在努力地加载数据中,请稍候……';
  5860. },
  5861. formatRecordsPerPage: function (pageNumber) {
  5862. return '每页显示 ' + pageNumber + ' 条记录';
  5863. },
  5864. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  5865. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  5866. },
  5867. formatSearch: function () {
  5868. return '搜索';
  5869. },
  5870. formatNoMatches: function () {
  5871. return '没有找到匹配的记录';
  5872. },
  5873. formatPaginationSwitch: function () {
  5874. return '隐藏/显示分页';
  5875. },
  5876. formatRefresh: function () {
  5877. return '刷新';
  5878. },
  5879. formatToggle: function () {
  5880. return '切换';
  5881. },
  5882. formatColumns: function () {
  5883. return '列';
  5884. },
  5885. formatExport: function () {
  5886. return '导出数据';
  5887. },
  5888. formatClearFilters: function () {
  5889. return '清空过滤';
  5890. }
  5891. };
  5892. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  5893. })(jQuery);
  5894. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  5895. return function () {
  5896. var ret, fn;
  5897. return ret || global.$.fn.bootstrapTable.defaults;
  5898. };
  5899. }(this)));
  5900. /**
  5901. * @author: Dennis Hernández
  5902. * @webSite: http://djhvscf.github.io/Blog
  5903. * @version: v1.1.0
  5904. */
  5905. !function ($) {
  5906. 'use strict';
  5907. var showHideColumns = function (that, checked) {
  5908. if (that.options.columnsHidden.length > 0 ) {
  5909. $.each(that.columns, function (i, column) {
  5910. if (that.options.columnsHidden.indexOf(column.field) !== -1) {
  5911. if (column.visible !== checked) {
  5912. that.toggleColumn($.fn.bootstrapTable.utils.getFieldIndex(that.columns, column.field), checked, true);
  5913. }
  5914. }
  5915. });
  5916. }
  5917. };
  5918. var resetView = function (that) {
  5919. if (that.options.height || that.options.showFooter) {
  5920. setTimeout(function(){
  5921. that.resetView.call(that);
  5922. }, 1);
  5923. }
  5924. };
  5925. var changeView = function (that, width, height) {
  5926. if (that.options.minHeight) {
  5927. if ((width <= that.options.minWidth) && (height <= that.options.minHeight)) {
  5928. conditionCardView(that);
  5929. } else if ((width > that.options.minWidth) && (height > that.options.minHeight)) {
  5930. conditionFullView(that);
  5931. }
  5932. } else {
  5933. if (width <= that.options.minWidth) {
  5934. conditionCardView(that);
  5935. } else if (width > that.options.minWidth) {
  5936. conditionFullView(that);
  5937. }
  5938. }
  5939. resetView(that);
  5940. };
  5941. var conditionCardView = function (that) {
  5942. changeTableView(that, false);
  5943. showHideColumns(that, false);
  5944. };
  5945. var conditionFullView = function (that) {
  5946. changeTableView(that, true);
  5947. showHideColumns(that, true);
  5948. };
  5949. var changeTableView = function (that, cardViewState) {
  5950. that.options.cardView = cardViewState;
  5951. that.toggleView();
  5952. };
  5953. var debounce = function(func,wait) {
  5954. var timeout;
  5955. return function() {
  5956. var context = this,
  5957. args = arguments;
  5958. var later = function() {
  5959. timeout = null;
  5960. func.apply(context,args);
  5961. };
  5962. clearTimeout(timeout);
  5963. timeout = setTimeout(later, wait);
  5964. };
  5965. };
  5966. $.extend($.fn.bootstrapTable.defaults, {
  5967. mobileResponsive: false,
  5968. minWidth: 562,
  5969. minHeight: undefined,
  5970. heightThreshold: 100, // just slightly larger than mobile chrome's auto-hiding toolbar
  5971. checkOnInit: true,
  5972. columnsHidden: []
  5973. });
  5974. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  5975. _init = BootstrapTable.prototype.init;
  5976. BootstrapTable.prototype.init = function () {
  5977. _init.apply(this, Array.prototype.slice.apply(arguments));
  5978. if (!this.options.mobileResponsive) {
  5979. return;
  5980. }
  5981. if (!this.options.minWidth) {
  5982. return;
  5983. }
  5984. if (this.options.minWidth < 100 && this.options.resizable) {
  5985. console.log("The minWidth when the resizable extension is active should be greater or equal than 100");
  5986. this.options.minWidth = 100;
  5987. }
  5988. var that = this,
  5989. old = {
  5990. width: $(window).width(),
  5991. height: $(window).height()
  5992. };
  5993. $(window).on('resize orientationchange',debounce(function (evt) {
  5994. // reset view if height has only changed by at least the threshold.
  5995. var height = $(this).height(),
  5996. width = $(this).width();
  5997. if (Math.abs(old.height - height) > that.options.heightThreshold || old.width != width) {
  5998. changeView(that, width, height);
  5999. old = {
  6000. width: width,
  6001. height: height
  6002. };
  6003. }
  6004. },200));
  6005. if (this.options.checkOnInit) {
  6006. var height = $(window).height(),
  6007. width = $(window).width();
  6008. changeView(this, width, height);
  6009. old = {
  6010. width: width,
  6011. height: height
  6012. };
  6013. }
  6014. };
  6015. }(jQuery);
  6016. define("bootstrap-table-mobile", ["bootstrap-table"], (function (global) {
  6017. return function () {
  6018. var ret, fn;
  6019. return ret || global.$.fn.bootstrapTable.defaults;
  6020. };
  6021. }(this)));
  6022. /*
  6023. tableExport.jquery.plugin
  6024. Copyright (c) 2015-2017 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
  6025. Original work Copyright (c) 2014 Giri Raj, https://github.com/kayalshri/
  6026. Licensed under the MIT License, http://opensource.org/licenses/mit-license
  6027. */
  6028. (function(c){c.fn.extend({tableExport:function(u){function T(b){var a=[];c(b).find("thead").first().find("th").each(function(b,d){void 0!==c(d).attr("data-field")?a[b]=c(d).attr("data-field"):a[b]=b.toString()});return a}function z(b,d,f,h,v){if(-1==c.inArray(f,a.ignoreRow)&&-1==c.inArray(f-h,a.ignoreRow)){var n=c(b).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display")||"always"==c(this).closest("table").data("tableexport-display"))}).find(d),
  6029. k=0;n.each(function(b){if("always"==c(this).data("tableexport-display")||"none"!=c(this).css("display")&&"hidden"!=c(this).css("visibility")&&"none"!=c(this).data("tableexport-display")){var d=b,h=!1;0<a.ignoreColumn.length&&("string"==typeof a.ignoreColumn[0]?I.length>d&&"undefined"!=typeof I[d]&&-1!=c.inArray(I[d],a.ignoreColumn)&&(h=!0):"number"!=typeof a.ignoreColumn[0]||-1==c.inArray(d,a.ignoreColumn)&&-1==c.inArray(d-n.length,a.ignoreColumn)||(h=!0));if(!1===h&&"function"===typeof v){var h=
  6030. 0,p,e=0;if("undefined"!=typeof B[f]&&0<B[f].length)for(d=0;d<=b;d++)"undefined"!=typeof B[f][d]&&(v(null,f,d),delete B[f][d],b++);c(this).is("[colspan]")&&(h=parseInt(c(this).attr("colspan")),k+=0<h?h-1:0);c(this).is("[rowspan]")&&(e=parseInt(c(this).attr("rowspan")));v(this,f,b);for(d=0;d<h-1;d++)v(null,f,b+d);if(e)for(p=1;p<e;p++)for("undefined"==typeof B[f+p]&&(B[f+p]=[]),B[f+p][b+k]="",d=1;d<h;d++)B[f+p][b+k-d]=""}}});if("undefined"!=typeof B[f]&&0<B[f].length)for(b=0;b<=B[f].length;b++)"undefined"!=
  6031. typeof B[f][b]&&(v(null,f,b),delete B[f][b])}}function aa(b,d){!0===a.consoleLog&&console.log(b.output());if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return G(b.output());if("window"===a.outputMode)window.open(URL.createObjectURL(b.output("blob")));else try{var f=b.output("blob");saveAs(f,a.fileName+".pdf")}catch(h){D(a.fileName+".pdf","data:application/pdf"+(d?"":";base64")+",",d?f:b.output())}}function ba(b,a,f){var d=0;"undefined"!=typeof f&&(d=f.colspan);if(0<=d){for(var c=
  6032. b.width,n=b.textPos.x,k=a.table.columns.indexOf(a.column),p=1;p<d;p++)c+=a.table.columns[k+p].width;1<d&&("right"===b.styles.halign?n=b.textPos.x+c-b.width:"center"===b.styles.halign&&(n=b.textPos.x+(c-b.width)/2));b.width=c;b.textPos.x=n;"undefined"!=typeof f&&1<f.rowspan&&(b.height*=f.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)f=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<f&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(f-2)/3);return!0}return!1}
  6033. function ca(b,a,f){"undefined"!=typeof f.images&&a.each(function(){var a=c(this).children();if(c(this).is("img")){var d=da(this.src);f.images[d]={url:this.src,src:this.src}}"undefined"!=typeof a&&0<a.length&&ca(b,a,f)})}function ma(b,a){function d(b){if(b.url){var d=new Image;c=++n;d.crossOrigin="Anonymous";d.onerror=d.onload=function(){if(d.complete&&(0===d.src.indexOf("data:image/")&&(d.width=b.width||d.width||0,d.height=b.height||d.height||0),d.width+d.height)){var f=document.createElement("canvas"),
  6034. h=f.getContext("2d");f.width=d.width;f.height=d.height;h.drawImage(d,0,0);b.src=f.toDataURL("image/jpeg")}--n||a(c)};d.src=b.url}}var h,c=0,n=0;if("undefined"!=typeof b.images)for(h in b.images)b.images.hasOwnProperty(h)&&d(b.images[h]);(h=n)||(a(c),h=void 0);return h}function ea(b,d,f){d.each(function(){var d=c(this).children();if(c(this).is("div")){var v=O(F(this,"background-color"),[255,255,255]),n=O(F(this,"border-top-color"),[0,0,0]),k=P(this,"border-top-width",a.jspdf.unit),p=this.getBoundingClientRect(),
  6035. m=this.offsetLeft*f.dw;var e=this.offsetTop*f.dh;var g=p.width*f.dw,p=p.height*f.dh;f.doc.setDrawColor.apply(void 0,n);f.doc.setFillColor.apply(void 0,v);f.doc.setLineWidth(k);f.doc.rect(b.x+m,b.y+e,g,p,k?"FD":"F")}else if(c(this).is("img")&&"undefined"!=typeof f.images&&(e=da(this.src),v=f.images[e],"undefined"!=typeof v)){n=b.width/b.height;k=this.width/this.height;m=b.width;g=b.height;e=0;k<n?(g=Math.min(b.height,this.height),m=this.width*g/this.height):k>n&&(m=Math.min(b.width,this.width),g=this.height*
  6036. m/this.width);g<b.height&&(e=(b.height-g)/2);try{f.doc.addImage(v.src,b.textPos.x,b.y+e,m,g)}catch(qa){}b.textPos.x+=m}"undefined"!=typeof d&&0<d.length&&ea(b,d,f)})}function fa(b,d,a){if("function"===typeof a.onAutotableText)a.onAutotableText(a.doc,b,d);else{var f=b.textPos.x,v=b.textPos.y,n={halign:b.styles.halign,valign:b.styles.valign};if(d.length){for(d=d[0];d.previousSibling;)d=d.previousSibling;for(var k=!1,p=!1;d;){var m=d.innerText||d.textContent||"",m=(m.length&&" "==m[0]?" ":"")+c.trim(m)+
  6037. (1<m.length&&" "==m[m.length-1]?" ":"");c(d).is("br")&&(f=b.textPos.x,v+=a.doc.internal.getFontSize());c(d).is("b")?k=!0:c(d).is("i")&&(p=!0);(k||p)&&a.doc.setFontType(k&&p?"bolditalic":k?"bold":"italic");var e=a.doc.getStringUnitWidth(m)*a.doc.internal.getFontSize();if(e){if("linebreak"===b.styles.overflow&&f>b.textPos.x&&f+e>b.textPos.x+b.width){if(0<=".,!%*;:=-".indexOf(m.charAt(0))){var g=m.charAt(0),e=a.doc.getStringUnitWidth(g)*a.doc.internal.getFontSize();f+e<=b.textPos.x+b.width&&(a.doc.autoTableText(g,
  6038. f,v,n),m=m.substring(1,m.length));e=a.doc.getStringUnitWidth(m)*a.doc.internal.getFontSize()}f=b.textPos.x;v+=a.doc.internal.getFontSize()}for(;m.length&&f+e>b.textPos.x+b.width;)m=m.substring(0,m.length-1),e=a.doc.getStringUnitWidth(m)*a.doc.internal.getFontSize();a.doc.autoTableText(m,f,v,n);f+=e}if(k||p)c(d).is("b")?k=!1:c(d).is("i")&&(p=!1),a.doc.setFontType(k||p?k?"bold":"italic":"normal");d=d.nextSibling}b.textPos.x=f;b.textPos.y=v}else a.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,n)}}
  6039. function Q(b,a,f){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),f)}function ga(b){b=Q(b||"0",a.numbers.html.thousandsSeparator,"");b=Q(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function y(b,d,f){var h="";if(null!==b){var v=c(b);if(v[0].hasAttribute("data-tableexport-value"))var e=v.data("tableexport-value");else if(e=v.html(),"function"===typeof a.onCellHtmlData)e=a.onCellHtmlData(v,d,f,e);else if(""!=e){b=c.parseHTML(e);
  6040. var k=0,p=0;e="";c.each(b,function(){if(c(this).is("input"))e+=v.find("input").eq(k++).val();else if(c(this).is("select"))e+=v.find("select option:selected").eq(p++).text();else if("undefined"===typeof c(this).html())e+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl"))e+=c(this).html()})}if(!0===a.htmlContent)h=c.trim(e);else if(""!=e){var m=e.replace(/\n/g,"\u2028").replace(/<br\s*[\/]?>/gi,"\u2060");b=c("<div/>").html(m).contents();m="";c.each(b.text().split("\u2028"),
  6041. function(b,a){0<b&&(m+=" ");m+=c.trim(a)});c.each(m.split("\u2060"),function(b,a){0<b&&(h+="\n");h+=c.trim(a).replace(/\u00AD/g,"")});if("json"==a.type||!1===a.numbers.output)b=ga(h),!1!==b&&(h=Number(b));else if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(b=ga(h),!1!==b){var g=(""+b).split(".");1==g.length&&(g[1]="");var l=3<g[0].length?g[0].length%3:0,h=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?(l?g[0].substr(0,
  6042. l)+a.numbers.output.thousandsSeparator:"")+g[0].substr(l).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):g[0])+(g[1].length?a.numbers.output.decimalMark+g[1]:"")}}!0===a.escape&&(h=escape(h));"function"===typeof a.onCellData&&(h=a.onCellData(v,d,f,h))}return h}function na(b,a,f){return a+"-"+f.toLowerCase()}function O(b,a){var d=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b),c=a;d&&(c=[parseInt(d[1]),parseInt(d[2]),parseInt(d[3])]);return c}function ha(b){var a=F(b,"text-align"),
  6043. f=F(b,"font-weight"),h=F(b,"font-style"),e="";"start"==a&&(a="rtl"==F(b,"direction")?"right":"left");700<=f&&(e="bold");"italic"==h&&(e+=h);""===e&&(e="normal");a={style:{align:a,bcolor:O(F(b,"background-color"),[255,255,255]),color:O(F(b,"color"),[0,0,0]),fstyle:e},colspan:parseInt(c(b).attr("colspan"))||0,rowspan:parseInt(c(b).attr("rowspan"))||0};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function F(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,
  6044. na),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(f){}return""}function P(b,a,f){a=F(b,a).match(/\d+/);if(null!==a){a=a[0];b=b.parentElement;var d=document.createElement("div");d.style.overflow="hidden";d.style.visibility="hidden";b.appendChild(d);d.style.width=100+f;f=100/d.offsetWidth;b.removeChild(d);return a*f}return 0}function U(){if(!(this instanceof U))return new U;this.SheetNames=[];this.Sheets={}}function oa(a){for(var b=new ArrayBuffer(a.length),
  6045. f=new Uint8Array(b),c=0;c!=a.length;++c)f[c]=a.charCodeAt(c)&255;return b}function pa(a){for(var b={},f={s:{c:1E7,r:1E7},e:{c:0,r:0}},c=0;c!=a.length;++c)for(var e=0;e!=a[c].length;++e){f.s.r>c&&(f.s.r=c);f.s.c>e&&(f.s.c=e);f.e.r<c&&(f.e.r=c);f.e.c<e&&(f.e.c=e);var g={v:a[c][e]};if(null!==g.v){var k=XLSX.utils.encode_cell({c:e,r:c});if("number"===typeof g.v)g.t="n";else if("boolean"===typeof g.v)g.t="b";else if(g.v instanceof Date){g.t="n";g.z=XLSX.SSF._table[14];var p=g;var m=(Date.parse(g.v)-new Date(Date.UTC(1899,
  6046. 11,30)))/864E5;p.v=m}else g.t="s";b[k]=g}}1E7>f.s.c&&(b["!ref"]=XLSX.utils.encode_range(f));return b}function da(a){var b=0,c;if(0===a.length)return b;var h=0;for(c=a.length;h<c;h++){var e=a.charCodeAt(h);b=(b<<5)-b+e;b|=0}return b}function D(a,d,c){var b=window.navigator.userAgent;if(!1!==a&&(0<b.indexOf("MSIE ")||b.match(/Trident.*rv\:11\./)))if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([c]),a);else{if(d=document.createElement("iframe"))document.body.appendChild(d),
  6047. d.setAttribute("style","display:none"),d.contentDocument.open("txt/html","replace"),d.contentDocument.write(c),d.contentDocument.close(),d.focus(),d.contentDocument.execCommand("SaveAs",!0,a),document.body.removeChild(d)}else if(b=document.createElement("a")){var f=null;b.style.display="none";!1!==a?b.download=a:b.target="_blank";"object"==typeof c?(f=window.URL.createObjectURL(c),b.href=f):0<=d.toLowerCase().indexOf("base64,")?b.href=d+G(c):b.href=d+encodeURIComponent(c);document.body.appendChild(b);
  6048. if(document.createEvent)null===R&&(R=document.createEvent("MouseEvents")),R.initEvent("click",!0,!1),b.dispatchEvent(R);else if(document.createEventObject)b.fireEvent("onclick");else if("function"==typeof b.onclick)b.onclick();f&&window.URL.revokeObjectURL(f);document.body.removeChild(b)}}function G(a){var b="",c,e=0;a=a.replace(/\x0d\x0a/g,"\n");var g="";for(c=0;c<a.length;c++){var n=a.charCodeAt(c);128>n?g+=String.fromCharCode(n):(127<n&&2048>n?g+=String.fromCharCode(n>>6|192):(g+=String.fromCharCode(n>>
  6049. 12|224),g+=String.fromCharCode(n>>6&63|128)),g+=String.fromCharCode(n&63|128))}for(a=g;e<a.length;){var k=a.charCodeAt(e++);g=a.charCodeAt(e++);c=a.charCodeAt(e++);n=k>>2;k=(k&3)<<4|g>>4;var p=(g&15)<<2|c>>6;var m=c&63;isNaN(g)?p=m=64:isNaN(c)&&(m=64);b=b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(m)}return b}
  6050. var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelstyles:[],fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",
  6051. halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,onCellHtmlData:null,outputMode:"file",pdfmake:{enabled:!1},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"myTableName",type:"csv",worksheetName:"xlsWorksheetName"},w=this,R=null,r=[],g=[],l=0,B=[],
  6052. q="",I=[];c.extend(!0,a,u);I=T(w);if("csv"==a.type||"tsv"==a.type||"txt"==a.type){var E="",J=0,l=0,V=function(b,d,f){b.each(function(){q="";z(this,d,l,f+b.length,function(b,c,d){var f=q,e="";if(null!==b)if(b=y(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"==a.type)b instanceof Date&&b.toLocaleString(),e=Q(c,"\t"," ");else if(b instanceof Date)e=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(e=Q(c,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=e.indexOf(a.csvSeparator)||/[\r\n ]/g.test(e))e=
  6053. a.csvEnclosure+e+a.csvEnclosure;q=f+(e+("tsv"==a.type?"\t":a.csvSeparator))});q=c.trim(q).substring(0,q.length-1);0<q.length&&(0<E.length&&(E+="\n"),E+=q);l++});return b.length},J=J+V(c(w).find("thead").first().find(a.theadSelector),"th,td",J);c(w).find("tbody").each(function(){J+=V(c(this).find(a.tbodySelector),"td,th",J)});a.tfootSelector.length&&V(c(w).find("tfoot").first().find(a.tfootSelector),"td,th",J);E+="\n";!0===a.consoleLog&&console.log(E);if("string"===a.outputMode)return E;if("base64"===
  6054. a.outputMode)return G(E);if("window"===a.outputMode){D(!1,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,",E);return}try{var A=new Blob([E],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"});saveAs(A,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){D(a.fileName+"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+("csv"==a.type&&a.csvUseBOM?"\ufeff":""),E)}}else if("sql"==a.type){var l=0,x="INSERT INTO `"+a.tableName+"` (",r=c(w).find("thead").first().find(a.theadSelector);
  6055. r.each(function(){z(this,"th,td",l,r.length,function(a,c,f){x+="'"+y(a,c,f)+"',"});l++;x=c.trim(x);x=c.trim(x).substring(0,x.length-1)});x+=") VALUES ";c(w).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(w).find("tfoot").find(a.tfootSelector));c(g).each(function(){q="";z(this,"td,th",l,r.length+g.length,function(a,c,f){q+="'"+y(a,c,f)+"',"});3<q.length&&(x+="("+q,x=c.trim(x).substring(0,x.length-1),x+="),");l++});x=c.trim(x).substring(0,
  6056. x.length-1);x+=";";!0===a.consoleLog&&console.log(x);if("string"===a.outputMode)return x;if("base64"===a.outputMode)return G(x);try{A=new Blob([x],{type:"text/plain;charset=utf-8"}),saveAs(A,a.fileName+".sql")}catch(b){D(a.fileName+".sql","data:application/sql;charset=utf-8,",x)}}else if("json"==a.type){var K=[],r=c(w).find("thead").first().find(a.theadSelector);r.each(function(){var a=[];z(this,"th,td",l,r.length,function(b,c,e){a.push(y(b,c,e))});K.push(a)});var W=[];c(w).find("tbody").each(function(){g.push.apply(g,
  6057. c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(w).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a={},d=0;z(this,"td,th",l,r.length+g.length,function(b,c,e){K.length?a[K[K.length-1][d]]=y(b,c,e):a[d]=y(b,c,e);d++});!1===c.isEmptyObject(a)&&W.push(a);l++});u="";u="head"==a.jsonScope?JSON.stringify(K):"data"==a.jsonScope?JSON.stringify(W):JSON.stringify({header:K,data:W});!0===a.consoleLog&&console.log(u);if("string"===a.outputMode)return u;if("base64"===a.outputMode)return G(u);
  6058. try{A=new Blob([u],{type:"application/json;charset=utf-8"}),saveAs(A,a.fileName+".json")}catch(b){D(a.fileName+".json","data:application/json;charset=utf-8;base64,",u)}}else if("xml"===a.type){var l=0,C='<?xml version="1.0" encoding="utf-8"?>',C=C+"<tabledata><fields>",r=c(w).find("thead").first().find(a.theadSelector);r.each(function(){z(this,"th,td",l,r.length,function(a,c,f){C+="<field>"+y(a,c,f)+"</field>"});l++});var C=C+"</fields><data>",ia=1;c(w).find("tbody").each(function(){g.push.apply(g,
  6059. c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(w).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=1;q="";z(this,"td,th",l,r.length+g.length,function(b,c,e){q+="<column-"+a+">"+y(b,c,e)+"</column-"+a+">";a++});0<q.length&&"<column-1></column-1>"!=q&&(C+='<row id="'+ia+'">'+q+"</row>",ia++);l++});C+="</data></tabledata>";!0===a.consoleLog&&console.log(C);if("string"===a.outputMode)return C;if("base64"===a.outputMode)return G(C);try{A=new Blob([C],{type:"application/xml;charset=utf-8"}),
  6060. saveAs(A,a.fileName+".xml")}catch(b){D(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",C)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){u="excel"==a.type||"xls"==a.type?"excel":"word";var L="excel"==u?"xls":"doc",t='xmlns:x="urn:schemas-microsoft-com:office:'+u+'"',H="";c(w).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=c(this);l=0;I=T(this);
  6061. H+="<table><thead>";r=b.find("thead").first().find(a.theadSelector);r.each(function(){q="";z(this,"th,td",l,r.length,function(b,f,e){if(null!==b){var d="";q+="<th";for(var g in a.excelstyles)if(a.excelstyles.hasOwnProperty(g)){var k=c(b).css(a.excelstyles[g]);""!==k&&"0px none rgb(0, 0, 0)"!=k&&"rgba(0, 0, 0, 0)"!=k&&(d+=""===d?'style="':";",d+=a.excelstyles[g]+":"+k)}""!==d&&(q+=" "+d+'"');c(b).is("[colspan]")&&(q+=' colspan="'+c(b).attr("colspan")+'"');c(b).is("[rowspan]")&&(q+=' rowspan="'+c(b).attr("rowspan")+
  6062. '"');q+=">"+y(b,f,e)+"</th>"}});0<q.length&&(H+="<tr>"+q+"</tr>");l++});H+="</thead><tbody>";b.find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,b.find("tfoot").find(a.tfootSelector));c(g).each(function(){var b=c(this);q="";z(this,"td,th",l,r.length+g.length,function(d,e,g){if(null!==d){var f="",k=c(d).data("tableexport-msonumberformat");"undefined"==typeof k&&"function"===typeof a.onMsoNumberFormat&&(k=a.onMsoNumberFormat(d,e,g));
  6063. "undefined"!=typeof k&&""!==k&&(f="style=\"mso-number-format:'"+k+"'");for(var p in a.excelstyles)a.excelstyles.hasOwnProperty(p)&&(k=c(d).css(a.excelstyles[p]),""===k&&(k=b.css(a.excelstyles[p])),""!==k&&"0px none rgb(0, 0, 0)"!=k&&"rgba(0, 0, 0, 0)"!=k&&(f+=""===f?'style="':";",f+=a.excelstyles[p]+":"+k));q+="<td";""!==f&&(q+=" "+f+'"');c(d).is("[colspan]")&&(q+=' colspan="'+c(d).attr("colspan")+'"');c(d).is("[rowspan]")&&(q+=' rowspan="'+c(d).attr("rowspan")+'"');q+=">"+y(d,e,g).replace(/\n/g,
  6064. "<br>")+"</td>"}});0<q.length&&(H+="<tr>"+q+"</tr>");l++});a.displayTableName&&(H+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+y(c("<p>"+a.tableName+"</p>"))+"</td></tr>");H+="</tbody></table>";!0===a.consoleLog&&console.log(H)});t='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+t+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+u+'; charset=UTF-8">')+"<head>";"excel"===u&&(t+="\x3c!--[if gte mso 9]>",t+="<xml>",t+="<x:ExcelWorkbook>",
  6065. t+="<x:ExcelWorksheets>",t+="<x:ExcelWorksheet>",t+="<x:Name>",t+=a.worksheetName,t+="</x:Name>",t+="<x:WorksheetOptions>",t+="<x:DisplayGridlines/>",t+="</x:WorksheetOptions>",t+="</x:ExcelWorksheet>",t+="</x:ExcelWorksheets>",t+="</x:ExcelWorkbook>",t+="</xml>",t+="<![endif]--\x3e");t+="<style>br {mso-data-placement:same-cell;}</style>";t+="</head>";t+="<body>";t+=H;t+="</body>";t+="</html>";!0===a.consoleLog&&console.log(t);if("string"===a.outputMode)return t;if("base64"===a.outputMode)return G(t);
  6066. try{A=new Blob([t],{type:"application/vnd.ms-"+a.type}),saveAs(A,a.fileName+"."+L)}catch(b){D(a.fileName+"."+L,"data:application/vnd.ms-"+u+";base64,",t)}}else if("xlsx"==a.type){var ja=[],X=[],l=0,g=c(w).find("thead").first().find(a.theadSelector);c(w).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(w).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];z(this,"th,td",l,g.length,function(b,c,e){if("undefined"!==
  6067. typeof b&&null!==b){var d=parseInt(b.getAttribute("colspan")),f=parseInt(b.getAttribute("rowspan"));b=y(b,c,e);""!==b&&b==+b&&(b=+b);X.forEach(function(b){if(l>=b.s.r&&l<=b.e.r&&a.length>=b.s.c&&a.length<=b.e.c)for(var c=0;c<=b.e.c-b.s.c;++c)a.push(null)});if(f||d)d=d||1,X.push({s:{r:l,c:a.length},e:{r:l+(f||1)-1,c:a.length+d-1}});a.push(""!==b?b:null);if(d)for(f=0;f<d-1;++f)a.push(null)}});ja.push(a);l++});u=new U;L=pa(ja);L["!merges"]=X;u.SheetNames.push(a.worksheetName);u.Sheets[a.worksheetName]=
  6068. L;u=XLSX.write(u,{bookType:a.type,bookSST:!1,type:"binary"});try{A=new Blob([oa(u)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),saveAs(A,a.fileName+"."+a.type)}catch(b){D(a.fileName+"."+a.type,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,",A)}}else if("png"==a.type)html2canvas(c(w)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),f=new ArrayBuffer(c.length),e=new Uint8Array(f),g=0;g<c.length;g++)e[g]=
  6069. c.charCodeAt(g);!0===a.consoleLog&&console.log(c);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return G(b);if("window"===a.outputMode)window.open(b);else try{A=new Blob([f],{type:"image/png"}),saveAs(A,a.fileName+".png")}catch(n){D(a.fileName+".png","data:image/png,",A)}});else if("pdf"==a.type)if(!0===a.pdfmake.enabled){var Y=[],Z=[],l=0,r=c(this).find("thead").first().find(a.theadSelector);r.each(function(){var a=[];z(this,"th,td",l,r.length,function(b,c,d){a.push(y(b,c,d))});
  6070. a.length&&Z.push(a);for(var c=Y.length;c<a.length;c++)Y.push("*");l++});c(this).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];z(this,"td,th",l,r.length+g.length,function(b,c,e){a.push(y(b,c,e))});a.length&&Z.push(a);l++});u={pageOrientation:"landscape",content:[{table:{headerRows:r.length,widths:Y,body:Z}}],defaultStyle:{font:"Roboto"}};pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",
  6071. bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}};pdfMake.createPdf(u).getBuffer(function(b){try{var c=new Blob([b],{type:"application/pdf"});saveAs(c,a.fileName+".pdf")}catch(f){D(a.fileName+".pdf","data:application/pdf;base64,",b)}})}else if(!1===a.jspdf.autotable){u={dim:{w:P(c(w).first().get(0),"width","mm"),h:P(c(w).first().get(0),"height","mm")},pagesplit:!1};var ka=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);ka.addHTML(c(w).first(),
  6072. a.jspdf.margins.left,a.jspdf.margins.top,u,function(){aa(ka,!1)})}else{var e=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var M={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},S="",N="",la=0;c(w).filter(":visible").each(function(){if("none"!=c(this).css("display")){var a=P(c(this).get(0),"width","pt");if(a>la){a>M.a0[0]&&(S="a0",N="l");for(var d in M)M.hasOwnProperty(d)&&M[d][1]>
  6073. a&&(S=d,N="l",M[d][0]>a&&(N="p"));la=a}}});a.jspdf.format=""===S?"a4":S;a.jspdf.orientation=""===N?"w":N}e.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);!0===e.outputImages&&(e.images={});"undefined"!=typeof e.images&&(c(w).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=0;r=c(this).find("thead").find(a.theadSelector);c(this).find("tbody").each(function(){g.push.apply(g,
  6074. c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){z(this,"td,th",r.length+b,r.length+g.length,function(a,b,g){"undefined"!==typeof a&&null!==a&&(b=c(a).children(),"undefined"!=typeof b&&0<b.length&&ca(a,b,e))});b++})}),r=[],g=[]);ma(e,function(b){c(w).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b,
  6075. f=0;I=T(this);e.columns=[];e.rows=[];e.rowoptions={};if("function"===typeof e.onTable&&!1===e.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var h=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=e;h.margin={};c.extend(!0,h.margin,a.jspdf.margins);h.tableExport=e;"function"!==typeof h.beforePageContent&&(h.beforePageContent=function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+=
  6076. (2-1.15)/2*b.styles.fontSize)})});"function"!==typeof h.createdHeaderCell&&(h.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!=typeof e.columns[b.column.dataKey]){var d=e.columns[b.column.dataKey];if("undefined"!=typeof d.rect){a.contentWidth=d.rect.width;if("undefined"==typeof e.heightRatio||0===e.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;
  6077. e.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*e.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}"undefined"!=typeof d.style&&!0!==d.style.hidden&&(a.styles.halign=d.style.align,"inherit"===h.styles.fillColor&&(a.styles.fillColor=d.style.bcolor),"inherit"===h.styles.textColor&&(a.styles.textColor=d.style.color),"inherit"===h.styles.fontStyle&&(a.styles.fontStyle=d.style.fstyle))}});"function"!==typeof h.createdCell&&(h.createdCell=function(a,b){var c=e.rowoptions[b.row.index+
  6078. ":"+b.column.dataKey];"undefined"!=typeof c&&"undefined"!=typeof c.style&&!0!==c.style.hidden&&(a.styles.halign=c.style.align,"inherit"===h.styles.fillColor&&(a.styles.fillColor=c.style.bcolor),"inherit"===h.styles.textColor&&(a.styles.textColor=c.style.color),"inherit"===h.styles.fontStyle&&(a.styles.fontStyle=c.style.fstyle))});"function"!==typeof h.drawHeaderCell&&(h.drawHeaderCell=function(a,b){var c=e.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&
  6079. 0<=c.rowIndex?ba(a,b,c):!1});"function"!==typeof h.drawCell&&(h.drawCell=function(a,b){var c=e.rowoptions[b.row.index+":"+b.column.dataKey];if(ba(a,b,c))if(e.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!=typeof c&&"undefined"!=typeof c.kids&&0<c.kids.length){var d=a.height/c.rect.height;if(d>e.dh||"undefined"==typeof e.dh)e.dh=d;e.dw=a.width/c.rect.width;d=a.textPos.y;ea(a,c.kids,e);a.textPos.y=d;fa(a,c.kids,e)}else fa(a,{},e);return!1});e.headerrows=[];r=c(this).find("thead").find(a.theadSelector);
  6080. r.each(function(){b=0;e.headerrows[f]=[];z(this,"th,td",f,r.length,function(a,c,d){var g=ha(a);g.title=y(a,c,d);g.key=b++;g.rowIndex=f;e.headerrows[f].push(g)});f++});if(0<f)for(var l=f-1;0<=l;)c.each(e.headerrows[l],function(){var a=this;0<l&&null===this.rect&&(a=e.headerrows[l-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&e.columns.push(a)}),l=0<e.columns.length?-1:l-1;var n=0;g=[];c(this).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});
  6081. a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];b=0;z(this,"td,th",f,r.length+g.length,function(d,f,g){if("undefined"===typeof e.columns[b]){var h={title:"",key:b,style:{hidden:!0}};e.columns.push(h)}"undefined"!==typeof d&&null!==d?(h=ha(d),h.kids=c(d).children()):(h=c.extend(!0,{},e.rowoptions[n+":"+(b-1)]),h.colspan=-1);e.rowoptions[n+":"+b++]=h;a.push(y(d,f,g))});a.length&&(e.rows.push(a),n++);f++});if("function"===typeof e.onBeforeAutotable)e.onBeforeAutotable(c(this),
  6082. e.columns,e.rows,h);e.doc.autoTable(e.columns,e.rows,h);if("function"===typeof e.onAfterAutotable)e.onAfterAutotable(c(this),h);a.jspdf.autotable.startY=e.doc.autoTableEndPosY()+h.margin.top});aa(e.doc,"undefined"!=typeof e.images&&!1===jQuery.isEmptyObject(e.images));"undefined"!=typeof e.headerrows&&(e.headerrows.length=0);"undefined"!=typeof e.columns&&(e.columns.length=0);"undefined"!=typeof e.rows&&(e.rows.length=0);delete e.doc;e.doc=null})}return this}})})(jQuery);
  6083. define("tableexport", ["jquery"], (function (global) {
  6084. return function () {
  6085. var ret, fn;
  6086. return ret || global.$.fn.extend;
  6087. };
  6088. }(this)));
  6089. /*
  6090. * bootstrap-table - v1.11.1 - 2017-02-22
  6091. * https://github.com/wenzhixin/bootstrap-table
  6092. * Copyright (c) 2017 zhixin wen
  6093. * Licensed MIT License
  6094. */
  6095. !function(a){"use strict";var b=a.fn.bootstrapTable.utils.sprintf,c={json:"JSON",xml:"XML",png:"PNG",csv:"CSV",txt:"TXT",sql:"SQL",doc:"MS-Word",excel:"MS-Excel",xlsx:"MS-Excel (OpenXML)",powerpoint:"MS-Powerpoint",pdf:"PDF"};a.extend(a.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),a.extend(a.fn.bootstrapTable.defaults.icons,{"export":"glyphicon-export icon-share"}),a.extend(a.fn.bootstrapTable.locales,{formatExport:function(){return"Export data"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initToolbar;d.prototype.initToolbar=function(){if(this.showToolbar=this.options.showExport,e.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport){var d=this,f=this.$toolbar.find(">.btn-group"),g=f.find("div.export");if(!g.length){g=a(['<div class="export btn-group">','<button class="btn'+b(" btn-%s",this.options.buttonsClass)+b(" btn-%s",this.options.iconSize)+' dropdown-toggle" aria-label="export type" title="'+this.options.formatExport()+'" data-toggle="dropdown" type="button">',b('<i class="%s %s"></i> ',this.options.iconsPrefix,this.options.icons["export"]),'<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">',"</ul>","</div>"].join("")).appendTo(f);var h=g.find(".dropdown-menu"),i=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var j=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");i=[],a.each(j,function(a,b){i.push(b.slice(1,-1))})}a.each(i,function(a,b){c.hasOwnProperty(b)&&h.append(['<li role="menuitem" data-type="'+b+'">','<a href="javascript:void(0)">',c[b],"</a>","</li>"].join(""))}),h.find("li").click(function(){var b=a(this).data("type"),c=function(){d.$el.tableExport(a.extend({},d.options.exportOptions,{type:b,escape:!1}))};if("all"===d.options.exportDataType&&d.options.pagination)d.$el.one("server"===d.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){c(),d.togglePagination()}),d.togglePagination();else if("selected"===d.options.exportDataType){var e=d.getData(),f=d.getAllSelections();"server"===d.options.sidePagination&&(e={total:d.options.totalRows},e[d.options.dataField]=d.getData(),f={total:d.options.totalRows},f[d.options.dataField]=d.getAllSelections()),d.load(f),c(),d.load(e)}else c()})}}}}(jQuery);
  6096. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6097. return function () {
  6098. var ret, fn;
  6099. return ret || global.$.fn.bootstrapTable.defaults;
  6100. };
  6101. }(this)));
  6102. //! moment.js locale configuration
  6103. //! locale : Chinese (China) [zh-cn]
  6104. //! author : suupic : https://github.com/suupic
  6105. //! author : Zeno Zeng : https://github.com/zenozeng
  6106. ;(function (global, factory) {
  6107. typeof exports === 'object' && typeof module !== 'undefined'
  6108. && typeof require === 'function' ? factory(require('../moment')) :
  6109. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  6110. factory(global.moment)
  6111. }(this, (function (moment) { 'use strict';
  6112. var zhCn = moment.defineLocale('zh-cn', {
  6113. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  6114. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  6115. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  6116. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  6117. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  6118. longDateFormat : {
  6119. LT : 'HH:mm',
  6120. LTS : 'HH:mm:ss',
  6121. L : 'YYYY年MMMD日',
  6122. LL : 'YYYY年MMMD日',
  6123. LLL : 'YYYY年MMMD日Ah点mm分',
  6124. LLLL : 'YYYY年MMMD日ddddAh点mm分',
  6125. l : 'YYYY年MMMD日',
  6126. ll : 'YYYY年MMMD日',
  6127. lll : 'YYYY年MMMD日 HH:mm',
  6128. llll : 'YYYY年MMMD日dddd HH:mm'
  6129. },
  6130. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  6131. meridiemHour: function (hour, meridiem) {
  6132. if (hour === 12) {
  6133. hour = 0;
  6134. }
  6135. if (meridiem === '凌晨' || meridiem === '早上' ||
  6136. meridiem === '上午') {
  6137. return hour;
  6138. } else if (meridiem === '下午' || meridiem === '晚上') {
  6139. return hour + 12;
  6140. } else {
  6141. // '中午'
  6142. return hour >= 11 ? hour : hour + 12;
  6143. }
  6144. },
  6145. meridiem : function (hour, minute, isLower) {
  6146. var hm = hour * 100 + minute;
  6147. if (hm < 600) {
  6148. return '凌晨';
  6149. } else if (hm < 900) {
  6150. return '早上';
  6151. } else if (hm < 1130) {
  6152. return '上午';
  6153. } else if (hm < 1230) {
  6154. return '中午';
  6155. } else if (hm < 1800) {
  6156. return '下午';
  6157. } else {
  6158. return '晚上';
  6159. }
  6160. },
  6161. calendar : {
  6162. sameDay : '[今天]LT',
  6163. nextDay : '[明天]LT',
  6164. nextWeek : '[下]ddddLT',
  6165. lastDay : '[昨天]LT',
  6166. lastWeek : '[上]ddddLT',
  6167. sameElse : 'L'
  6168. },
  6169. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  6170. ordinal : function (number, period) {
  6171. switch (period) {
  6172. case 'd':
  6173. case 'D':
  6174. case 'DDD':
  6175. return number + '日';
  6176. case 'M':
  6177. return number + '月';
  6178. case 'w':
  6179. case 'W':
  6180. return number + '周';
  6181. default:
  6182. return number;
  6183. }
  6184. },
  6185. relativeTime : {
  6186. future : '%s内',
  6187. past : '%s前',
  6188. s : '几秒',
  6189. m : '1 分钟',
  6190. mm : '%d 分钟',
  6191. h : '1 小时',
  6192. hh : '%d 小时',
  6193. d : '1 天',
  6194. dd : '%d 天',
  6195. M : '1 个月',
  6196. MM : '%d 个月',
  6197. y : '1 年',
  6198. yy : '%d 年'
  6199. },
  6200. week : {
  6201. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6202. dow : 1, // Monday is the first day of the week.
  6203. doy : 4 // The week that contains Jan 4th is the first week of the year.
  6204. }
  6205. });
  6206. return zhCn;
  6207. })));
  6208. !function(a){"use strict";if("function"==typeof define&&define.amd)define('bootstrap-datetimepicker',["jquery","moment"],a);else if("object"==typeof exports)module.exports=a(require("jquery"),require("moment"));else{if("undefined"==typeof jQuery)throw"bootstrap-datetimepicker requires jQuery to be loaded first";if("undefined"==typeof moment)throw"bootstrap-datetimepicker requires Moment.js to be loaded first";a(jQuery,moment)}}(function(a,b){"use strict";if(!b)throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");var c=function(c,d){var e,f,g,h,i,j,k,l={},m=!0,n=!1,o=!1,p=0,q=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10},{clsName:"decades",navFnc:"y",navStep:100}],r=["days","months","years","decades"],s=["top","bottom","auto"],t=["left","right","auto"],u=["default","top","bottom"],v={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},w={},x=function(){return void 0!==b.tz&&void 0!==d.timeZone&&null!==d.timeZone&&""!==d.timeZone},y=function(a){var c;return c=void 0===a||null===a?b():b.isDate(a)||b.isMoment(a)?b(a):x()?b.tz(a,j,d.useStrict,d.timeZone):b(a,j,d.useStrict),x()&&c.tz(d.timeZone),c},z=function(a){if("string"!=typeof a||a.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(a){case"y":return i.indexOf("Y")!==-1;case"M":return i.indexOf("M")!==-1;case"d":return i.toLowerCase().indexOf("d")!==-1;case"h":case"H":return i.toLowerCase().indexOf("h")!==-1;case"m":return i.indexOf("m")!==-1;case"s":return i.indexOf("s")!==-1;default:return!1}},A=function(){return z("h")||z("m")||z("s")},B=function(){return z("y")||z("M")||z("d")},C=function(){var b=a("<thead>").append(a("<tr>").append(a("<th>").addClass("prev").attr("data-action","previous").append(a("<span>").addClass(d.icons.previous))).append(a("<th>").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",d.calendarWeeks?"6":"5")).append(a("<th>").addClass("next").attr("data-action","next").append(a("<span>").addClass(d.icons.next)))),c=a("<tbody>").append(a("<tr>").append(a("<td>").attr("colspan",d.calendarWeeks?"8":"7")));return[a("<div>").addClass("datepicker-days").append(a("<table>").addClass("table-condensed").append(b).append(a("<tbody>"))),a("<div>").addClass("datepicker-months").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())),a("<div>").addClass("datepicker-years").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())),a("<div>").addClass("datepicker-decades").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone()))]},D=function(){var b=a("<tr>"),c=a("<tr>"),e=a("<tr>");return z("h")&&(b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementHour}).addClass("btn").attr("data-action","incrementHours").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-hour").attr({"data-time-component":"hours",title:d.tooltips.pickHour}).attr("data-action","showHours"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementHour}).addClass("btn").attr("data-action","decrementHours").append(a("<span>").addClass(d.icons.down))))),z("m")&&(z("h")&&(b.append(a("<td>").addClass("separator")),c.append(a("<td>").addClass("separator").html(":")),e.append(a("<td>").addClass("separator"))),b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementMinute}).addClass("btn").attr("data-action","incrementMinutes").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-minute").attr({"data-time-component":"minutes",title:d.tooltips.pickMinute}).attr("data-action","showMinutes"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementMinute}).addClass("btn").attr("data-action","decrementMinutes").append(a("<span>").addClass(d.icons.down))))),z("s")&&(z("m")&&(b.append(a("<td>").addClass("separator")),c.append(a("<td>").addClass("separator").html(":")),e.append(a("<td>").addClass("separator"))),b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementSecond}).addClass("btn").attr("data-action","incrementSeconds").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-second").attr({"data-time-component":"seconds",title:d.tooltips.pickSecond}).attr("data-action","showSeconds"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementSecond}).addClass("btn").attr("data-action","decrementSeconds").append(a("<span>").addClass(d.icons.down))))),h||(b.append(a("<td>").addClass("separator")),c.append(a("<td>").append(a("<button>").addClass("btn btn-primary").attr({"data-action":"togglePeriod",tabindex:"-1",title:d.tooltips.togglePeriod}))),e.append(a("<td>").addClass("separator"))),a("<div>").addClass("timepicker-picker").append(a("<table>").addClass("table-condensed").append([b,c,e]))},E=function(){var b=a("<div>").addClass("timepicker-hours").append(a("<table>").addClass("table-condensed")),c=a("<div>").addClass("timepicker-minutes").append(a("<table>").addClass("table-condensed")),d=a("<div>").addClass("timepicker-seconds").append(a("<table>").addClass("table-condensed")),e=[D()];return z("h")&&e.push(b),z("m")&&e.push(c),z("s")&&e.push(d),e},F=function(){var b=[];return d.showTodayButton&&b.push(a("<td>").append(a("<a>").attr({"data-action":"today",title:d.tooltips.today}).append(a("<span>").addClass(d.icons.today)))),!d.sideBySide&&B()&&A()&&b.push(a("<td>").append(a("<a>").attr({"data-action":"togglePicker",title:d.tooltips.selectTime}).append(a("<span>").addClass(d.icons.time)))),d.showClear&&b.push(a("<td>").append(a("<a>").attr({"data-action":"clear",title:d.tooltips.clear}).append(a("<span>").addClass(d.icons.clear)))),d.showClose&&b.push(a("<td>").append(a("<a>").attr({"data-action":"close",title:d.tooltips.close}).append(a("<span>").addClass(d.icons.close)))),a("<table>").addClass("table-condensed").append(a("<tbody>").append(a("<tr>").append(b)))},G=function(){var b=a("<div>").addClass("bootstrap-datetimepicker-widget dropdown-menu"),c=a("<div>").addClass("datepicker").append(C()),e=a("<div>").addClass("timepicker").append(E()),f=a("<ul>").addClass("list-unstyled"),g=a("<li>").addClass("picker-switch"+(d.collapse?" accordion-toggle":"")).append(F());return d.inline&&b.removeClass("dropdown-menu"),h&&b.addClass("usetwentyfour"),z("s")&&!h&&b.addClass("wider"),d.sideBySide&&B()&&A()?(b.addClass("timepicker-sbs"),"top"===d.toolbarPlacement&&b.append(g),b.append(a("<div>").addClass("row").append(c.addClass("col-md-6")).append(e.addClass("col-md-6"))),"bottom"===d.toolbarPlacement&&b.append(g),b):("top"===d.toolbarPlacement&&f.append(g),B()&&f.append(a("<li>").addClass(d.collapse&&A()?"collapse in":"").append(c)),"default"===d.toolbarPlacement&&f.append(g),A()&&f.append(a("<li>").addClass(d.collapse&&B()?"collapse":"").append(e)),"bottom"===d.toolbarPlacement&&f.append(g),b.append(f))},H=function(){var b,e={};return b=c.is("input")||d.inline?c.data():c.find("input").data(),b.dateOptions&&b.dateOptions instanceof Object&&(e=a.extend(!0,e,b.dateOptions)),a.each(d,function(a){var c="date"+a.charAt(0).toUpperCase()+a.slice(1);void 0!==b[c]&&(e[a]=b[c])}),e},I=function(){var b,e=(n||c).position(),f=(n||c).offset(),g=d.widgetPositioning.vertical,h=d.widgetPositioning.horizontal;if(d.widgetParent)b=d.widgetParent.append(o);else if(c.is("input"))b=c.after(o).parent();else{if(d.inline)return void(b=c.append(o));b=c,c.children().first().after(o)}if("auto"===g&&(g=f.top+1.5*o.height()>=a(window).height()+a(window).scrollTop()&&o.height()+c.outerHeight()<f.top?"top":"bottom"),"auto"===h&&(h=b.width()<f.left+o.outerWidth()/2&&f.left+o.outerWidth()>a(window).width()?"right":"left"),"top"===g?o.addClass("top").removeClass("bottom"):o.addClass("bottom").removeClass("top"),"right"===h?o.addClass("pull-right"):o.removeClass("pull-right"),"static"===b.css("position")&&(b=b.parents().filter(function(){return"static"!==a(this).css("position")}).first()),0===b.length)throw new Error("datetimepicker component should be placed within a non-static positioned container");o.css({top:"top"===g?"auto":e.top+c.outerHeight(),bottom:"top"===g?b.outerHeight()-(b===c?0:e.top):"auto",left:"left"===h?b===c?0:e.left:"auto",right:"left"===h?"auto":b.outerWidth()-c.outerWidth()-(b===c?0:e.left)})},J=function(a){"dp.change"===a.type&&(a.date&&a.date.isSame(a.oldDate)||!a.date&&!a.oldDate)||c.trigger(a)},K=function(a){"y"===a&&(a="YYYY"),J({type:"dp.update",change:a,viewDate:f.clone()})},L=function(a){o&&(a&&(k=Math.max(p,Math.min(3,k+a))),o.find(".datepicker > div").hide().filter(".datepicker-"+q[k].clsName).show())},M=function(){var b=a("<tr>"),c=f.clone().startOf("w").startOf("d");for(d.calendarWeeks===!0&&b.append(a("<th>").addClass("cw").text("#"));c.isBefore(f.clone().endOf("w"));)b.append(a("<th>").addClass("dow").text(c.format("dd"))),c.add(1,"d");o.find(".datepicker-days thead").append(b)},N=function(a){return d.disabledDates[a.format("YYYY-MM-DD")]===!0},O=function(a){return d.enabledDates[a.format("YYYY-MM-DD")]===!0},P=function(a){return d.disabledHours[a.format("H")]===!0},Q=function(a){return d.enabledHours[a.format("H")]===!0},R=function(b,c){if(!b.isValid())return!1;if(d.disabledDates&&"d"===c&&N(b))return!1;if(d.enabledDates&&"d"===c&&!O(b))return!1;if(d.minDate&&b.isBefore(d.minDate,c))return!1;if(d.maxDate&&b.isAfter(d.maxDate,c))return!1;if(d.daysOfWeekDisabled&&"d"===c&&d.daysOfWeekDisabled.indexOf(b.day())!==-1)return!1;if(d.disabledHours&&("h"===c||"m"===c||"s"===c)&&P(b))return!1;if(d.enabledHours&&("h"===c||"m"===c||"s"===c)&&!Q(b))return!1;if(d.disabledTimeIntervals&&("h"===c||"m"===c||"s"===c)){var e=!1;if(a.each(d.disabledTimeIntervals,function(){if(b.isBetween(this[0],this[1]))return e=!0,!1}),e)return!1}return!0},S=function(){for(var b=[],c=f.clone().startOf("y").startOf("d");c.isSame(f,"y");)b.push(a("<span>").attr("data-action","selectMonth").addClass("month").text(c.format("MMM"))),c.add(1,"M");o.find(".datepicker-months td").empty().append(b)},T=function(){var b=o.find(".datepicker-months"),c=b.find("th"),g=b.find("tbody").find("span");c.eq(0).find("span").attr("title",d.tooltips.prevYear),c.eq(1).attr("title",d.tooltips.selectYear),c.eq(2).find("span").attr("title",d.tooltips.nextYear),b.find(".disabled").removeClass("disabled"),R(f.clone().subtract(1,"y"),"y")||c.eq(0).addClass("disabled"),c.eq(1).text(f.year()),R(f.clone().add(1,"y"),"y")||c.eq(2).addClass("disabled"),g.removeClass("active"),e.isSame(f,"y")&&!m&&g.eq(e.month()).addClass("active"),g.each(function(b){R(f.clone().month(b),"M")||a(this).addClass("disabled")})},U=function(){var a=o.find(".datepicker-years"),b=a.find("th"),c=f.clone().subtract(5,"y"),g=f.clone().add(6,"y"),h="";for(b.eq(0).find("span").attr("title",d.tooltips.prevDecade),b.eq(1).attr("title",d.tooltips.selectDecade),b.eq(2).find("span").attr("title",d.tooltips.nextDecade),a.find(".disabled").removeClass("disabled"),d.minDate&&d.minDate.isAfter(c,"y")&&b.eq(0).addClass("disabled"),b.eq(1).text(c.year()+"-"+g.year()),d.maxDate&&d.maxDate.isBefore(g,"y")&&b.eq(2).addClass("disabled");!c.isAfter(g,"y");)h+='<span data-action="selectYear" class="year'+(c.isSame(e,"y")&&!m?" active":"")+(R(c,"y")?"":" disabled")+'">'+c.year()+"</span>",c.add(1,"y");a.find("td").html(h)},V=function(){var a,c=o.find(".datepicker-decades"),g=c.find("th"),h=b({y:f.year()-f.year()%100-1}),i=h.clone().add(100,"y"),j=h.clone(),k=!1,l=!1,m="";for(g.eq(0).find("span").attr("title",d.tooltips.prevCentury),g.eq(2).find("span").attr("title",d.tooltips.nextCentury),c.find(".disabled").removeClass("disabled"),(h.isSame(b({y:1900}))||d.minDate&&d.minDate.isAfter(h,"y"))&&g.eq(0).addClass("disabled"),g.eq(1).text(h.year()+"-"+i.year()),(h.isSame(b({y:2e3}))||d.maxDate&&d.maxDate.isBefore(i,"y"))&&g.eq(2).addClass("disabled");!h.isAfter(i,"y");)a=h.year()+12,k=d.minDate&&d.minDate.isAfter(h,"y")&&d.minDate.year()<=a,l=d.maxDate&&d.maxDate.isAfter(h,"y")&&d.maxDate.year()<=a,m+='<span data-action="selectDecade" class="decade'+(e.isAfter(h)&&e.year()<=a?" active":"")+(R(h,"y")||k||l?"":" disabled")+'" data-selection="'+(h.year()+6)+'">'+(h.year()+1)+" - "+(h.year()+12)+"</span>",h.add(12,"y");m+="<span></span><span></span><span></span>",c.find("td").html(m),g.eq(1).text(j.year()+1+"-"+h.year())},W=function(){var b,c,g,h=o.find(".datepicker-days"),i=h.find("th"),j=[],k=[];if(B()){for(i.eq(0).find("span").attr("title",d.tooltips.prevMonth),i.eq(1).attr("title",d.tooltips.selectMonth),i.eq(2).find("span").attr("title",d.tooltips.nextMonth),h.find(".disabled").removeClass("disabled"),i.eq(1).text(f.format(d.dayViewHeaderFormat)),R(f.clone().subtract(1,"M"),"M")||i.eq(0).addClass("disabled"),R(f.clone().add(1,"M"),"M")||i.eq(2).addClass("disabled"),b=f.clone().startOf("M").startOf("w").startOf("d"),g=0;g<42;g++)0===b.weekday()&&(c=a("<tr>"),d.calendarWeeks&&c.append('<td class="cw">'+b.week()+"</td>"),j.push(c)),k=["day"],b.isBefore(f,"M")&&k.push("old"),b.isAfter(f,"M")&&k.push("new"),b.isSame(e,"d")&&!m&&k.push("active"),R(b,"d")||k.push("disabled"),b.isSame(y(),"d")&&k.push("today"),0!==b.day()&&6!==b.day()||k.push("weekend"),J({type:"dp.classify",date:b,classNames:k}),c.append('<td data-action="selectDay" data-day="'+b.format("L")+'" class="'+k.join(" ")+'">'+b.date()+"</td>"),b.add(1,"d");h.find("tbody").empty().append(j),T(),U(),V()}},X=function(){var b=o.find(".timepicker-hours table"),c=f.clone().startOf("d"),d=[],e=a("<tr>");for(f.hour()>11&&!h&&c.hour(12);c.isSame(f,"d")&&(h||f.hour()<12&&c.hour()<12||f.hour()>11);)c.hour()%4===0&&(e=a("<tr>"),d.push(e)),e.append('<td data-action="selectHour" class="hour'+(R(c,"h")?"":" disabled")+'">'+c.format(h?"HH":"hh")+"</td>"),c.add(1,"h");b.empty().append(d)},Y=function(){for(var b=o.find(".timepicker-minutes table"),c=f.clone().startOf("h"),e=[],g=a("<tr>"),h=1===d.stepping?5:d.stepping;f.isSame(c,"h");)c.minute()%(4*h)===0&&(g=a("<tr>"),e.push(g)),g.append('<td data-action="selectMinute" class="minute'+(R(c,"m")?"":" disabled")+'">'+c.format("mm")+"</td>"),c.add(h,"m");b.empty().append(e)},Z=function(){for(var b=o.find(".timepicker-seconds table"),c=f.clone().startOf("m"),d=[],e=a("<tr>");f.isSame(c,"m");)c.second()%20===0&&(e=a("<tr>"),d.push(e)),e.append('<td data-action="selectSecond" class="second'+(R(c,"s")?"":" disabled")+'">'+c.format("ss")+"</td>"),c.add(5,"s");b.empty().append(d)},$=function(){var a,b,c=o.find(".timepicker span[data-time-component]");h||(a=o.find(".timepicker [data-action=togglePeriod]"),b=e.clone().add(e.hours()>=12?-12:12,"h"),a.text(e.format("A")),R(b,"h")?a.removeClass("disabled"):a.addClass("disabled")),c.filter("[data-time-component=hours]").text(e.format(h?"HH":"hh")),c.filter("[data-time-component=minutes]").text(e.format("mm")),c.filter("[data-time-component=seconds]").text(e.format("ss")),X(),Y(),Z()},_=function(){o&&(W(),$())},aa=function(a){var b=m?null:e;if(!a)return m=!0,g.val(""),c.data("date",""),J({type:"dp.change",date:!1,oldDate:b}),void _();if(a=a.clone().locale(d.locale),x()&&a.tz(d.timeZone),1!==d.stepping)for(a.minutes(Math.round(a.minutes()/d.stepping)*d.stepping).seconds(0);d.minDate&&a.isBefore(d.minDate);)a.add(d.stepping,"minutes");R(a)?(e=a,f=e.clone(),g.val(e.format(i)),c.data("date",e.format(i)),m=!1,_(),J({type:"dp.change",date:e.clone(),oldDate:b})):(d.keepInvalid?J({type:"dp.change",date:a,oldDate:b}):g.val(m?"":e.format(i)),J({type:"dp.error",date:a,oldDate:b}))},ba=function(){var b=!1;return o?(o.find(".collapse").each(function(){var c=a(this).data("collapse");return!c||!c.transitioning||(b=!0,!1)}),b?l:(n&&n.hasClass("btn")&&n.toggleClass("active"),o.hide(),a(window).off("resize",I),o.off("click","[data-action]"),o.off("mousedown",!1),o.remove(),o=!1,J({type:"dp.hide",date:e.clone()}),g.blur(),f=e.clone(),l)):l},ca=function(){aa(null)},da=function(a){return void 0===d.parseInputDate?(!b.isMoment(a)||a instanceof Date)&&(a=y(a)):a=d.parseInputDate(a),a},ea={next:function(){var a=q[k].navFnc;f.add(q[k].navStep,a),W(),K(a)},previous:function(){var a=q[k].navFnc;f.subtract(q[k].navStep,a),W(),K(a)},pickerSwitch:function(){L(1)},selectMonth:function(b){var c=a(b.target).closest("tbody").find("span").index(a(b.target));f.month(c),k===p?(aa(e.clone().year(f.year()).month(f.month())),d.inline||ba()):(L(-1),W()),K("M")},selectYear:function(b){var c=parseInt(a(b.target).text(),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDecade:function(b){var c=parseInt(a(b.target).data("selection"),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDay:function(b){var c=f.clone();a(b.target).is(".old")&&c.subtract(1,"M"),a(b.target).is(".new")&&c.add(1,"M"),aa(c.date(parseInt(a(b.target).text(),10))),A()||d.keepOpen||d.inline||ba()},incrementHours:function(){var a=e.clone().add(1,"h");R(a,"h")&&aa(a)},incrementMinutes:function(){var a=e.clone().add(d.stepping,"m");R(a,"m")&&aa(a)},incrementSeconds:function(){var a=e.clone().add(1,"s");R(a,"s")&&aa(a)},decrementHours:function(){var a=e.clone().subtract(1,"h");R(a,"h")&&aa(a)},decrementMinutes:function(){var a=e.clone().subtract(d.stepping,"m");R(a,"m")&&aa(a)},decrementSeconds:function(){var a=e.clone().subtract(1,"s");R(a,"s")&&aa(a)},togglePeriod:function(){aa(e.clone().add(e.hours()>=12?-12:12,"h"))},togglePicker:function(b){var c,e=a(b.target),f=e.closest("ul"),g=f.find(".in"),h=f.find(".collapse:not(.in)");if(g&&g.length){if(c=g.data("collapse"),c&&c.transitioning)return;g.collapse?(g.collapse("hide"),h.collapse("show")):(g.removeClass("in"),h.addClass("in")),e.is("span")?e.toggleClass(d.icons.time+" "+d.icons.date):e.find("span").toggleClass(d.icons.time+" "+d.icons.date)}},showPicker:function(){o.find(".timepicker > div:not(.timepicker-picker)").hide(),o.find(".timepicker .timepicker-picker").show()},showHours:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-hours").show()},showMinutes:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-seconds").show()},selectHour:function(b){var c=parseInt(a(b.target).text(),10);h||(e.hours()>=12?12!==c&&(c+=12):12===c&&(c=0)),aa(e.clone().hours(c)),ea.showPicker.call(l)},selectMinute:function(b){aa(e.clone().minutes(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},selectSecond:function(b){aa(e.clone().seconds(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},clear:ca,today:function(){var a=y();R(a,"d")&&aa(a)},close:ba},fa=function(b){return!a(b.currentTarget).is(".disabled")&&(ea[a(b.currentTarget).data("action")].apply(l,arguments),!1)},ga=function(){var b,c={year:function(a){return a.month(0).date(1).hours(0).seconds(0).minutes(0)},month:function(a){return a.date(1).hours(0).seconds(0).minutes(0)},day:function(a){return a.hours(0).seconds(0).minutes(0)},hour:function(a){return a.seconds(0).minutes(0)},minute:function(a){return a.seconds(0)}};return g.prop("disabled")||!d.ignoreReadonly&&g.prop("readonly")||o?l:(void 0!==g.val()&&0!==g.val().trim().length?aa(da(g.val().trim())):m&&d.useCurrent&&(d.inline||g.is("input")&&0===g.val().trim().length)&&(b=y(),"string"==typeof d.useCurrent&&(b=c[d.useCurrent](b)),aa(b)),o=G(),M(),S(),o.find(".timepicker-hours").hide(),o.find(".timepicker-minutes").hide(),o.find(".timepicker-seconds").hide(),_(),L(),a(window).on("resize",I),o.on("click","[data-action]",fa),o.on("mousedown",!1),n&&n.hasClass("btn")&&n.toggleClass("active"),I(),o.show(),d.focusOnShow&&!g.is(":focus")&&g.focus(),J({type:"dp.show"}),l)},ha=function(){return o?ba():ga()},ia=function(a){var b,c,e,f,g=null,h=[],i={},j=a.which,k="p";w[j]=k;for(b in w)w.hasOwnProperty(b)&&w[b]===k&&(h.push(b),parseInt(b,10)!==j&&(i[b]=!0));for(b in d.keyBinds)if(d.keyBinds.hasOwnProperty(b)&&"function"==typeof d.keyBinds[b]&&(e=b.split(" "),e.length===h.length&&v[j]===e[e.length-1])){for(f=!0,c=e.length-2;c>=0;c--)if(!(v[e[c]]in i)){f=!1;break}if(f){g=d.keyBinds[b];break}}g&&(g.call(l,o),a.stopPropagation(),a.preventDefault())},ja=function(a){w[a.which]="r",a.stopPropagation(),a.preventDefault()},ka=function(b){var c=a(b.target).val().trim(),d=c?da(c):null;return aa(d),b.stopImmediatePropagation(),!1},la=function(){g.on({change:ka,blur:d.debug?"":ba,keydown:ia,keyup:ja,focus:d.allowInputToggle?ga:""}),c.is("input")?g.on({focus:ga}):n&&(n.on("click",ha),n.on("mousedown",!1))},ma=function(){g.off({change:ka,blur:blur,keydown:ia,keyup:ja,focus:d.allowInputToggle?ba:""}),c.is("input")?g.off({focus:ga}):n&&(n.off("click",ha),n.off("mousedown",!1))},na=function(b){var c={};return a.each(b,function(){var a=da(this);a.isValid()&&(c[a.format("YYYY-MM-DD")]=!0)}),!!Object.keys(c).length&&c},oa=function(b){var c={};return a.each(b,function(){c[this]=!0}),!!Object.keys(c).length&&c},pa=function(){var a=d.format||"L LT";i=a.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){var b=e.localeData().longDateFormat(a)||a;return b.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){return e.localeData().longDateFormat(a)||a})}),j=d.extraFormats?d.extraFormats.slice():[],j.indexOf(a)<0&&j.indexOf(i)<0&&j.push(i),h=i.toLowerCase().indexOf("a")<1&&i.replace(/\[.*?\]/g,"").indexOf("h")<1,z("y")&&(p=2),z("M")&&(p=1),z("d")&&(p=0),k=Math.max(p,k),m||aa(e)};if(l.destroy=function(){ba(),ma(),c.removeData("DateTimePicker"),c.removeData("date")},l.toggle=ha,l.show=ga,l.hide=ba,l.disable=function(){return ba(),n&&n.hasClass("btn")&&n.addClass("disabled"),g.prop("disabled",!0),l},l.enable=function(){return n&&n.hasClass("btn")&&n.removeClass("disabled"),g.prop("disabled",!1),l},l.ignoreReadonly=function(a){if(0===arguments.length)return d.ignoreReadonly;if("boolean"!=typeof a)throw new TypeError("ignoreReadonly () expects a boolean parameter");return d.ignoreReadonly=a,l},l.options=function(b){if(0===arguments.length)return a.extend(!0,{},d);if(!(b instanceof Object))throw new TypeError("options() options parameter should be an object");return a.extend(!0,d,b),a.each(d,function(a,b){if(void 0===l[a])throw new TypeError("option "+a+" is not recognized!");l[a](b)}),l},l.date=function(a){if(0===arguments.length)return m?null:e.clone();if(!(null===a||"string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("date() parameter must be one of [null, string, moment or Date]");return aa(null===a?null:da(a)),l},l.format=function(a){if(0===arguments.length)return d.format;if("string"!=typeof a&&("boolean"!=typeof a||a!==!1))throw new TypeError("format() expects a string or boolean:false parameter "+a);return d.format=a,i&&pa(),l},l.timeZone=function(a){if(0===arguments.length)return d.timeZone;if("string"!=typeof a)throw new TypeError("newZone() expects a string parameter");return d.timeZone=a,l},l.dayViewHeaderFormat=function(a){if(0===arguments.length)return d.dayViewHeaderFormat;if("string"!=typeof a)throw new TypeError("dayViewHeaderFormat() expects a string parameter");return d.dayViewHeaderFormat=a,l},l.extraFormats=function(a){if(0===arguments.length)return d.extraFormats;if(a!==!1&&!(a instanceof Array))throw new TypeError("extraFormats() expects an array or false parameter");return d.extraFormats=a,j&&pa(),l},l.disabledDates=function(b){if(0===arguments.length)return d.disabledDates?a.extend({},d.disabledDates):d.disabledDates;if(!b)return d.disabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledDates() expects an array parameter");return d.disabledDates=na(b),d.enabledDates=!1,_(),l},l.enabledDates=function(b){if(0===arguments.length)return d.enabledDates?a.extend({},d.enabledDates):d.enabledDates;if(!b)return d.enabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledDates() expects an array parameter");return d.enabledDates=na(b),d.disabledDates=!1,_(),l},l.daysOfWeekDisabled=function(a){if(0===arguments.length)return d.daysOfWeekDisabled.splice(0);if("boolean"==typeof a&&!a)return d.daysOfWeekDisabled=!1,_(),l;if(!(a instanceof Array))throw new TypeError("daysOfWeekDisabled() expects an array parameter");if(d.daysOfWeekDisabled=a.reduce(function(a,b){return b=parseInt(b,10),b>6||b<0||isNaN(b)?a:(a.indexOf(b)===-1&&a.push(b),a)},[]).sort(),d.useCurrent&&!d.keepInvalid){for(var b=0;!R(e,"d");){if(e.add(1,"d"),31===b)throw"Tried 31 times to find a valid date";b++}aa(e)}return _(),l},l.maxDate=function(a){if(0===arguments.length)return d.maxDate?d.maxDate.clone():d.maxDate;if("boolean"==typeof a&&a===!1)return d.maxDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("maxDate() Could not parse date parameter: "+a);if(d.minDate&&b.isBefore(d.minDate))throw new TypeError("maxDate() date parameter is before options.minDate: "+b.format(i));return d.maxDate=b,d.useCurrent&&!d.keepInvalid&&e.isAfter(a)&&aa(d.maxDate),f.isAfter(b)&&(f=b.clone().subtract(d.stepping,"m")),_(),l},l.minDate=function(a){if(0===arguments.length)return d.minDate?d.minDate.clone():d.minDate;if("boolean"==typeof a&&a===!1)return d.minDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("minDate() Could not parse date parameter: "+a);if(d.maxDate&&b.isAfter(d.maxDate))throw new TypeError("minDate() date parameter is after options.maxDate: "+b.format(i));return d.minDate=b,d.useCurrent&&!d.keepInvalid&&e.isBefore(a)&&aa(d.minDate),f.isBefore(b)&&(f=b.clone().add(d.stepping,"m")),_(),l},l.defaultDate=function(a){if(0===arguments.length)return d.defaultDate?d.defaultDate.clone():d.defaultDate;if(!a)return d.defaultDate=!1,l;"string"==typeof a&&(a="now"===a||"moment"===a?y():y(a));var b=da(a);if(!b.isValid())throw new TypeError("defaultDate() Could not parse date parameter: "+a);if(!R(b))throw new TypeError("defaultDate() date passed is invalid according to component setup validations");return d.defaultDate=b,(d.defaultDate&&d.inline||""===g.val().trim())&&aa(d.defaultDate),l},l.locale=function(a){if(0===arguments.length)return d.locale;if(!b.localeData(a))throw new TypeError("locale() locale "+a+" is not loaded from moment locales!");return d.locale=a,e.locale(d.locale),f.locale(d.locale),i&&pa(),o&&(ba(),ga()),l},l.stepping=function(a){return 0===arguments.length?d.stepping:(a=parseInt(a,10),(isNaN(a)||a<1)&&(a=1),d.stepping=a,l)},l.useCurrent=function(a){var b=["year","month","day","hour","minute"];if(0===arguments.length)return d.useCurrent;if("boolean"!=typeof a&&"string"!=typeof a)throw new TypeError("useCurrent() expects a boolean or string parameter");if("string"==typeof a&&b.indexOf(a.toLowerCase())===-1)throw new TypeError("useCurrent() expects a string parameter of "+b.join(", "));return d.useCurrent=a,l},l.collapse=function(a){if(0===arguments.length)return d.collapse;if("boolean"!=typeof a)throw new TypeError("collapse() expects a boolean parameter");return d.collapse===a?l:(d.collapse=a,o&&(ba(),ga()),l)},l.icons=function(b){if(0===arguments.length)return a.extend({},d.icons);if(!(b instanceof Object))throw new TypeError("icons() expects parameter to be an Object");return a.extend(d.icons,b),o&&(ba(),ga()),l},l.tooltips=function(b){if(0===arguments.length)return a.extend({},d.tooltips);if(!(b instanceof Object))throw new TypeError("tooltips() expects parameter to be an Object");return a.extend(d.tooltips,b),o&&(ba(),ga()),l},l.useStrict=function(a){if(0===arguments.length)return d.useStrict;if("boolean"!=typeof a)throw new TypeError("useStrict() expects a boolean parameter");return d.useStrict=a,l},l.sideBySide=function(a){if(0===arguments.length)return d.sideBySide;if("boolean"!=typeof a)throw new TypeError("sideBySide() expects a boolean parameter");return d.sideBySide=a,o&&(ba(),ga()),l},l.viewMode=function(a){if(0===arguments.length)return d.viewMode;if("string"!=typeof a)throw new TypeError("viewMode() expects a string parameter");if(r.indexOf(a)===-1)throw new TypeError("viewMode() parameter must be one of ("+r.join(", ")+") value");return d.viewMode=a,k=Math.max(r.indexOf(a),p),L(),l},l.toolbarPlacement=function(a){if(0===arguments.length)return d.toolbarPlacement;if("string"!=typeof a)throw new TypeError("toolbarPlacement() expects a string parameter");if(u.indexOf(a)===-1)throw new TypeError("toolbarPlacement() parameter must be one of ("+u.join(", ")+") value");return d.toolbarPlacement=a,o&&(ba(),ga()),l},l.widgetPositioning=function(b){if(0===arguments.length)return a.extend({},d.widgetPositioning);if("[object Object]"!=={}.toString.call(b))throw new TypeError("widgetPositioning() expects an object variable");if(b.horizontal){if("string"!=typeof b.horizontal)throw new TypeError("widgetPositioning() horizontal variable must be a string");if(b.horizontal=b.horizontal.toLowerCase(),t.indexOf(b.horizontal)===-1)throw new TypeError("widgetPositioning() expects horizontal parameter to be one of ("+t.join(", ")+")");d.widgetPositioning.horizontal=b.horizontal}if(b.vertical){if("string"!=typeof b.vertical)throw new TypeError("widgetPositioning() vertical variable must be a string");if(b.vertical=b.vertical.toLowerCase(),s.indexOf(b.vertical)===-1)throw new TypeError("widgetPositioning() expects vertical parameter to be one of ("+s.join(", ")+")");d.widgetPositioning.vertical=b.vertical}return _(),l},l.calendarWeeks=function(a){if(0===arguments.length)return d.calendarWeeks;if("boolean"!=typeof a)throw new TypeError("calendarWeeks() expects parameter to be a boolean value");return d.calendarWeeks=a,_(),l},l.showTodayButton=function(a){if(0===arguments.length)return d.showTodayButton;if("boolean"!=typeof a)throw new TypeError("showTodayButton() expects a boolean parameter");return d.showTodayButton=a,o&&(ba(),ga()),l},l.showClear=function(a){if(0===arguments.length)return d.showClear;if("boolean"!=typeof a)throw new TypeError("showClear() expects a boolean parameter");return d.showClear=a,o&&(ba(),ga()),l},l.widgetParent=function(b){if(0===arguments.length)return d.widgetParent;if("string"==typeof b&&(b=a(b)),null!==b&&"string"!=typeof b&&!(b instanceof a))throw new TypeError("widgetParent() expects a string or a jQuery object parameter");return d.widgetParent=b,o&&(ba(),ga()),l},l.keepOpen=function(a){if(0===arguments.length)return d.keepOpen;if("boolean"!=typeof a)throw new TypeError("keepOpen() expects a boolean parameter");return d.keepOpen=a,l},l.focusOnShow=function(a){if(0===arguments.length)return d.focusOnShow;if("boolean"!=typeof a)throw new TypeError("focusOnShow() expects a boolean parameter");return d.focusOnShow=a,l},l.inline=function(a){if(0===arguments.length)return d.inline;if("boolean"!=typeof a)throw new TypeError("inline() expects a boolean parameter");return d.inline=a,l},l.clear=function(){return ca(),l},l.keyBinds=function(a){return 0===arguments.length?d.keyBinds:(d.keyBinds=a,l)},l.getMoment=function(a){return y(a)},l.debug=function(a){if("boolean"!=typeof a)throw new TypeError("debug() expects a boolean parameter");return d.debug=a,l},l.allowInputToggle=function(a){if(0===arguments.length)return d.allowInputToggle;if("boolean"!=typeof a)throw new TypeError("allowInputToggle() expects a boolean parameter");return d.allowInputToggle=a,l},l.showClose=function(a){if(0===arguments.length)return d.showClose;if("boolean"!=typeof a)throw new TypeError("showClose() expects a boolean parameter");return d.showClose=a,l},l.keepInvalid=function(a){if(0===arguments.length)return d.keepInvalid;if("boolean"!=typeof a)throw new TypeError("keepInvalid() expects a boolean parameter");
  6209. return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)return d.datepickerInput;if("string"!=typeof a)throw new TypeError("datepickerInput() expects a string parameter");return d.datepickerInput=a,l},l.parseInputDate=function(a){if(0===arguments.length)return d.parseInputDate;if("function"!=typeof a)throw new TypeError("parseInputDate() sholud be as function");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledTimeIntervals() expects an array parameter");return d.disabledTimeIntervals=b,_(),l},l.disabledHours=function(b){if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledHours() expects an array parameter");if(d.disabledHours=oa(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.enabledHours=function(b){if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledHours() expects an array parameter");if(d.enabledHours=oa(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!("string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");return f=da(a),K(),l},c.is("input"))g=c;else if(g=c.find(d.datepickerInput),0===g.length)g=c.find("input");else if(!g.is("input"))throw new Error('CSS class "'+d.datepickerInput+'" cannot be applied to non input element');if(c.hasClass("input-group")&&(n=0===c.find(".datepickerbutton").length?c.find(".input-group-addon"):c.find(".datepickerbutton")),!d.inline&&!g.is("input"))throw new Error("Could not initialize DateTimePicker without an input element");return e=y(),f=e.clone(),a.extend(!0,d,H()),l.options(d),pa(),la(),g.prop("disabled")&&l.disable(),g.is("input")&&0!==g.val().trim().length?aa(da(g.val().trim())):d.defaultDate&&void 0===g.attr("placeholder")&&aa(d.defaultDate),d.inline&&ga(),l};return a.fn.datetimepicker=function(b){b=b||{};var d,e=Array.prototype.slice.call(arguments,1),f=!0,g=["destroy","hide","show","toggle"];if("object"==typeof b)return this.each(function(){var d,e=a(this);e.data("DateTimePicker")||(d=a.extend(!0,{},a.fn.datetimepicker.defaults,b),e.data("DateTimePicker",c(e,d)))});if("string"==typeof b)return this.each(function(){var c=a(this),g=c.data("DateTimePicker");if(!g)throw new Error('bootstrap-datetimepicker("'+b+'") method was called on an element that is not using DateTimePicker');d=g[b].apply(g,e),f=d===g}),f||a.inArray(b,g)>-1?this:d;throw new TypeError("Invalid arguments for DateTimePicker: "+b)},a.fn.datetimepicker.defaults={timeZone:"",format:!1,dayViewHeaderFormat:"MMMM YYYY",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down",previous:"glyphicon glyphicon-chevron-left",next:"glyphicon glyphicon-chevron-right",today:"glyphicon glyphicon-screenshot",clear:"glyphicon glyphicon-trash",close:"glyphicon glyphicon-remove"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:"days",toolbarPlacement:"default",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:".datepickerinput",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(7,"d")):this.date(b.clone().add(this.stepping(),"m"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(7,"d")):this.date(b.clone().subtract(this.stepping(),"m"))},"control up":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(1,"y")):this.date(b.clone().add(1,"h"))}},"control down":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(1,"y")):this.date(b.clone().subtract(1,"h"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"d"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"d"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"M"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"M"))}},enter:function(){this.hide()},escape:function(){this.hide()},"control space":function(a){a&&a.find(".timepicker").is(":visible")&&a.find('.btn[data-action="togglePeriod"]').click()},t:function(){this.date(this.getMoment())},delete:function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1},a.fn.datetimepicker});
  6210. /**
  6211. * @author: pppscn <35696959@qq.com>
  6212. * @version: v0.0.1
  6213. *
  6214. * @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
  6215. */
  6216. !function ($) {
  6217. 'use strict';
  6218. var firstLoad = false, ColumnsForSearch = [];
  6219. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  6220. var initCommonSearch = function (pColumns, that) {
  6221. var vFormCommon = createFormCommon(pColumns, that), timeoutId = 0;
  6222. var vModal = sprintf("<div id=\"commonSearchContent_%s\" class=\"common-search-table %s\">", that.options.idTable, that.options.searchFormVisible ? "" : "hidden");
  6223. vModal += vFormCommon.join('');
  6224. vModal += "</div>";
  6225. $("#myTabContent").before($(vModal));
  6226. var form = $("#commonSearchForm" + "_" + that.options.idTable);
  6227. //绑定日期时间元素事件
  6228. if ($(".datetimepicker", form).size() > 0) {
  6229. require(['bootstrap-datetimepicker'], function () {
  6230. $('.datetimepicker', form).parent().css('position', 'relative');
  6231. $('.datetimepicker', form).datetimepicker({
  6232. //format: 'YYYY-MM-DD',
  6233. icons: {
  6234. time: 'fa fa-clock-o',
  6235. date: 'fa fa-calendar',
  6236. up: 'fa fa-chevron-up',
  6237. down: 'fa fa-chevron-down',
  6238. previous: 'fa fa-chevron-left',
  6239. next: 'fa fa-chevron-right',
  6240. today: 'fa fa-history',
  6241. clear: 'fa fa-trash',
  6242. close: 'fa fa-remove'
  6243. },
  6244. showTodayButton: true,
  6245. showClose: true
  6246. });
  6247. });
  6248. }
  6249. // 表单提交
  6250. form.on("submit", function (event) {
  6251. that.onColumnCommonSearch();
  6252. return false;
  6253. });
  6254. // 重置搜索
  6255. form.on("click", "#btnResetCommon" + "_" + that.options.idTable, function (event) {
  6256. form[0].reset();
  6257. that.onColumnCommonSearch();
  6258. });
  6259. };
  6260. var createFormCommon = function (pColumns, that) {
  6261. var htmlForm = [];
  6262. var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'];
  6263. htmlForm.push(sprintf('<form class="form-inline" id="commonSearchForm_%s" action="%s" >', that.options.idTable, that.options.actionForm));
  6264. htmlForm.push('<fieldset>');
  6265. if (that.options.titleForm.length > 0)
  6266. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  6267. for (var i in pColumns) {
  6268. var vObjCol = pColumns[i];
  6269. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  6270. var query = Backend.api.query(vObjCol.field);
  6271. query = query ? query : '';
  6272. vObjCol.defaultValue = that.options.renderDefault && query != '' ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  6273. ColumnsForSearch.push(vObjCol);
  6274. htmlForm.push('<div class="form-group" style="margin:5px">');
  6275. htmlForm.push(sprintf('<label for="%s" class="control-label" style="padding:0 10px">%s</label>', vObjCol.field, vObjCol.title));
  6276. //htmlForm.push('<div class="col-sm-2">');
  6277. //htmlForm.push(sprintf('<select class="form-control" name="field-%s" data-name="%s">%s</select>', vObjCol.field, vObjCol.field, selectHtml));
  6278. vObjCol.operate = (typeof vObjCol.operate === 'undefined' || $.inArray(vObjCol.operate, opList) === -1) ? '=' : vObjCol.operate;
  6279. htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="field-%s" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
  6280. //htmlForm.push('</div>');
  6281. //htmlForm.push('<div class="col-sm-8">');
  6282. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  6283. if (vObjCol.searchList) {
  6284. if (typeof vObjCol.searchList == 'function') {
  6285. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  6286. } else {
  6287. var isArray = vObjCol.searchList.constructor === Array;
  6288. var searchList = [];
  6289. searchList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  6290. $.each(vObjCol.searchList, function (key, value) {
  6291. var isSelect = (isArray ? value : key) === vObjCol.defaultValue ? 'selected' : '';
  6292. searchList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
  6293. });
  6294. htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, searchList.join('')));
  6295. }
  6296. } else {
  6297. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  6298. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  6299. var addclass = typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass;
  6300. var data = typeof vObjCol.data === 'undefined' ? '' : vObjCol.data;
  6301. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  6302. if (/BETWEEN$/.test(vObjCol.operate)) {
  6303. var defaultValueArr = /^.+|.+$/.test(defaultValue) ? defaultValue.split('|') : ['', ''];
  6304. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValueArr[0], placeholder, vObjCol.field, style, data));
  6305. htmlForm.push(sprintf('&nbsp;-&nbsp;<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValueArr[1], placeholder, vObjCol.field, style, data));
  6306. } else {
  6307. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValue, placeholder, vObjCol.field, style, data));
  6308. }
  6309. }
  6310. //htmlForm.push('</div>');
  6311. htmlForm.push('</div>');
  6312. }
  6313. }
  6314. htmlForm.push(createFormBtn(that).join(''));
  6315. htmlForm.push('</fieldset>');
  6316. htmlForm.push('</form>');
  6317. return htmlForm;
  6318. };
  6319. var createFormBtn = function (that) {
  6320. var htmlBtn = [];
  6321. var searchSubmit = that.options.formatCommonSubmitButton();
  6322. var searchReset = that.options.formatCommonResetButton();
  6323. htmlBtn.push('<div class="form-group" style="margin:5px">');
  6324. htmlBtn.push('<div class="col-sm-12 text-center">');
  6325. htmlBtn.push(sprintf('<button type="submit" id="btnSubmitCommon%s" class="btn btn-success" >%s</button> ', "_" + that.options.idTable, searchSubmit));
  6326. htmlBtn.push(sprintf('<button type="button" id="btnResetCommon%s" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchReset));
  6327. htmlBtn.push('</div>');
  6328. htmlBtn.push('</div>');
  6329. return htmlBtn;
  6330. };
  6331. var isSearchAvailble = function (that) {
  6332. //只支持服务端搜索
  6333. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  6334. return false;
  6335. }
  6336. if (!that.options.idTable) {
  6337. return false;
  6338. }
  6339. return true;
  6340. };
  6341. var getSearchQuery = function (that) {
  6342. var op = {};
  6343. var filter = {};
  6344. $("#commonSearchContent_" + that.options.idTable + " input.operate").each(function (i) {
  6345. var name = $(this).data("name");
  6346. var sym = $(this).val();
  6347. var obj = $("[name='" + name + "']");
  6348. if (obj.size() == 0)
  6349. return true;
  6350. var vObjCol = ColumnsForSearch[i];
  6351. if (obj.size() > 1) {
  6352. if (/BETWEEN$/.test(sym)) {
  6353. var value_begin = $.trim($("[name='" + name + "']:first").val()), value_end = $.trim($("[name='" + name + "']:last").val());
  6354. if (!value_begin.length || !value_end.length) {
  6355. return true;
  6356. }
  6357. if (typeof vObjCol.process === 'function') {
  6358. value_begin = vObjCol.process(value_begin, 'begin');
  6359. value_end = vObjCol.process(value_end, 'end');
  6360. } else if ($("[name='" + name + "']:first").attr('type') === 'datetime') { //datetime类型字段转换成时间戳
  6361. var Hms = Moment(value_begin).format("HH:mm:ss");
  6362. value_begin = parseInt(Moment(value_begin) / 1000);
  6363. value_end = parseInt(Moment(value_end) / 1000);
  6364. if (value_begin === value_end && '00:00:00' === Hms) {
  6365. value_end += 86399;
  6366. }
  6367. }
  6368. var value = value_begin + ',' + value_end;
  6369. } else {
  6370. var value = $("[name='" + name + "']:checked").val();
  6371. }
  6372. } else {
  6373. var value = (typeof vObjCol.process === 'function') ? vObjCol.process(obj.val()) : obj.val();
  6374. }
  6375. if (value == '' && sym.indexOf("NULL") == -1) {
  6376. return true;
  6377. }
  6378. op[name] = sym;
  6379. filter[name] = value;
  6380. });
  6381. return {op: op, filter: filter};
  6382. };
  6383. $.extend($.fn.bootstrapTable.defaults, {
  6384. commonSearch: false,
  6385. titleForm: "Common search",
  6386. actionForm: "",
  6387. idTable: undefined,
  6388. searchFormVisible: true,
  6389. searchClass: 'searchit',
  6390. renderDefault: true,
  6391. onColumnCommonSearch: function (field, text) {
  6392. return false;
  6393. }
  6394. });
  6395. $.extend($.fn.bootstrapTable.defaults.icons, {
  6396. commonSearchIcon: 'glyphicon-search'
  6397. });
  6398. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  6399. 'column-common-search.bs.table': 'onColumnCommonSearch'
  6400. });
  6401. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  6402. formatCommonSearch: function () {
  6403. return "Common search";
  6404. },
  6405. formatCommonSubmitButton: function () {
  6406. return "Submit";
  6407. },
  6408. formatCommonResetButton: function () {
  6409. return "Reset";
  6410. },
  6411. formatCommonCloseButton: function () {
  6412. return "Close";
  6413. },
  6414. formatCommonChoose: function () {
  6415. return "Choose";
  6416. }
  6417. });
  6418. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  6419. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6420. _initToolbar = BootstrapTable.prototype.initToolbar,
  6421. _load = BootstrapTable.prototype.load,
  6422. _initSearch = BootstrapTable.prototype.initSearch;
  6423. BootstrapTable.prototype.initToolbar = function () {
  6424. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  6425. if (!isSearchAvailble(this)) {
  6426. return;
  6427. }
  6428. var that = this,
  6429. html = [];
  6430. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  6431. html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="commonSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatCommonSearch()));
  6432. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  6433. html.push('</button></div>');
  6434. that.$toolbar.prepend(html.join(''));
  6435. initCommonSearch(that.columns, that);
  6436. var searchContainer = $("#commonSearchContent_" + that.options.idTable);
  6437. that.$toolbar.find('button[name="commonSearch"]')
  6438. .off('click').on('click', function () {
  6439. searchContainer.toggleClass("hidden");
  6440. return;
  6441. });
  6442. that.$container.on("click", "." + that.options.searchClass, function () {
  6443. $("form [name='" + $(this).data("field") + "']", searchContainer).val($(this).data("value"));
  6444. $("form", searchContainer).trigger("submit");
  6445. });
  6446. var searchquery = getSearchQuery(this);
  6447. this.options.queryParams = function (params) {
  6448. return {
  6449. search: params.search,
  6450. sort: params.sort,
  6451. order: params.order,
  6452. filter: JSON.stringify(searchquery.filter),
  6453. op: JSON.stringify(searchquery.op),
  6454. offset: params.offset,
  6455. limit: params.limit,
  6456. };
  6457. };
  6458. };
  6459. BootstrapTable.prototype.load = function (data) {
  6460. _load.apply(this, Array.prototype.slice.apply(arguments));
  6461. if (!isSearchAvailble(this)) {
  6462. return;
  6463. }
  6464. if (!firstLoad) {
  6465. var height = parseInt($(".bootstrap-table").height());
  6466. height += 10;
  6467. $("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
  6468. firstLoad = true;
  6469. }
  6470. };
  6471. BootstrapTable.prototype.initSearch = function () {
  6472. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  6473. if (!isSearchAvailble(this)) {
  6474. return;
  6475. }
  6476. var that = this;
  6477. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  6478. this.data = fp ? $.grep(this.data, function (item, i) {
  6479. for (var key in fp) {
  6480. var fval = fp[key].toLowerCase();
  6481. var value = item[key];
  6482. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  6483. that.header.formatters[$.inArray(key, that.header.fields)],
  6484. [value, item, i], value);
  6485. if (!($.inArray(key, that.header.fields) !== -1 &&
  6486. (typeof value === 'string' || typeof value === 'number') &&
  6487. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  6488. return false;
  6489. }
  6490. }
  6491. return true;
  6492. }) : this.data;
  6493. };
  6494. BootstrapTable.prototype.onColumnCommonSearch = function (event) {
  6495. if (typeof event === 'undefined') {
  6496. var searchquery = getSearchQuery(this);
  6497. // 追加查询关键字
  6498. this.options.pageNumber = 1;
  6499. this.options.queryParams = function (params) {
  6500. return {
  6501. search: params.search,
  6502. sort: params.sort,
  6503. order: params.order,
  6504. filter: JSON.stringify(searchquery.filter),
  6505. op: JSON.stringify(searchquery.op),
  6506. offset: params.offset,
  6507. limit: params.limit,
  6508. };
  6509. };
  6510. this.refresh({query: {filter: JSON.stringify(searchquery.filter), op: JSON.stringify(searchquery.op)}});
  6511. } else {
  6512. var text = $.trim($(event.currentTarget).val());
  6513. var $field = $(event.currentTarget)[0].id;
  6514. if ($.isEmptyObject(this.filterColumnsPartial)) {
  6515. this.filterColumnsPartial = {};
  6516. }
  6517. if (text) {
  6518. this.filterColumnsPartial[$field] = text;
  6519. } else {
  6520. delete this.filterColumnsPartial[$field];
  6521. }
  6522. this.options.pageNumber = 1;
  6523. this.onSearch(event);
  6524. // this.updatePagination();
  6525. this.trigger('column-common-search', $field, text);
  6526. }
  6527. };
  6528. }(jQuery);
  6529. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  6530. return function () {
  6531. var ret, fn;
  6532. return ret || global.$.fn.bootstrapTable.defaults;
  6533. };
  6534. }(this)));
  6535. define('table',['jquery', 'bootstrap', 'backend', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-commonsearch'], function ($, undefined, Backend, Toastr, Moment) {
  6536. var Table = {
  6537. list: {},
  6538. // Bootstrap-table 基础配置
  6539. defaults: {
  6540. url: '',
  6541. sidePagination: 'server',
  6542. method: 'get',
  6543. toolbar: "#toolbar",
  6544. search: true,
  6545. cache: false,
  6546. commonSearch: true,
  6547. searchFormVisible: false,
  6548. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  6549. idTable: 'commonTable',
  6550. showExport: true,
  6551. exportDataType: "all",
  6552. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  6553. pageSize: 10,
  6554. pageList: [10, 25, 50, 'All'],
  6555. pagination: true,
  6556. clickToSelect: true,
  6557. showRefresh: false,
  6558. locale: 'zh-CN',
  6559. showToggle: true,
  6560. showColumns: true,
  6561. sortName: 'id',
  6562. sortOrder: 'desc',
  6563. paginationFirstText: __("First"),
  6564. paginationPreText: __("Previous"),
  6565. paginationNextText: __("Next"),
  6566. paginationLastText: __("Last"),
  6567. mobileResponsive: true,
  6568. cardView: true,
  6569. checkOnInit: true,
  6570. extend: {
  6571. index_url: '',
  6572. add_url: '',
  6573. edit_url: '',
  6574. del_url: '',
  6575. multi_url: '',
  6576. dragsort_url: 'ajax/weigh',
  6577. }
  6578. },
  6579. // Bootstrap-table 列配置
  6580. columnDefaults: {
  6581. align: 'center',
  6582. valign: 'middle',
  6583. },
  6584. config: {
  6585. firsttd: 'tbody tr td:first-child:not(:has(div.card-views))',
  6586. toolbar: '.toolbar',
  6587. refreshbtn: '.btn-refresh',
  6588. addbtn: '.btn-add',
  6589. editbtn: '.btn-edit',
  6590. delbtn: '.btn-del',
  6591. multibtn: '.btn-multi',
  6592. disabledbtn: '.btn-disabled',
  6593. editonebtn: '.btn-editone',
  6594. dragsortfield: 'weigh',
  6595. },
  6596. api: {
  6597. init: function (defaults, columnDefaults, locales) {
  6598. defaults = defaults ? defaults : {};
  6599. columnDefaults = columnDefaults ? columnDefaults : {};
  6600. locales = locales ? locales : {};
  6601. // 写入bootstrap-table默认配置
  6602. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  6603. // 写入bootstrap-table column配置
  6604. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  6605. // 写入bootstrap-table locale配置
  6606. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  6607. formatCommonSearch: function () {
  6608. return __('Common search');
  6609. },
  6610. formatCommonSubmitButton: function () {
  6611. return __('Submit');
  6612. },
  6613. formatCommonResetButton: function () {
  6614. return __('Reset');
  6615. },
  6616. formatCommonCloseButton: function () {
  6617. return __('Close');
  6618. },
  6619. formatCommonChoose: function () {
  6620. return __('Choose');
  6621. }
  6622. }, locales);
  6623. },
  6624. // 绑定事件
  6625. bindevent: function (table) {
  6626. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  6627. var parenttable = table.closest('.bootstrap-table');
  6628. //Bootstrap-table配置
  6629. var options = table.bootstrapTable('getOptions');
  6630. //Bootstrap操作区
  6631. var toolbar = $(options.toolbar, parenttable);
  6632. //当刷新表格时
  6633. table.on('load-error.bs.table', function (status, res) {
  6634. Toastr.error(__('Unknown data format'));
  6635. });
  6636. //当刷新表格时
  6637. table.on('refresh.bs.table', function (e, settings, data) {
  6638. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  6639. });
  6640. //当双击单元格时
  6641. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  6642. $(Table.config.editonebtn, element).trigger("click");
  6643. });
  6644. //当内容渲染完成后
  6645. table.on('post-body.bs.table', function (e, settings, json, xhr) {
  6646. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  6647. // 挺拽选择,需要重新绑定事件
  6648. require(['drag', 'drop'], function () {
  6649. $(Table.config.firsttd, table).drag("start", function (ev, dd) {
  6650. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  6651. }).drag(function (ev, dd) {
  6652. $(dd.proxy).css({
  6653. top: Math.min(ev.pageY, dd.startY),
  6654. left: Math.min(ev.pageX, dd.startX),
  6655. height: Math.abs(ev.pageY - dd.startY),
  6656. width: Math.abs(ev.pageX - dd.startX)
  6657. });
  6658. }).drag("end", function (ev, dd) {
  6659. $(dd.proxy).remove();
  6660. });
  6661. $(Table.config.firsttd, table).drop("start", function () {
  6662. Table.api.toggleattr(this);
  6663. }).drop(function () {
  6664. Table.api.toggleattr(this);
  6665. }).drop("end", function () {
  6666. Table.api.toggleattr(this);
  6667. });
  6668. $.drop({
  6669. multi: true
  6670. });
  6671. });
  6672. });
  6673. // 处理选中筛选框后按钮的状态统一变更
  6674. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
  6675. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !table.bootstrapTable('getSelections').length);
  6676. });
  6677. // 刷新按钮事件
  6678. $(toolbar).on('click', Table.config.refreshbtn, function () {
  6679. table.bootstrapTable('refresh');
  6680. });
  6681. // 添加按钮事件
  6682. $(toolbar).on('click', Table.config.addbtn, function () {
  6683. var ids = Table.api.selectedids(table);
  6684. Backend.api.open(options.extend.add_url + "/ids/" + ids.join(","), __('Add'));
  6685. });
  6686. // 编辑按钮事件
  6687. $(toolbar).on('click', Table.config.editbtn, function () {
  6688. var ids = Table.api.selectedids(table);
  6689. //循环弹出多个编辑框
  6690. $.each(ids, function (i, j) {
  6691. Backend.api.open(options.extend.edit_url + "/ids/" + j, __('Edit'));
  6692. });
  6693. });
  6694. // 批量操作按钮事件
  6695. $(toolbar).on('click', Table.config.multibtn, function () {
  6696. var ids = Table.api.selectedids(table);
  6697. Table.api.multi($(this).data("action"), ids, table, this);
  6698. });
  6699. // 批量删除按钮事件
  6700. $(toolbar).on('click', Table.config.delbtn, function () {
  6701. var that = this;
  6702. var ids = Table.api.selectedids(table);
  6703. var index = Backend.api.layer.confirm(
  6704. __('Are you sure you want to delete the %s selected item?', ids.length),
  6705. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
  6706. function () {
  6707. Table.api.multi("del", ids, table, that);
  6708. Backend.api.layer.close(index);
  6709. }
  6710. );
  6711. });
  6712. // 拖拽排序
  6713. require(['dragsort'], function () {
  6714. //绑定拖动排序
  6715. $("tbody", table).dragsort({
  6716. itemSelector: 'tr',
  6717. dragSelector: "a.btn-dragsort",
  6718. dragEnd: function () {
  6719. var data = table.bootstrapTable('getData');
  6720. var current = data[parseInt($(this).data("index"))];
  6721. //改变的值和改变的ID集合
  6722. var ids = $.map($("tbody tr:visible", table), function (tr) {
  6723. return data[parseInt($(tr).data("index"))].id;
  6724. });
  6725. var changeid = current.id;
  6726. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  6727. var options = {
  6728. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  6729. data: {
  6730. ids: ids.join(','),
  6731. changeid: changeid,
  6732. pid: pid,
  6733. field: Table.config.dragsortfield,
  6734. orderway: table.bootstrapTable('getOptions').sortOrder,
  6735. table: table.bootstrapTable('getOptions').extend.table
  6736. }
  6737. };
  6738. Backend.api.ajax(options, function (data) {
  6739. Toastr.success(__('Operation completed'));
  6740. table.bootstrapTable('refresh');
  6741. });
  6742. },
  6743. placeHolderTemplate: ""
  6744. });
  6745. });
  6746. var id = table.attr("id");
  6747. Table.list[id] = table;
  6748. return table;
  6749. },
  6750. // 批量操作请求
  6751. multi: function (action, ids, table, element) {
  6752. var options = table.bootstrapTable('getOptions');
  6753. var url = action == "del" ? options.extend.del_url : options.extend.multi_url;
  6754. url = url + "/ids/" + ($.isArray(ids) ? ids.join(",") : ids);
  6755. var options = {url: url, data: {action: action, ids: ids, params: element ? $(element).data("params") : ''}};
  6756. Backend.api.ajax(options, function (data) {
  6757. Toastr.success(__('Operation completed'));
  6758. table.bootstrapTable('refresh');
  6759. });
  6760. },
  6761. // 单元格元素事件
  6762. events: {
  6763. operate: {
  6764. 'click .btn-editone': function (e, value, row, index) {
  6765. var options = $(this).closest('table').bootstrapTable('getOptions');
  6766. Backend.api.open(options.extend.edit_url + "/ids/" + row.id, __('Edit'));
  6767. },
  6768. 'click .btn-delone': function (e, value, row, index) {
  6769. var that = this;
  6770. var top = $(that).offset().top - $(window).scrollTop();
  6771. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  6772. if (top + 154 > $(window).height()) {
  6773. top = top - 154;
  6774. }
  6775. if ($(window).width() < 480) {
  6776. top = left = undefined;
  6777. }
  6778. var index = Backend.api.layer.confirm(
  6779. __('Are you sure you want to delete this item?'),
  6780. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
  6781. function () {
  6782. var table = $(that).closest('table');
  6783. Table.api.multi("del", row.id, table, that);
  6784. Backend.api.layer.close(index);
  6785. }
  6786. );
  6787. }
  6788. }
  6789. },
  6790. // 单元格数据格式化
  6791. formatter: {
  6792. icon: function (value, row, index) {
  6793. if (!value)
  6794. return '';
  6795. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  6796. //渲染fontawesome图标
  6797. return '<i class="' + value + '"></i> ' + value;
  6798. },
  6799. image: function (value, row, index) {
  6800. return '<img class="img-rounded img-sm" src="' + (value.indexOf("http") === 0 ? '' : Config.upload.cdnurl) + value + '" />';
  6801. },
  6802. status: function (value, row, index, custom) {
  6803. //颜色状态数组,可使用red/yellow/aqua/blue/navy/teal/olive/lime/fuchsia/purple/maroon
  6804. var colorArr = {normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info'};
  6805. //如果有自定义状态,可以按需传入
  6806. if (typeof custom !== 'undefined') {
  6807. colorArr = $.extend(colorArr, custom);
  6808. }
  6809. value = value.toString();
  6810. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  6811. value = value[0].toUpperCase() + value.substr(1);
  6812. //渲染状态
  6813. var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(value) + '</span>';
  6814. return html;
  6815. },
  6816. url: function (value, row, index) {
  6817. return '<a href="' + value + '" target="_blank" class="label bg-green">' + value + '</a>';
  6818. },
  6819. search: function (value, row, index) {
  6820. return '<a href="javascript:;" class="searchit" data-field="' + this.field + '" data-value="' + value + '">' + value + '</a>';
  6821. },
  6822. addtabs: function (value, row, index, url) {
  6823. return '<a href="' + url + '" class="addtabsit" title="' + __("Search %s", value) + '">' + value + '</a>';
  6824. },
  6825. flag: function (value, row, index, custom) {
  6826. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  6827. //如果有自定义状态,可以按需传入
  6828. if (typeof custom !== 'undefined') {
  6829. colorArr = $.extend(colorArr, custom);
  6830. }
  6831. //渲染Flag
  6832. var html = [];
  6833. var arr = value.split(',');
  6834. $.each(arr, function (i, value) {
  6835. value = value.toString();
  6836. if (value == '')
  6837. return true;
  6838. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  6839. value = value[0].toUpperCase() + value.substr(1);
  6840. html.push('<span class="label label-' + color + '">' + __(value) + '</span>');
  6841. });
  6842. return html.join(' ');
  6843. },
  6844. datetime: function (value, row, index) {
  6845. return value ? Moment(parseInt(value) * 1000).format("YYYY-MM-DD HH:mm:ss") : __('None');
  6846. },
  6847. operate: function (value, row, index, table) {
  6848. var showweigh = true;
  6849. var showedit = true;
  6850. var showdel = true;
  6851. if (typeof table != 'undefined') {
  6852. var options = table.bootstrapTable('getOptions');
  6853. if (options.extend.del_url == '')
  6854. showdel = false;
  6855. if (options.extend.edit_url == '')
  6856. showedit = false;
  6857. }
  6858. showweigh = typeof row[Table.config.dragsortfield] != 'undefined' ? true : false;
  6859. //行操作
  6860. var html = [];
  6861. if (showweigh)
  6862. html.push('<a href="javascript:;" class="btn btn-primary btn-dragsort btn-xs"><i class="fa fa-arrows"></i></a>');
  6863. if (showedit)
  6864. html.push('<a href="javascript:;" class="btn btn-success btn-editone btn-xs"><i class="fa fa-pencil"></i></a>');
  6865. if (showdel)
  6866. html.push('<a href="javascript:;" class="btn btn-danger btn-delone btn-xs"><i class="fa fa-trash"></i></a>');
  6867. return html.join(' ');
  6868. }
  6869. },
  6870. // 获取选中的条目ID集合
  6871. selectedids: function (table) {
  6872. return $.map(table.bootstrapTable('getSelections'), function (row) {
  6873. return row.id
  6874. });
  6875. },
  6876. // 切换复选框状态
  6877. toggleattr: function (table) {
  6878. $("input[type='checkbox']", table).trigger('click');
  6879. }
  6880. },
  6881. };
  6882. return Table;
  6883. });
  6884. /**
  6885. * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
  6886. * v1.5.3
  6887. *
  6888. * Copyright 2013, Moxiecode Systems AB
  6889. * Released under GPL License.
  6890. *
  6891. * License: http://www.plupload.com/license
  6892. * Contributing: http://www.plupload.com/contributing
  6893. *
  6894. * Date: 2017-02-02
  6895. */
  6896. !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.moxie};"function"==typeof define&&define.amd?define("moxie",[],i):"object"==typeof module&&module.exports?module.exports=i():e.moxie=i()}(this||window,function(){!function(e,t){"use strict";function i(e,t){for(var i,n=[],r=0;r<e.length;++r){if(i=s[e[r]]||o(e[r]),!i)throw"module definition dependecy not found: "+e[r];n.push(i)}t.apply(null,n)}function n(e,n,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(n===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";i(n,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var i=e,n=t.split(/[.\/]/),r=0;r<n.length;++r){if(!i[n[r]])return;i=i[n[r]]}return i}function a(i){for(var n=0;n<i.length;n++){for(var r=e,o=i[n],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={};n("moxie/core/utils/Basic",[],function(){function e(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()}function t(){return a(!1,!1,arguments)}function i(){return a(!0,!1,arguments)}function n(){return a(!1,!0,arguments)}function r(){return a(!0,!0,arguments)}function o(i){switch(e(i)){case"array":return Array.prototype.slice.call(i);case"object":return t({},i)}return i}function a(t,i,n){var r,s=n[0];return u(n,function(n,c){c>0&&u(n,function(n,u){var c=-1!==m(e(n),["array","object"]);return n===r||t&&s[u]===r?!0:(c&&i&&(n=o(n)),e(s[u])===e(n)&&c?a(t,i,[s[u],n]):s[u]=n,void 0)})}),s}function s(e,t){function i(){this.constructor=e}for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__parent__=t.prototype,e}function u(e,t){var i,n,r,o;if(e){try{i=e.length}catch(a){i=o}if(i===o||"number"!=typeof i){for(n in e)if(e.hasOwnProperty(n)&&t(e[n],n)===!1)return}else for(r=0;i>r;r++)if(t(e[r],r)===!1)return}}function c(t){var i;if(!t||"object"!==e(t))return!0;for(i in t)return!1;return!0}function l(t,i){function n(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?n(r):i(e)})}var r=0,o=t.length;"function"!==e(i)&&(i=function(){}),t&&t.length||i(),n(r)}function d(e,t){var i=0,n=e.length,r=new Array(n);u(e,function(e,o){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),r[o]=a,i++,i===n&&(r.unshift(null),t.apply(this,r))})})}function m(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var i=0,n=t.length;n>i;i++)if(t[i]===e)return i}return-1}function h(t,i){var n=[];"array"!==e(t)&&(t=[t]),"array"!==e(i)&&(i=[i]);for(var r in t)-1===m(t[r],i)&&n.push(t[r]);return n.length?n:!1}function f(e,t){var i=[];return u(e,function(e){-1!==m(e,t)&&i.push(e)}),i.length?i:null}function p(e){var t,i=[];for(t=0;t<e.length;t++)i[t]=e[t];return i}function g(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e}function x(e){if("string"!=typeof e)return e;var t,i={t:1099511627776,g:1073741824,m:1048576,k:1024};return e=/^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),t=e[2],e=+e[1],i.hasOwnProperty(t)&&(e*=i[t]),Math.floor(e)}function v(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e(t)?t:""})}function w(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var y=function(){var e=0;return function(t){var i,n=(new Date).getTime().toString(32);for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}();return{guid:y,typeOf:e,extend:t,extendIf:i,extendImmutable:n,extendImmutableIf:r,inherit:s,each:u,isEmptyObj:c,inSeries:l,inParallel:d,inArray:m,arrayDiff:h,arrayIntersect:f,toArray:p,trim:g,sprintf:v,parseSizeStr:x,delay:w}}),n("moxie/core/utils/Encode",[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},i=function(e,i){if("function"==typeof window.atob)return i?t(window.atob(e)):window.atob(e);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!e)return e;e+="";do a=d.indexOf(e.charAt(m++)),s=d.indexOf(e.charAt(m++)),u=d.indexOf(e.charAt(m++)),c=d.indexOf(e.charAt(m++)),l=a<<18|s<<12|u<<6|c,n=255&l>>16,r=255&l>>8,o=255&l,p[h++]=64==u?String.fromCharCode(n):64==c?String.fromCharCode(n,r):String.fromCharCode(n,r,o);while(m<e.length);return f=p.join(""),i?t(f):f},n=function(t,i){if(i&&(t=e(t)),"function"==typeof window.btoa)return window.btoa(t);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!t)return t;do n=t.charCodeAt(m++),r=t.charCodeAt(m++),o=t.charCodeAt(m++),l=n<<16|r<<8|o,a=63&l>>18,s=63&l>>12,u=63&l>>6,c=63&l,p[h++]=d.charAt(a)+d.charAt(s)+d.charAt(u)+d.charAt(c);while(m<t.length);f=p.join("");var g=t.length%3;return(g?f.slice(0,g-3):f)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:i,btoa:n}}),n("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(e){function t(e,t,i){var n=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),n=0;r>n;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]<t[n]){o=-1;break}if(e[n]>t[n]){o=1;break}}if(!i)return o;switch(i){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var i=function(e){var t="",i="?",n="function",r="undefined",o="object",a="name",s="version",u={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},c={rgx:function(){for(var t,i,a,s,u,c,l,d=0,m=arguments;d<m.length;d+=2){var h=m[d],f=m[d+1];if(typeof t===r){t={};for(s in f)u=f[s],typeof u===o?t[u[0]]=e:t[u]=e}for(i=a=0;i<h.length;i++)if(c=h[i].exec(this.getUA())){for(s=0;s<f.length;s++)l=c[++a],u=f[s],typeof u===o&&u.length>0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var a=0;a<n[r].length;a++)if(u.has(n[r][a],t))return r===i?e:r}else if(u.has(n[r],t))return r===i?e:r;return t}},l={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},d={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a,s],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],s],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[a,s],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],s],[/(edge)\/((\d+)?[\w\.]+)/i],[a,s],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],s],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],s],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[a,s],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],s],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],s],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[s,[a,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[s,[a,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[s,[a,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[s,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[s,a],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[s,c.str,l.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,s],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],s],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,s]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[s,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,s],[/rv\:([\w\.]+).*(gecko)/i],[s,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,s],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[s,c.str,l.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[s,c.str,l.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],s],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,s],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],s],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],s],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,s],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],s],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],s],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,s],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[s,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[s,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,s]]},m=function(e){var i=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return c.rgx.apply(this,d.browser)},this.getEngine=function(){return c.rgx.apply(this,d.engine)},this.getOS=function(){return c.rgx.apply(this,d.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return i},this.setUA=function(e){return i=e,this},this.setUA(i)};return m}(),n=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var i=new XMLHttpRequest;if(i.open("get","/"),"responseType"in i)return i.responseType=t,i.responseType!==t?!1:!0}}catch(n){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==o.browser||o.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(i){var n=[].slice.call(arguments);return n.shift(),"function"===e.typeOf(t[i])?t[i].apply(this,n):!!t[i]}}(),r=(new i).getResult(),o={can:n,uaParser:i,browser:r.browser.name,version:r.browser.version,os:r.os.name,osVersion:r.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return o.OS=o.os,o}),n("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{RuntimeError:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||": RuntimeError "+this.code)}var n={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(i,n),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": ImageError "+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(i,n),i.prototype=Error.prototype,i}(),FileException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": FileException "+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(i,n),i.prototype=Error.prototype,i}(),DOMException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": DOMException "+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(i,n),i.prototype=Error.prototype,i}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),n("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},i=function(e,t){if(!e.className)return!1;var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return i.test(e.className)},n=function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(i,function(e,t,i){return" "===t&&" "===i?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getBoundingClientRect(),t="CSS1Compat"===c.compatMode?c.documentElement:c.body,n=i.left+t.scrollLeft,r=i.top+t.scrollTop),{x:n,y:r}}var r,o,a,s=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!c.documentMode||c.documentMode<8))return o=n(t),a=n(i),{x:o.x-a.x,y:o.y-a.y};for(r=t;r&&r!=i&&r.nodeType;)s+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)s-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;return{x:s,y:u}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:i,addClass:n,removeClass:r,getStyle:o,getPos:a,getSize:s}}),n("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addEventListener:function(e,t,n,o){var a,s=this;return this.hasOwnProperty("uid")||(this.uid=i.guid("uid_")),e=i.trim(e),/\s/.test(e)?(i.each(e.split(/\s+/),function(e){s.addEventListener(e,t,n,o)}),void 0):(e=e.toLowerCase(),n=parseInt(n,10)||0,a=r[this.uid]&&r[this.uid][e]||[],a.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=a,void 0)},hasEventListener:function(e){var t;return e?(e=e.toLowerCase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeEventListener:function(e,t){var n,o,a=this;if(e=e.toLowerCase(),/\s/.test(e))return i.each(e.split(/\s+/),function(e){a.removeEventListener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var n,o,a,s,u,c={},l=!0;if("string"!==i.typeOf(e)){if(s=e,"string"!==i.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=s.type,s.total!==u&&s.loaded!==u&&(c.total=s.total,c.loaded=s.loaded),c.async=s.async||!1}if(-1!==e.indexOf("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c);var d=[];i.each(o,function(e){a[0].target=e.scope,c.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&i.inSeries(d,function(e){l=!e})}return l},bindOnce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===i.typeOf(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===i.typeOf(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(e,t,i,n){function r(e,n,o,s,u){var c,l=this,d=t.guid(n+"_"),m=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(m=r.getMode(s,e.preferred_caps,m)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var i=this;t.each(e,function(e,n){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getMode(s,e.required_caps,m),shimid:d+"_container",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(i)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],n))return!1;return!0}return"function"===t.typeOf(n[e])?n[e].call(this,i):i===n[e]},getShimContainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createElement("div"),n.id=this.shimid,n.className="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(n),e=null),n},getShim:function(){return c},shimExec:function(e,t){var i=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentNode.removeChild(e),c&&c.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return a[e]?a[e]:!1},r.addConstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var i={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getConstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatCan=function(e,t){var i=(t||r.order).split(/\s*,\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getMode=function(e,i,n){var r=null;if("undefined"===t.typeOf(n)&&(n="browser"),i&&!t.isEmptyObj(e)){if(t.each(i,function(i,n){if(e.hasOwnProperty(n)){var o=e[n](i);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(n,r)?n:r[0];if(r===!1)return!1}return n},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),n("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(e,t,i,n){return function(){var e;i.extend(this,{connectRuntime:function(r){function o(i){var a,u;return i.length?(a=i.shift().toLowerCase(),(u=n.getConstructor(a))?(e=new u(r),e.bind("Init",function(){e.initialized=!0,setTimeout(function(){e.clients++,s.ruid=e.uid,s.trigger("RuntimeInit",e)},1)}),e.bind("Error",function(){e.destroy(),o(i)}),e.bind("Exception",function(e,i){var n=i.name+"(#"+i.code+")"+(i.message?", from: "+i.message:"");s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR,n))}),e.mode?(e.init(),void 0):(e.trigger("Error"),void 0)):(o(i),void 0)):(s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),e=null,void 0)}var a,s=this;if("string"===i.typeOf(r)?a=r:"string"===i.typeOf(r.ruid)&&(a=r.ruid),a){if(e=n.getRuntime(a))return s.ruid=a,e.clients++,e;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null},can:function(t){return e?e.can(t):!1}})}}),n("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(e,t,i){function n(o,a){function s(t,i,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new n(null,{type:o,size:i-t}),a.detach(s.substr(t,a.size)),a):null}i.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,i){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,i)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),e=e||"","data:"==e.substr(0,5)){var i=e.indexOf(";base64,");this.type=e.substring(5,i),e=t.atob(e.substring(i+8))}this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return n}),n("moxie/core/I18n",["moxie/core/utils/Basic"],function(e){var t={};return{addI18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),n("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(e,t){var i="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",n={mimes:{},extensions:{},addMimeType:function(e){var t,i,n,r=e.split(/,/);for(t=0;t<r.length;t+=2){for(n=r[t+1].split(/ /),i=0;i<n.length;i++)this.mimes[n[i]]=r[t];this.extensions[r[t]]=n}},extList2mimes:function(t,i){var n,r,o,a,s=this,u=[];for(r=0;r<t.length;r++)for(n=t[r].extensions.toLowerCase().split(/\s*,\s*/),o=0;o<n.length;o++){if("*"===n[o])return[];if(a=s.mimes[n[o]],i&&/^\w+$/.test(n[o]))u.push("."+n[o]);else if(a&&-1===e.inArray(a,u))u.push(a);else if(!a)return[]}return u},mimes2exts:function(t){var i=this,n=[];return e.each(t,function(t){if(t=t.toLowerCase(),"*"===t)return n=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(i.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(n,i.extensions[t])}):i.extensions[t]&&[].push.apply(n,i.extensions[t]))}),n},mimes2extList:function(i){var n=[],r=[];return"string"===e.typeOf(i)&&(i=e.trim(i).split(/\s*,\s*/)),r=this.mimes2exts(i),n.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),n.mimes=i,n},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return n.addMimeType(i),n}),n("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o,a,s,u){function c(t){var o,c,d;if(-1!==e.inArray(e.typeOf(t),["string","node"])&&(t={browse_button:t}),c=n.get(t.browse_button),!c)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR);d={accept:[{title:a.translate("All Files"),extensions:"*"}],multiple:!1,required_caps:!1,container:c.parentNode||document.body},t=e.extend({},d,t),"string"==typeof t.required_caps&&(t.required_caps=s.parseCaps(t.required_caps)),"string"==typeof t.accept&&(t.accept=i.mimes2extList(t.accept)),o=n.get(t.container),o||(o=document.body),"static"===n.getStyle(o,"position")&&(o.style.position="relative"),o=c=null,u.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){var i=this;i.bind("RuntimeInit",function(r,o){i.ruid=o.uid,i.shimid=o.shimid,i.bind("Ready",function(){i.trigger("Refresh")},999),i.bind("Refresh",function(){var i,r,a,s,u;a=n.get(t.browse_button),s=n.get(o.shimid),a&&(i=n.getPos(a,n.get(t.container)),r=n.getSize(a),u=parseInt(n.getStyle(a,"z-index"),10)||0,s&&e.extend(s.style,{top:i.y+"px",left:i.x+"px",width:r.w+"px",height:r.h+"px",zIndex:u+1})),s=a=null}),o.exec.call(i,"FileInput","init",t)}),i.connectRuntime(e.extend({},t,{required_caps:{select_file:!0}}))},getOption:function(e){return t[e]},setOption:function(e,n){if(t.hasOwnProperty(e)){var o=t[e];switch(e){case"accept":"string"==typeof n&&(n=i.mimes2extList(n));break;case"container":case"required_caps":throw new r.FileException(r.FileException.NO_MODIFICATION_ALLOWED_ERR)}t[e]=n,this.exec("FileInput","setOption",e,n),this.trigger("OptionChanged",e,n,o)}},disable:function(t){var i=this.getRuntime();i&&this.exec("FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){this.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=o.instance,c}),n("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(e,t,i){function n(n,r){r||(r={}),i.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var a=this.type.split("/")[0];o=e.guid((""!==a?a:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return n.prototype=i.prototype,n}),n("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u){function c(i){var r,o=this;"string"==typeof i&&(i={drop_zone:i}),r={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},i="object"==typeof i?n.extend({},r,i):r,i.container=t.get(i.drop_zone)||document.body,"static"===t.getStyle(i.container,"position")&&(i.container.style.position="relative"),"string"==typeof i.accept&&(i.accept=u.mimes2extList(i.accept)),a.call(o),n.extend(o,{uid:n.guid("uid_"),ruid:null,files:null,init:function(){o.bind("RuntimeInit",function(e,t){o.ruid=t.uid,t.exec.call(o,"FileDrop","init",i),o.dispatchEvent("ready")}),o.connectRuntime(i)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=s.instance,c}),n("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o){function a(){function n(e,n){if(this.trigger("loadstart"),this.readyState===a.LOADING)return this.trigger("error",new i.DOMException(i.DOMException.INVALID_STATE_ERR)),this.trigger("loadend"),void 0;
  6897. if(!(n instanceof r))return this.trigger("error",new i.DOMException(i.DOMException.NOT_FOUND_ERR)),this.trigger("loadend"),void 0;if(this.result=null,this.readyState=a.LOADING,n.isDetached()){var o=n.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=o;break;case"readAsDataURL":this.result="data:"+n.type+";base64,"+t.btoa(o)}this.readyState=a.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(n.ruid),this.exec("FileReader","read",e,n)}o.call(this),e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){n.call(this,"readAsDataURL",e)},readAsText:function(e){n.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[a.EMPTY,a.DONE])&&(this.readyState===a.LOADING&&(this.readyState=a.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(s),this.bind("Error",function(e,t){this.readyState=a.DONE,this.error=t},999),this.bind("Load",function(){this.readyState=a.DONE},999)}var s=["loadstart","progress","load","abort","error","loadend"];return a.EMPTY=0,a.LOADING=1,a.DONE=2,a.prototype=n.instance,a}),n("moxie/core/utils/Url",["moxie/core/utils/Basic"],function(e){var t=function(i,n){var r,o=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],a=o.length,s={http:80,https:443},u={},c=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,l=c.exec(i||""),d=/^\/\/\w/.test(i);switch(e.typeOf(n)){case"undefined":n=t(document.location.href,!1);break;case"string":n=t(n,!1)}for(;a--;)l[a]&&(u[o[a]]=l[a]);if(r=!d&&!u.scheme,(d||r)&&(u.scheme=n.scheme),r){u.host=n.host,u.port=n.port;var m="";/^[^\/]/.test(u.path)&&(m=n.path,m=/\/[^\/]*\.[^\/]*$/.test(m)?m.replace(/\/[^\/]+$/,"/"):m.replace(/\/?$/,"/")),u.path=m+(u.path||"")}return u.port||(u.port=s[u.scheme]||80),u.port=parseInt(u.port,10),u.path||(u.path="/"),delete u.source,u},i=function(e){var i={http:80,https:443},n="object"==typeof e?e:t(e);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},n=function(e){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof e&&(e=t(e)),i(t())===i(e)};return{parseUrl:t,resolveUrl:i,hasSameOrigin:n}}),n("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i){function n(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return n.prototype=i.instance,n}),n("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,t,i){return function(){function n(e,t){if(!t.isDetached()){var n=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),n}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+i.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return n.call(this,"readAsDataURL",e)},readAsText:function(e){return n.call(this,"readAsText",e)}})}}),n("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof i?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):n.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u,c,l,d){function m(){this.uid=e.guid("uid_")}function h(){function i(e,t){return I.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?I[e]:A[e]:(l.can("define_property")?I[e]=t:A[e]=t,void 0):void 0}function u(t){function n(){R&&(R.destroy(),R=null),s.dispatchEvent("loadend"),s=null}function r(r){R.bind("LoadStart",function(e){i("readyState",h.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),L&&s.upload.dispatchEvent(e)}),R.bind("Progress",function(e){i("readyState")!==h.LOADING&&(i("readyState",h.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),R.bind("UploadProgress",function(e){L&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),R.bind("Load",function(t){i("readyState",h.DONE),i("status",Number(r.exec.call(R,"XMLHttpRequest","getStatus")||0)),i("statusText",f[i("status")]||""),i("response",r.exec.call(R,"XMLHttpRequest","getResponse",i("responseType"))),~e.inArray(i("responseType"),["text",""])?i("responseText",i("response")):"document"===i("responseType")&&i("responseXML",i("response")),U=r.exec.call(R,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),i("status")>0?(L&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(F=!0,s.dispatchEvent("error")),n()}),R.bind("Abort",function(e){s.dispatchEvent(e),n()}),R.bind("Error",function(e){F=!0,i("readyState",h.DONE),s.dispatchEvent("readystatechange"),M=!0,s.dispatchEvent(e),n()}),r.exec.call(R,"XMLHttpRequest","send",{url:x,method:v,async:T,user:w,password:y,headers:S,mimeType:D,encoding:O,responseType:s.responseType,withCredentials:s.withCredentials,options:k},t)}var s=this;E=(new Date).getTime(),R=new a,"string"==typeof k.required_caps&&(k.required_caps=o.parseCaps(k.required_caps)),k.required_caps=e.extend({},k.required_caps,{return_response_type:s.responseType}),t instanceof c&&(k.required_caps.send_multipart=!0),e.isEmptyObj(S)||(k.required_caps.send_custom_headers=!0),B||(k.required_caps.do_cors=!0),k.ruid?r(R.connectRuntime(k)):(R.bind("RuntimeInit",function(e,t){r(t)}),R.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),R.connectRuntime(k))}function g(){i("responseText",""),i("responseXML",null),i("response",null),i("status",0),i("statusText",""),E=b=null}var x,v,w,y,E,b,R,_,A=this,I={timeout:0,readyState:h.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},T=!0,S={},O=null,D=null,N=!1,C=!1,L=!1,M=!1,F=!1,B=!1,P=null,H=null,k={},U="";e.extend(this,I,{uid:e.guid("uid_"),upload:new m,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(v=o.toUpperCase()),~e.inArray(v,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=n.utf8_encode(a),l=r.parseUrl(a),B=r.hasSameOrigin(l),x=r.resolveUrl(a),(u||c)&&!B)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(w=u||l.user,y=c||l.pass,T=s||!0,T===!1&&(i("timeout")||i("withCredentials")||""!==i("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);N=!T,C=!1,S={},g.call(this),i("readyState",h.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(i("readyState")!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(S[r]?S[r]+=", "+o:S[r]=o,!0)},hasRequestHeader:function(e){return e&&S[e.toLowerCase()]||!1},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),F||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(_||(_={},e.each(U.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=e.trim(i[0]),_[i[0].toLowerCase()]={header:i[0],value:e.trim(i[1])})})),_.hasOwnProperty(t))?_[t].header+": "+_[t].value:null},overrideMimeType:function(n){var r,o;if(~e.inArray(i("readyState"),[h.LOADING,h.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n=e.trim(n.toLowerCase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.DOMException(t.DOMException.SYNTAX_ERR);P=n,H=o},send:function(i,r){if(k="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof s)k.ruid=i.ruid,D=i.type||"application/octet-stream";else if(i instanceof c){if(i.hasBlob()){var o=i.getBlob();k.ruid=o.ruid,D=o.type||"application/octet-stream"}}else"string"==typeof i&&(O="UTF-8",D="text/plain;charset=UTF-8",i=n.utf8_encode(i));this.withCredentials||(this.withCredentials=k.required_caps&&k.required_caps.send_browser_cookies&&!B),L=!N&&this.upload.hasEventListener(),F=!1,M=!i,N||(C=!0),u.call(this,i)},abort:function(){if(F=!0,N=!1,~e.inArray(i("readyState"),[h.UNSENT,h.OPENED,h.DONE]))i("readyState",h.UNSENT);else{if(i("readyState",h.DONE),C=!1,!R)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);R.getRuntime().exec.call(R,"XMLHttpRequest","abort",M),M=!0}},destroy:function(){R&&("function"===e.typeOf(R.destroy)&&R.destroy(),R=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat(["readystatechange"])),this.upload.handleEventProps(p)}var f={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};m.prototype=i.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return h.UNSENT=0,h.OPENED=1,h.HEADERS_RECEIVED=2,h.LOADING=3,h.DONE=4,h.prototype=i.instance,h}),n("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(n.state,[r.IDLE,r.DONE])&&a.call(n)},999),n.bind("TransportingComplete",function(){d=l,n.state=r.DONE,c=null,n.result=u.exec.call(n,"Transporter","getAsBlob",t||"")},999),n.state=r.BUSY,n.trigger("TransportingStarted"),a.call(n)}function a(){var e,i=this,n=l-d;m>n&&(m=n),e=t.btoa(c.substr(d,m)),u.exec.call(i,"Transporter","receive",e,l)}var s,u,c,l,d,m;i.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,i,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),m=r.chunk_size,n.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,i,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,i,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),n.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),n.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=n.instance,r}),n("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(e,t,i,n,r,o,a,s,u,c,l,d,m){function h(){function n(e){try{return e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name),!0}catch(t){return this.trigger("error",t.code),!1}}function c(t){var n=e.typeOf(t);try{if(t instanceof h){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(n,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===n)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if("node"!==n||"img"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function p(t,i){var n=this.connectRuntime(t.ruid);this.ruid=n.uid,n.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){n(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=o.parseCaps(i.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectRuntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,a={x:0,y:0,width:o.width,height:o.height},s=e.extendIf({width:o.width,height:o.height,type:o.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t);try{if(!o.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(o.width>h.MAX_RESIZE_WIDTH||o.height>h.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.Orientation||1,-1!==e.inArray(n,[5,6,7,8])){var u=s.width;s.width=s.height,s.height=u}if(s.crop){switch(r=Math.max(s.width/o.width,s.height/o.height),t.fit?(a.width=Math.min(Math.ceil(s.width/r),o.width),a.height=Math.min(Math.ceil(s.height/r),o.height),r=s.width/a.width):(a.width=Math.min(s.width,o.width),a.height=Math.min(s.height,o.height),r=1),"boolean"==typeof s.crop&&(s.crop="cc"),s.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":a.x=o.width-a.width,a.y=o.height-a.height;break;case"cb":case"center-bottom":a.x=Math.floor((o.width-a.width)/2),a.y=o.height-a.height;break;case"lb":case"left-bottom":a.x=0,a.y=o.height-a.height;break;case"lt":case"left-top":a.x=0,a.y=0;break;case"ct":case"center-top":a.x=Math.floor((o.width-a.width)/2),a.y=0;break;case"rt":case"right-top":a.x=o.width-a.width,a.y=0;break;case"rc":case"right-center":case"right-middle":a.x=o.width-a.width,a.y=Math.floor((o.height-a.height)/2);break;case"lc":case"left-center":case"left-middle":a.x=0,a.y=Math.floor((o.height-a.height)/2);break;case"cc":case"center-center":case"center-middle":default:a.x=Math.floor((o.width-a.width)/2),a.y=Math.floor((o.height-a.height)/2)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0)}else r=Math.min(s.width/o.width,s.height/o.height);this.exec("Image","resize",a,r,s)}catch(c){o.trigger("error",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:"default"};i="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return this.exec("Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var i=this.getAsDataURL(e,t);return m.atob(i.substring(i.indexOf("base64,")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return n.appendChild(l),l=null,o.destroy(),c.trigger("embedded"),void 0}var d=o.getAsDataURL(t,r);if(!d)throw new i.ImageError(i.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))n.innerHTML='<img src="'+d+'" width="'+o.width+'" height="'+o.height+'" />',o.destroy(),c.trigger("embedded");else{var h=new s;h.bind("TransportingComplete",function(){a=c.connectRuntime(this.result.ruid),c.bind("Embedded",function(){e.extend(a.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),a=null},999),a.exec.call(c,"ImageView","display",this.result.uid,width,height),o.destroy()}),h.transport(m.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:n})}}var a,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},r);try{if(!(n=t.get(n)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT;var d=new h;return d.bind("Resize",function(){o.call(this,l.type,l.quality)}),d.bind("Load",function(){this.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(f){this.trigger("error",f.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.meta&&this.meta.thumb&&this.meta.thumb.data.destroy(),this.unbindAll()}}),this.handleEventProps(f),this.bind("Load Resize",function(){return n.call(this)},999)}var f=["progress","load","error","resize","embedded"];return h.MAX_RESIZE_WIDTH=8192,h.MAX_RESIZE_HEIGHT=8192,h.prototype=c.instance,h}),n("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!s.Image},display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==n.browser||n.verComp(n.version,9,">"))}()),filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return"json"===e&&window.JSON?!0:n.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&n.can("create_canvas")},select_file:function(){return n.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===n.browser&&n.verComp(n.version,21,">=")||"Firefox"===n.browser&&n.verComp(n.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"Safari"===n.browser&&"Windows"===n.os||"iOS"===n.os&&n.verComp(n.osVersion,"7.0.0",">")&&n.verComp(n.osVersion,"8.0.0","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari","Edge"]))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html5",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){function i(){function e(e,t,i){var n;if(!window.File.prototype.slice)return(n=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=i}),n("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(e){function t(){this.returnValue=!1}function i(){this.cancelBubble=!0}var n={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=i,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),n.hasOwnProperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,i,o){var a,s;if(i=i.toLowerCase(),t[r]&&n[t[r]]&&n[t[r]][i]){a=n[t[r]][i];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(i,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+i,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete n[t[r]][i],e.isEmptyObj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){a(t,n,i)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),n("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){var e,s;i.extend(this,{init:function(u){var c,l,d,m,h,f,p=this,g=p.getRuntime();e=u,d=e.accept.mimes||o.extList2mimes(e.accept,g.can("filter_by_extension")),l=g.getShimContainer(),l.innerHTML='<input id="'+g.uid+'" type="file" style="font-size:999px;opacity:0;"'+(e.multiple&&g.can("select_multiple")?"multiple":"")+(e.directory&&g.can("select_folder")?"webkitdirectory directory":"")+(d?' accept="'+d.join(",")+'"':"")+" />",c=n.get(g.uid),i.extend(c.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=n.get(e.browse_button),s=n.getStyle(m,"z-index")||"auto",g.can("summon_file_dialog")&&("static"===n.getStyle(m,"position")&&(m.style.position="relative"),r.addEvent(m,"click",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventDefault()},p.uid),p.bind("Refresh",function(){h=parseInt(s,10)||1,n.get(e.browse_button).style.zIndex=h,this.getRuntime().getShimContainer().style.zIndex=h-1})),f=g.can("summon_file_dialog")?m:l,r.addEvent(f,"mouseover",function(){p.trigger("mouseenter")},p.uid),r.addEvent(f,"mouseout",function(){p.trigger("mouseleave")},p.uid),r.addEvent(f,"mousedown",function(){p.trigger("mousedown")},p.uid),r.addEvent(n.get(e.container),"mouseup",function(){p.trigger("mouseup")},p.uid),c.onchange=function x(){if(p.files=[],i.each(this.files,function(i){var n="";return e.directory&&"."==i.name?!0:(i.webkitRelativePath&&(n="/"+i.webkitRelativePath.replace(/^\//,"")),i=new t(g.uid,i),i.relativePath=n,p.files.push(i),void 0)}),"IE"!==a.browser&&"IEMobile"!==a.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=x}p.files.length&&p.trigger("change")},p.trigger({type:"ready",async:!0}),l=null},setOption:function(e,t){var i=this.getRuntime(),r=n.get(i.uid);switch(e){case"accept":if(t){var a=t.mimes||o.extList2mimes(t,i.can("filter_by_extension"));r.setAttribute("accept",a.join(","))}else r.removeAttribute("accept");break;case"directory":t&&i.can("select_folder")?(r.setAttribute("directory",""),r.setAttribute("webkitdirectory","")):(r.removeAttribute("directory"),r.removeAttribute("webkitdirectory"));break;case"multiple":t&&i.can("select_multiple")?r.setAttribute("multiple",""):r.removeAttribute("multiple")}},disable:function(e){var t,i=this.getRuntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getRuntime(),i=t.getShim(),o=t.getShimContainer(),a=e&&n.get(e.container),u=e&&n.get(e.browse_button);a&&r.removeAllEvents(a,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=s),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=""),i.removeInstance(this.uid),e=o=a=u=i=null}})}return e.FileInput=s}),n("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,t,i,n,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=i.toArray(e.dataTransfer.types||[]);return-1!==i.inArray("Files",t)||-1!==i.inArray("public.file-url",t)||-1!==i.inArray("application/x-moz-file",t)}function a(e,i){if(u(e)){var n=new t(f,e);n.relativePath=i||"",p.push(n)}}function s(e){for(var t=[],n=0;n<e.length;n++)[].push.apply(t,e[n].extensions.split(/\s*,\s*/));return-1===i.inArray("*",t)?t:[]}function u(e){if(!g.length)return!0;var t=o.getFileExtension(e.name);return!t||-1!==i.inArray(t,g)}function c(e,t){var n=[];i.each(e,function(e){var t=e.webkitGetAsEntry();t&&(t.isFile?a(e.getAsFile(),t.fullPath):n.push(t))}),n.length?l(n,t):t()}function l(e,t){var n=[];i.each(e,function(e){n.push(function(t){d(e,t)})}),i.inSeries(n,function(){t()})}function d(e,t){e.isFile?e.file(function(i){a(i,e.fullPath),t()},function(){t()}):e.isDirectory?m(e,t):t()}function m(e,t){function i(e){r.readEntries(function(t){t.length?([].push.apply(n,t),i(e)):e()},e)}var n=[],r=e.createReader();i(function(){l(n,t)})}var h,f,p=[],g=[];i.extend(this,{init:function(t){var n,o=this;h=t,f=o.ruid,g=s(h.accept),n=h.container,r.addEvent(n,"dragover",function(t){e(t)&&(t.preventDefault(),t.dataTransfer.dropEffect="copy")},o.uid),r.addEvent(n,"drop",function(t){e(t)&&(t.preventDefault(),p=[],t.dataTransfer.items&&t.dataTransfer.items[0].webkitGetAsEntry?c(t.dataTransfer.items,function(){o.files=p,o.trigger("drop")}):(i.each(t.dataTransfer.files,function(e){a(e)}),o.files=p,o.trigger("drop")))},o.uid),r.addEvent(n,"dragenter",function(){o.trigger("dragenter")},o.uid),r.addEvent(n,"dragleave",function(){o.trigger("dragleave")},o.uid)},destroy:function(){r.removeAllEvents(h&&n.get(h.container),this.uid),f=p=g=h=null}})}return e.FileDrop=a}),n("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(e,t,i){function n(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var n,r=!1;i.extend(this,{read:function(t,o){var a=this;a.result="",n=new window.FileReader,n.addEventListener("progress",function(e){a.trigger(e)}),n.addEventListener("load",function(t){a.result=r?e(n.result):n.result,a.trigger(t)}),n.addEventListener("error",function(e){a.trigger(e,n.error)}),n.addEventListener("loadend",function(e){n=null,a.trigger(e)}),"function"===i.typeOf(n[t])?(r=!1,n[t](o.getSource())):"readAsBinaryString"===t&&(r=!0,n.readAsDataURL(o.getSource()))},abort:function(){n&&n.abort()},destroy:function(){n=null}})}return e.FileReader=n}),n("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(e,t){var i,n,r=this;i=t.getBlob().getSource(),n=new window.FileReader,n.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:n.result})),f.send.call(r,e,t)},n.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.verComp(u.version,8,"<")?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(i){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,i=e.responseText;return"IE"===u.browser&&i&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(i)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),i="--",n="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return m.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?i+t+n+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+n+"Content-Type: "+(e.type||"application/octet-stream")+n+n+e.getSource()+n:i+t+n+'Content-Disposition: form-data; name="'+a+'"'+n+n+unescape(encodeURIComponent(e))+n}),r+=i+t+i+n}var m,h,f=this;t.extend(this,{send:function(i,r){var s=this,l="Mozilla"===u.browser&&u.verComp(u.version,4,">=")&&u.verComp(u.version,7,"<"),f="Android Browser"===u.browser,p=!1;
  6898. if(h=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),m=c(),m.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isDetached()&&(p=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),p=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,i,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}m.upload?(i.withCredentials&&(m.withCredentials=!0),m.addEventListener("load",function(e){s.trigger(e)}),m.addEventListener("error",function(e){s.trigger(e)}),m.addEventListener("progress",function(e){s.trigger(e)}),m.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var e,t;try{n.hasSameOrigin(i.url)&&(e=m.getResponseHeader("Content-Length")||0),m.responseText&&(t=m.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:m.onreadystatechange=function(){},0===m.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(i.headers)||t.each(i.headers,function(e,t){m.setRequestHeader(t,e)}),""!==i.responseType&&"responseType"in m&&(m.responseType="json"!==i.responseType||u.can("return_response_type","json")?i.responseType:"text"),p?m.sendAsBinary?m.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);m.send(e.buffer)}():m.send(r),s.trigger("loadstart")},getStatus:function(){try{if(m)return m.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var n=new r(t.uid,m.response),o=m.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return n.name=h,n.type||(n.type=i.getFileMime(h)),n;case"json":return u.can("return_response_type","json")?m.response:200===m.status&&window.JSON?JSON.parse(m.responseText):null;case"document":return l(m);default:return""!==m.responseText?m.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return m.getAllResponseHeaders()}catch(e){}return""},abort:function(){m&&m.abort()},destroy:function(){f=h=null}})}return e.XMLHttpRequest=c}),n("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(e){function t(e){e instanceof ArrayBuffer?i.apply(this,arguments):n.apply(this,arguments)}function i(t){var i=new DataView(t);e.extend(this,{readByteAt:function(e){return i.getUint8(e)},writeByteAt:function(e,t){i.setUint8(e,t)},SEGMENT:function(e,n,r){switch(arguments.length){case 2:return t.slice(e,e+n);case 1:return t.slice(e);case 3:if(null===r&&(r=new ArrayBuffer),r instanceof ArrayBuffer){var o=new Uint8Array(this.length()-n+r.byteLength);e>0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+n)),e+r.byteLength),this.clear(),t=o.buffer,i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){i(String.fromCharCode(t),e,1)},SEGMENT:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:"",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(n=this.littleEndian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readByteAt(e+r)<<Math.abs(n+8*r);return i},write:function(e,t,i){var n,r;if(e>this.length())throw new Error("You are trying to write outside the source boundaries.");for(n=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(e+r,255&t>>Math.abs(n+8*r))},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,t){return function i(n){var r,o,a,s=[],u=0;if(r=new e(n),65496!==r.SHORT(0))throw r.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(o=2;o<=r.length();)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;u=r.SHORT(o+2)+2,a>=65505&&65519>=a&&s.push({hex:a,name:"APP"+(15&a),start:o,length:u,segment:r.SEGMENT(o,u)}),o+=u}return r.clear(),{headers:s,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,i=s.length;i>n;n++)r.SEGMENT(o,0,s[n].segment),o+=s[n].length;return t=r.SEGMENT(),r.clear(),t},strip:function(t){var n,r,o,a;for(o=new i(t),r=o.headers,o.purge(),n=new e(t),a=r.length;a--;)n.SEGMENT(r[a].start,r[a].length,"");return t=n.SEGMENT(),n.clear(),t},get:function(e){for(var t=[],i=0,n=s.length;n>i;i++)s[i].name===e.toUpperCase()&&t.push(s[i].segment);return t},set:function(e,t){var i,n,r,o=[];for("string"==typeof t?o.push(t):o=t,i=n=0,r=s.length;r>i&&(s[i].name===e.toUpperCase()&&(s[i].segment=o[n],s[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=s=[]}}}}),n("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,i,n){function r(o){function a(i,r){var o,a,s,u,c,m,h,f,p=this,g=[],x={},v={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},w={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(o=p.SHORT(i),a=0;o>a;a++)if(g=[],h=i+2+12*a,s=r[p.SHORT(h)],s!==t){if(u=v[p.SHORT(h+=2)],c=p.LONG(h+=2),m=w[u],!m)throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(h+=4,m*c>4&&(h=p.LONG(h)+d.tiffHeader),h+m*c>=this.length())throw new n.ImageError(n.ImageError.INVALID_META_ERR);"ASCII"!==u?(g=p.asArray(u,h,c),f=1==c?g[0]:g,x[s]=l.hasOwnProperty(s)&&"object"!=typeof f?l[s][f]:f):x[s]=e.trim(p.STRING(h,c).replace(/\0$/,""))}return x}function s(e,t,i){var n,r,o,a=0;if("string"==typeof t){var s=c[e.toLowerCase()];for(var u in s)if(s[u]===t){t=u;break}}n=d[e.toLowerCase()+"IFD"],r=this.SHORT(n);for(var l=0;r>l;l++)if(o=n+12*l+2,this.SHORT(o)==t){a=o+8;break}if(!a)return!1;try{this.write(a,i,4)}catch(m){return!1}return!0}var u,c,l,d,m,h;if(i.call(this,o),c={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},d={tiffHeader:10},m=d.tiffHeader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return h||null},EXIF:function(){var t=null;if(d.exifIFD){try{t=a.call(this,d.exifIFD,c.exif)}catch(i){return null}if(t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}}return t},GPS:function(){var t=null;if(d.gpsIFD){try{t=a.call(this,d.gpsIFD,c.gps)}catch(i){return null}t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join("."))}return t},thumb:function(){if(d.IFD1)try{var e=a.call(this,d.IFD1,c.thumb);if("JPEGInterchangeFormat"in e)return this.SEGMENT(d.tiffHeader+e.JPEGInterchangeFormat,e.JPEGInterchangeFormatLength)}catch(t){}return null},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:s.call(this,"exif",e,t)},clear:function(){u.clear(),o=c=l=h=d=u=null}}),65505!==this.SHORT(0)||"EXIF\0"!==this.STRING(4,5).toUpperCase())throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(m),42!==this.SHORT(m+=2))throw new n.ImageError(n.ImageError.INVALID_META_ERR);d.IFD0=d.tiffHeader+this.LONG(m+=2),h=a.call(this,d.IFD0,c.tiff),"ExifIFDPointer"in h&&(d.exifIFD=d.tiffHeader+h.ExifIFDPointer,delete h.ExifIFDPointer),"GPSInfoIFDPointer"in h&&(d.gpsIFD=d.tiffHeader+h.GPSInfoIFDPointer,delete h.GPSInfoIFDPointer),e.isEmptyObj(h)&&(h=null);var f=this.LONG(d.IFD0+12*this.SHORT(d.IFD0)+2);f&&(d.IFD1=d.tiffHeader+f)}return r.prototype=i.prototype,r}),n("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(e,t,i,n,r){function o(o){function a(e){var t,i,n=0;for(e||(e=c);n<=e.length();){if(t=e.SHORT(n+=2),t>=65472&&65475>=t)return n+=5,{height:e.SHORT(n),width:e.SHORT(n+=2)};i=e.SHORT(n+=2),n+=i-2}return null}function s(){var e,t,i=d.thumb();return i&&(e=new n(i),t=a(e),e.clear(),t)?(t.data=i,t):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),m=l=d=c=null)}var c,l,d,m;if(c=new n(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new i(o);try{d=new r(l.get("app1")[0])}catch(h){}m=a.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:m&&m.width||0,height:m&&m.height||0,setExif:function(t,i){return d?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,i),l.set("app1",d.SEGMENT()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:s()})}return o}),n("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(e,t,i){function n(n){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:s.LONG(t),height:s.LONG(t+=4)}):null}function o(){s&&(s.clear(),n=l=u=c=s=null)}function a(e){var t,i,n,r;return t=s.LONG(e),i=s.STRING(e+=4,4),n=e+=4,r=s.LONG(e+t),{length:t,type:i,start:n,CRC:r}}var s,u,c,l;s=new i(n),function(){var t=0,i=0,n=[35152,20039,3338,6666];for(i=0;i<n.length;i++,t+=2)if(n[i]!=s.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),l=r.call(this),t.extend(this,{type:"image/png",size:s.length(),width:l.width,height:l.height,purge:function(){o.call(this)}}),o.call(this)}return n}),n("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(e,t,i,n){return function(r){var o,a=[i,n];o=function(){for(var e=0;e<a.length;e++)try{return new a[e](r)}catch(i){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){r=null}}),e.extend(this,o),this.purge=function(){o.purge(),o=null}}}),n("moxie/runtime/html5/image/ResizerCanvas",[],function(){function e(i,n){var r=i.width,o=Math.floor(r*n),a=!1;(.5>n||n>2)&&(n=.5>n?.5:2,a=!0);var s=t(i,n);return a?e(s,o/s.width):s}function t(e,t){var i=e.width,n=e.height,r=Math.floor(i*t),o=Math.floor(n*t),a=document.createElement("canvas");return a.width=r,a.height=o,a.getContext("2d").drawImage(e,0,0,i,n,0,0,r,o),e=null,a}return{scale:e}}),n("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/ResizerCanvas","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(){if(!v&&!g)throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);return v||g}function c(){var t=e();return"canvas"==t.nodeName.toLowerCase()?t:(v=document.createElement("canvas"),v.width=t.width,v.height=t.height,v.getContext("2d").drawImage(t,0,0),v)}function l(e){return n.atob(e.substring(e.indexOf("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+n.btoa(e)}function m(e){var t=this;g=new Image,g.onerror=function(){p.call(this),t.trigger("error",i.ImageError.WRONG_FORMAT)},g.onload=function(){t.trigger("load")},g.src="data:"==e.substr(0,5)?e:d(e,y.type)}function h(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t.call(r,this.result)},n.onerror=function(){r.trigger("error",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t.call(this,e.getAsDataURL())}function f(e,i){var n=Math.PI/180,r=document.createElement("canvas"),o=r.getContext("2d"),a=e.width,s=e.height;switch(t.inArray(i,[5,6,7,8])>-1?(r.width=s,r.height=a):(r.width=a,r.height=s),i){case 2:o.translate(a,0),o.scale(-1,1);break;case 3:o.translate(a,s),o.rotate(180*n);break;case 4:o.translate(0,s),o.scale(1,-1);break;case 5:o.rotate(90*n),o.scale(1,-1);break;case 6:o.rotate(90*n),o.translate(0,-s);break;case 7:o.rotate(90*n),o.translate(a,-s),o.scale(-1,1);break;case 8:o.rotate(-90*n),o.translate(-a,0)}return o.drawImage(e,0,0,a,s),r}function p(){x&&(x.purge(),x=null),w=g=v=y=null,b=!1}var g,x,v,w,y,E=this,b=!1,R=!0;t.extend(this,{loadFromBlob:function(e){var t=this.getRuntime(),n=arguments.length>1?arguments[1]:!0;if(!t.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return y=e,e.isDetached()?(w=e.getSource(),m.call(this,w),void 0):(h.call(this,e.getSource(),function(e){n&&(w=l(e)),m.call(this,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,y=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?w=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&w&&i.can("access_image_binary")&&(x=new a(w)),t={width:e().width||0,height:e().height||0,type:y.type||u.getFileMime(y.name),size:w&&w.length||y.size||0,name:y.name||"",meta:null},R&&(t.meta=x&&x.meta||this.meta||{},!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof r||(t.meta.thumb.data=new r(null,{type:"image/jpeg",data:t.meta.thumb.data}))),t},resize:function(t,i,n){var r=document.createElement("canvas");if(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),v=s.scale(r,i),R=n.preserveHeaders,!R){var o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;v=f(v,o)}this.width=v.width,this.height=v.height,b=!0,this.trigger("Resize")},getAsCanvas:function(){return v||(v=c()),v.id=this.uid+"_canvas",v},getAsBlob:function(e,t){return e!==this.type?(b=!0,new o(null,{name:y.name||"",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:y.name||"",type:e,data:E.getAsBinaryString(e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!b)return g.src;if(c(),"image/jpeg"!==e)return v.toDataURL("image/png");try{return v.toDataURL("image/jpeg",t/100)}catch(i){return v.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!b)return w||(w=l(E.getAsDataURL(e,t))),w;if("image/jpeg"!==e)w=l(E.getAsDataURL(e,t));else{var i;t||(t=90),c();try{i=v.toDataURL("image/jpeg",t/100)}catch(n){i=v.toDataURL("image/jpeg")}w=l(i),x&&(w=x.stripHeaders(w),R&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),w=x.writeHeaders(w)),x.purge(),x=null)}return b=!1,w},destroy:function(){E=null,p.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),n("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function s(e){var n=i.get(e);n&&"OBJECT"==n.nodeName&&("IE"===t.browser?(n.style.display="none",function r(){4==n.readyState?u(e):setTimeout(r,10)}()):n.parentNode.removeChild(n))}function u(e){var t=i.get(e);if(t){for(var n in t)"function"==typeof t[n]&&(t[n]=null);t.parentNode.removeChild(t)}}function c(u){var c,m=this;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&"browser"===m.mode},access_image_binary:function(e){return e&&"browser"===m.mode},display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===m.mode},resize_image:o.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===m.mode},return_status_code:function(t){return"browser"===m.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:function(e){return e&&"browser"===m.mode},send_browser_cookies:function(e){return e&&"browser"===m.mode},send_custom_headers:function(e){return e&&"browser"===m.mode},send_multipart:o.capTrue,slice_blob:function(e){return e&&"browser"===m.mode},stream_upload:function(e){return e&&"browser"===m.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===m.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},slice_blob:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),a()<11.3&&(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid)},shimExec:function(e,t){var i=[].slice.call(arguments,2);return m.getShim().exec(this.uid,e,t,i)},init:function(){var i,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),i='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+u.swf_url+'" ',"IE"===t.browser&&(i+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),i+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+u.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=i,r=o=null):o.innerHTML=i,c=setTimeout(function(){m&&!m.initialized&&m.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){s(m.uid),e.call(m),clearTimeout(c),u=c=e=m=null}}(this.destroy)},d)}var l="flash",d={};return o.addConstructor(l,c),d}),n("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={slice:function(e,i,n,r){var o=this.getRuntime();return 0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),e=o.shimExec.call(this,"Blob","slice",i,n,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=i}),n("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){var n={init:function(e){var n=this,r=this.getRuntime();this.bind("Change",function(){var e=r.shimExec.call(n,"FileInput","getFiles");n.files=[],i.each(e,function(e){n.files.push(new t(r.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=n}),n("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n=this;return n.result="","readAsDataURL"===e&&(n.result="data:"+(t.type||"")+";base64,"),n.bind("Progress",function(t,r){r&&(n.result+=i(r,e))},999),n.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return e.FileReader=n}),n("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n,r=this.getRuntime();return(n=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(n="data:"+(t.type||"")+";base64,"+n),i(n,e,t.type)):null}};return e.FileReaderSync=n}),n("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={getAsBlob:function(e){var i=this.getRuntime(),n=i.shimExec.call(this,"Transporter","getAsBlob",e);return n?new t(i.uid,n):null}};return e.Transporter=i}),n("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/runtime/flash/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter","moxie/runtime/flash/runtime/Transporter"],function(e,t,i,n,r,o,a,s){var u={send:function(e,n){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,n)}function o(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),n=null,r()}function u(e,t){var i=new s;i.bind("TransportingComplete",function(){t(this.result)}),i.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),n instanceof a){var d;if(n.each(function(e,t){e instanceof i?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),n.hasBlob()){var m=n.getBlob();m.isDetached()?u(m,function(e){m.destroy(),o(d,e)}):o(d,m)}else n=null,r()}else n instanceof i?n.isDetached()?u(n,function(e){n.destroy(),n=e.uid,r()}):(n=n.uid,r()):r()},getResponse:function(e){var i,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new n(a.uid,o),"blob"===e)return o;try{if(i=new r,~t.inArray(e,["","text"]))return i.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(i.readAsText(o))}finally{o.destroy()}}return null},abort:function(){var e=this.getRuntime();e.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=u}),n("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(e,t,i,n,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(n,"Image","loadFromBlob",e.uid),n=r=null}var n=this,r=n.getRuntime();if(e.isDetached()){var o=new i;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,"Image","getInfo");return t.meta&&t.meta.thumb&&t.meta.thumb.data&&!(e.meta.thumb.data instanceof n)&&(t.meta.thumb.data=new n(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var i=this.getRuntime(),r=i.shimExec.call(this,"Image","getAsBlob",e,t);return r?new n(i.uid,r):null},getAsDataURL:function(){var e,t=this.getRuntime(),i=t.Image.getAsBlob.apply(this,arguments);return i?(e=new r,e.readAsDataURL(i)):null}};return e.Image=o}),n("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(e){var t,i,n,r,o,a=!1,s=null,u=0;try{try{s=new ActiveXObject("AgControl.AgControl"),s.IsVersionSupported(e)&&(a=!0),s=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(t=l.description,"1.0.30226.2"===t&&(t="2.0.30226.2"),i=t.split(".");i.length>3;)i.pop();for(;i.length<4;)i.push(0);for(n=e.split(".");n.length>4;)n.pop();do r=parseInt(n[u],10),o=parseInt(i[u],10),u++;while(u<n.length&&r===o);o>=r&&!isNaN(r)&&(a=!0)}}}catch(d){a=!1}return a}function s(s){var l,d=this;s=e.extend({xap_url:t.xap_url},s),o.call(this,s,u,{access_binary:o.capTrue,access_image_binary:o.capTrue,display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:o.capTrue,resize_image:o.capTrue,return_response_headers:function(e){return e&&"client"===d.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===d.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:o.capTrue,send_browser_cookies:function(e){return e&&"browser"===d.mode},send_custom_headers:function(e){return e&&"client"===d.mode},send_multipart:o.capTrue,slice_blob:o.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:o.capTrue,use_http_method:function(t){return"client"===d.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),a("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid).content.Moxie},shimExec:function(e,t){var i=[].slice.call(arguments,2);return d.getShim().exec(this.uid,e,t,i)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+s.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){d&&!d.initialized&&d.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(d),clearTimeout(l),s=l=e=d=null}}(this.destroy)},c)}var u="silverlight",c={};return o.addConstructor(u,s),c}),n("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(e,t,i){return e.Blob=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){function n(e){for(var t="",i=0;i<e.length;i++)t+=(""!==t?"|":"")+e[i].title+" | *."+e[i].extensions.replace(/,/g,";*.");return t}var r={init:function(e){var r=this,o=this.getRuntime();this.bind("Change",function(){var e=o.shimExec.call(r,"FileInput","getFiles");r.files=[],i.each(e,function(e){r.files.push(new t(o.uid,e))})},999),o.shimExec.call(this,"FileInput","init",n(e.accept),e.multiple),this.trigger("ready")},setOption:function(e,t){"accept"==e&&(t=n(t)),this.getRuntime().shimExec.call(this,"FileInput","setOption",e,t)}};return e.FileInput=r}),n("moxie/runtime/silverlight/file/FileDrop",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Dom","moxie/core/utils/Events"],function(e,t,i){var n={init:function(){var e,n=this,r=n.getRuntime();return e=r.getShimContainer(),i.addEvent(e,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},n.uid),i.addEvent(e,"dragenter",function(e){e.preventDefault();var i=t.get(r.uid).dragEnter(e);i&&e.stopPropagation()},n.uid),i.addEvent(e,"drop",function(e){e.preventDefault();var i=t.get(r.uid).dragDrop(e);i&&e.stopPropagation()},n.uid),r.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=n}),n("moxie/runtime/silverlight/file/FileReader",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReader"],function(e,t,i){return e.FileReader=t.extend({},i)
  6899. }),n("moxie/runtime/silverlight/file/FileReaderSync",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReaderSync"],function(e,t,i){return e.FileReaderSync=t.extend({},i)}),n("moxie/runtime/silverlight/runtime/Transporter",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/runtime/Transporter"],function(e,t,i){return e.Transporter=t.extend({},i)}),n("moxie/runtime/silverlight/xhr/XMLHttpRequest",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/xhr/XMLHttpRequest","moxie/runtime/silverlight/file/FileReaderSync","moxie/runtime/silverlight/runtime/Transporter"],function(e,t,i){return e.XMLHttpRequest=t.extend({},i)}),n("moxie/runtime/silverlight/image/Image",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/runtime/flash/image/Image"],function(e,t,i,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps","thumb"],r={meta:{}},o=e.shimExec.call(this,"Image","getInfo");return o.meta&&(t.each(n,function(e){var t,i,n,a,s=o.meta[e];if(s&&s.keys)for(r.meta[e]={},i=0,n=s.keys.length;n>i;i++)t=s.keys[i],a=s[t],a&&(/^(\d|[1-9]\d+)$/.test(a)?a=parseInt(a,10):/^\d*\.\d+$/.test(a)&&(a=parseFloat(a)),r.meta[e][t]=a)}),r.meta&&r.meta.thumb&&r.meta.thumb.data&&!(e.meta.thumb.data instanceof i)&&(r.meta.thumb.data=new i(e.uid,r.meta.thumb.data))),r.width=parseInt(o.width,10),r.height=parseInt(o.height,10),r.size=parseInt(o.size,10),r.type=o.type,r.name=o.name,r},resize:function(e,t,i){this.getRuntime().shimExec.call(this,"Image","resize",e.x,e.y,e.width,e.height,t,i.preserveHeaders,i.resample)}})}),n("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue;i.call(this,t,a,{access_binary:u(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),resize_image:function(){return s.Image&&o.can("access_binary")&&n.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return n.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can("select_file")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari"]))},upload_filesize:c,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html4",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){function e(){var o,c,d,m,h,f,p=this,g=p.getRuntime();f=i.guid("uid_"),o=g.getShimContainer(),s&&(d=n.get(s+"_form"),d&&i.extend(d.style,{top:"100%"})),m=document.createElement("form"),m.setAttribute("id",f+"_form"),m.setAttribute("method","post"),m.setAttribute("enctype","multipart/form-data"),m.setAttribute("encoding","multipart/form-data"),i.extend(m.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),h=document.createElement("input"),h.setAttribute("id",f),h.setAttribute("type","file"),h.setAttribute("accept",l.join(",")),i.extend(h.style,{fontSize:"999px",opacity:0}),m.appendChild(h),o.appendChild(m),i.extend(h.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===a.browser&&a.verComp(a.version,10,"<")&&i.extend(h.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),h.onchange=function(){var i;if(this.value){if(this.files){if(i=this.files[0],0===i.size)return m.parentNode.removeChild(m),void 0}else i={name:this.value};i=new t(g.uid,i),this.onchange=function(){},e.call(p),p.files=[i],h.setAttribute("id",i.uid),m.setAttribute("id",i.uid+"_form"),p.trigger("change"),h=m=null}},g.can("summon_file_dialog")&&(c=n.get(u.browse_button),r.removeEvent(c,"click",p.uid),r.addEvent(c,"click",function(e){h&&!h.disabled&&h.click(),e.preventDefault()},p.uid)),s=f,o=d=c=null}var s,u,c,l=[];i.extend(this,{init:function(t){var i,a=this,s=a.getRuntime();u=t,l=t.accept.mimes||o.extList2mimes(t.accept,s.can("filter_by_extension")),i=s.getShimContainer(),function(){var e,o,l;e=n.get(t.browse_button),c=n.getStyle(e,"z-index")||"auto",s.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),a.bind("Refresh",function(){o=parseInt(c,10)||1,n.get(u.browse_button).style.zIndex=o,this.getRuntime().getShimContainer().style.zIndex=o-1})),l=s.can("summon_file_dialog")?e:i,r.addEvent(l,"mouseover",function(){a.trigger("mouseenter")},a.uid),r.addEvent(l,"mouseout",function(){a.trigger("mouseleave")},a.uid),r.addEvent(l,"mousedown",function(){a.trigger("mousedown")},a.uid),r.addEvent(n.get(t.container),"mouseup",function(){a.trigger("mouseup")},a.uid),e=null}(),e.call(this),i=null,a.trigger({type:"ready",async:!0})},setOption:function(e,t){var i,r=this.getRuntime();"accept"==e&&(l=t.mimes||o.extList2mimes(t,r.can("filter_by_extension"))),i=n.get(s),i&&i.setAttribute("accept",l.join(","))},disable:function(e){var t;(t=n.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),i=e.getShimContainer(),o=u&&n.get(u.container),a=u&&n.get(u.browse_button);o&&r.removeAllEvents(o,this.uid),a&&(r.removeAllEvents(a,this.uid),a.style.zIndex=c),i&&(r.removeAllEvents(i,this.uid),i.innerHTML=""),t.removeInstance(this.uid),s=l=u=i=o=a=t=null}})}return e.FileInput=s}),n("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(e,t){return e.FileReader=t}),n("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(e,t,i,n,r,o,a,s){function u(){function e(e){var t,n,r,a,s=this,u=!1;if(l){if(t=l.id.replace(/_iframe$/,""),n=i.get(t+"_form")){for(r=n.getElementsByTagName("input"),a=r.length;a--;)switch(r[a].getAttribute("type")){case"hidden":r[a].parentNode.removeChild(r[a]);break;case"file":u=!0}r=[],u||n.parentNode.removeChild(n),n=null}setTimeout(function(){o.removeEvent(l,"load",s.uid),l.parentNode&&l.parentNode.removeChild(l);var t=s.getRuntime().getShimContainer();t.children.length||t.parentNode.removeChild(t),t=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,m){function h(){var i=w.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+f+'_iframe" name="'+f+'_iframe" src="javascript:&quot;&quot;" style="display:none"></iframe>',l=r.firstChild,i.appendChild(l),o.addEvent(l,"load",function(){var i;try{i=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title)?u=i.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(i.body.innerHTML),v.trigger({type:"progress",loaded:c.length,total:c.length}),x&&v.trigger({type:"uploadprogress",loaded:x.size||1025,total:x.size||1025}))}catch(r){if(!n.hasSameOrigin(d.url))return e.call(v,function(){v.trigger("error")}),void 0;u=404}e.call(v,function(){v.trigger("load")})},v.uid)}var f,p,g,x,v=this,w=v.getRuntime();if(u=c=null,m instanceof s&&m.hasBlob()){if(x=m.getBlob(),f=x.uid,g=i.get(f),p=i.get(f+"_form"),!p)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else f=t.guid("uid_"),p=document.createElement("form"),p.setAttribute("id",f+"_form"),p.setAttribute("method",d.method),p.setAttribute("enctype","multipart/form-data"),p.setAttribute("encoding","multipart/form-data"),w.getShimContainer().appendChild(p);p.setAttribute("target",f+"_iframe"),m instanceof s&&m.each(function(e,i){if(e instanceof a)g&&g.setAttribute("name",i);else{var n=document.createElement("input");t.extend(n,{type:"hidden",name:i,value:e}),g?p.insertBefore(n,g):p.appendChild(n)}}),p.setAttribute("action",d.url),h(),p.submit(),v.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),n("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t}),a(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"])}(this)});
  6900. define("../libs/plupload/js/moxie.min", function(){});
  6901. /**
  6902. * Plupload - multi-runtime File Uploader
  6903. * v2.3.1
  6904. *
  6905. * Copyright 2013, Moxiecode Systems AB
  6906. * Released under GPL License.
  6907. *
  6908. * License: http://www.plupload.com/license
  6909. * Contributing: http://www.plupload.com/contributing
  6910. *
  6911. * Date: 2017-02-06
  6912. */
  6913. !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],i):"object"==typeof module&&module.exports?module.exports=i(require("./moxie")):e.plupload=i(e.moxie)}(this||window,function(e){!function(e,t,i){function n(e){function t(e,t,i){var r={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};r[e]?n[r[e]]=t:i||(n[e]=t)}var i=e.required_features,n={};return"string"==typeof i?l.each(i.split(/\s*,\s*/),function(e){t(e,!0)}):"object"==typeof i?l.each(i,function(e,i){t(i,e)}):i===!0&&(e.chunk_size&&e.chunk_size>0&&(n.slice_blob=!0),l.isEmptyObj(e.resize)&&e.multipart!==!1||(n.send_binary_string=!0),e.http_method&&(n.use_http_method=e.http_method),l.each(e,function(e,i){t(i,!!e,!0)})),n}var r=window.setTimeout,s={},a=t.core.utils,o=t.runtime.Runtime,l={VERSION:"2.3.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:a.Mime.mimes,ua:a.Env,typeOf:a.Basic.typeOf,extend:a.Basic.extend,guid:a.Basic.guid,getAll:function(e){var t,i=[];"array"!==l.typeOf(e)&&(e=[e]);for(var n=e.length;n--;)t=l.get(e[n]),t&&i.push(t);return i.length?i:null},get:a.Dom.get,each:a.Basic.each,getPos:a.Dom.getPos,getSize:a.Dom.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g;return e?(""+e).replace(i,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:a.Basic.toArray,inArray:a.Basic.inArray,inSeries:a.Basic.inSeries,addI18n:t.core.I18n.addI18n,translate:t.core.I18n.translate,sprintf:a.Basic.sprintf,isEmptyObj:a.Basic.isEmptyObj,hasClass:a.Dom.hasClass,addClass:a.Dom.addClass,removeClass:a.Dom.removeClass,getStyle:a.Dom.getStyle,addEvent:a.Events.addEvent,removeEvent:a.Events.removeEvent,removeAllEvents:a.Events.removeAllEvents,cleanName:function(e){var t,i;for(i=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t<i.length;t+=2)e=e.replace(i[t],i[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(e,t){var i="";return l.each(t,function(e,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),i&&(e+=(e.indexOf("?")>0?"&":"?")+i),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===i||/\D/.test(e))return l.translate("N/A");var n=Math.pow(1024,4);return e>n?t(e/n,1)+" "+l.translate("tb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("gb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("mb"):e>1024?Math.round(e/1024)+" "+l.translate("kb"):e+" "+l.translate("b")},parseSize:a.Basic.parseSizeStr,predictRuntime:function(e,t){var i,n;return i=new l.Uploader(e),n=o.thatCan(i.getOption().required_features,t||e.runtimes),i.destroy(),n},addFileFilter:function(e,t){s[e]=t}};l.addFileFilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:l.FILE_EXTENSION_ERROR,message:l.translate("File extension error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("max_file_size",function(e,t,i){var n;e=l.parseSize(e),t.size!==n&&e&&t.size>e?(this.trigger("Error",{code:l.FILE_SIZE_ERROR,message:l.translate("File size error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("Error",{code:l.FILE_DUPLICATE_ERROR,message:l.translate("Duplicate file error."),file:t}),i(!1),void 0;i(!0)}),l.Uploader=function(e){function a(){var e,t,i=0;if(this.state==l.STARTED){for(t=0;t<x.length;t++)e||x[t].status!=l.QUEUED?i++:(e=x[t],this.trigger("BeforeUpload",e)&&(e.status=l.UPLOADING,this.trigger("UploadFile",e)));i==x.length&&(this.state!==l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",x))}}function u(e){e.percent=e.size>0?Math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t,n,r=0;for(w.reset(),e=0;e<x.length;e++)t=x[e],t.size!==i?(w.size+=t.origSize,n=t.loaded*t.origSize/t.size,(!t.completeTimestamp||t.completeTimestamp>I)&&(r+=n),w.loaded+=n):w.size=i,t.status==l.DONE?w.uploaded++:t.status==l.FAILED?w.failed++:w.queued++;w.size===i?w.percent=x.length>0?Math.ceil(100*(w.uploaded/x.length)):0:(w.bytesPerSec=Math.ceil(r/((+new Date-I||1)/1e3)),w.percent=w.size>0?Math.ceil(100*(w.loaded/w.size)):0)}function c(){var e=U[0]||F[0];return e?e.getRuntime().uid:!1}function f(e,t){if(e.ruid){var i=o.getInfo(e.ruid);if(i)return i.can(t)}return!1}function p(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()}),this.bind("CancelUpload",y),this.bind("BeforeUpload",_),this.bind("UploadFile",E),this.bind("UploadProgress",v),this.bind("StateChanged",b),this.bind("QueueChanged",d),this.bind("Error",z),this.bind("FileUploaded",R),this.bind("Destroy",O)}function g(e,i){var n=this,r=0,s=[],a={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:P,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};l.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(a[t]=e[t])}),e.browse_button&&l.each(e.browse_button,function(i){s.push(function(s){var u=new t.file.FileInput(l.extend({},a,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:i}));u.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),r++,U.push(this),s()},u.onchange=function(){n.addFile(this.files)},u.bind("mouseenter mouseleave mousedown mouseup",function(t){A||(e.browse_button_hover&&("mouseenter"===t.type?l.addClass(i,e.browse_button_hover):"mouseleave"===t.type&&l.removeClass(i,e.browse_button_hover)),e.browse_button_active&&("mousedown"===t.type?l.addClass(i,e.browse_button_active):"mouseup"===t.type&&l.removeClass(i,e.browse_button_active)))}),u.bind("mousedown",function(){n.trigger("Browse")}),u.bind("error runtimeerror",function(){u=null,s()}),u.init()})}),e.drop_element&&l.each(e.drop_element,function(e){s.push(function(i){var s=new t.file.FileDrop(l.extend({},a,{drop_zone:e}));s.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),dragdrop:e.can("drag_and_drop")}),r++,F.push(this),i()},s.ondrop=function(){n.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,i()}),s.init()})}),l.inSeries(s,function(){"function"==typeof i&&i(r)})}function h(e,n,r){var s=new t.image.Image;try{s.onload=function(){return n.width>this.width&&n.height>this.height&&n.quality===i&&n.preserve_headers&&!n.crop?(this.destroy(),r(e)):(s.downsize(n.width,n.height,n.crop,n.preserve_headers),void 0)},s.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},s.onerror=function(){r(e)},s.load(e)}catch(a){r(e)}}function m(e,i,r){function s(e,i,n){var r=S[e];switch(e){case"max_file_size":"max_file_size"===e&&(S.max_file_size=S.filters.max_file_size=i);break;case"chunk_size":(i=l.parseSize(i))&&(S[e]=i,S.send_file_name=!0);break;case"multipart":S[e]=i,i||(S.send_file_name=!0);break;case"http_method":S[e]="PUT"===i.toUpperCase()?"PUT":"POST";break;case"unique_names":S[e]=i,i&&(S.send_file_name=!0);break;case"filters":"array"===l.typeOf(i)&&(i={mime_types:i}),n?l.extend(S.filters,i):S.filters=i,i.mime_types&&("string"===l.typeOf(i.mime_types)&&(i.mime_types=t.core.utils.Mime.mimes2extList(i.mime_types)),i.mime_types.regexp=function(e){var t=[];return l.each(e,function(e){l.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(i.mime_types),S.filters.mime_types=i.mime_types);break;case"resize":S.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":S.prevent_duplicates=S.filters.prevent_duplicates=!!i;break;case"container":case"browse_button":case"drop_element":i="container"===e?l.get(i):l.getAll(i);case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":S[e]=i,n||(u=!0);break;default:S[e]=i}n||a.trigger("OptionChanged",e,i,r)}var a=this,u=!1;"object"==typeof e?l.each(e,function(e,t){s(t,e,r)}):s(e,i,r),r?(S.required_features=n(l.extend({},S)),P=n(l.extend({},S,{required_features:!0}))):u&&(a.trigger("Destroy"),g.call(a,S,function(e){e?(a.runtime=o.getInfo(c()).type,a.trigger("Init",{runtime:a.runtime}),a.trigger("PostInit")):a.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}))}function _(e,t){if(e.settings.unique_names){var i=t.name.match(/\.([^.]+)$/),n="part";i&&(n=i[1]),t.target_name=t.id+"."+n}}function E(e,i){function n(){c-->0?r(s,1e3):(i.loaded=g,e.trigger("Error",{code:l.HTTP_ERROR,message:l.translate("HTTP Error."),file:i,response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()}))}function s(){var t,n,r={};i.status===l.UPLOADING&&e.state!==l.STOPPED&&(e.settings.send_file_name&&(r.name=i.target_name||i.name),d&&p.chunks&&o.size>d?(n=Math.min(d,o.size-g),t=o.slice(g,g+n)):(n=o.size,t=o),d&&p.chunks&&(e.settings.send_chunk_number?(r.chunk=Math.ceil(g/d),r.chunks=Math.ceil(o.size/d)):(r.offset=g,r.total=o.size)),e.trigger("BeforeChunkUpload",i,r,t,g)&&a(r,t,n))}function a(a,d,f){var h;T=new t.xhr.XMLHttpRequest,T.upload&&(T.upload.onprogress=function(t){i.loaded=Math.min(i.size,g+t.loaded),e.trigger("UploadProgress",i)}),T.onload=function(){return T.status>=400?(n(),void 0):(c=e.settings.max_retries,f<o.size?(d.destroy(),g+=f,i.loaded=Math.min(g,o.size),e.trigger("ChunkUploaded",i,{offset:i.loaded,total:o.size,response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()}),"Android Browser"===l.ua.browser&&e.trigger("UploadProgress",i)):i.loaded=i.size,d=h=null,!g||g>=o.size?(i.size!=i.origSize&&(o.destroy(),o=null),e.trigger("UploadProgress",i),i.status=l.DONE,i.completeTimestamp=+new Date,e.trigger("FileUploaded",i,{response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()})):r(s,1),void 0)},T.onerror=function(){n()},T.onloadend=function(){this.destroy(),T=null},e.settings.multipart&&p.multipart?(T.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),h=new t.xhr.FormData,l.each(l.extend(a,e.settings.multipart_params),function(e,t){h.append(t,e)}),h.append(e.settings.file_data_name,d),T.send(h,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:P,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(u=l.buildUrl(e.settings.url,l.extend(a,e.settings.multipart_params)),T.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),T.hasRequestHeader("Content-Type")||T.setRequestHeader("Content-Type","application/octet-stream"),T.send(d,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:P,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url}))}var o,u=e.settings.url,d=e.settings.chunk_size,c=e.settings.max_retries,p=e.features,g=0;i.loaded&&(g=i.loaded=d?d*Math.floor(i.loaded/d):0),o=i.getSource(),!l.isEmptyObj(e.settings.resize)&&f(o,"send_binary_string")&&-1!==l.inArray(o.type,["image/jpeg","image/png"])?h.call(this,o,e.settings.resize,function(e){o=e,i.size=e.size,s()}):s()}function v(e,t){u(t)}function b(e){if(e.state==l.STARTED)I=+new Date;else if(e.state==l.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==l.UPLOADING&&(e.files[t].status=l.QUEUED,d())}function y(){T&&T.abort()}function R(e){d(),r(function(){a.call(e)},1)}function z(e,t){t.code===l.INIT_ERROR?e.destroy():t.code===l.HTTP_ERROR&&(t.file.status=l.FAILED,t.file.completeTimestamp=+new Date,u(t.file),e.state==l.STARTED&&(e.trigger("CancelUpload"),r(function(){a.call(e)},1)))}function O(e){e.stop(),l.each(x,function(e){e.destroy()}),x=[],U.length&&(l.each(U,function(e){e.destroy()}),U=[]),F.length&&(l.each(F,function(e){e.destroy()}),F=[]),P={},A=!1,I=T=null,w.reset()}var S,I,w,T,D=l.guid(),x=[],P={},U=[],F=[],A=!1;S={chunk_size:0,file_data_name:"file",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},flash_swf_url:"js/Moxie.swf",http_method:"POST",max_retries:0,multipart:!0,multi_selection:!0,resize:!1,runtimes:o.order,send_file_name:!0,send_chunk_number:!0,silverlight_xap_url:"js/Moxie.xap"},m.call(this,e,null,!0),w=new l.QueueProgress,l.extend(this,{id:D,uid:D,state:l.STOPPED,features:{},runtime:null,files:x,settings:S,total:w,init:function(){var e,t,i=this;return e=i.getOption("preinit"),"function"==typeof e?e(i):l.each(e,function(e,t){i.bind(t,e)}),p.call(i),l.each(["container","browse_button","drop_element"],function(e){return null===i.getOption(e)?(t={code:l.INIT_ERROR,message:l.sprintf(l.translate("%s specified, but cannot be found."),e)},!1):void 0}),t?i.trigger("Error",t):S.browse_button||S.drop_element?(g.call(i,S,function(e){var t=i.getOption("init");"function"==typeof t?t(i):l.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=o.getInfo(c()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}),void 0):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("You must specify either browse_button or drop_element.")})},setOption:function(e,t){m.call(this,e,t,!this.runtime)},getOption:function(e){return e?S[e]:S},refresh:function(){U.length&&l.each(U,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=l.STARTED&&(this.state=l.STARTED,this.trigger("StateChanged"),a.call(this))},stop:function(){this.state!=l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){A=arguments[0]!==i?arguments[0]:!0,U.length&&l.each(U,function(e){e.disable(A)}),this.trigger("DisableBrowse",A)},getFile:function(e){var t;for(t=x.length-1;t>=0;t--)if(x[t].id===e)return x[t]},addFile:function(e,i){function n(e,t){var i=[];l.each(u.settings.filters,function(t,n){s[n]&&i.push(function(i){s[n].call(u,t,e,function(e){i(!e)})})}),l.inSeries(i,t)}function a(e){var s=l.typeOf(e);if(e instanceof t.file.File){if(!e.ruid&&!e.isDetached()){if(!o)return!1;e.ruid=o,e.connectRuntime(o)}a(new l.File(e))}else e instanceof t.file.Blob?(a(e.getSource()),e.destroy()):e instanceof l.File?(i&&(e.name=i),d.push(function(t){n(e,function(i){i||(x.push(e),f.push(e),u.trigger("FileFiltered",e)),r(t,1)})})):-1!==l.inArray(s,["file","blob"])?a(new t.file.File(null,e)):"node"===s&&"filelist"===l.typeOf(e.files)?l.each(e.files,a):"array"===s&&(i=null,l.each(e,a))}var o,u=this,d=[],f=[];o=c(),a(e),d.length&&l.inSeries(d,function(){f.length&&u.trigger("FilesAdded",f)})},removeFile:function(e){for(var t="string"==typeof e?e:e.id,i=x.length-1;i>=0;i--)if(x[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=x.splice(e===i?0:e,t===i?x.length:t),r=!1;return this.state==l.STARTED&&(l.each(n,function(e){return e.status===l.UPLOADING?(r=!0,!1):void 0}),r&&this.stop()),this.trigger("FilesRemoved",n),l.each(n,function(e){e.destroy()}),r&&this.start(),n},dispatchEvent:function(e){var t,i;if(e=e.toLowerCase(),t=this.hasEventListener(e)){t.sort(function(e,t){return t.priority-e.priority}),i=[].slice.call(arguments),i.shift(),i.unshift(this);for(var n=0;n<t.length;n++)if(t[n].fn.apply(t[n].scope,i)===!1)return!1}return!0},bind:function(e,t,i,n){l.Uploader.prototype.bind.call(this,e,t,n,i)},destroy:function(){this.trigger("Destroy"),S=w=null,this.unbindAll()}})},l.Uploader.prototype=t.core.EventTarget.instance,l.File=function(){function e(e){l.extend(this,{id:l.guid(),name:e.name||e.fileName,type:e.type||"",size:e.size||e.fileSize,origSize:e.size||e.fileSize,loaded:0,percent:0,status:l.QUEUED,lastModifiedDate:e.lastModifiedDate||(new Date).toLocaleString(),completeTimestamp:0,getNative:function(){var e=this.getSource().getSource();return-1!==l.inArray(l.typeOf(e),["blob","file"])?e:null},getSource:function(){return t[this.id]?t[this.id]:null},destroy:function(){var e=this.getSource();e&&(e.destroy(),delete t[this.id])}}),t[this.id]=e}var t={};return e}(),l.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=l}(this,e)});
  6914. define('upload',['jquery', 'bootstrap', 'backend', 'plupload'], function ($, undefined, Backend, Plupload) {
  6915. var Upload = {
  6916. list: {},
  6917. config: {
  6918. container: document.body,
  6919. classname: '.plupload',
  6920. },
  6921. api: {
  6922. //Plupload上传
  6923. plupload: function (element, onAfterUpload) {
  6924. element = typeof element == 'undefined' ? Upload.config.classname : element;
  6925. $(element, Upload.config.container).each(function () {
  6926. var that = this;
  6927. var id = $(this).prop("id");
  6928. var url = $(this).data("url");
  6929. var maxsize = $(this).data("maxsize");
  6930. var mimetype = $(this).data("mimetype");
  6931. var multipart = $(this).data("multipart");
  6932. var multiple = $(this).data("multiple");
  6933. //上传URL
  6934. url = url ? url : Config.upload.uploadurl;
  6935. url = Backend.api.fixurl(url);
  6936. //最大可上传
  6937. maxsize = maxsize ? maxsize : Config.upload.maxsize;
  6938. //文件类型
  6939. mimetype = mimetype ? mimetype : Config.upload.mimetype;
  6940. //请求的表单参数
  6941. multipart = multipart ? multipart : Config.upload.multipart;
  6942. //是否支持批量上传
  6943. multiple = multiple ? multiple : Config.upload.multiple;
  6944. //生成Plupload实例
  6945. Upload.list[id] = new Plupload.Uploader({
  6946. runtimes: 'html5,flash,silverlight,html4',
  6947. multi_selection: multiple, //是否允许多选批量上传
  6948. browse_button: id, // 浏览按钮的ID
  6949. container: $(this).parent().get(0), //取按钮的上级元素
  6950. flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
  6951. silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
  6952. filters: {
  6953. max_file_size: maxsize,
  6954. mime_types: mimetype
  6955. },
  6956. url: url,
  6957. multipart_params: multipart,
  6958. init: {
  6959. PostInit: function () {
  6960. },
  6961. FilesAdded: function (up, files) {
  6962. Plupload.each(files, function (file) {
  6963. //这里可以改成其它的表现形式
  6964. //document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
  6965. });
  6966. $(that).data("bakup-html", $(that).html());
  6967. //添加后立即上传
  6968. setTimeout(function () {
  6969. Upload.list[id].start();
  6970. }, 1);
  6971. },
  6972. UploadProgress: function (up, file) {
  6973. //这里可以改成其它的表现形式
  6974. //document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
  6975. $(that).prop("disabled", true).html("<i class='fa fa-upload'></i> 上传" + file.percent + "%");
  6976. },
  6977. FileUploaded: function (up, file, info) {
  6978. //还原按钮文字及状态
  6979. $(that).prop("disabled", false).html($(that).data("bakup-html"));
  6980. //这里可以改成其它的表现形式
  6981. //document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML += (' [Url]: ' + '<a href="' + url + '" target="_blank">' + url + '</a>');
  6982. //这里建议不修改
  6983. try {
  6984. var ret = JSON.parse(info.response);
  6985. if (ret.hasOwnProperty('code')) {
  6986. ret.data = ret.code == 200 ? ret : ret.data;
  6987. ret.code = ret.code == 200 ? 1 : ret.code;
  6988. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  6989. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  6990. if (ret.code === 1) {
  6991. //$("input[data-plupload-id='" + id + "-text']").val(data.url);
  6992. if ($(that).data("input-id")) {
  6993. $("input#" + $(that).data("input-id")).val(data.url);
  6994. }
  6995. var afterUpload = $("#" + id).data("after-upload");
  6996. if (afterUpload && typeof Upload.api.custom[afterUpload] == 'function') {
  6997. Upload.api.custom[afterUpload].call(that, data);
  6998. }
  6999. if (typeof onAfterUpload == 'function') {
  7000. onAfterUpload.call(that, data);
  7001. }
  7002. } else {
  7003. Toastr.error(msg ? msg : __('Operation failed'));
  7004. }
  7005. } else {
  7006. Toastr.error(e.message + "(code:-2)");
  7007. }
  7008. } catch (e) {
  7009. Toastr.error(e.message + "(code:-1)");
  7010. }
  7011. },
  7012. Error: function (up, err) {
  7013. Toastr.error(err.message + "(code:" + err.code + ")");
  7014. }
  7015. }
  7016. });
  7017. Upload.list[id].init();
  7018. });
  7019. },
  7020. // AJAX异步上传,主要用于Summernote上传回调
  7021. send: function (file, callback) {
  7022. var data = new FormData();
  7023. data.append("file", file);
  7024. $.each(Config.upload.multipart, function (k, v) {
  7025. data.append(k, v);
  7026. });
  7027. $.ajax({
  7028. url: Config.upload.uploadurl,
  7029. data: data,
  7030. cache: false,
  7031. contentType: false,
  7032. processData: false,
  7033. type: 'POST',
  7034. dataType: 'json',
  7035. success: function (ret) {
  7036. if (ret.hasOwnProperty("code")) {
  7037. ret.data = ret.code == 200 ? ret : ret.data;
  7038. ret.code = ret.code == 200 ? 1 : ret.code;
  7039. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  7040. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  7041. if (ret.code === 1) {
  7042. // 如果回调存在,则直接调用回调
  7043. if (typeof callback == 'function') {
  7044. callback.call(this, data);
  7045. } else {
  7046. Toastr.success(msg ? msg : __('Operation completed'));
  7047. }
  7048. } else {
  7049. Toastr.error(msg ? msg : __('Operation failed'));
  7050. }
  7051. } else {
  7052. Toastr.error(__('Unknown data format'));
  7053. }
  7054. }, error: function () {
  7055. Toastr.error(__('Network error'));
  7056. }
  7057. });
  7058. },
  7059. custom: {
  7060. //自定义上传完成回调
  7061. afteruploadcallback: function (response) {
  7062. console.log(this, response);
  7063. alert("Custom Callback,Response URL:" + response.url);
  7064. },
  7065. },
  7066. }
  7067. };
  7068. return Upload;
  7069. });
  7070. /*! nice-validator 1.0.10
  7071. * (c) 2012-2017 Jony Zhang <niceue@live.com>, MIT Licensed
  7072. * https://github.com/niceue/nice-validator
  7073. */
  7074. ;(function(factory) {
  7075. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  7076. typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
  7077. factory(jQuery);
  7078. }(function($, undefined) {
  7079. "use strict";
  7080. var NS = 'validator',
  7081. CLS_NS = '.' + NS,
  7082. CLS_NS_RULE = '.rule',
  7083. CLS_NS_FIELD = '.field',
  7084. CLS_NS_FORM = '.form',
  7085. CLS_WRAPPER = 'nice-' + NS,
  7086. CLS_MSG_BOX = 'msg-box',
  7087. ARIA_REQUIRED = 'aria-required',
  7088. ARIA_INVALID = 'aria-invalid',
  7089. DATA_RULE = 'data-rule',
  7090. DATA_MSG = 'data-msg',
  7091. DATA_TIP = 'data-tip',
  7092. DATA_OK = 'data-ok',
  7093. DATA_TIMELY = 'data-timely',
  7094. DATA_TARGET = 'data-target',
  7095. DATA_DISPLAY = 'data-display',
  7096. DATA_MUST = 'data-must',
  7097. NOVALIDATE = 'novalidate',
  7098. INPUT_SELECTOR = ':verifiable',
  7099. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  7100. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  7101. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  7102. rDoubleBytes = /[^\x00-\xff]/g,
  7103. rPos = /top|right|bottom|left/,
  7104. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  7105. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  7106. noop = $.noop,
  7107. proxy = $.proxy,
  7108. trim = $.trim,
  7109. isFunction = $.isFunction,
  7110. isString = function(s) {
  7111. return typeof s === 'string';
  7112. },
  7113. isObject = function(o) {
  7114. return o && Object.prototype.toString.call(o) === '[object Object]';
  7115. },
  7116. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  7117. attr = function(el, key, value) {
  7118. if (!el || !el.tagName) return null;
  7119. if (value !== undefined) {
  7120. if (value === null) el.removeAttribute(key);
  7121. else el.setAttribute(key, '' + value);
  7122. } else {
  7123. return el.getAttribute(key);
  7124. }
  7125. },
  7126. novalidateonce,
  7127. preinitialized = {},
  7128. defaults = {
  7129. debug: 0,
  7130. theme: 'default',
  7131. ignore: '',
  7132. focusInvalid: true,
  7133. focusCleanup: false,
  7134. stopOnError: false,
  7135. beforeSubmit: null,
  7136. valid: null,
  7137. invalid: null,
  7138. validation: null,
  7139. formClass: 'n-default',
  7140. validClass: 'n-valid',
  7141. invalidClass: 'n-invalid',
  7142. bindClassTo: null
  7143. },
  7144. fieldDefaults = {
  7145. timely: 1,
  7146. display: null,
  7147. target: null,
  7148. ignoreBlank: false,
  7149. showOk: true,
  7150. // Translate ajax response to validation result
  7151. dataFilter: function (data) {
  7152. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  7153. return data;
  7154. }
  7155. },
  7156. msgMaker: function(opt) {
  7157. var html;
  7158. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  7159. if (opt.result) {
  7160. $.each(opt.result, function(i, obj){
  7161. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  7162. });
  7163. } else {
  7164. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  7165. }
  7166. html += '</span>';
  7167. return html;
  7168. },
  7169. msgWrapper: 'span',
  7170. msgArrow: '',
  7171. msgIcon: '<span class="n-icon"></span>',
  7172. msgClass: 'n-right',
  7173. msgStyle: '',
  7174. msgShow: null,
  7175. msgHide: null
  7176. },
  7177. themes = {};
  7178. /** jQuery Plugin
  7179. * @param {Object} options
  7180. debug {Boolean} 0 Whether to enable debug mode
  7181. timely {Number} 1 Whether to enable timely validation
  7182. theme {String} 'default' Theme name
  7183. stopOnError {Boolean} false Whether to stop validate when found an error input
  7184. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  7185. focusInvalid {Boolean} true Whether to focus the field that is invalid
  7186. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  7187. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  7188. beforeSubmit {Function} Do something before submit form
  7189. dataFilter {Function} Convert ajax results
  7190. valid {Function} Triggered when the form is valid
  7191. invalid {Function} Triggered when the form is invalid
  7192. validClass {String} 'n-valid' Add this class name to a valid field
  7193. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  7194. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  7195. display {Function} Callback function to get dynamic display
  7196. target {Function} Callback function to get dynamic target
  7197. msgShow {Function} Trigger this callback when show message
  7198. msgHide {Function} Trigger this callback when hide message
  7199. msgWrapper {String} 'span' Message wrapper tag name
  7200. msgMaker {Function} Callback function to make message HTML
  7201. msgArrow {String} Message arrow template
  7202. msgIcon {String} Message icon template
  7203. msgStyle {String} Custom message css style
  7204. msgClass {String} Additional added to the message class names
  7205. formClass {String} Additional added to the form class names
  7206. messages {Object} Custom messages for the current instance
  7207. rules {Object} Custom rules for the current instance
  7208. fields {Object} Field validation configuration
  7209. {String} key name|#id
  7210. {String|Object} value Rule string or an object which can pass more arguments
  7211. fields[key][rule] {String} Rule string
  7212. fields[key][display] {String|Function}
  7213. fields[key][tip] {String} Custom tip message
  7214. fields[key][ok] {String} Custom success message
  7215. fields[key][msg] {Object} Custom error message
  7216. fields[key][msgStyle] {String} Custom message style
  7217. fields[key][msgClass] {String} A className which added to message placeholder element
  7218. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  7219. fields[key][msgMaker] {Function} A function to custom message HTML
  7220. fields[key][dataFilter] {Function} A function to convert ajax results
  7221. fields[key][valid] {Function} A function triggered when field is valid
  7222. fields[key][invalid] {Function} A function triggered when field is invalid
  7223. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  7224. fields[key][timely] {Boolean} Whether to enable timely validation
  7225. fields[key][target] {jqSelector} Define placement of a message
  7226. */
  7227. $.fn.validator = function(options) {
  7228. var that = this,
  7229. args = arguments;
  7230. if (that.is(INPUT_SELECTOR)) return that;
  7231. if (!that.is('form')) that = this.find('form');
  7232. if (!that.length) that = this;
  7233. that.each(function() {
  7234. var instance = $(this).data(NS);
  7235. if (instance) {
  7236. if ( isString(options) ) {
  7237. if ( options.charAt(0) === '_' ) return;
  7238. instance[options].apply(instance, [].slice.call(args, 1));
  7239. }
  7240. else if (options) {
  7241. instance._reset(true);
  7242. instance._init(this, options);
  7243. }
  7244. } else {
  7245. new Validator(this, options);
  7246. }
  7247. });
  7248. return this;
  7249. };
  7250. // Validate a field, or an area
  7251. $.fn.isValid = function(callback, hideMsg) {
  7252. var me = _getInstance(this[0]),
  7253. hasCallback = isFunction(callback),
  7254. ret, opt;
  7255. if (!me) return true;
  7256. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  7257. me.checkOnly = !!hideMsg;
  7258. opt = me.options;
  7259. ret = me._multiValidate(
  7260. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  7261. function(isValid){
  7262. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  7263. // navigate to the error element
  7264. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7265. }
  7266. if (hasCallback) {
  7267. if (callback.length) {
  7268. callback(isValid);
  7269. } else if (isValid) {
  7270. callback();
  7271. }
  7272. }
  7273. me.checkOnly = false;
  7274. }
  7275. );
  7276. // If you pass a callback, we maintain the jQuery object chain
  7277. return hasCallback ? this : ret;
  7278. };
  7279. $.extend($.expr.pseudos || $.expr[':'], {
  7280. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  7281. verifiable: function(elem) {
  7282. var name = elem.nodeName.toLowerCase();
  7283. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  7284. name === 'select' ||
  7285. name === 'textarea' ||
  7286. elem.contentEditable === 'true'
  7287. ) && !elem.disabled;
  7288. },
  7289. // any value, but not only whitespace
  7290. filled: function(elem) {
  7291. return !!trim($(elem).val());
  7292. }
  7293. });
  7294. /**
  7295. * Creates a new Validator
  7296. *
  7297. * @class
  7298. * @param {Element} element - form element
  7299. * @param {Object} options - options for validator
  7300. */
  7301. function Validator(element, options) {
  7302. var me = this;
  7303. if ( !(me instanceof Validator) ) {
  7304. return new Validator(element, options);
  7305. }
  7306. if (Validator.pending) {
  7307. $(window).on('validatorready', init);
  7308. } else {
  7309. init();
  7310. }
  7311. function init() {
  7312. me.$el = $(element);
  7313. if (me.$el.length) {
  7314. me._init(me.$el[0], options);
  7315. }
  7316. else if (isString(element)) {
  7317. preinitialized[element] = options;
  7318. }
  7319. }
  7320. }
  7321. Validator.prototype = {
  7322. _init: function(element, options) {
  7323. var me = this,
  7324. opt, themeOpt, dataOpt;
  7325. // Initialization options
  7326. if ( isFunction(options) ) {
  7327. options = {
  7328. valid: options
  7329. };
  7330. }
  7331. options = me._opt = options || {};
  7332. dataOpt = attr(element, 'data-'+ NS +'-option');
  7333. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function("return " + dataOpt))() : {};
  7334. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  7335. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  7336. me.rules = new Rules(opt.rules, true);
  7337. me.messages = new Messages(opt.messages, true);
  7338. me.Field = _createFieldFactory(me);
  7339. me.elements = me.elements || {};
  7340. me.deferred = {};
  7341. me.errors = {};
  7342. me.fields = {};
  7343. // Initialization fields
  7344. me._initFields(opt.fields);
  7345. // Initialization events and make a cache
  7346. if ( !me.$el.data(NS) ) {
  7347. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  7348. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  7349. me.vetoed = veto.veto = !me.isValid;
  7350. me.ajaxFormOptions = opts;
  7351. })
  7352. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  7353. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  7354. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  7355. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  7356. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  7357. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  7358. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  7359. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  7360. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  7361. // cache the novalidate attribute value
  7362. me._NOVALIDATE = attr(element, NOVALIDATE);
  7363. // Initialization is complete, stop off default HTML5 form validation
  7364. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  7365. attr(element, NOVALIDATE, NOVALIDATE);
  7366. }
  7367. // Display all messages in target container
  7368. if ( isString(opt.target) ) {
  7369. me.$el.find(opt.target).addClass('msg-container');
  7370. }
  7371. },
  7372. // Guess whether the form use ajax submit
  7373. _guessAjax: function(form) {
  7374. var me = this;
  7375. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7376. // if there is a "valid.form" event
  7377. var events = ($._data || $.data)(form, "events");
  7378. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7379. }
  7380. function issetEvent(events, name, namespace) {
  7381. if ( events && events[name] &&
  7382. $.map(events[name], function(e){
  7383. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7384. }).length
  7385. ) {
  7386. return true;
  7387. }
  7388. return false;
  7389. }
  7390. },
  7391. _initFields: function(fields) {
  7392. var me = this, k, arr, i,
  7393. clear = fields === null;
  7394. // Processing field information
  7395. if (clear) fields = me.fields;
  7396. if ( isObject(fields) ) {
  7397. for (k in fields) {
  7398. if (~k.indexOf(',')) {
  7399. arr = k.split(',');
  7400. i = arr.length;
  7401. while (i--) {
  7402. initField(trim(arr[i]), fields[k]);
  7403. }
  7404. } else {
  7405. initField(k, fields[k]);
  7406. }
  7407. }
  7408. }
  7409. // Parsing DOM rules
  7410. me.$el.find(INPUT_SELECTOR).each(function() {
  7411. me._parse(this);
  7412. });
  7413. function initField(k, v) {
  7414. // delete a field from settings
  7415. if ( v === null || clear ) {
  7416. var el = me.elements[k];
  7417. if (el) me._resetElement(el, true);
  7418. delete me.fields[k];
  7419. } else {
  7420. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7421. }
  7422. }
  7423. },
  7424. // Parsing a field
  7425. _parse: function(el) {
  7426. var me = this,
  7427. field,
  7428. key = el.name,
  7429. display,
  7430. timely,
  7431. dataRule = attr(el, DATA_RULE);
  7432. dataRule && attr(el, DATA_RULE, null);
  7433. // If the field has passed the key as id mode, or it doesn't has a name
  7434. if ( el.id && (
  7435. ('#' + el.id in me.fields) ||
  7436. !key ||
  7437. // If dataRule and element are diffrent from old's, we use ID mode.
  7438. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7439. )
  7440. ) {
  7441. key = '#' + el.id;
  7442. }
  7443. // doesn't verify a field that has neither id nor name
  7444. if (!key) return;
  7445. field = me.getField(key, true);
  7446. // The priority of passing parameter by DOM is higher than by JS.
  7447. field.rule = dataRule || field.rule;
  7448. if (display = attr(el, DATA_DISPLAY)) {
  7449. field.display = display;
  7450. }
  7451. if (field.rule) {
  7452. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7453. field.must = true;
  7454. }
  7455. if ( /\brequired\b/.test(field.rule) ) {
  7456. field.required = true;
  7457. attr(el, ARIA_REQUIRED, true);
  7458. }
  7459. if (timely = attr(el, DATA_TIMELY)) {
  7460. field.timely = +timely;
  7461. } else if (field.timely > 3) {
  7462. attr(el, DATA_TIMELY, field.timely);
  7463. }
  7464. me._parseRule(field);
  7465. field.old = {};
  7466. }
  7467. if ( isString(field.target) ) {
  7468. attr(el, DATA_TARGET, field.target);
  7469. }
  7470. if ( isString(field.tip) ) {
  7471. attr(el, DATA_TIP, field.tip);
  7472. }
  7473. return me.fields[key] = field;
  7474. },
  7475. // Parsing field rules
  7476. _parseRule: function(field) {
  7477. var arr = rDisplay.exec(field.rule);
  7478. if (!arr) return;
  7479. // current rule index
  7480. field._i = 0;
  7481. if (arr[1]) {
  7482. field.display = arr[1];
  7483. }
  7484. if (arr[2]) {
  7485. field._rules = [];
  7486. arr[2].replace(rRules, function(){
  7487. var args = arguments;
  7488. args[4] = args[4] || args[5];
  7489. field._rules.push({
  7490. and: args[1] === "&",
  7491. not: args[2] === "!",
  7492. or: args[6] === "|",
  7493. method: args[3],
  7494. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7495. });
  7496. });
  7497. }
  7498. },
  7499. // Verify a zone
  7500. _multiValidate: function($inputs, doneCallback){
  7501. var me = this,
  7502. opt = me.options;
  7503. me.hasError = false;
  7504. if (opt.ignore) {
  7505. $inputs = $inputs.not(opt.ignore);
  7506. }
  7507. $inputs.each(function() {
  7508. me._validate(this);
  7509. if (me.hasError && opt.stopOnError) {
  7510. // stop the validation
  7511. return false;
  7512. }
  7513. });
  7514. // Need to wait for all fields validation complete, especially asynchronous validation
  7515. if (doneCallback) {
  7516. me.validating = true;
  7517. $.when.apply(
  7518. null,
  7519. $.map(me.deferred, function(v){return v;})
  7520. ).done(function(){
  7521. doneCallback.call(me, !me.hasError);
  7522. me.validating = false;
  7523. });
  7524. }
  7525. // If the form does not contain asynchronous validation, the return value is correct.
  7526. // Otherwise, you should detect form validation result through "doneCallback".
  7527. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7528. },
  7529. // Validate the whole form
  7530. _submit: function(e) {
  7531. var me = this,
  7532. opt = me.options,
  7533. form = e.target,
  7534. canSubmit = e.type === 'submit' && !e.isDefaultPrevented();
  7535. e.preventDefault();
  7536. if (
  7537. novalidateonce && ~(novalidateonce = false) ||
  7538. // Prevent duplicate submission
  7539. me.submiting ||
  7540. // Receive the "validate" event only from the form.
  7541. e.type === 'validate' && me.$el[0] !== form ||
  7542. // trigger the beforeSubmit callback.
  7543. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7544. ) {
  7545. return;
  7546. }
  7547. if (me.isAjaxSubmit === undefined) {
  7548. me._guessAjax(form);
  7549. }
  7550. me._debug('log', '\n<<< event: ' + e.type);
  7551. me._reset();
  7552. me.submiting = true;
  7553. me._multiValidate(
  7554. me.$el.find(INPUT_SELECTOR),
  7555. function(isValid){
  7556. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7557. errors;
  7558. if (!isValid) {
  7559. if (opt.focusInvalid) {
  7560. // navigate to the error element
  7561. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7562. }
  7563. errors = $.map(me.errors, function(err){return err;});
  7564. }
  7565. // releasing submit
  7566. me.submiting = false;
  7567. me.isValid = isValid;
  7568. // trigger callback and event
  7569. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7570. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7571. me._debug('log', '>>> ' + ret);
  7572. if (!isValid) return;
  7573. // For jquery.form plugin
  7574. if (me.vetoed) {
  7575. $(form).ajaxSubmit(me.ajaxFormOptions);
  7576. }
  7577. else if (canSubmit && !me.isAjaxSubmit) {
  7578. document.createElement('form').submit.call(form);
  7579. }
  7580. }
  7581. );
  7582. },
  7583. _reset: function(e) {
  7584. var me = this;
  7585. me.errors = {};
  7586. if (e) {
  7587. me.reseting = true;
  7588. me.$el.find(INPUT_SELECTOR).each( function(){
  7589. me._resetElement(this);
  7590. });
  7591. delete me.reseting;
  7592. }
  7593. },
  7594. _resetElement: function(el, all) {
  7595. this._setClass(el, null);
  7596. this.hideMsg(el);
  7597. if (all) {
  7598. attr(el, ARIA_REQUIRED, null);
  7599. }
  7600. },
  7601. // Handle events: "focusin/click"
  7602. _focusin: function(e) {
  7603. var me = this,
  7604. opt = me.options,
  7605. el = e.target,
  7606. timely,
  7607. msg;
  7608. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7609. return;
  7610. }
  7611. if (opt.focusCleanup) {
  7612. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7613. me._setClass(el, null);
  7614. me.hideMsg(el);
  7615. }
  7616. }
  7617. msg = attr(el, DATA_TIP);
  7618. if (msg) {
  7619. me.showMsg(el, {
  7620. type: 'tip',
  7621. msg: msg
  7622. });
  7623. } else {
  7624. if (attr(el, DATA_RULE)) {
  7625. me._parse(el);
  7626. }
  7627. if (timely = attr(el, DATA_TIMELY)) {
  7628. if ( timely === 8 || timely === 9 ) {
  7629. me._focusout(e);
  7630. }
  7631. }
  7632. }
  7633. },
  7634. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7635. _focusout: function(e) {
  7636. var me = this,
  7637. opt = me.options,
  7638. el = e.target,
  7639. etype = e.type,
  7640. etype0,
  7641. focusin = etype === 'focusin',
  7642. special = etype === 'validate',
  7643. elem,
  7644. field,
  7645. old,
  7646. value,
  7647. timestamp,
  7648. key, specialKey,
  7649. timely,
  7650. timer = 0;
  7651. if (etype === 'compositionstart') {
  7652. me.pauseValidate = true;
  7653. }
  7654. if (etype === 'compositionend') {
  7655. me.pauseValidate = false;
  7656. }
  7657. if (me.pauseValidate) {
  7658. return;
  7659. }
  7660. // For checkbox and radio
  7661. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  7662. // Get field
  7663. if (!(field = me.getField(elem)) || !field.rule) {
  7664. return;
  7665. }
  7666. // Cache event type
  7667. etype0 = field._e;
  7668. field._e = etype;
  7669. timely = field.timely;
  7670. if (!special) {
  7671. if (!timely || (_checkable(el) && etype !== 'click')) {
  7672. return;
  7673. }
  7674. value = field.getValue();
  7675. // not validate field unless fill a value
  7676. if ( field.ignoreBlank && !value && !focusin ) {
  7677. me.hideMsg(el);
  7678. return;
  7679. }
  7680. if ( etype === 'focusout' ) {
  7681. if (etype0 === 'change') {
  7682. return;
  7683. }
  7684. if ( timely === 2 || timely === 8 ) {
  7685. old = field.old;
  7686. if (value && old) {
  7687. if (field.isValid && !old.showOk) {
  7688. me.hideMsg(el);
  7689. } else {
  7690. me._makeMsg(el, field, old);
  7691. }
  7692. } else {
  7693. return;
  7694. }
  7695. }
  7696. }
  7697. else {
  7698. if ( timely < 2 && !e.data ) {
  7699. return;
  7700. }
  7701. // mark timestamp to reduce the frequency of the received event
  7702. timestamp = +new Date();
  7703. if ( timestamp - (el._ts || 0) < 100 ) {
  7704. return;
  7705. }
  7706. el._ts = timestamp;
  7707. // handle keyup
  7708. if ( etype === 'keyup' ) {
  7709. if (etype0 === 'input') {
  7710. return;
  7711. }
  7712. key = e.keyCode;
  7713. specialKey = {
  7714. 8: 1, // Backspace
  7715. 9: 1, // Tab
  7716. 16: 1, // Shift
  7717. 32: 1, // Space
  7718. 46: 1 // Delete
  7719. };
  7720. // only gets focus, no validation
  7721. if ( key === 9 && !value ) {
  7722. return;
  7723. }
  7724. // do not validate, if triggered by these keys
  7725. if ( key < 48 && !specialKey[key] ) {
  7726. return;
  7727. }
  7728. }
  7729. if ( !focusin ) {
  7730. // keyboard events, reducing the frequency of validation
  7731. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  7732. }
  7733. }
  7734. }
  7735. // if the current field is ignored
  7736. if ( opt.ignore && $(el).is(opt.ignore) ) {
  7737. return;
  7738. }
  7739. clearTimeout(field._t);
  7740. if (timer) {
  7741. field._t = setTimeout(function() {
  7742. me._validate(el, field);
  7743. }, timer);
  7744. } else {
  7745. if (special) field.old = {};
  7746. me._validate(el, field);
  7747. }
  7748. },
  7749. _setClass: function(el, isValid) {
  7750. var $el = $(el), opt = this.options;
  7751. if (opt.bindClassTo) {
  7752. $el = $el.closest(opt.bindClassTo);
  7753. }
  7754. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  7755. if (isValid !== null) {
  7756. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  7757. }
  7758. },
  7759. _showmsg: function(e, type, msg) {
  7760. var me = this,
  7761. el = e.target;
  7762. if ( me.$el.is(el) ) {
  7763. if (isObject(type)) {
  7764. me.showMsg(type)
  7765. }
  7766. else if ( type === 'tip' ) {
  7767. me.$el.find(INPUT_SELECTOR +"["+ DATA_TIP +"]", el).each(function(){
  7768. me.showMsg(this, {type: type, msg: msg});
  7769. });
  7770. }
  7771. }
  7772. else {
  7773. me.showMsg(el, {type: type, msg: msg});
  7774. }
  7775. },
  7776. _hidemsg: function(e) {
  7777. var $el = $(e.target);
  7778. if ( $el.is(INPUT_SELECTOR) ) {
  7779. this.hideMsg($el);
  7780. }
  7781. },
  7782. // Validated a field
  7783. _validatedField: function(el, field, ret) {
  7784. var me = this,
  7785. opt = me.options,
  7786. isValid = field.isValid = ret.isValid = !!ret.isValid,
  7787. callback = isValid ? 'valid' : 'invalid';
  7788. ret.key = field.key;
  7789. ret.ruleName = field._r;
  7790. ret.id = el.id;
  7791. ret.value = field.value;
  7792. me.elements[field.key] = ret.element = el;
  7793. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  7794. if (isValid) {
  7795. ret.type = 'ok';
  7796. } else {
  7797. if (me.submiting) {
  7798. me.errors[field.key] = ret.msg;
  7799. }
  7800. me.hasError = true;
  7801. }
  7802. // cache result
  7803. field.old = ret;
  7804. // trigger callback
  7805. isFunction(field[callback]) && field[callback].call(me, el, ret);
  7806. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  7807. // trigger event
  7808. $(el).attr( ARIA_INVALID, isValid ? null : true )
  7809. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  7810. me.$el.triggerHandler('validation', [ret, me]);
  7811. if (me.checkOnly) return;
  7812. // set className
  7813. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  7814. me._makeMsg.apply(me, arguments);
  7815. },
  7816. _makeMsg: function(el, field, ret) {
  7817. // show or hide the message
  7818. if (field.msgMaker) {
  7819. ret = $.extend({}, ret);
  7820. if (field._e === 'focusin') {
  7821. ret.type = 'tip';
  7822. }
  7823. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  7824. }
  7825. },
  7826. // Validated a rule
  7827. _validatedRule: function(el, field, ret, msgOpt) {
  7828. field = field || me.getField(el);
  7829. msgOpt = msgOpt || {};
  7830. var me = this,
  7831. msg,
  7832. rule,
  7833. method = field._r,
  7834. timely = field.timely,
  7835. special = timely === 9 || timely === 8,
  7836. transfer,
  7837. temp,
  7838. isValid = false;
  7839. // use null to break validation from a field
  7840. if (ret === null) {
  7841. me._validatedField(el, field, {isValid: true, skip: true});
  7842. field._i = 0;
  7843. return;
  7844. }
  7845. else if (ret === undefined) {
  7846. transfer = true;
  7847. }
  7848. else if (ret === true || ret === '') {
  7849. isValid = true;
  7850. }
  7851. else if (isString(ret)) {
  7852. msg = ret;
  7853. }
  7854. else if (isObject(ret)) {
  7855. if (ret.error) {
  7856. msg = ret.error;
  7857. } else {
  7858. msg = ret.ok;
  7859. isValid = true;
  7860. }
  7861. }
  7862. rule = field._rules[field._i];
  7863. if (rule.not) {
  7864. msg = undefined;
  7865. isValid = method === "required" || !isValid;
  7866. }
  7867. if (rule.or) {
  7868. if (isValid) {
  7869. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  7870. field._i++;
  7871. }
  7872. } else {
  7873. transfer = true;
  7874. }
  7875. }
  7876. else if (rule.and) {
  7877. if (!field.isValid) transfer = true;
  7878. }
  7879. if (transfer) {
  7880. isValid = true;
  7881. }
  7882. // message analysis, and throw rule level event
  7883. else {
  7884. if (isValid) {
  7885. if (field.showOk !== false) {
  7886. temp = attr(el, DATA_OK);
  7887. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  7888. if (!isString(msg) && isString(field.showOk)) {
  7889. msg = field.showOk;
  7890. }
  7891. if (isString(msg)) {
  7892. msgOpt.showOk = isValid;
  7893. }
  7894. }
  7895. }
  7896. if (!isValid || special) {
  7897. /* rule message priority:
  7898. 1. custom DOM message
  7899. 2. custom field message;
  7900. 3. global defined message;
  7901. 4. rule returned message;
  7902. 5. default message;
  7903. */
  7904. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  7905. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  7906. });
  7907. }
  7908. if (!isValid) field.isValid = isValid;
  7909. msgOpt.msg = msg;
  7910. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  7911. }
  7912. if (special && (!transfer || rule.and)) {
  7913. if (!isValid && !field._m) field._m = msg;
  7914. field._v = field._v || [];
  7915. field._v.push({
  7916. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  7917. msg: msg || rule.msg
  7918. });
  7919. }
  7920. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  7921. // the current rule has passed, continue to validate
  7922. if ( (isValid || special) && field._i < field._rules.length - 1) {
  7923. field._i++;
  7924. me._checkRule(el, field);
  7925. }
  7926. // field was invalid, or all fields was valid
  7927. else {
  7928. field._i = 0;
  7929. if (special) {
  7930. msgOpt.isValid = field.isValid;
  7931. msgOpt.result = field._v;
  7932. msgOpt.msg = field._m || '';
  7933. if (!field.value && (field._e === 'focusin')) {
  7934. msgOpt.type = 'tip';
  7935. }
  7936. } else {
  7937. msgOpt.isValid = isValid;
  7938. }
  7939. me._validatedField(el, field, msgOpt);
  7940. delete field._m;
  7941. delete field._v;
  7942. }
  7943. },
  7944. // Verify a rule form a field
  7945. _checkRule: function(el, field) {
  7946. var me = this,
  7947. ret,
  7948. fn,
  7949. old,
  7950. key = field.key,
  7951. rule = field._rules[field._i],
  7952. method = rule.method,
  7953. params = rule.params;
  7954. // request has been sent, wait it
  7955. if (me.submiting && me.deferred[key]) {
  7956. return;
  7957. }
  7958. old = field.old;
  7959. field._r = method;
  7960. if (old && !field.must && !rule.must && rule.result !== undefined &&
  7961. old.ruleName === method && old.id === el.id &&
  7962. field.value && old.value === field.value )
  7963. {
  7964. // get result from cache
  7965. ret = rule.result;
  7966. }
  7967. else {
  7968. // get result from current rule
  7969. fn = _getDataRule(el, method) || me.rules[method] || noop;
  7970. ret = fn.call(field, el, params, field);
  7971. if (fn.msg) rule.msg = fn.msg;
  7972. }
  7973. // asynchronous validation
  7974. if (isObject(ret) && isFunction(ret.then)) {
  7975. me.deferred[key] = ret;
  7976. // whether the field valid is unknown
  7977. field.isValid = undefined;
  7978. // show loading message
  7979. !me.checkOnly && me.showMsg(el, {
  7980. type: 'loading',
  7981. msg: me.messages.loading
  7982. }, field);
  7983. // waiting to parse the response data
  7984. ret.then(
  7985. function(d, textStatus, jqXHR) {
  7986. var data = trim(jqXHR.responseText),
  7987. result,
  7988. dataFilter = field.dataFilter;
  7989. // detect if data is json or jsonp format
  7990. if (/jsonp?/.test(this.dataType)) {
  7991. data = d;
  7992. } else if (data.charAt(0) === '{') {
  7993. data = $.parseJSON(data);
  7994. }
  7995. // filter data
  7996. result = dataFilter.call(this, data, field);
  7997. if (result === undefined) result = dataFilter.call(this, data.data, field);
  7998. rule.data = this.data;
  7999. rule.result = field.old ? result : undefined;
  8000. me._validatedRule(el, field, result);
  8001. },
  8002. function(jqXHR, textStatus){
  8003. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  8004. }
  8005. ).always(function(){
  8006. delete me.deferred[key];
  8007. });
  8008. }
  8009. // other result
  8010. else {
  8011. me._validatedRule(el, field, ret);
  8012. }
  8013. },
  8014. // Processing the validation
  8015. _validate: function(el, field) {
  8016. var me = this;
  8017. // doesn't validate the element that has "disabled" or "novalidate" attribute
  8018. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  8019. return;
  8020. }
  8021. field = field || me.getField(el);
  8022. if (!field) return;
  8023. if (!field._rules) me._parse(el);
  8024. if (!field._rules) return;
  8025. me._debug('info', field.key);
  8026. field.isValid = true;
  8027. field.element = el;
  8028. // Cache the value
  8029. field.value = field.getValue();
  8030. // if the field is not required, and that has a blank value
  8031. if (!field.required && !field.must && !field.value) {
  8032. if (!_checkable(el)) {
  8033. me._validatedField(el, field, {isValid: true});
  8034. return true;
  8035. }
  8036. }
  8037. me._checkRule(el, field);
  8038. return field.isValid;
  8039. },
  8040. _debug: function(type, messages) {
  8041. if (window.console && this.options.debug) {
  8042. console[type](messages);
  8043. }
  8044. },
  8045. /**
  8046. * Detecting whether the value of an element that matches a rule
  8047. *
  8048. * @method test
  8049. * @param {Element} el - input element
  8050. * @param {String} rule - rule name
  8051. */
  8052. test: function(el, rule) {
  8053. var me = this,
  8054. ret,
  8055. parts = rRule.exec(rule),
  8056. field,
  8057. method,
  8058. params;
  8059. if (parts) {
  8060. method = parts[1];
  8061. if (method in me.rules) {
  8062. params = parts[2] || parts[3];
  8063. params = params ? params.split(', ') : undefined;
  8064. field = me.getField(el, true);
  8065. field._r = method;
  8066. field.value = field.getValue();
  8067. ret = me.rules[method].call(field, el, params);
  8068. }
  8069. }
  8070. return ret === true || ret === undefined || ret === null;
  8071. },
  8072. _getDisplay: function(el, str) {
  8073. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  8074. },
  8075. _getMsgOpt: function(obj, field) {
  8076. var opt = field ? field : this.options;
  8077. return $.extend({
  8078. type: 'error',
  8079. pos: _getPos(opt.msgClass),
  8080. target: opt.target,
  8081. wrapper: opt.msgWrapper,
  8082. style: opt.msgStyle,
  8083. cls: opt.msgClass,
  8084. arrow: opt.msgArrow,
  8085. icon: opt.msgIcon
  8086. }, isString(obj) ? {msg: obj} : obj);
  8087. },
  8088. _getMsgDOM: function(el, msgOpt) {
  8089. var $el = $(el), $msgbox, datafor, tgt, container;
  8090. if ( $el.is(INPUT_SELECTOR) ) {
  8091. tgt = msgOpt.target || attr(el, DATA_TARGET);
  8092. if (tgt) {
  8093. tgt = isFunction(tgt) ? tgt.call(this, el) : this.$el.find(tgt);
  8094. if (tgt.length) {
  8095. if ( tgt.is(INPUT_SELECTOR) ) {
  8096. $el = tgt
  8097. el = tgt.get(0);
  8098. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  8099. $msgbox = tgt;
  8100. } else {
  8101. container = tgt;
  8102. }
  8103. }
  8104. }
  8105. if (!$msgbox) {
  8106. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  8107. $msgbox = this.$el.find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  8108. }
  8109. } else {
  8110. $msgbox = $el;
  8111. }
  8112. // Create new message box
  8113. if (!msgOpt.hide && !$msgbox.length) {
  8114. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  8115. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  8116. 'style': msgOpt.style || undefined,
  8117. 'for': datafor
  8118. });
  8119. if ( _checkable(el) ) {
  8120. var $parent = $el.parent();
  8121. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  8122. } else {
  8123. if (container) {
  8124. $msgbox.appendTo(container);
  8125. } else {
  8126. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  8127. }
  8128. }
  8129. }
  8130. return $msgbox;
  8131. },
  8132. /**
  8133. * Show validation message
  8134. *
  8135. * @method showMsg
  8136. * @param {Element} el - input element
  8137. * @param {Object} msgOpt
  8138. */
  8139. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  8140. if (!el) return;
  8141. var me = this,
  8142. opt = me.options,
  8143. msgShow,
  8144. msgMaker,
  8145. temp,
  8146. $msgbox;
  8147. if (isObject(el) && !el.jquery && !msgOpt) {
  8148. $.each(el, function(key, msg) {
  8149. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  8150. me.showMsg(el, msg);
  8151. });
  8152. return;
  8153. }
  8154. if ($(el).is(INPUT_SELECTOR)) {
  8155. field = field || me.getField(el);
  8156. }
  8157. if (!(msgMaker = (field || opt).msgMaker)) {
  8158. return;
  8159. }
  8160. msgOpt = me._getMsgOpt(msgOpt, field);
  8161. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  8162. // ok or tip
  8163. if (!msgOpt.msg && msgOpt.type !== 'error') {
  8164. temp = attr(el, 'data-' + msgOpt.type);
  8165. if (temp !== null) msgOpt.msg = temp;
  8166. }
  8167. if ( !isString(msgOpt.msg) ) {
  8168. return;
  8169. }
  8170. $msgbox = me._getMsgDOM(el, msgOpt);
  8171. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  8172. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  8173. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  8174. }
  8175. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  8176. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  8177. msgShow.call(me, $msgbox, msgOpt.type);
  8178. }
  8179. },
  8180. /**
  8181. * Hide validation message
  8182. *
  8183. * @method hideMsg
  8184. * @param {Element} el - input element
  8185. * @param {Object} msgOpt optional
  8186. */
  8187. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  8188. var me = this,
  8189. opt = me.options,
  8190. msgHide,
  8191. $msgbox;
  8192. el = $(el).get(0);
  8193. if ($(el).is(INPUT_SELECTOR)) {
  8194. field = field || me.getField(el);
  8195. if (field) {
  8196. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  8197. }
  8198. }
  8199. msgOpt = me._getMsgOpt(msgOpt, field);
  8200. msgOpt.hide = true;
  8201. $msgbox = me._getMsgDOM(el, msgOpt);
  8202. if (!$msgbox.length) return;
  8203. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  8204. msgHide.call(me, $msgbox, msgOpt.type);
  8205. } else {
  8206. $msgbox[0].style.display = 'none';
  8207. $msgbox[0].innerHTML = null;
  8208. }
  8209. },
  8210. /**
  8211. * Get field information
  8212. *
  8213. * @method getField
  8214. * @param {Element} - input element
  8215. * @return {Object} field
  8216. */
  8217. getField: function(el, must) {
  8218. var me = this,
  8219. key,
  8220. field;
  8221. if (isString(el)) {
  8222. key = el;
  8223. el = undefined;
  8224. } else {
  8225. if (attr(el, DATA_RULE)) {
  8226. return me._parse(el);
  8227. }
  8228. if (el.id && '#' + el.id in me.fields || !el.name) {
  8229. key = '#' + el.id;
  8230. } else {
  8231. key = el.name;
  8232. }
  8233. }
  8234. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  8235. field.element = el;
  8236. }
  8237. return field;
  8238. },
  8239. /**
  8240. * Config a field
  8241. *
  8242. * @method: setField
  8243. * @param {String} key
  8244. * @param {Object} obj
  8245. */
  8246. setField: function(key, obj) {
  8247. var fields = {};
  8248. if (!key) return;
  8249. // update this field
  8250. if (isString(key)) {
  8251. fields[key] = obj;
  8252. }
  8253. // update fields
  8254. else {
  8255. fields = key;
  8256. }
  8257. this._initFields(fields);
  8258. },
  8259. /**
  8260. * Detecting whether the form is valid
  8261. *
  8262. * @method isFormValid
  8263. * @return {Boolean}
  8264. */
  8265. isFormValid: function() {
  8266. var fields = this.fields, k, field;
  8267. for (k in fields) {
  8268. field = fields[k];
  8269. if (!field._rules || !field.required && !field.must && !field.value) continue;
  8270. if (!field.isValid) return false;
  8271. }
  8272. return true;
  8273. },
  8274. /**
  8275. * Prevent submission form
  8276. *
  8277. * @method holdSubmit
  8278. * @param {Boolean} hold - If set to false, will release the hold
  8279. */
  8280. holdSubmit: function(hold) {
  8281. this.submiting = hold === undefined || hold;
  8282. },
  8283. /**
  8284. * Clean validation messages
  8285. *
  8286. * @method cleanUp
  8287. */
  8288. cleanUp: function() {
  8289. this._reset(1);
  8290. },
  8291. /**
  8292. * Destroy the validation
  8293. *
  8294. * @method destroy
  8295. */
  8296. destroy: function() {
  8297. this._reset(1);
  8298. this.$el.off(CLS_NS).removeData(NS);
  8299. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  8300. }
  8301. };
  8302. /**
  8303. * Create Field Factory
  8304. *
  8305. * @class
  8306. * @param {Object} context
  8307. * @return {Function} Factory
  8308. */
  8309. function _createFieldFactory(context) {
  8310. function FieldFactory() {
  8311. var options = this.options;
  8312. for (var i in options) {
  8313. if (i in fieldDefaults) this[i] = options[i];
  8314. }
  8315. $.extend(this, {
  8316. _valHook: function() {
  8317. return this.element.contentEditable === 'true' ? 'text' : 'val';
  8318. },
  8319. getValue: function() {
  8320. var elem = this.element;
  8321. if (elem.type === "number" && elem.validity && elem.validity.badInput) {
  8322. return 'NaN';
  8323. }
  8324. return $(elem)[this._valHook()]();
  8325. },
  8326. setValue: function(value) {
  8327. $(this.element)[this._valHook()](this.value = value);
  8328. },
  8329. // Get a range of validation messages
  8330. getRangeMsg: function(value, params, suffix) {
  8331. if (!params) return;
  8332. var me = this,
  8333. msg = me.messages[me._r] || '',
  8334. result,
  8335. p = params[0].split('~'),
  8336. e = params[1] === 'false',
  8337. a = p[0],
  8338. b = p[1],
  8339. c = 'rg',
  8340. args = [''],
  8341. isNumber = trim(value) && +value === +value;
  8342. function compare(large, small) {
  8343. return !e ? large >= small : large > small;
  8344. }
  8345. if (p.length === 2) {
  8346. if (a && b) {
  8347. if (isNumber && compare(value, +a) && compare(+b, value)) {
  8348. result = true;
  8349. }
  8350. args = args.concat(p);
  8351. c = e ? 'gtlt' : 'rg';
  8352. }
  8353. else if (a && !b) {
  8354. if (isNumber && compare(value, +a)) {
  8355. result = true;
  8356. }
  8357. args.push(a);
  8358. c = e ? 'gt' : 'gte';
  8359. }
  8360. else if (!a && b) {
  8361. if (isNumber && compare(+b, value)) {
  8362. result = true;
  8363. }
  8364. args.push(b);
  8365. c = e ? 'lt' : 'lte';
  8366. }
  8367. }
  8368. else {
  8369. if (value === +a) {
  8370. result = true;
  8371. }
  8372. args.push(a);
  8373. c = 'eq';
  8374. }
  8375. if (msg) {
  8376. if (suffix && msg[c + suffix]) {
  8377. c += suffix;
  8378. }
  8379. args[0] = msg[c];
  8380. }
  8381. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8382. },
  8383. // Render message template
  8384. renderMsg: function() {
  8385. var args = arguments,
  8386. tpl = args[0],
  8387. i = args.length;
  8388. if (!tpl) return;
  8389. while (--i) {
  8390. tpl = tpl.replace('{' + i + '}', args[i]);
  8391. }
  8392. return tpl;
  8393. }
  8394. });
  8395. }
  8396. function Field(key, obj, oldField) {
  8397. this.key = key;
  8398. this.validator = context;
  8399. $.extend(this, oldField, obj);
  8400. }
  8401. FieldFactory.prototype = context;
  8402. Field.prototype = new FieldFactory();
  8403. return Field;
  8404. }
  8405. /**
  8406. * Create Rules
  8407. *
  8408. * @class
  8409. * @param {Object} obj rules
  8410. * @param {Object} context context
  8411. */
  8412. function Rules(obj, context) {
  8413. if (!isObject(obj)) return;
  8414. var k, that = context ? context === true ? this : context : Rules.prototype;
  8415. for (k in obj) {
  8416. if (_checkRuleName(k))
  8417. that[k] = _getRule(obj[k]);
  8418. }
  8419. }
  8420. /**
  8421. * Create Messages
  8422. *
  8423. * @class
  8424. * @param {Object} obj rules
  8425. * @param {Object} context context
  8426. */
  8427. function Messages(obj, context) {
  8428. if (!isObject(obj)) return;
  8429. var k, that = context ? context === true ? this : context : Messages.prototype;
  8430. for (k in obj) {
  8431. that[k] = obj[k];
  8432. }
  8433. }
  8434. // Rule converted factory
  8435. function _getRule(fn) {
  8436. switch ($.type(fn)) {
  8437. case 'function':
  8438. return fn;
  8439. case 'array':
  8440. var f = function() {
  8441. return fn[0].test(this.value) || fn[1] || false;
  8442. };
  8443. f.msg = fn[1];
  8444. return f;
  8445. case 'regexp':
  8446. return function() {
  8447. return fn.test(this.value);
  8448. };
  8449. }
  8450. }
  8451. // Get instance by an element
  8452. function _getInstance(el) {
  8453. var wrap, k, options;
  8454. if (!el || !el.tagName) return;
  8455. switch (el.tagName) {
  8456. case 'INPUT':
  8457. case 'SELECT':
  8458. case 'TEXTAREA':
  8459. case 'BUTTON':
  8460. case 'FIELDSET':
  8461. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8462. break;
  8463. case 'FORM':
  8464. wrap = el;
  8465. break;
  8466. default:
  8467. wrap = $(el).closest('.' + CLS_WRAPPER);
  8468. }
  8469. for (k in preinitialized) {
  8470. if ($(wrap).is(k)) {
  8471. options = preinitialized[k];
  8472. break;
  8473. }
  8474. }
  8475. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8476. }
  8477. // Get custom rules on the node
  8478. function _getDataRule(el, method) {
  8479. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8480. if ( fn && (fn = new Function("return " + fn)()) ) {
  8481. return _getRule(fn);
  8482. }
  8483. }
  8484. // Get custom messages on the node
  8485. function _getDataMsg(el, field, m) {
  8486. var msg = field.msg,
  8487. item = field._r;
  8488. if ( isObject(msg) ) msg = msg[item];
  8489. if ( !isString(msg) ) {
  8490. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8491. }
  8492. return msg;
  8493. }
  8494. // Get message position
  8495. function _getPos(str) {
  8496. var pos;
  8497. if (str) pos = rPos.exec(str);
  8498. return pos && pos[0];
  8499. }
  8500. // Check whether the element is checkbox or radio
  8501. function _checkable(el) {
  8502. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8503. }
  8504. // Parse date string to timestamp
  8505. function _parseDate(str) {
  8506. return Date.parse(str.replace(/\.|\-/g, '/'));
  8507. }
  8508. // Rule name only allows alphanumeric characters and underscores
  8509. function _checkRuleName(name) {
  8510. return /^\w+$/.test(name);
  8511. }
  8512. // Translate field key to jQuery selector.
  8513. function _key2selector(key) {
  8514. var isID = key.charAt(0) === "#";
  8515. key = key.replace(/([:.{(|)}/\[\]])/g, "\\$1");
  8516. return isID ? key : '[name="'+ key +'"]:first';
  8517. }
  8518. // Fixed a issue cause by refresh page in IE.
  8519. $(window).on('beforeunload', function(){
  8520. this.focus();
  8521. });
  8522. $(document)
  8523. .on('click', ':submit', function(){
  8524. var input = this, attrNode;
  8525. if (!input.form) return;
  8526. // Shim for "formnovalidate"
  8527. attrNode = input.getAttributeNode('formnovalidate');
  8528. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8529. novalidateonce = true;
  8530. }
  8531. })
  8532. // Automatic initializing form validation
  8533. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8534. if ( attr(this, NOVALIDATE) !== null ) return;
  8535. var $form = $(this), me;
  8536. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8537. if ( !$.isEmptyObject(me.fields) ) {
  8538. // Execute event handler
  8539. if (e.type === 'focusin') {
  8540. me._focusin(e);
  8541. } else {
  8542. me._submit(e);
  8543. }
  8544. } else {
  8545. attr(this, NOVALIDATE, NOVALIDATE);
  8546. $form.off(CLS_NS).removeData(NS);
  8547. }
  8548. }
  8549. });
  8550. new Messages({
  8551. fallback: "This field is not valid.",
  8552. loading: 'Validating...'
  8553. });
  8554. // Built-in rules (global)
  8555. new Rules({
  8556. /**
  8557. * required
  8558. *
  8559. * @example:
  8560. required
  8561. required(anotherRule)
  8562. required(not, -1)
  8563. required(from, .contact)
  8564. */
  8565. required: function(element, params) {
  8566. var me = this,
  8567. val = trim(me.value),
  8568. isValid = true;
  8569. if (params) {
  8570. if ( params.length === 1 ) {
  8571. if ( !_checkRuleName(params[0]) ) {
  8572. if (!val && !$(params[0], me.$el).length ) {
  8573. return null;
  8574. }
  8575. }
  8576. else if ( me.rules[params[0]] ) {
  8577. if ( !val && !me.test(element, params[0]) ) {
  8578. attr(element, ARIA_REQUIRED, null);
  8579. return null;
  8580. } else {
  8581. attr(element, ARIA_REQUIRED, true);
  8582. }
  8583. }
  8584. }
  8585. else if ( params[0] === 'not' ) {
  8586. $.each(params.slice(1), function() {
  8587. return (isValid = val !== trim(this));
  8588. });
  8589. }
  8590. else if ( params[0] === 'from' ) {
  8591. var $elements = me.$el.find(params[1]),
  8592. VALIDATED = '_validated_',
  8593. ret;
  8594. isValid = $elements.filter(function(){
  8595. var field = me.getField(this);
  8596. return field && !!trim(field.getValue());
  8597. }).length >= (params[2] || 1);
  8598. if (isValid) {
  8599. if (!val) ret = null;
  8600. } else {
  8601. ret = _getDataMsg($elements[0], me) || false;
  8602. }
  8603. if ( !$(element).data(VALIDATED) ) {
  8604. $elements.data(VALIDATED, 1).each(function(){
  8605. if (element !== this) {
  8606. me._validate(this);
  8607. }
  8608. }).removeData(VALIDATED);
  8609. }
  8610. return ret;
  8611. }
  8612. }
  8613. return isValid && !!val;
  8614. },
  8615. /**
  8616. * integer
  8617. *
  8618. * @example:
  8619. integer
  8620. integer[+]
  8621. integer[+0]
  8622. integer[-]
  8623. integer[-0]
  8624. */
  8625. integer: function(element, params) {
  8626. var re, z = '0|',
  8627. p = '[1-9]\\d*',
  8628. key = params ? params[0] : '*';
  8629. switch (key) {
  8630. case '+':
  8631. re = p;
  8632. break;
  8633. case '-':
  8634. re = '-' + p;
  8635. break;
  8636. case '+0':
  8637. re = z + p;
  8638. break;
  8639. case '-0':
  8640. re = z + '-' + p;
  8641. break;
  8642. default:
  8643. re = z + '-?' + p;
  8644. }
  8645. re = '^(?:' + re + ')$';
  8646. return new RegExp(re).test(this.value) || this.messages.integer[key];
  8647. },
  8648. /**
  8649. * match another field
  8650. *
  8651. * @example:
  8652. match[password] Match the password field (two values ​​must be the same)
  8653. match[eq, password] Ditto
  8654. match[neq, count] The value must be not equal to the value of the count field
  8655. match[lt, count] The value must be less than the value of the count field
  8656. match[lte, count] The value must be less than or equal to the value of the count field
  8657. match[gt, count] The value must be greater than the value of the count field
  8658. match[gte, count] The value must be greater than or equal to the value of the count field
  8659. match[gte, startDate, date]
  8660. match[gte, startTime, time]
  8661. **/
  8662. match: function(element, params) {
  8663. if (!params) return;
  8664. var me = this,
  8665. a, b,
  8666. key, msg, type = 'eq', parser,
  8667. selector2, elem2, field2;
  8668. if (params.length === 1) {
  8669. key = params[0];
  8670. } else {
  8671. type = params[0];
  8672. key = params[1];
  8673. }
  8674. selector2 = _key2selector(key);
  8675. elem2 = me.$el.find(selector2)[0];
  8676. // If the compared field is not exist
  8677. if (!elem2) return;
  8678. field2 = me.getField(elem2);
  8679. a = me.value;
  8680. b = field2.getValue();
  8681. if (!me._match) {
  8682. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  8683. $(element).trigger('validate');
  8684. });
  8685. me._match = field2._match = 1;
  8686. }
  8687. // If both fields are blank
  8688. if (!me.required && a === "" && b === "") {
  8689. return null;
  8690. }
  8691. parser = params[2];
  8692. if (parser) {
  8693. if (/^date(time)?$/i.test(parser)) {
  8694. a = _parseDate(a);
  8695. b = _parseDate(b);
  8696. } else if (parser === 'time') {
  8697. a = +a.replace(/:/g, '');
  8698. b = +b.replace(/:/g, '');
  8699. }
  8700. }
  8701. // If the compared field is incorrect, we only ensure that this field is correct.
  8702. if (type !== "eq" && !isNaN(+a) && isNaN(+b)) {
  8703. return true;
  8704. }
  8705. msg = me.messages.match[type].replace( '{1}', me._getDisplay( element, field2.display || key ) );
  8706. switch (type) {
  8707. case 'lt':
  8708. return (+a < +b) || msg;
  8709. case 'lte':
  8710. return (+a <= +b) || msg;
  8711. case 'gte':
  8712. return (+a >= +b) || msg;
  8713. case 'gt':
  8714. return (+a > +b) || msg;
  8715. case 'neq':
  8716. return (a !== b) || msg;
  8717. default:
  8718. return (a === b) || msg;
  8719. }
  8720. },
  8721. /**
  8722. * range numbers
  8723. *
  8724. * @example:
  8725. range[0~99] Number 0-99
  8726. range[0~] Number greater than or equal to 0
  8727. range[~100] Number less than or equal to 100
  8728. **/
  8729. range: function(element, params) {
  8730. return this.getRangeMsg(this.value, params);
  8731. },
  8732. /**
  8733. * how many checkbox or radio inputs that checked
  8734. *
  8735. * @example:
  8736. checked; no empty, same to required
  8737. checked[1~3] 1-3 items
  8738. checked[1~] greater than 1 item
  8739. checked[~3] less than 3 items
  8740. checked[3] 3 items
  8741. **/
  8742. checked: function(element, params) {
  8743. if ( !_checkable(element) ) return;
  8744. var me = this,
  8745. elem, count;
  8746. if (element.name) {
  8747. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  8748. var el = this;
  8749. if (!elem && _checkable(el)) elem = el;
  8750. return !el.disabled && el.checked;
  8751. }).length;
  8752. } else {
  8753. elem = element;
  8754. count = elem.checked;
  8755. }
  8756. if (params) {
  8757. return me.getRangeMsg(count, params);
  8758. } else {
  8759. return !!count || _getDataMsg(elem, me, '') || me.messages.required;
  8760. }
  8761. },
  8762. /**
  8763. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  8764. *
  8765. * @example:
  8766. length[6~16] 6-16 characters
  8767. length[6~] Greater than 6 characters
  8768. length[~16] Less than 16 characters
  8769. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  8770. **/
  8771. length: function(element, params) {
  8772. var value = this.value,
  8773. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  8774. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  8775. },
  8776. /**
  8777. * remote validation
  8778. *
  8779. * @description
  8780. * remote([get:]url [, name1, [name2 ...]]);
  8781. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  8782. 1. text:
  8783. '' 'Error Message'
  8784. 2. json:
  8785. {"ok": ""} {"error": "Error Message"}
  8786. 3. json wrapper:
  8787. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  8788. * @example
  8789. The simplest: remote(path/to/server);
  8790. With parameters: remote(path/to/server, name1, name2, ...);
  8791. By GET: remote(get:path/to/server, name1, name2, ...);
  8792. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  8793. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  8794. */
  8795. remote: function(element, params) {
  8796. if (!params) return;
  8797. var me = this,
  8798. arr = rAjaxType.exec(params[0]),
  8799. rule = me._rules[me._i],
  8800. data = {},
  8801. queryString = '',
  8802. url = arr[3],
  8803. type = arr[2] || 'POST', // GET / POST
  8804. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  8805. dataType;
  8806. rule.must = true;
  8807. data[element.name] = me.value;
  8808. // There are extra fields
  8809. if (params[1]) {
  8810. $.map(params.slice(1), function(name) {
  8811. var arr, key;
  8812. if (~name.indexOf('=')) {
  8813. queryString += '&' + name;
  8814. } else {
  8815. arr = name.split(':');
  8816. name = trim(arr[0]);
  8817. key = trim(arr[1]) || name;
  8818. data[ name ] = me.$el.find( _key2selector(key) ).val();
  8819. }
  8820. });
  8821. }
  8822. data = $.param(data) + queryString;
  8823. if (!me.must && rule.data && rule.data === data) {
  8824. return rule.result;
  8825. }
  8826. // Cross-domain request, force jsonp dataType
  8827. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  8828. dataType = 'jsonp';
  8829. }
  8830. // Asynchronous validation need return jqXHR objects
  8831. return $.ajax({
  8832. url: url,
  8833. type: type,
  8834. data: data,
  8835. dataType: dataType
  8836. });
  8837. },
  8838. /**
  8839. * filter characters, direct filtration without prompting error (support custom regular expressions)
  8840. *
  8841. * @example
  8842. * filter filtering unsafe characters
  8843. * filter(regexp) filtering the "regexp" matched characters
  8844. */
  8845. filter: function(element, params) {
  8846. var value = this.value,
  8847. temp = value.replace( params ? (new RegExp("[" + params[0] + "]", "gm")) : rUnsafe, '' );
  8848. if (temp !== value) this.setValue(temp);
  8849. }
  8850. });
  8851. /**
  8852. * Config global options
  8853. *
  8854. * @static config
  8855. * @param {Object} options
  8856. */
  8857. Validator.config = function(key, value) {
  8858. if (isObject(key)) {
  8859. $.each(key, _config);
  8860. }
  8861. else if (isString(key)) {
  8862. _config(key, value);
  8863. }
  8864. function _config(k, o) {
  8865. if (k === 'rules') {
  8866. new Rules(o);
  8867. }
  8868. else if (k === 'messages') {
  8869. new Messages(o);
  8870. }
  8871. else if (k in fieldDefaults) {
  8872. fieldDefaults[k] = o;
  8873. }
  8874. else {
  8875. defaults[k] = o;
  8876. }
  8877. }
  8878. };
  8879. /**
  8880. * Config themes
  8881. *
  8882. * @static setTheme
  8883. * @param {String|Object} name
  8884. * @param {Object} obj
  8885. * @example
  8886. .setTheme( themeName, themeOptions )
  8887. .setTheme( multiThemes )
  8888. */
  8889. Validator.setTheme = function(name, obj) {
  8890. if ( isObject(name) ) {
  8891. $.extend(true, themes, name);
  8892. }
  8893. else if ( isString(name) && isObject(obj) ) {
  8894. themes[name] = $.extend(themes[name], obj);
  8895. }
  8896. };
  8897. /**
  8898. * Resource loader
  8899. *
  8900. * @static load
  8901. * @param {String} str
  8902. * @example
  8903. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  8904. .load('local=zh-CN&css=') // load: local/zh-CN.js
  8905. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  8906. .load('local') // dito
  8907. */
  8908. Validator.load = function(str) {
  8909. if (!str) return;
  8910. var doc = document,
  8911. params = {},
  8912. node = doc.scripts[0],
  8913. dir, el, ONLOAD;
  8914. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  8915. params[key] = value;
  8916. });
  8917. dir = params.dir || Validator.dir;
  8918. if (!Validator.css && params.css !== '') {
  8919. el = doc.createElement('link');
  8920. el.rel = 'stylesheet';
  8921. el.href = Validator.css = dir + 'jquery.validator.css';
  8922. node.parentNode.insertBefore(el, node);
  8923. }
  8924. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  8925. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  8926. Validator.pending = 1;
  8927. el = doc.createElement('script');
  8928. el.src = dir + 'local/' + Validator.local + '.js';
  8929. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  8930. el[ONLOAD] = function() {
  8931. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  8932. el = el[ONLOAD] = null;
  8933. delete Validator.pending;
  8934. $(window).triggerHandler('validatorready');
  8935. }
  8936. };
  8937. node.parentNode.insertBefore(el, node);
  8938. }
  8939. };
  8940. // Auto loading resources
  8941. (function(){
  8942. var scripts = document.scripts,
  8943. i = scripts.length, node, arr,
  8944. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  8945. while (i-- && !arr) {
  8946. node = scripts[i];
  8947. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  8948. }
  8949. if (!arr) return;
  8950. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  8951. Validator.load(arr[2]);
  8952. })();
  8953. return $[NS] = Validator;
  8954. }));
  8955. /*********************************
  8956. * Themes, rules, and i18n support
  8957. * Locale: Chinese; 中文
  8958. *********************************/
  8959. (function(factory) {
  8960. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  8961. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  8962. factory(jQuery);
  8963. }(function($) {
  8964. /* Global configuration
  8965. */
  8966. $.validator.config({
  8967. //stopOnError: true,
  8968. //focusCleanup: true,
  8969. //theme: 'yellow_right',
  8970. //timely: 2,
  8971. // Custom rules
  8972. rules: {
  8973. digits: [/^\d+$/, "请填写数字"]
  8974. ,letters: [/^[a-z]+$/i, "请填写字母"]
  8975. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  8976. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  8977. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  8978. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  8979. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  8980. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  8981. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  8982. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  8983. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  8984. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  8985. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  8986. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  8987. ,accept: function (element, params){
  8988. if (!params) return true;
  8989. var ext = params[0],
  8990. value = $(element).val();
  8991. return (ext === '*') ||
  8992. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  8993. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  8994. }
  8995. },
  8996. // Default error messages
  8997. messages: {
  8998. 0: "此处",
  8999. fallback: "{0}格式不正确",
  9000. loading: "正在验证...",
  9001. error: "网络异常",
  9002. timeout: "请求超时",
  9003. required: "{0}不能为空",
  9004. remote: "{0}已被使用",
  9005. integer: {
  9006. '*': "请填写整数",
  9007. '+': "请填写正整数",
  9008. '+0': "请填写正整数或0",
  9009. '-': "请填写负整数",
  9010. '-0': "请填写负整数或0"
  9011. },
  9012. match: {
  9013. eq: "{0}与{1}不一致",
  9014. neq: "{0}与{1}不能相同",
  9015. lt: "{0}必须小于{1}",
  9016. gt: "{0}必须大于{1}",
  9017. lte: "{0}不能大于{1}",
  9018. gte: "{0}不能小于{1}"
  9019. },
  9020. range: {
  9021. rg: "请填写{1}到{2}的数",
  9022. gte: "请填写不小于{1}的数",
  9023. lte: "请填写最大{1}的数",
  9024. gtlt: "请填写{1}到{2}之间的数",
  9025. gt: "请填写大于{1}的数",
  9026. lt: "请填写小于{1}的数"
  9027. },
  9028. checked: {
  9029. eq: "请选择{1}项",
  9030. rg: "请选择{1}到{2}项",
  9031. gte: "请至少选择{1}项",
  9032. lte: "请最多选择{1}项"
  9033. },
  9034. length: {
  9035. eq: "请填写{1}个字符",
  9036. rg: "请填写{1}到{2}个字符",
  9037. gte: "请至少填写{1}个字符",
  9038. lte: "请最多填写{1}个字符",
  9039. eq_2: "",
  9040. rg_2: "",
  9041. gte_2: "",
  9042. lte_2: ""
  9043. }
  9044. }
  9045. });
  9046. /* Themes
  9047. */
  9048. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  9049. $.validator.setTheme({
  9050. 'simple_right': {
  9051. formClass: 'n-simple',
  9052. msgClass: 'n-right'
  9053. },
  9054. 'simple_bottom': {
  9055. formClass: 'n-simple',
  9056. msgClass: 'n-bottom'
  9057. },
  9058. 'yellow_top': {
  9059. formClass: 'n-yellow',
  9060. msgClass: 'n-top',
  9061. msgArrow: TPL_ARROW
  9062. },
  9063. 'yellow_right': {
  9064. formClass: 'n-yellow',
  9065. msgClass: 'n-right',
  9066. msgArrow: TPL_ARROW
  9067. },
  9068. 'yellow_right_effect': {
  9069. formClass: 'n-yellow',
  9070. msgClass: 'n-right',
  9071. msgArrow: TPL_ARROW,
  9072. msgShow: function($msgbox, type){
  9073. var $el = $msgbox.children();
  9074. if ($el.is(':animated')) return;
  9075. if (type === 'error') {
  9076. $el.css({left: '20px', opacity: 0})
  9077. .delay(100).show().stop()
  9078. .animate({left: '-4px', opacity: 1}, 150)
  9079. .animate({left: '3px'}, 80)
  9080. .animate({left: 0}, 80);
  9081. } else {
  9082. $el.css({left: 0, opacity: 1}).fadeIn(200);
  9083. }
  9084. },
  9085. msgHide: function($msgbox, type){
  9086. var $el = $msgbox.children();
  9087. $el.stop().delay(100).show()
  9088. .animate({left: '20px', opacity: 0}, 300, function(){
  9089. $msgbox.hide();
  9090. });
  9091. }
  9092. }
  9093. });
  9094. }));
  9095. define('validator',['validator-core', 'validator-lang'], function (Validator, undefined) {
  9096. return Validator;
  9097. });
  9098. define('form',['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'], function ($, undefined, Backend, Toastr, Upload, Validator) {
  9099. var Form = {
  9100. config: {
  9101. },
  9102. api: {
  9103. submit: function (form, onBeforeSubmit, onAfterSubmit) {
  9104. if (form.size() == 0)
  9105. return Toastr.error("表单未初始化完成,无法提交");
  9106. //提交前事件
  9107. var beforeSubmit = form.data("before-submit");
  9108. //元素绑定函数
  9109. if (beforeSubmit && typeof Form.api.custom[beforeSubmit] == 'function') {
  9110. if (!Form.api.custom[beforeSubmit].call(form)) {
  9111. return false;
  9112. }
  9113. }
  9114. //自定义函数
  9115. if (typeof onBeforeSubmit == 'function') {
  9116. if (!onBeforeSubmit.call(form)) {
  9117. return false;
  9118. }
  9119. }
  9120. var type = form.attr("method").toUpperCase();
  9121. type = type && (type == 'GET' || type == 'POST') ? type : 'GET';
  9122. url = form.attr("action");
  9123. url = url ? url : location.href;
  9124. $.ajax({
  9125. type: type,
  9126. url: url,
  9127. data: form.serialize(),
  9128. dataType: 'json',
  9129. success: function (ret) {
  9130. if (ret.hasOwnProperty("code")) {
  9131. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  9132. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  9133. if (ret.code === 1) {
  9134. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9135. //成功提交后事件
  9136. var afterSubmit = form.data("after-submit");
  9137. //元素绑定函数
  9138. if (afterSubmit && typeof Form.api.custom[afterSubmit] == 'function') {
  9139. if (!Form.api.custom[afterSubmit].call(form, data)) {
  9140. return false;
  9141. }
  9142. }
  9143. //自定义函数
  9144. if (typeof onAfterSubmit == 'function') {
  9145. if (!onAfterSubmit.call(form, data)) {
  9146. return false;
  9147. }
  9148. }
  9149. Toastr.success(msg ? msg : __('Operation completed'));
  9150. } else {
  9151. Toastr.error(msg ? msg : __('Operation failed'));
  9152. }
  9153. } else {
  9154. Toastr.error(__('Unknown data format'));
  9155. }
  9156. }, error: function () {
  9157. Toastr.error(__('Network error'));
  9158. }, complete: function (e) {
  9159. }
  9160. });
  9161. return false;
  9162. },
  9163. bindevent: function (form, onBeforeSubmit, onAfterSubmit) {
  9164. form.validator({
  9165. validClass: 'has-success',
  9166. invalidClass: 'has-error',
  9167. bindClassTo: '.form-group',
  9168. formClass: 'n-default n-bootstrap',
  9169. msgClass: 'n-right',
  9170. stopOnError: true,
  9171. valid: function (ret) {
  9172. //验证通过提交表单
  9173. Form.api.submit(form, onBeforeSubmit, function (data) {
  9174. if (typeof onAfterSubmit == 'function') {
  9175. if (!onAfterSubmit.call(form, data)) {
  9176. return false;
  9177. }
  9178. }
  9179. //提示及关闭当前窗口
  9180. parent.Toastr.success(__('Operation completed'));
  9181. parent.$(".btn-refresh").trigger("click");
  9182. var index = parent.Layer.getFrameIndex(window.name);
  9183. parent.Layer.close(index);
  9184. });
  9185. return false;
  9186. }
  9187. });
  9188. //绑定select元素事件
  9189. if ($(".selectpicker", form).size() > 0) {
  9190. require(['bootstrap-select'], function () {
  9191. $('.selectpicker', form).selectpicker();
  9192. });
  9193. }
  9194. //绑定cxselect元素事件
  9195. if ($("[data-toggle='cxselect']").size() > 0) {
  9196. require(['cxselect'], function () {
  9197. $.cxSelect.defaults.jsonName = 'name';
  9198. $.cxSelect.defaults.jsonValue = 'value';
  9199. $.cxSelect.defaults.jsonSpace = 'data';
  9200. $("[data-toggle='cxselect']").cxSelect();
  9201. });
  9202. }
  9203. if ($(".typeahead").size() > 0 || $(".tagsinput").size() > 0) {
  9204. require(['bloodhound'], function () {
  9205. var remotesource = function (input) {
  9206. return new Bloodhound({
  9207. datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
  9208. queryTokenizer: Bloodhound.tokenizers.whitespace,
  9209. remote: {
  9210. url: 'ajax/typeahead?search=%QUERY&field=' + $(input).attr("name"),
  9211. wildcard: '%QUERY',
  9212. transform: function (ret) {
  9213. return ret.data.searchlist;
  9214. }
  9215. }
  9216. });
  9217. };
  9218. //绑定typeahead事件
  9219. if ($(".typeahead", form).size() > 0) {
  9220. require(['typeahead'], function () {
  9221. $(".typeahead", form).each(function () {
  9222. $(this).typeahead({
  9223. hint: true,
  9224. highlight: true,
  9225. minLength: 0
  9226. }, {
  9227. name: 'typeahead',
  9228. limit: 20,
  9229. displayKey: 'id',
  9230. source: remotesource(this),
  9231. templates: {
  9232. empty: '<li class="notfound">' + __('No matches found') + '</li>',
  9233. suggestion: function (item) {
  9234. return '<li>' + item.name + '</li>';
  9235. }
  9236. }
  9237. });
  9238. });
  9239. });
  9240. }
  9241. //绑定tagsinput事件
  9242. if ($(".tagsinput", form).size() > 0) {
  9243. require(['bootstrap-tagsinput'], function () {
  9244. $('.tagsinput', form).each(function () {
  9245. $(this).tagsinput({
  9246. freeInput: false,
  9247. typeaheadjs: {
  9248. name: 'tagsinput',
  9249. limit: 20,
  9250. displayKey: 'name',
  9251. valueKey: 'id',
  9252. source: remotesource(this),
  9253. templates: {
  9254. empty: '<li class="notfound">' + __('No matches found') + '</li>',
  9255. suggestion: function (item) {
  9256. return '<li>' + item.name + '</li>';
  9257. }
  9258. }
  9259. }
  9260. });
  9261. });
  9262. $('.bootstrap-tagsinput .twitter-typeahead').css('display', 'inline');
  9263. });
  9264. }
  9265. });
  9266. }
  9267. //绑定日期时间元素事件
  9268. if ($(".datetimepicker", form).size() > 0) {
  9269. require(['bootstrap-datetimepicker'], function () {
  9270. $('.datetimepicker', form).parent().css('position', 'relative');
  9271. $('.datetimepicker', form)
  9272. .datetimepicker({
  9273. format: 'YYYY-MM-DD HH:mm:ss',
  9274. icons: {
  9275. time: 'fa fa-clock-o',
  9276. date: 'fa fa-calendar',
  9277. up: 'fa fa-chevron-up',
  9278. down: 'fa fa-chevron-down',
  9279. previous: 'fa fa-chevron-left',
  9280. next: 'fa fa-chevron-right',
  9281. today: 'fa fa-history',
  9282. clear: 'fa fa-trash',
  9283. close: 'fa fa-remove'
  9284. },
  9285. showTodayButton: true,
  9286. showClose: true
  9287. });
  9288. });
  9289. }
  9290. //绑定summernote事件
  9291. if ($(".summernote", form).size() > 0) {
  9292. require(['summernote'], function () {
  9293. $(".summernote", form).summernote({
  9294. height: 250,
  9295. lang: 'zh-CN',
  9296. dialogsInBody: true,
  9297. callbacks: {
  9298. onChange: function (contents) {
  9299. $(this).val(contents);
  9300. $(this).trigger('change');
  9301. },
  9302. onInit: function () {
  9303. },
  9304. onImageUpload: function (files) {
  9305. var that = this;
  9306. //依次上传图片
  9307. for (var i = 0; i < files.length; i++) {
  9308. Upload.api.send(files[i], function (data) {
  9309. var url = Config.upload.cdnurl + data.url;
  9310. $(that).summernote("insertImage", url, 'filename');
  9311. });
  9312. }
  9313. }
  9314. }
  9315. });
  9316. });
  9317. }
  9318. //绑定plupload上传元素事件
  9319. if ($(".plupload", form).size() > 0) {
  9320. Upload.api.plupload();
  9321. }
  9322. },
  9323. custom: {}
  9324. },
  9325. };
  9326. return Form;
  9327. });
  9328. // jQuery List DragSort v0.5.2
  9329. // Website: http://dragsort.codeplex.com/
  9330. // License: http://dragsort.codeplex.com/license
  9331. (function($) {
  9332. $.fn.dragsort = function(options) {
  9333. if (options == "destroy") {
  9334. $(this.selector).trigger("dragsort-uninit");
  9335. return;
  9336. }
  9337. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  9338. var lists = [];
  9339. var list = null, lastPos = null;
  9340. this.each(function(i, cont) {
  9341. //if list container is table, the browser automatically wraps rows in tbody if not specified so change list container to tbody so that children returns rows as user expected
  9342. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  9343. cont = $(cont).children().get(0);
  9344. var newList = {
  9345. draggedItem: null,
  9346. placeHolderItem: null,
  9347. pos: null,
  9348. offset: null,
  9349. offsetLimit: null,
  9350. scroll: null,
  9351. container: cont,
  9352. init: function() {
  9353. //set options to default values if not set
  9354. opts.tagName = $(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase();
  9355. if (opts.itemSelector == "")
  9356. opts.itemSelector = opts.tagName;
  9357. if (opts.dragSelector == "")
  9358. opts.dragSelector = opts.tagName;
  9359. if (opts.placeHolderTemplate == "")
  9360. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  9361. //listidx allows reference back to correct list variable instance
  9362. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  9363. this.styleDragHandlers(true);
  9364. },
  9365. uninit: function() {
  9366. var list = lists[$(this).attr("data-listidx")];
  9367. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  9368. list.styleDragHandlers(false);
  9369. },
  9370. getItems: function() {
  9371. return $(this.container).children(opts.itemSelector);
  9372. },
  9373. styleDragHandlers: function(cursor) {
  9374. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  9375. },
  9376. grabItem: function(e) {
  9377. var list = lists[$(this).attr("data-listidx")];
  9378. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  9379. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  9380. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  9381. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  9382. return;
  9383. //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved,
  9384. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  9385. //e.preventDefault();
  9386. //change cursor to move while dragging
  9387. var dragHandle = e.target;
  9388. while (!$(dragHandle).is(opts.dragSelector)) {
  9389. if (dragHandle == this) return;
  9390. dragHandle = dragHandle.parentNode;
  9391. }
  9392. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  9393. $(dragHandle).css("cursor", "move");
  9394. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  9395. var listElem = this;
  9396. var trigger = function() {
  9397. list.dragStart.call(listElem, e);
  9398. $(list.container).unbind("mousemove", trigger);
  9399. };
  9400. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  9401. },
  9402. dragStart: function(e) {
  9403. if (list != null && list.draggedItem != null)
  9404. list.dropItem();
  9405. list = lists[$(this).attr("data-listidx")];
  9406. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  9407. //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items
  9408. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  9409. //calculate mouse offset relative to draggedItem
  9410. var mt = parseInt(list.draggedItem.css("marginTop"));
  9411. var ml = parseInt(list.draggedItem.css("marginLeft"));
  9412. list.offset = list.draggedItem.offset();
  9413. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  9414. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  9415. //calculate box the dragged item can't be dragged outside of
  9416. if (!opts.dragBetween) {
  9417. var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight();
  9418. list.offsetLimit = $(list.container).offset();
  9419. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  9420. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  9421. }
  9422. //create placeholder item
  9423. var h = list.draggedItem.height();
  9424. var w = list.draggedItem.width();
  9425. if (opts.tagName == "tr") {
  9426. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  9427. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  9428. list.draggedItem.after(list.placeHolderItem);
  9429. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  9430. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  9431. } else {
  9432. list.draggedItem.after(opts.placeHolderTemplate);
  9433. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  9434. }
  9435. if (opts.tagName == "td") {
  9436. var listTable = list.draggedItem.closest("table").get(0);
  9437. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  9438. }
  9439. //style draggedItem while dragging
  9440. var orig = list.draggedItem.attr("style");
  9441. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  9442. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  9443. //auto-scroll setup
  9444. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  9445. list.scroll.scrollY = window.setInterval(function() {
  9446. if (opts.scrollContainer != window) {
  9447. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  9448. return;
  9449. }
  9450. var t = $(opts.scrollContainer).scrollTop();
  9451. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  9452. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  9453. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  9454. }
  9455. }, 10);
  9456. list.scroll.scrollX = window.setInterval(function() {
  9457. if (opts.scrollContainer != window) {
  9458. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  9459. return;
  9460. }
  9461. var l = $(opts.scrollContainer).scrollLeft();
  9462. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  9463. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  9464. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  9465. }
  9466. }, 10);
  9467. //misc
  9468. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9469. list.setPos(e.pageX, e.pageY);
  9470. $(document).bind("mousemove", list.swapItems);
  9471. $(document).bind("mouseup", list.dropItem);
  9472. if (opts.scrollContainer != window)
  9473. $(window).bind("wheel", list.wheel);
  9474. },
  9475. //set position of draggedItem
  9476. setPos: function(x, y) {
  9477. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  9478. var top = y - this.offset.top;
  9479. var left = x - this.offset.left;
  9480. //limit top, left to within box draggedItem can't be dragged outside of
  9481. if (!opts.dragBetween) {
  9482. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  9483. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  9484. }
  9485. //adjust top & left calculations to parent offset
  9486. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  9487. if (parent != null) {
  9488. top -= parent.top;
  9489. left -= parent.left;
  9490. }
  9491. //set x or y auto-scroll amount
  9492. if (opts.scrollContainer == window) {
  9493. y -= $(window).scrollTop();
  9494. x -= $(window).scrollLeft();
  9495. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  9496. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  9497. } else {
  9498. var cont = $(opts.scrollContainer);
  9499. var offset = cont.offset();
  9500. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  9501. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  9502. }
  9503. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  9504. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  9505. //move draggedItem to new mouse cursor location
  9506. this.draggedItem.css({ top: top, left: left });
  9507. },
  9508. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  9509. wheel: function(e) {
  9510. if (list && opts.scrollContainer != window) {
  9511. var cont = $(opts.scrollContainer);
  9512. var offset = cont.offset();
  9513. e = e.originalEvent;
  9514. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  9515. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  9516. cont.scrollTop(cont.scrollTop() + deltaY);
  9517. e.preventDefault();
  9518. }
  9519. }
  9520. },
  9521. //build a table recording all the positions of the moveable list items
  9522. buildPositionTable: function() {
  9523. var pos = [];
  9524. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  9525. var loc = $(this).offset();
  9526. loc.right = loc.left + $(this).outerWidth();
  9527. loc.bottom = loc.top + $(this).outerHeight();
  9528. loc.elm = this;
  9529. pos[i] = loc;
  9530. });
  9531. this.pos = pos;
  9532. },
  9533. dropItem: function() {
  9534. if (list.draggedItem == null)
  9535. return;
  9536. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  9537. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  9538. var orig = list.draggedItem.attr("data-origstyle");
  9539. list.draggedItem.attr("style", orig);
  9540. if (orig == "")
  9541. list.draggedItem.removeAttr("style");
  9542. list.draggedItem.removeAttr("data-origstyle");
  9543. list.styleDragHandlers(true);
  9544. list.placeHolderItem.before(list.draggedItem);
  9545. list.placeHolderItem.remove();
  9546. $("[data-droptarget], .dragSortItem").remove();
  9547. window.clearInterval(list.scroll.scrollY);
  9548. window.clearInterval(list.scroll.scrollX);
  9549. //if position changed call dragEnd
  9550. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  9551. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  9552. var pos = list.draggedItem.attr("data-origpos").split('-');
  9553. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  9554. if (nextItem.size() > 0)
  9555. nextItem.before(list.draggedItem);
  9556. else if (pos[1] == 0) //was the only item in list
  9557. $(lists[pos[0]].container).prepend(list.draggedItem);
  9558. else //was the last item in list
  9559. $(lists[pos[0]].container).append(list.draggedItem);
  9560. }
  9561. list.draggedItem.removeAttr("data-origpos");
  9562. list.draggedItem = null;
  9563. $(document).unbind("mousemove", list.swapItems);
  9564. $(document).unbind("mouseup", list.dropItem);
  9565. if (opts.scrollContainer != window)
  9566. $(window).unbind("wheel", list.wheel);
  9567. return false;
  9568. },
  9569. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  9570. swapItems: function(e) {
  9571. if (list.draggedItem == null)
  9572. return false;
  9573. //move draggedItem to mouse location
  9574. list.setPos(e.pageX, e.pageY);
  9575. //retrieve list and item position mouse cursor is over
  9576. var ei = list.findPos(e.pageX, e.pageY);
  9577. var nlist = list;
  9578. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  9579. ei = lists[i].findPos(e.pageX, e.pageY);
  9580. nlist = lists[i];
  9581. }
  9582. //if not over another moveable list item return
  9583. if (ei == -1)
  9584. return false;
  9585. //save fixed items locations
  9586. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  9587. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  9588. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  9589. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  9590. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  9591. else
  9592. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  9593. //restore fixed items location
  9594. fixed.each(function() {
  9595. var elm = children().eq(this.idx).get(0);
  9596. if (this != elm && children().index(this) < this.idx)
  9597. $(this).insertAfter(elm);
  9598. else if (this != elm)
  9599. $(this).insertBefore(elm);
  9600. });
  9601. //misc
  9602. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9603. lastPos = list.draggedItem.offset();
  9604. return false;
  9605. },
  9606. //returns the index of the list item the mouse is over
  9607. findPos: function(x, y) {
  9608. for (var i = 0; i < this.pos.length; i++) {
  9609. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  9610. return i;
  9611. }
  9612. return -1;
  9613. },
  9614. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  9615. createDropTargets: function() {
  9616. if (!opts.dragBetween)
  9617. return;
  9618. $(lists).each(function() {
  9619. var ph = $(this.container).find("[data-placeholder]");
  9620. var dt = $(this.container).find("[data-droptarget]");
  9621. if (ph.size() > 0 && dt.size() > 0)
  9622. dt.remove();
  9623. else if (ph.size() == 0 && dt.size() == 0) {
  9624. if (opts.tagName == "td")
  9625. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  9626. else
  9627. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  9628. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  9629. list.placeHolderItem.attr("data-placeholder", true);
  9630. }
  9631. });
  9632. }
  9633. };
  9634. newList.init();
  9635. lists.push(newList);
  9636. });
  9637. return this;
  9638. };
  9639. $.fn.dragsort.defaults = {
  9640. itemSelector: "",
  9641. dragSelector: "",
  9642. dragSelectorExclude: "input, textarea",
  9643. dragEnd: function() { },
  9644. dragBetween: false,
  9645. placeHolderTemplate: "",
  9646. scrollContainer: window,
  9647. scrollSpeed: 5
  9648. };
  9649. })(jQuery);
  9650. define("dragsort", function(){});
  9651. /*!
  9652. * jquery.event.drag - v 2.2
  9653. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9654. * Open Source MIT License - http://threedubmedia.com/code/license
  9655. */
  9656. ;(function(e){e.fn.drag=function(k,g,j){var i=typeof k=="string"?k:"",h=e.isFunction(k)?k:e.isFunction(g)?g:null;if(i.indexOf("drag")!==0){i="drag"+i}j=(k==h?g:j)||{};return h?this.bind(i,j,h):this.trigger(i)};var b=e.event,a=b.special,d=a.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:false,drop:true,click:false},datakey:"dragdata",noBubble:true,add:function(i){var h=e.data(this,d.datakey),g=i.data||{};h.related+=1;e.each(d.defaults,function(j,k){if(g[j]!==undefined){h[j]=g[j]}})},remove:function(){e.data(this,d.datakey).related-=1},setup:function(){if(e.data(this,d.datakey)){return}var g=e.extend({related:0},d.defaults);e.data(this,d.datakey,g);b.add(this,"touchstart mousedown",d.init,g);if(this.attachEvent){this.attachEvent("ondragstart",d.dontstart)}},teardown:function(){var g=e.data(this,d.datakey)||{};if(g.related){return}e.removeData(this,d.datakey);b.remove(this,"touchstart mousedown",d.init);d.textselect(true);if(this.detachEvent){this.detachEvent("ondragstart",d.dontstart)}},init:function(i){if(d.touched){return}var g=i.data,h;if(i.which!=0&&g.which>0&&i.which!=g.which){return}if(e(i.target).is(g.not)){return}if(g.handle&&!e(i.target).closest(g.handle,i.currentTarget).length){return}d.touched=i.type=="touchstart"?this:null;g.propagates=1;g.mousedown=this;g.interactions=[d.interaction(this,g)];g.target=i.target;g.pageX=i.pageX;g.pageY=i.pageY;g.dragging=null;h=d.hijack(i,"draginit",g);if(!g.propagates){return}h=d.flatten(h);if(h&&h.length){g.interactions=[];e.each(h,function(){g.interactions.push(d.interaction(this,g))})}g.propagates=g.interactions.length;if(g.drop!==false&&a.drop){a.drop.handler(i,g)}d.textselect(false);if(d.touched){b.add(d.touched,"touchmove touchend",d.handler,g)}else{b.add(document,"mousemove mouseup",d.handler,g)}if(!d.touched||g.live){return false}},interaction:function(h,g){var i=e(h)[g.relative?"position":"offset"]()||{top:0,left:0};return{drag:h,callback:new d.callback(),droppable:[],offset:i}},handler:function(h){var g=h.data;switch(h.type){case !g.dragging&&"touchmove":h.preventDefault();case !g.dragging&&"mousemove":if(Math.pow(h.pageX-g.pageX,2)+Math.pow(h.pageY-g.pageY,2)<Math.pow(g.distance,2)){break}h.target=g.target;d.hijack(h,"dragstart",g);if(g.propagates){g.dragging=true}case"touchmove":h.preventDefault();case"mousemove":if(g.dragging){d.hijack(h,"drag",g);if(g.propagates){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}break}h.type="mouseup"}case"touchend":case"mouseup":default:if(d.touched){b.remove(d.touched,"touchmove touchend",d.handler)}else{b.remove(document,"mousemove mouseup",d.handler)}if(g.dragging){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}d.hijack(h,"dragend",g)}d.textselect(true);if(g.click===false&&g.dragging){e.data(g.mousedown,"suppress.click",new Date().getTime()+5)}g.dragging=d.touched=false;break}},hijack:function(h,o,r,p,k){if(!r){return}var q={event:h.originalEvent,type:h.type},m=o.indexOf("drop")?"drag":"drop",t,l=p||0,j,g,s,n=!isNaN(p)?p:r.interactions.length;h.type=o;h.originalEvent=null;r.results=[];do{if(j=r.interactions[l]){if(o!=="dragend"&&j.cancelled){continue}s=d.properties(h,r,j);j.results=[];e(k||j[m]||r.droppable).each(function(u,i){s.target=i;h.isPropagationStopped=function(){return false};t=i?b.dispatch.call(i,h,s):null;if(t===false){if(m=="drag"){j.cancelled=true;r.propagates-=1}if(o=="drop"){j[m][u]=null}}else{if(o=="dropinit"){j.droppable.push(d.element(t)||i)}}if(o=="dragstart"){j.proxy=e(d.element(t)||j.drag)[0]}j.results.push(t);delete h.result;if(o!=="dropinit"){return t}});r.results[l]=d.flatten(j.results);if(o=="dropinit"){j.droppable=d.flatten(j.droppable)}if(o=="dragstart"&&!j.cancelled){s.update()}}}while(++l<n);h.type=q.type;h.originalEvent=q.event;return d.flatten(r.results)},properties:function(i,g,h){var j=h.callback;j.drag=h.drag;j.proxy=h.proxy||h.drag;j.startX=g.pageX;j.startY=g.pageY;j.deltaX=i.pageX-g.pageX;j.deltaY=i.pageY-g.pageY;j.originalX=h.offset.left;j.originalY=h.offset.top;j.offsetX=j.originalX+j.deltaX;j.offsetY=j.originalY+j.deltaY;j.drop=d.flatten((h.drop||[]).slice());j.available=d.flatten((h.droppable||[]).slice());return j},element:function(g){if(g&&(g.jquery||g.nodeType==1)){return g}},flatten:function(g){return e.map(g,function(h){return h&&h.jquery?e.makeArray(h):h&&h.length?d.flatten(h):h})},textselect:function(g){e(document)[g?"unbind":"bind"]("selectstart",d.dontstart).css("MozUserSelect",g?"":"none");document.unselectable=g?"off":"on"},dontstart:function(){return false},callback:function(){}};d.callback.prototype={update:function(){if(a.drop&&this.available.length){e.each(this.available,function(g){a.drop.locate(this,g)})}}};var f=b.dispatch;b.dispatch=function(g){if(e.data(this,"suppress."+g.type)-new Date().getTime()>0){e.removeData(this,"suppress."+g.type);return}return f.apply(this,arguments)};var c=b.fixHooks.touchstart=b.fixHooks.touchmove=b.fixHooks.touchend=b.fixHooks.touchcancel={props:"clientX clientY pageX pageY screenX screenY".split(" "),filter:function(h,i){if(i){var g=(i.touches&&i.touches[0])||(i.changedTouches&&i.changedTouches[0])||null;if(g){e.each(c.props,function(j,k){h[k]=g[k]})}}return h}};a.draginit=a.dragstart=a.dragend=d})(jQuery);
  9657. define("drag", function(){});
  9658. /*!
  9659. * jquery.event.drop - v 2.2
  9660. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9661. * Open Source MIT License - http://threedubmedia.com/code/license
  9662. */
  9663. ;(function(d){d.fn.drop=function(i,e,h){var g=typeof i=="string"?i:"",f=d.isFunction(i)?i:d.isFunction(e)?e:null;if(g.indexOf("drop")!==0){g="drop"+g}h=(i==f?e:h)||{};return f?this.bind(g,h,f):this.trigger(g)};d.drop=function(e){e=e||{};b.multi=e.multi===true?Infinity:e.multi===false?1:!isNaN(e.multi)?e.multi:b.multi;b.delay=e.delay||b.delay;b.tolerance=d.isFunction(e.tolerance)?e.tolerance:e.tolerance===null?null:b.tolerance;b.mode=e.mode||b.mode||"intersect"};var c=d.event,a=c.special,b=d.event.special.drop={multi:1,delay:20,mode:"overlap",targets:[],datakey:"dropdata",noBubble:true,add:function(f){var e=d.data(this,b.datakey);e.related+=1},remove:function(){d.data(this,b.datakey).related-=1},setup:function(){if(d.data(this,b.datakey)){return}var e={related:0,active:[],anyactive:0,winner:0,location:{}};d.data(this,b.datakey,e);b.targets.push(this);return false},teardown:function(){var f=d.data(this,b.datakey)||{};if(f.related){return}d.removeData(this,b.datakey);var e=this;b.targets=d.grep(b.targets,function(g){return(g!==e)})},handler:function(g,e){var f,h;if(!e){return}switch(g.type){case"mousedown":case"touchstart":h=d(b.targets);if(typeof e.drop=="string"){h=h.filter(e.drop)}h.each(function(){var i=d.data(this,b.datakey);i.active=[];i.anyactive=0;i.winner=0});e.droppable=h;a.drag.hijack(g,"dropinit",e);break;case"mousemove":case"touchmove":b.event=g;if(!b.timer){b.tolerate(e)}break;case"mouseup":case"touchend":b.timer=clearTimeout(b.timer);if(e.propagates){a.drag.hijack(g,"drop",e);a.drag.hijack(g,"dropend",e)}break}},locate:function(k,h){var l=d.data(k,b.datakey),g=d(k),i=g.offset()||{},e=g.outerHeight(),j=g.outerWidth(),f={elem:k,width:j,height:e,top:i.top,left:i.left,right:i.left+j,bottom:i.top+e};if(l){l.location=f;l.index=h;l.elem=k}return f},contains:function(e,f){return((f[0]||f.left)>=e.left&&(f[0]||f.right)<=e.right&&(f[1]||f.top)>=e.top&&(f[1]||f.bottom)<=e.bottom)},modes:{intersect:function(f,e,g){return this.contains(g,[f.pageX,f.pageY])?1000000000:this.modes.overlap.apply(this,arguments)},overlap:function(f,e,g){return Math.max(0,Math.min(g.bottom,e.bottom)-Math.max(g.top,e.top))*Math.max(0,Math.min(g.right,e.right)-Math.max(g.left,e.left))},fit:function(f,e,g){return this.contains(g,e)?1:0},middle:function(f,e,g){return this.contains(g,[e.left+e.width*0.5,e.top+e.height*0.5])?1:0}},sort:function(f,e){return(e.winner-f.winner)||(f.index-e.index)},tolerate:function(q){var k,e,n,j,l,m,g,p=0,f,h=q.interactions.length,r=[b.event.pageX,b.event.pageY],o=b.tolerance||b.modes[b.mode];do{if(f=q.interactions[p]){if(!f){return}f.drop=[];l=[];m=f.droppable.length;if(o){n=b.locate(f.proxy)}k=0;do{if(g=f.droppable[k]){j=d.data(g,b.datakey);e=j.location;if(!e){continue}j.winner=o?o.call(b,b.event,n,e):b.contains(e,r)?1:0;l.push(j)}}while(++k<m);l.sort(b.sort);k=0;do{if(j=l[k]){if(j.winner&&f.drop.length<b.multi){if(!j.active[p]&&!j.anyactive){if(a.drag.hijack(b.event,"dropstart",q,p,j.elem)[0]!==false){j.active[p]=1;j.anyactive+=1}else{j.winner=0}}if(j.winner){f.drop.push(j.elem)}}else{if(j.active[p]&&j.anyactive==1){a.drag.hijack(b.event,"dropend",q,p,j.elem);j.active[p]=0;j.anyactive-=1}}}}while(++k<m)}}while(++p<h);if(b.last&&r[0]==b.last.pageX&&r[1]==b.last.pageY){delete b.timer}else{b.timer=setTimeout(function(){b.tolerate(q)},b.delay)}b.last=b.event}};a.dropinit=a.dropstart=a.dropend=b})(jQuery);
  9664. define("drop", function(){});
  9665. /**
  9666. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  9667. * Created by joe on 2015-12-19.
  9668. * @param {type} options {
  9669. * content string||html 直接指定内容
  9670. * close bool 是否可以关闭
  9671. * monitor 监视的区域
  9672. * }
  9673. *
  9674. * @returns
  9675. */
  9676. $.fn.addtabs = function (options) {
  9677. var obj = $(this);
  9678. options = $.extend({
  9679. content: '', //直接指定所有页面TABS内容
  9680. close: true, //是否可以关闭
  9681. monitor: 'body', //监视的区域
  9682. nav: '.nav-addtabs',
  9683. tab: '.tab-addtabs',
  9684. iframeUse: true, //使用iframe还是ajax
  9685. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  9686. callback: function () {
  9687. //关闭后回调函数
  9688. }
  9689. }, options || {});
  9690. var navobj = $(options.nav);
  9691. var tabobj = $(options.tab);
  9692. if (history.pushState) {
  9693. //浏览器前进后退事件
  9694. $(window).on("popstate", function (e) {
  9695. var state = e.originalEvent.state;
  9696. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  9697. });
  9698. }
  9699. $(options.monitor).on('click', '[addtabs]', function (e) {
  9700. if ($(this).attr('url').indexOf("javascript") !== 0) {
  9701. if ($(this).is("a")) {
  9702. e.preventDefault();
  9703. }
  9704. var id = $(this).attr('addtabs');
  9705. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  9706. var url = $(this).attr('url');
  9707. var content = options.content ? options.content : $(this).attr('content');
  9708. var ajax = $(this).attr('ajax') ? true : false;
  9709. var state = ({
  9710. url: url, title: title, id: id, content: content, ajax: ajax
  9711. });
  9712. document.title = title;
  9713. if (history.pushState && !$(this).data("pushstate")) {
  9714. window.history.pushState(state, title, url);
  9715. }
  9716. $(this).data("pushstate", null);
  9717. _add({
  9718. id: id,
  9719. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  9720. content: content,
  9721. url: url,
  9722. ajax: ajax
  9723. });
  9724. }
  9725. });
  9726. navobj.on('click', '.close-tab', function (e) {
  9727. id = $(this).prev("a").attr("aria-controls");
  9728. _close(id);
  9729. return false;
  9730. });
  9731. navobj.on('dblclick', 'li[role=presentation]', function (e) {
  9732. $(this).find(".close-tab").trigger("click");
  9733. });
  9734. navobj.on('click', 'li[role=presentation]', function (e) {
  9735. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  9736. });
  9737. $(window).resize(function () {
  9738. $("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  9739. _drop();
  9740. });
  9741. _add = function (opts) {
  9742. id = 'tab_' + opts.id;
  9743. url = opts.url;
  9744. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  9745. navobj.find("[role='presentation']").removeClass('active');
  9746. tabobj.find("[role='tabpanel']").removeClass('active');
  9747. //如果TAB不存在,创建一个新的TAB
  9748. if ($("#" + id).size() == 0) {
  9749. //创建新TAB的title
  9750. title = $('<li role="presentation" id="tab_' + id + '"><a href="#' + id + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
  9751. //是否允许关闭
  9752. if (options.close) {
  9753. title.append(' <i class="close-tab fa fa-remove"></i>');
  9754. }
  9755. //创建新TAB的内容
  9756. content = $('<div role="tabpanel" class="tab-pane" id="' + id + '"></div>');
  9757. //是否指定TAB内容
  9758. if (opts.content) {
  9759. content.append(opts.content);
  9760. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  9761. var height = options.iframeHeight;
  9762. content.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
  9763. } else {
  9764. $.get(url, function (data) {
  9765. content.append(data);
  9766. });
  9767. }
  9768. //加入TABS
  9769. if ($('.tabdrop li').size() > 0) {
  9770. $('.tabdrop ul').append(title);
  9771. } else {
  9772. navobj.append(title);
  9773. }
  9774. tabobj.append(content);
  9775. }
  9776. //激活TAB
  9777. $("#tab_" + id).addClass('active');
  9778. $("#" + id).addClass("active");
  9779. _drop();
  9780. };
  9781. _close = function (id) {
  9782. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  9783. if (obj.find("li.active").attr('id') == "tab_" + id) {
  9784. if ($("#tab_" + id).prev().not(".tabdrop").size() > 0) {
  9785. $("#tab_" + id).prev().not(".tabdrop").find("a").trigger("click");
  9786. } else if ($("#tab_" + id).next().size() > 0) {
  9787. $("#tab_" + id).next().trigger("click");
  9788. }
  9789. }
  9790. //关闭TAB
  9791. $("#tab_" + id).remove();
  9792. $("#" + id).remove();
  9793. _drop();
  9794. options.callback();
  9795. };
  9796. _drop = function () {
  9797. //创建下拉标签
  9798. var dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  9799. '<i class="glyphicon glyphicon-align-justify"></i>' +
  9800. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  9801. //检测是否已增加
  9802. if (!$('.tabdrop').html()) {
  9803. dropdown.prependTo(navobj);
  9804. } else {
  9805. dropdown = navobj.find('.tabdrop');
  9806. }
  9807. //检测是否有下拉样式
  9808. if (navobj.parent().is('.tabs-below')) {
  9809. dropdown.addClass('dropup');
  9810. }
  9811. var collection = 0;
  9812. var maxwidth = navobj.width() - 60;
  9813. var liwidth = 0;
  9814. //检查超过一行的标签页
  9815. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  9816. var lisize = litabs.size();
  9817. litabs.each(function (i, j) {
  9818. liwidth += $(this).width();
  9819. if (collection == 0 && i == lisize - 1 && liwidth <= navobj.width()) {
  9820. return true;
  9821. }
  9822. if (liwidth > maxwidth) {
  9823. dropdown.find('ul').append($(this));
  9824. collection++;
  9825. }
  9826. });
  9827. //如果有超出的,显示下拉标签
  9828. if (collection > 0) {
  9829. dropdown.removeClass('hide');
  9830. if (dropdown.find('.active').length == 1) {
  9831. dropdown.addClass('active');
  9832. } else {
  9833. dropdown.removeClass('active');
  9834. }
  9835. } else {
  9836. dropdown.addClass('hide');
  9837. }
  9838. };
  9839. };
  9840. define("addtabs", function(){});