require-backend.min.js 871 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577
  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.4.1 (https://getbootstrap.com/)
  7. * Copyright 2011-2019 Twitter, Inc.
  8. * Licensed under the MIT license
  9. */
  10. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",p.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",p.proxy(this.pause,this)).on("mouseleave.bs.carousel",p.proxy(this.cycle,this))};function r(n){return this.each(function(){var t=p(this),e=t.data("bs.carousel"),i=p.extend({},c.DEFAULTS,t.data(),"object"==typeof n&&n),o="string"==typeof n?n:i.slide;e||t.data("bs.carousel",e=new c(this,i)),"number"==typeof n?e.to(n):o?e[o]():i.interval&&e.pause().cycle()})}c.VERSION="3.4.1",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},c.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(p.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},c.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var o=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(o)},c.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i<t?"next":"prev",this.$items.eq(t))},c.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&p.support.transition&&(this.$element.trigger(p.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(t,e){var i=this.$element.find(".item.active"),o=e||this.getItemForDirection(t,i),n=this.interval,s="next"==t?"left":"right",a=this;if(o.hasClass("active"))return this.sliding=!1;var r=o[0],l=p.Event("slide.bs.carousel",{relatedTarget:r,direction:s});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,n&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=p(this.$indicators.children()[this.getItemIndex(o)]);h&&h.addClass("active")}var d=p.Event("slid.bs.carousel",{relatedTarget:r,direction:s});return p.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),"object"==typeof o&&o.length&&o[0].offsetWidth,i.addClass(s),o.addClass(s),i.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),i.removeClass(["active",s].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(d)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(i.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),n&&this.cycle(),this}};var t=p.fn.carousel;p.fn.carousel=r,p.fn.carousel.Constructor=c,p.fn.carousel.noConflict=function(){return p.fn.carousel=t,this};var e=function(t){var e=p(this),i=e.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var o=e.attr("data-target")||i,n=p(document).find(o);if(n.hasClass("carousel")){var s=p.extend({},n.data(),e.data()),a=e.attr("data-slide-to");a&&(s.interval=!1),r.call(n,s),a&&n.data("bs.carousel").to(a),t.preventDefault()}};p(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),p(window).on("load",function(){p('[data-ride="carousel"]').each(function(){var t=p(this);r.call(t,t.data())})})}(jQuery),function(a){"use strict";var r=function(t,e){this.$element=a(t),this.options=a.extend({},r.DEFAULTS,e),this.$trigger=a('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function n(t){var e,i=t.attr("data-target")||(e=t.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"");return a(document).find(i)}function l(o){return this.each(function(){var t=a(this),e=t.data("bs.collapse"),i=a.extend({},r.DEFAULTS,t.data(),"object"==typeof o&&o);!e&&i.toggle&&/show|hide/.test(o)&&(i.toggle=!1),e||t.data("bs.collapse",e=new r(this,i)),"string"==typeof o&&e[o]()})}r.VERSION="3.4.1",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0},r.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(t=e.data("bs.collapse"))&&t.transitioning)){var i=a.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){e&&e.length&&(l.call(e,"hide"),t||e.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var n=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return n.call(this);var s=a.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",a.proxy(n,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][s])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=a.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[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 i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!a.support.transition)return i.call(this);this.$element[e](0).one("bsTransitionEnd",a.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return a(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(t,e){var i=a(e);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var t=a.fn.collapse;a.fn.collapse=l,a.fn.collapse.Constructor=r,a.fn.collapse.noConflict=function(){return a.fn.collapse=t,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var e=a(this);e.attr("data-target")||t.preventDefault();var i=n(e),o=i.data("bs.collapse")?"toggle":e.data();l.call(i,o)})}(jQuery),function(a){"use strict";var r='[data-toggle="dropdown"]',o=function(t){a(t).on("click.bs.dropdown",this.toggle)};function l(t){var e=t.attr("data-target");e||(e=(e=t.attr("href"))&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==e?a(document).find(e):null;return i&&i.length?i:t.parent()}function s(o){o&&3===o.which||(a(".dropdown-backdrop").remove(),a(r).each(function(){var t=a(this),e=l(t),i={relatedTarget:this};e.hasClass("open")&&(o&&"click"==o.type&&/input|textarea/i.test(o.target.tagName)&&a.contains(e[0],o.target)||(e.trigger(o=a.Event("hide.bs.dropdown",i)),o.isDefaultPrevented()||(t.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",i)))))}))}o.VERSION="3.4.1",o.prototype.toggle=function(t){var e=a(this);if(!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(s(),!o){"ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",s);var n={relatedTarget:this};if(i.trigger(t=a.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),i.toggleClass("open").trigger(a.Event("shown.bs.dropdown",n))}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=a(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(r).trigger("focus"),e.trigger("click");var n=i.find(".dropdown-menu li:not(.disabled):visible a");if(n.length){var s=n.index(t.target);38==t.which&&0<s&&s--,40==t.which&&s<n.length-1&&s++,~s||(s=0),n.eq(s).trigger("focus")}}}};var t=a.fn.dropdown;a.fn.dropdown=function e(i){return this.each(function(){var t=a(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new o(this)),"string"==typeof i&&e[i].call(t)})},a.fn.dropdown.Constructor=o,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=t,this},a(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(a){"use strict";var s=function(t,e){this.options=e,this.$body=a(document.body),this.$element=a(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function r(o,n){return this.each(function(){var t=a(this),e=t.data("bs.modal"),i=a.extend({},s.DEFAULTS,t.data(),"object"==typeof o&&o);e||t.data("bs.modal",e=new s(this,i)),"string"==typeof o?e[o](n):i.show&&e.show(n)})}s.VERSION="3.4.1",s.TRANSITION_DURATION=300,s.BACKDROP_TRANSITION_DURATION=150,s.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},s.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},s.prototype.show=function(i){var o=this,t=a.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(t),this.isShown||t.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(){o.$element.one("mouseup.dismiss.bs.modal",function(t){a(t.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var t=a.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),t&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:i});t?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(s.TRANSITION_DURATION):o.$element.trigger("focus").trigger(e)}))},s.prototype.hide=function(t){t&&t.preventDefault(),t=a.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.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(s.TRANSITION_DURATION):this.hideModal())},s.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},s.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},s.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},s.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},s.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},s.prototype.backdrop=function(t){var e=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=a.support.transition&&i;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var n=function(){e.removeBackdrop(),t&&t()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):n()}else t&&t()},s.prototype.handleUpdate=function(){this.adjustDialog()},s.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},s.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",t+n),a(this.fixedContent).each(function(t,e){var i=e.style.paddingRight,o=a(e).css("padding-right");a(e).data("padding-right",i).css("padding-right",parseFloat(o)+n+"px")}))},s.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),a(this.fixedContent).each(function(t,e){var i=a(e).data("padding-right");a(e).removeData("padding-right"),e.style.paddingRight=i||""})},s.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var t=a.fn.modal;a.fn.modal=r,a.fn.modal.Constructor=s,a.fn.modal.noConflict=function(){return a.fn.modal=t,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=a(this),i=e.attr("href"),o=e.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),n=a(document).find(o),s=n.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(i)&&i},n.data(),e.data());e.is("a")&&t.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){e.is(":visible")&&e.trigger("focus")})}),r.call(n,s,this)})}(jQuery),function(g){"use strict";var o=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],t={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function u(t,e){var i=t.nodeName.toLowerCase();if(-1!==g.inArray(i,e))return-1===g.inArray(i,a)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(l));for(var o=g(e).filter(function(t,e){return e instanceof RegExp}),n=0,s=o.length;n<s;n++)if(i.match(o[n]))return!0;return!1}function n(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=t;for(var n=g.map(e,function(t,e){return e}),s=g(o.body).find("*"),a=0,r=s.length;a<r;a++){var l=s[a],h=l.nodeName.toLowerCase();if(-1!==g.inArray(h,n))for(var d=g.map(l.attributes,function(t){return t}),p=[].concat(e["*"]||[],e[h]||[]),c=0,f=d.length;c<f;c++)u(d[c],p)||l.removeAttribute(d[c].nodeName);else l.parentNode.removeChild(l)}return o.body.innerHTML}var m=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};m.VERSION="3.4.1",m.TRANSITION_DURATION=150,m.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},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.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 o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-d<c.top?"bottom":"right"==s&&l.right+h>c.width?"left":"left"==s&&l.left-h<c.left?"right":s,o.removeClass(p).addClass(s)}var f=this.getCalculatedOffset(s,l,h,d);this.applyPlacement(f,s);var u=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};g.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",u).emulateTransitionEnd(m.TRANSITION_DURATION):u()}},m.prototype.applyPlacement=function(t,e){var i=this.tip(),o=i[0].offsetWidth,n=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),t.top+=s,t.left+=a,g.offset.setOffset(i[0],g.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},t),0),i.addClass("in");var r=i[0].offsetWidth,l=i[0].offsetHeight;"top"==e&&l!=n&&(t.top=t.top+n-l);var h=this.getViewportAdjustedDelta(e,t,r,l);h.left?t.left+=h.left:t.top+=h.top;var d=/top|bottom/.test(e),p=d?2*h.left-o+r:2*h.top-n+l,c=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(p,i[0][c],d)},m.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},m.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},m.prototype.hide=function(t){var e=this,i=g(this.$tip),o=g.Event("hide.bs."+this.type);function n(){"in"!=e.hoverState&&i.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),t&&t()}if(this.$element.trigger(o),!o.isDefaultPrevented())return i.removeClass("in"),g.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",n).emulateTransitionEnd(m.TRANSITION_DURATION):n(),this.hoverState=null,this},m.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},m.prototype.hasContent=function(){return this.getTitle()},m.prototype.getPosition=function(t){var e=(t=t||this.$element)[0],i="BODY"==e.tagName,o=e.getBoundingClientRect();null==o.width&&(o=g.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var n=window.SVGElement&&e instanceof window.SVGElement,s=i?{top:0,left:0}:n?null:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},r=i?{width:g(window).width(),height:g(window).height()}:null;return g.extend({},o,a,r,s)},m.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},m.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(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},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.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>'}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(n[t+1]===undefined||e<n[t+1])&&this.activate(s[t])},n.prototype.activate=function(t){this.activeTarget=t,this.clear();var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=s(e).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},n.prototype.clear=function(){s(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=s.fn.scrollspy;s.fn.scrollspy=e,s.fn.scrollspy.Constructor=n,s.fn.scrollspy.noConflict=function(){return s.fn.scrollspy=t,this},s(window).on("load.bs.scrollspy.data-api",function(){s('[data-spy="scroll"]').each(function(){var t=s(this);e.call(t,t.data())})})}(jQuery),function(r){"use strict";var a=function(t){this.element=r(t)};function e(i){return this.each(function(){var t=r(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof i&&e[i]()})}a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var o=e.find(".active:last a"),n=r.Event("hide.bs.tab",{relatedTarget:t[0]}),s=r.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(n),t.trigger(s),!s.isDefaultPrevented()&&!n.isDefaultPrevented()){var a=r(document).find(i);this.activate(t.closest("li"),e),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},a.prototype.activate=function(t,e,i){var o=e.find("> .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n<i&&"top";if("bottom"==this.affixed)return null!=i?!(n+this.unpin<=s.top)&&"bottom":!(n+a<=t-o)&&"bottom";var r=null==this.affixed,l=r?n:s.top;return null!=i&&n<=i?"top":null!=o&&t-o<=l+(r?a:e)&&"bottom"},h.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(h.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},h.prototype.checkPositionWithEventLoop=function(){setTimeout(l.proxy(this.checkPosition,this),1)},h.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),e=this.options.offset,i=e.top,o=e.bottom,n=Math.max(l(document).height(),l(document.body).height());"object"!=typeof e&&(o=i=e),"function"==typeof i&&(i=e.top(this.$element)),"function"==typeof o&&(o=e.bottom(this.$element));var s=this.getState(n,t,i,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var a="affix"+(s?"-"+s:""),r=l.Event(a+".bs.affix");if(this.$element.trigger(r),r.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(h.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:n-t-o})}};var t=l.fn.affix;l.fn.affix=i,l.fn.affix.Constructor=h,l.fn.affix.noConflict=function(){return l.fn.affix=t,this},l(window).on("load",function(){l('[data-spy="affix"]').each(function(){var t=l(this),e=t.data();e.offset=e.offset||{},null!=e.offsetBottom&&(e.offset.bottom=e.offsetBottom),null!=e.offsetTop&&(e.offset.top=e.offsetTop),i.call(t,e)})})}(jQuery);
  11. define("bootstrap", ["jquery"], function(){});
  12. require.config({
  13. urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
  14. packages: [{
  15. name: 'moment',
  16. location: '../libs/moment',
  17. main: 'moment'
  18. }
  19. ],
  20. //在打包压缩时将会把include中的模块合并到主文件中
  21. include: ['css', 'layer', 'toastr', 'fast', 'backend', 'backend-init', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs', 'selectpage'],
  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. 'bootstrap-table-template': 'bootstrap-table-template',
  35. //
  36. // 以下的包从bower的libs目录加载
  37. 'jquery': '../libs/jquery/dist/jquery.min',
  38. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  39. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  40. 'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
  41. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  42. 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
  43. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  44. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  45. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  46. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  47. 'bootstrap-slider': '../libs/bootstrap-slider/bootstrap-slider',
  48. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  49. 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
  50. 'sortable': '../libs/Sortable/Sortable.min',
  51. 'addtabs': '../libs/fastadmin-addtabs/jquery.addtabs',
  52. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  53. 'validator-core': '../libs/nice-validator/dist/jquery.validator',
  54. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  55. 'plupload': '../libs/plupload/js/plupload.min',
  56. 'toastr': '../libs/toastr/toastr',
  57. 'jstree': '../libs/jstree/dist/jstree.min',
  58. 'layer': '../libs/fastadmin-layer/dist/layer',
  59. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  60. 'cxselect': '../libs/fastadmin-cxselect/js/jquery.cxselect',
  61. 'template': '../libs/art-template/dist/template-native',
  62. 'selectpage': '../libs/fastadmin-selectpage/selectpage',
  63. 'citypicker': '../libs/fastadmin-citypicker/dist/js/city-picker.min',
  64. 'citypicker-data': '../libs/fastadmin-citypicker/dist/js/city-picker.data',
  65. },
  66. // shim依赖配置
  67. shim: {
  68. 'addons': ['backend'],
  69. 'bootstrap': ['jquery'],
  70. 'bootstrap-table': {
  71. deps: [
  72. 'bootstrap',
  73. // 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'
  74. ],
  75. exports: '$.fn.bootstrapTable'
  76. },
  77. 'bootstrap-table-lang': {
  78. deps: ['bootstrap-table'],
  79. exports: '$.fn.bootstrapTable.defaults'
  80. },
  81. 'bootstrap-table-export': {
  82. deps: ['bootstrap-table', 'tableexport'],
  83. exports: '$.fn.bootstrapTable.defaults'
  84. },
  85. 'bootstrap-table-mobile': {
  86. deps: ['bootstrap-table'],
  87. exports: '$.fn.bootstrapTable.defaults'
  88. },
  89. 'bootstrap-table-advancedsearch': {
  90. deps: ['bootstrap-table'],
  91. exports: '$.fn.bootstrapTable.defaults'
  92. },
  93. 'bootstrap-table-commonsearch': {
  94. deps: ['bootstrap-table'],
  95. exports: '$.fn.bootstrapTable.defaults'
  96. },
  97. 'bootstrap-table-template': {
  98. deps: ['bootstrap-table', 'template'],
  99. exports: '$.fn.bootstrapTable.defaults'
  100. },
  101. 'tableexport': {
  102. deps: ['jquery'],
  103. exports: '$.fn.extend'
  104. },
  105. 'slimscroll': {
  106. deps: ['jquery'],
  107. exports: '$.fn.extend'
  108. },
  109. 'adminlte': {
  110. deps: ['bootstrap', 'slimscroll'],
  111. exports: '$.AdminLTE'
  112. },
  113. 'bootstrap-datetimepicker': [
  114. 'moment/locale/zh-cn',
  115. // 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
  116. ],
  117. // 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css',],
  118. 'bootstrap-select-lang': ['bootstrap-select'],
  119. // 'toastr': ['css!../libs/toastr/toastr.min.css'],
  120. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css',],
  121. 'plupload': {
  122. deps: ['../libs/plupload/js/moxie.min'],
  123. exports: "plupload"
  124. },
  125. // 'layer': ['css!../libs/fastadmin-layer/dist/theme/default/layer.css'],
  126. // 'validator-core': ['css!../libs/nice-validator/dist/jquery.validator.css'],
  127. 'validator-lang': ['validator-core'],
  128. // 'selectpage': ['css!../libs/fastadmin-selectpage/selectpage.css'],
  129. 'citypicker': ['citypicker-data', 'css!../libs/fastadmin-citypicker/dist/css/city-picker.css']
  130. },
  131. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  132. map: {
  133. '*': {
  134. 'css': '../libs/require-css/css.min'
  135. }
  136. },
  137. waitSeconds: 30,
  138. charset: 'utf-8' // 文件编码
  139. });
  140. require(['jquery', 'bootstrap'], function ($, undefined) {
  141. //初始配置
  142. var Config = requirejs.s.contexts._.config.config;
  143. //将Config渲染到全局
  144. window.Config = Config;
  145. // 配置语言包的路径
  146. var paths = {};
  147. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
  148. // 避免目录冲突
  149. paths['backend/'] = 'backend/';
  150. require.config({paths: paths});
  151. // 初始化
  152. $(function () {
  153. require(['fast'], function (Fast) {
  154. require(['backend', 'backend-init', 'addons'], function (Backend, undefined, Addons) {
  155. //加载相应模块
  156. if (Config.jsname) {
  157. require([Config.jsname], function (Controller) {
  158. if (Controller.hasOwnProperty(Config.actionname)) {
  159. Controller[Config.actionname]();
  160. } else {
  161. if (Controller.hasOwnProperty("_empty")) {
  162. Controller._empty();
  163. }
  164. }
  165. }, function (e) {
  166. console.error(e);
  167. // 这里可捕获模块加载的错误
  168. });
  169. }
  170. });
  171. });
  172. });
  173. });
  174. define("require-backend", function(){});
  175. 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});
  176. /*! layer-v3.1.1 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */
  177. ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},f=r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},n.icon!==-1&&n.icon!==t||(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+(r.fixed?"":";position:absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="layui-layer-move"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+">"+(e.value||"")+"</textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input" value="'+(e.value||"")+'">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(e.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)?.9:t["shade"],scrollbar:!("scrollbar"in t)?!1:t["scrollbar"]}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'"><div class="layui-layer-imgsee">'+(u.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>':"")+'<div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+"/"+u.length+"</em></span></div></div></div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["&#x4E0B;&#x4E00;&#x5F20;","&#x4E0D;&#x770B;&#x4E86;"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define('layer',["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window);
  178. /*
  179. * Toastr
  180. * Copyright 2012-2015
  181. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  182. * All Rights Reserved.
  183. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  184. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  185. *
  186. * ARIA Support: Greta Krafsig
  187. *
  188. * Project: https://github.com/CodeSeven/toastr
  189. */
  190. /* global define */
  191. (function (define) {
  192. define('toastr',['jquery'], function ($) {
  193. return (function () {
  194. var $container;
  195. var listener;
  196. var toastId = 0;
  197. var toastType = {
  198. error: 'error',
  199. info: 'info',
  200. success: 'success',
  201. warning: 'warning'
  202. };
  203. var toastr = {
  204. clear: clear,
  205. remove: remove,
  206. error: error,
  207. getContainer: getContainer,
  208. info: info,
  209. options: {},
  210. subscribe: subscribe,
  211. success: success,
  212. version: '2.1.3',
  213. warning: warning
  214. };
  215. var previousToast;
  216. return toastr;
  217. ////////////////
  218. function error(message, title, optionsOverride) {
  219. return notify({
  220. type: toastType.error,
  221. iconClass: getOptions().iconClasses.error,
  222. message: message,
  223. optionsOverride: optionsOverride,
  224. title: title
  225. });
  226. }
  227. function getContainer(options, create) {
  228. if (!options) { options = getOptions(); }
  229. $container = $('#' + options.containerId);
  230. if ($container.length) {
  231. return $container;
  232. }
  233. if (create) {
  234. $container = createContainer(options);
  235. }
  236. return $container;
  237. }
  238. function info(message, title, optionsOverride) {
  239. return notify({
  240. type: toastType.info,
  241. iconClass: getOptions().iconClasses.info,
  242. message: message,
  243. optionsOverride: optionsOverride,
  244. title: title
  245. });
  246. }
  247. function subscribe(callback) {
  248. listener = callback;
  249. }
  250. function success(message, title, optionsOverride) {
  251. return notify({
  252. type: toastType.success,
  253. iconClass: getOptions().iconClasses.success,
  254. message: message,
  255. optionsOverride: optionsOverride,
  256. title: title
  257. });
  258. }
  259. function warning(message, title, optionsOverride) {
  260. return notify({
  261. type: toastType.warning,
  262. iconClass: getOptions().iconClasses.warning,
  263. message: message,
  264. optionsOverride: optionsOverride,
  265. title: title
  266. });
  267. }
  268. function clear($toastElement, clearOptions) {
  269. var options = getOptions();
  270. if (!$container) { getContainer(options); }
  271. if (!clearToast($toastElement, options, clearOptions)) {
  272. clearContainer(options);
  273. }
  274. }
  275. function remove($toastElement) {
  276. var options = getOptions();
  277. if (!$container) { getContainer(options); }
  278. if ($toastElement && $(':focus', $toastElement).length === 0) {
  279. removeToast($toastElement);
  280. return;
  281. }
  282. if ($container.children().length) {
  283. $container.remove();
  284. }
  285. }
  286. // internal functions
  287. function clearContainer (options) {
  288. var toastsToClear = $container.children();
  289. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  290. clearToast($(toastsToClear[i]), options);
  291. }
  292. }
  293. function clearToast ($toastElement, options, clearOptions) {
  294. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  295. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  296. $toastElement[options.hideMethod]({
  297. duration: options.hideDuration,
  298. easing: options.hideEasing,
  299. complete: function () { removeToast($toastElement); }
  300. });
  301. return true;
  302. }
  303. return false;
  304. }
  305. function createContainer(options) {
  306. $container = $('<div/>')
  307. .attr('id', options.containerId)
  308. .addClass(options.positionClass);
  309. $container.appendTo($(options.target));
  310. return $container;
  311. }
  312. function getDefaults() {
  313. return {
  314. tapToDismiss: true,
  315. toastClass: 'toast',
  316. containerId: 'toast-container',
  317. debug: false,
  318. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  319. showDuration: 300,
  320. showEasing: 'swing', //swing and linear are built into jQuery
  321. onShown: undefined,
  322. hideMethod: 'fadeOut',
  323. hideDuration: 1000,
  324. hideEasing: 'swing',
  325. onHidden: undefined,
  326. closeMethod: false,
  327. closeDuration: false,
  328. closeEasing: false,
  329. closeOnHover: true,
  330. extendedTimeOut: 1000,
  331. iconClasses: {
  332. error: 'toast-error',
  333. info: 'toast-info',
  334. success: 'toast-success',
  335. warning: 'toast-warning'
  336. },
  337. iconClass: 'toast-info',
  338. positionClass: 'toast-top-right',
  339. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  340. titleClass: 'toast-title',
  341. messageClass: 'toast-message',
  342. escapeHtml: false,
  343. target: 'body',
  344. closeHtml: '<button type="button">&times;</button>',
  345. closeClass: 'toast-close-button',
  346. newestOnTop: true,
  347. preventDuplicates: false,
  348. progressBar: false,
  349. progressClass: 'toast-progress',
  350. rtl: false
  351. };
  352. }
  353. function publish(args) {
  354. if (!listener) { return; }
  355. listener(args);
  356. }
  357. function notify(map) {
  358. var options = getOptions();
  359. var iconClass = map.iconClass || options.iconClass;
  360. if (typeof (map.optionsOverride) !== 'undefined') {
  361. options = $.extend(options, map.optionsOverride);
  362. iconClass = map.optionsOverride.iconClass || iconClass;
  363. }
  364. if (shouldExit(options, map)) { return; }
  365. toastId++;
  366. $container = getContainer(options, true);
  367. var intervalId = null;
  368. var $toastElement = $('<div/>');
  369. var $titleElement = $('<div/>');
  370. var $messageElement = $('<div/>');
  371. var $progressElement = $('<div/>');
  372. var $closeElement = $(options.closeHtml);
  373. var progressBar = {
  374. intervalId: null,
  375. hideEta: null,
  376. maxHideTime: null
  377. };
  378. var response = {
  379. toastId: toastId,
  380. state: 'visible',
  381. startTime: new Date(),
  382. options: options,
  383. map: map
  384. };
  385. personalizeToast();
  386. displayToast();
  387. handleEvents();
  388. publish(response);
  389. if (options.debug && console) {
  390. console.log(response);
  391. }
  392. return $toastElement;
  393. function escapeHtml(source) {
  394. if (source == null) {
  395. source = '';
  396. }
  397. return source
  398. .replace(/&/g, '&amp;')
  399. .replace(/"/g, '&quot;')
  400. .replace(/'/g, '&#39;')
  401. .replace(/</g, '&lt;')
  402. .replace(/>/g, '&gt;');
  403. }
  404. function personalizeToast() {
  405. setIcon();
  406. setTitle();
  407. setMessage();
  408. setCloseButton();
  409. setProgressBar();
  410. setRTL();
  411. setSequence();
  412. setAria();
  413. }
  414. function setAria() {
  415. var ariaValue = '';
  416. switch (map.iconClass) {
  417. case 'toast-success':
  418. case 'toast-info':
  419. ariaValue = 'polite';
  420. break;
  421. default:
  422. ariaValue = 'assertive';
  423. }
  424. $toastElement.attr('aria-live', ariaValue);
  425. }
  426. function handleEvents() {
  427. if (options.closeOnHover) {
  428. $toastElement.hover(stickAround, delayedHideToast);
  429. }
  430. if (!options.onclick && options.tapToDismiss) {
  431. $toastElement.click(hideToast);
  432. }
  433. if (options.closeButton && $closeElement) {
  434. $closeElement.click(function (event) {
  435. if (event.stopPropagation) {
  436. event.stopPropagation();
  437. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  438. event.cancelBubble = true;
  439. }
  440. if (options.onCloseClick) {
  441. options.onCloseClick(event);
  442. }
  443. hideToast(true);
  444. });
  445. }
  446. if (options.onclick) {
  447. $toastElement.click(function (event) {
  448. options.onclick(event);
  449. hideToast();
  450. });
  451. }
  452. }
  453. function displayToast() {
  454. $toastElement.hide();
  455. $toastElement[options.showMethod](
  456. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  457. );
  458. if (options.timeOut > 0) {
  459. intervalId = setTimeout(hideToast, options.timeOut);
  460. progressBar.maxHideTime = parseFloat(options.timeOut);
  461. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  462. if (options.progressBar) {
  463. progressBar.intervalId = setInterval(updateProgress, 10);
  464. }
  465. }
  466. }
  467. function setIcon() {
  468. if (map.iconClass) {
  469. $toastElement.addClass(options.toastClass).addClass(iconClass);
  470. }
  471. }
  472. function setSequence() {
  473. if (options.newestOnTop) {
  474. $container.prepend($toastElement);
  475. } else {
  476. $container.append($toastElement);
  477. }
  478. }
  479. function setTitle() {
  480. if (map.title) {
  481. var suffix = map.title;
  482. if (options.escapeHtml) {
  483. suffix = escapeHtml(map.title);
  484. }
  485. $titleElement.append(suffix).addClass(options.titleClass);
  486. $toastElement.append($titleElement);
  487. }
  488. }
  489. function setMessage() {
  490. if (map.message) {
  491. var suffix = map.message;
  492. if (options.escapeHtml) {
  493. suffix = escapeHtml(map.message);
  494. }
  495. $messageElement.append(suffix).addClass(options.messageClass);
  496. $toastElement.append($messageElement);
  497. }
  498. }
  499. function setCloseButton() {
  500. if (options.closeButton) {
  501. $closeElement.addClass(options.closeClass).attr('role', 'button');
  502. $toastElement.prepend($closeElement);
  503. }
  504. }
  505. function setProgressBar() {
  506. if (options.progressBar) {
  507. $progressElement.addClass(options.progressClass);
  508. $toastElement.prepend($progressElement);
  509. }
  510. }
  511. function setRTL() {
  512. if (options.rtl) {
  513. $toastElement.addClass('rtl');
  514. }
  515. }
  516. function shouldExit(options, map) {
  517. if (options.preventDuplicates) {
  518. if (map.message === previousToast) {
  519. return true;
  520. } else {
  521. previousToast = map.message;
  522. }
  523. }
  524. return false;
  525. }
  526. function hideToast(override) {
  527. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  528. var duration = override && options.closeDuration !== false ?
  529. options.closeDuration : options.hideDuration;
  530. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  531. if ($(':focus', $toastElement).length && !override) {
  532. return;
  533. }
  534. clearTimeout(progressBar.intervalId);
  535. return $toastElement[method]({
  536. duration: duration,
  537. easing: easing,
  538. complete: function () {
  539. removeToast($toastElement);
  540. clearTimeout(intervalId);
  541. if (options.onHidden && response.state !== 'hidden') {
  542. options.onHidden();
  543. }
  544. response.state = 'hidden';
  545. response.endTime = new Date();
  546. publish(response);
  547. }
  548. });
  549. }
  550. function delayedHideToast() {
  551. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  552. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  553. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  554. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  555. }
  556. }
  557. function stickAround() {
  558. clearTimeout(intervalId);
  559. progressBar.hideEta = 0;
  560. $toastElement.stop(true, true)[options.showMethod](
  561. {duration: options.showDuration, easing: options.showEasing}
  562. );
  563. }
  564. function updateProgress() {
  565. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  566. $progressElement.width(percentage + '%');
  567. }
  568. }
  569. function getOptions() {
  570. return $.extend({}, getDefaults(), toastr.options);
  571. }
  572. function removeToast($toastElement) {
  573. if (!$container) { $container = getContainer(); }
  574. if ($toastElement.is(':visible')) {
  575. return;
  576. }
  577. $toastElement.remove();
  578. $toastElement = null;
  579. if ($container.children().length === 0) {
  580. $container.remove();
  581. previousToast = undefined;
  582. }
  583. }
  584. })();
  585. });
  586. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  587. if (typeof module !== 'undefined' && module.exports) { //Node
  588. module.exports = factory(require('jquery'));
  589. } else {
  590. window.toastr = factory(window.jQuery);
  591. }
  592. }));
  593. define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
  594. var Fast = {
  595. config: {
  596. //toastr默认配置
  597. toastr: {
  598. "closeButton": true,
  599. "debug": false,
  600. "newestOnTop": false,
  601. "progressBar": false,
  602. "positionClass": "toast-top-center",
  603. "preventDuplicates": false,
  604. "onclick": null,
  605. "showDuration": "300",
  606. "hideDuration": "1000",
  607. "timeOut": "5000",
  608. "extendedTimeOut": "1000",
  609. "showEasing": "swing",
  610. "hideEasing": "linear",
  611. "showMethod": "fadeIn",
  612. "hideMethod": "fadeOut"
  613. }
  614. },
  615. events: {
  616. //请求成功的回调
  617. onAjaxSuccess: function (ret, onAjaxSuccess) {
  618. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  619. var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
  620. if (typeof onAjaxSuccess === 'function') {
  621. var result = onAjaxSuccess.call(this, data, ret);
  622. if (result === false)
  623. return;
  624. }
  625. Toastr.success(msg);
  626. },
  627. //请求错误的回调
  628. onAjaxError: function (ret, onAjaxError) {
  629. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  630. if (typeof onAjaxError === 'function') {
  631. var result = onAjaxError.call(this, data, ret);
  632. if (result === false) {
  633. return;
  634. }
  635. }
  636. Toastr.error(ret.msg);
  637. },
  638. //服务器响应数据后
  639. onAjaxResponse: function (response) {
  640. try {
  641. var ret = typeof response === 'object' ? response : JSON.parse(response);
  642. if (!ret.hasOwnProperty('code')) {
  643. $.extend(ret, {code: -2, msg: response, data: null});
  644. }
  645. } catch (e) {
  646. var ret = {code: -1, msg: e.message, data: null};
  647. }
  648. return ret;
  649. }
  650. },
  651. api: {
  652. //发送Ajax请求
  653. ajax: function (options, success, error) {
  654. options = typeof options === 'string' ? {url: options} : options;
  655. var index;
  656. if (typeof options.loading === 'undefined' || options.loading) {
  657. index = Layer.load(options.loading || 0);
  658. }
  659. options = $.extend({
  660. type: "POST",
  661. dataType: "json",
  662. success: function (ret) {
  663. index && Layer.close(index);
  664. ret = Fast.events.onAjaxResponse(ret);
  665. if (ret.code === 1) {
  666. Fast.events.onAjaxSuccess(ret, success);
  667. } else {
  668. Fast.events.onAjaxError(ret, error);
  669. }
  670. },
  671. error: function (xhr) {
  672. index && Layer.close(index);
  673. var ret = {code: xhr.status, msg: xhr.statusText, data: null};
  674. Fast.events.onAjaxError(ret, error);
  675. }
  676. }, options);
  677. $.ajax(options);
  678. },
  679. //修复URL
  680. fixurl: function (url) {
  681. if (url.substr(0, 1) !== "/") {
  682. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  683. if (!r.test(url)) {
  684. url = Config.moduleurl + "/" + url;
  685. }
  686. } else if (url.substr(0, 8) === "/addons/") {
  687. url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
  688. }
  689. return url;
  690. },
  691. //获取修复后可访问的cdn链接
  692. cdnurl: function (url, domain) {
  693. var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i");
  694. var url = rule.test(url) ? url : Config.upload.cdnurl + url;
  695. if (domain && !rule.test(url)) {
  696. domain = typeof domain === 'string' ? domain : location.origin;
  697. url = domain + url;
  698. }
  699. return url;
  700. },
  701. //查询Url参数
  702. query: function (name, url) {
  703. if (!url) {
  704. url = window.location.href;
  705. }
  706. name = name.replace(/[\[\]]/g, "\\$&");
  707. var regex = new RegExp("[?&/]" + name + "([=/]([^&#/?]*)|&|#|$)"),
  708. results = regex.exec(url);
  709. if (!results)
  710. return null;
  711. if (!results[2])
  712. return '';
  713. return decodeURIComponent(results[2].replace(/\+/g, " "));
  714. },
  715. //打开一个弹出窗口
  716. open: function (url, title, options) {
  717. title = options && options.title ? options.title : (title ? title : "");
  718. url = Fast.api.fixurl(url);
  719. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  720. var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
  721. options = $.extend({
  722. type: 2,
  723. title: title,
  724. shadeClose: true,
  725. shade: false,
  726. maxmin: true,
  727. moveOut: true,
  728. area: area,
  729. content: url,
  730. zIndex: Layer.zIndex,
  731. success: function (layero, index) {
  732. var that = this;
  733. //存储callback事件
  734. $(layero).data("callback", that.callback);
  735. //$(layero).removeClass("layui-layer-border");
  736. Layer.setTop(layero);
  737. try {
  738. var frame = Layer.getChildFrame('html', index);
  739. var layerfooter = frame.find(".layer-footer");
  740. Fast.api.layerfooter(layero, index, that);
  741. //绑定事件
  742. if (layerfooter.size() > 0) {
  743. // 监听窗口内的元素及属性变化
  744. // Firefox和Chrome早期版本中带有前缀
  745. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  746. if (MutationObserver) {
  747. // 选择目标节点
  748. var target = layerfooter[0];
  749. // 创建观察者对象
  750. var observer = new MutationObserver(function (mutations) {
  751. Fast.api.layerfooter(layero, index, that);
  752. mutations.forEach(function (mutation) {
  753. });
  754. });
  755. // 配置观察选项:
  756. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  757. // 传入目标节点和观察选项
  758. observer.observe(target, config);
  759. // 随后,你还可以停止观察
  760. // observer.disconnect();
  761. }
  762. }
  763. } catch (e) {
  764. }
  765. if ($(layero).height() > $(window).height()) {
  766. //当弹出窗口大于浏览器可视高度时,重定位
  767. Layer.style(index, {
  768. top: 0,
  769. height: $(window).height()
  770. });
  771. }
  772. }
  773. }, options ? options : {});
  774. if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").size() > 0)) {
  775. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  776. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  777. }
  778. return Layer.open(options);
  779. },
  780. //关闭窗口并回传数据
  781. close: function (data) {
  782. var index = parent.Layer.getFrameIndex(window.name);
  783. var callback = parent.$("#layui-layer" + index).data("callback");
  784. //再执行关闭
  785. parent.Layer.close(index);
  786. //再调用回传函数
  787. if (typeof callback === 'function') {
  788. callback.call(undefined, data);
  789. }
  790. },
  791. layerfooter: function (layero, index, that) {
  792. var frame = Layer.getChildFrame('html', index);
  793. var layerfooter = frame.find(".layer-footer");
  794. if (layerfooter.size() > 0) {
  795. $(".layui-layer-footer", layero).remove();
  796. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  797. footer.html(layerfooter.html());
  798. if ($(".row", footer).size() === 0) {
  799. $(">", footer).wrapAll("<div class='row'></div>");
  800. }
  801. footer.insertAfter(layero.find('.layui-layer-content'));
  802. //绑定事件
  803. footer.on("click", ".btn", function () {
  804. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  805. return;
  806. }
  807. var index = footer.find('.btn').index(this);
  808. $(".btn:eq(" + index + ")", layerfooter).trigger("click");
  809. });
  810. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  811. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  812. //重设iframe高度
  813. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  814. }
  815. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  816. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  817. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  818. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  819. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  820. $("iframe", layero).css("height", "100%");
  821. }
  822. },
  823. success: function (options, callback) {
  824. var type = typeof options === 'function';
  825. if (type) {
  826. callback = options;
  827. }
  828. return Layer.msg(__('Operation completed'), $.extend({
  829. offset: 0, icon: 1
  830. }, type ? {} : options), callback);
  831. },
  832. error: function (options, callback) {
  833. var type = typeof options === 'function';
  834. if (type) {
  835. callback = options;
  836. }
  837. return Layer.msg(__('Operation failed'), $.extend({
  838. offset: 0, icon: 2
  839. }, type ? {} : options), callback);
  840. },
  841. msg: function (message, url) {
  842. var callback = typeof url === 'function' ? url : function () {
  843. if (typeof url !== 'undefined' && url) {
  844. location.href = url;
  845. }
  846. };
  847. Layer.msg(message, {
  848. time: 2000
  849. }, callback);
  850. },
  851. toastr: Toastr,
  852. layer: Layer
  853. },
  854. lang: function () {
  855. var args = arguments,
  856. string = args[0],
  857. i = 1;
  858. string = string.toLowerCase();
  859. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  860. if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
  861. if (typeof Lang[string] == 'object')
  862. return Lang[string];
  863. string = Lang[string];
  864. } else if (string.indexOf('.') !== -1 && false) {
  865. var arr = string.split('.');
  866. var current = Lang[arr[0]];
  867. for (var i = 1; i < arr.length; i++) {
  868. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  869. if (typeof current != 'object')
  870. break;
  871. }
  872. if (typeof current == 'object')
  873. return current;
  874. string = current;
  875. } else {
  876. string = args[0];
  877. }
  878. return string.replace(/%((%)|s|d)/g, function (m) {
  879. // m is the matched format, e.g. %s, %d
  880. var val = null;
  881. if (m[2]) {
  882. val = m[2];
  883. } else {
  884. val = args[i];
  885. // A switch statement so that the formatter can be extended. Default is %s
  886. switch (m) {
  887. case '%d':
  888. val = parseFloat(val);
  889. if (isNaN(val)) {
  890. val = 0;
  891. }
  892. break;
  893. }
  894. i++;
  895. }
  896. return val;
  897. });
  898. },
  899. init: function () {
  900. // 对相对地址进行处理
  901. $.ajaxSetup({
  902. beforeSend: function (xhr, setting) {
  903. setting.url = Fast.api.fixurl(setting.url);
  904. }
  905. });
  906. Layer.config({
  907. skin: 'layui-layer-fast'
  908. });
  909. // 绑定ESC关闭窗口事件
  910. $(window).keyup(function (e) {
  911. if (e.keyCode == 27) {
  912. if ($(".layui-layer").size() > 0) {
  913. var index = 0;
  914. $(".layui-layer").each(function () {
  915. index = Math.max(index, parseInt($(this).attr("times")));
  916. });
  917. if (index) {
  918. Layer.close(index);
  919. }
  920. }
  921. }
  922. });
  923. //公共代码
  924. //配置Toastr的参数
  925. Toastr.options = Fast.config.toastr;
  926. }
  927. };
  928. //将Layer暴露到全局中去
  929. window.Layer = Layer;
  930. //将Toastr暴露到全局中去
  931. window.Toastr = Toastr;
  932. //将语言方法暴露到全局中去
  933. window.__ = Fast.lang;
  934. //将Fast渲染至全局
  935. window.Fast = Fast;
  936. //默认初始化执行的代码
  937. Fast.init();
  938. return Fast;
  939. });
  940. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  941. !function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c<d;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define('template',[],function(){return d}):this.template=d}();
  942. //! moment.js
  943. ;(function (global, factory) {
  944. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  945. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  946. global.moment = factory()
  947. }(this, (function () { 'use strict';
  948. var hookCallback;
  949. function hooks () {
  950. return hookCallback.apply(null, arguments);
  951. }
  952. // This is done to register the method called with moment()
  953. // without creating circular dependencies.
  954. function setHookCallback (callback) {
  955. hookCallback = callback;
  956. }
  957. function isArray(input) {
  958. return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
  959. }
  960. function isObject(input) {
  961. // IE8 will treat undefined and null as object if it wasn't for
  962. // input != null
  963. return input != null && Object.prototype.toString.call(input) === '[object Object]';
  964. }
  965. function isObjectEmpty(obj) {
  966. if (Object.getOwnPropertyNames) {
  967. return (Object.getOwnPropertyNames(obj).length === 0);
  968. } else {
  969. var k;
  970. for (k in obj) {
  971. if (obj.hasOwnProperty(k)) {
  972. return false;
  973. }
  974. }
  975. return true;
  976. }
  977. }
  978. function isUndefined(input) {
  979. return input === void 0;
  980. }
  981. function isNumber(input) {
  982. return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
  983. }
  984. function isDate(input) {
  985. return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
  986. }
  987. function map(arr, fn) {
  988. var res = [], i;
  989. for (i = 0; i < arr.length; ++i) {
  990. res.push(fn(arr[i], i));
  991. }
  992. return res;
  993. }
  994. function hasOwnProp(a, b) {
  995. return Object.prototype.hasOwnProperty.call(a, b);
  996. }
  997. function extend(a, b) {
  998. for (var i in b) {
  999. if (hasOwnProp(b, i)) {
  1000. a[i] = b[i];
  1001. }
  1002. }
  1003. if (hasOwnProp(b, 'toString')) {
  1004. a.toString = b.toString;
  1005. }
  1006. if (hasOwnProp(b, 'valueOf')) {
  1007. a.valueOf = b.valueOf;
  1008. }
  1009. return a;
  1010. }
  1011. function createUTC (input, format, locale, strict) {
  1012. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1013. }
  1014. function defaultParsingFlags() {
  1015. // We need to deep clone this object.
  1016. return {
  1017. empty : false,
  1018. unusedTokens : [],
  1019. unusedInput : [],
  1020. overflow : -2,
  1021. charsLeftOver : 0,
  1022. nullInput : false,
  1023. invalidMonth : null,
  1024. invalidFormat : false,
  1025. userInvalidated : false,
  1026. iso : false,
  1027. parsedDateParts : [],
  1028. meridiem : null,
  1029. rfc2822 : false,
  1030. weekdayMismatch : false
  1031. };
  1032. }
  1033. function getParsingFlags(m) {
  1034. if (m._pf == null) {
  1035. m._pf = defaultParsingFlags();
  1036. }
  1037. return m._pf;
  1038. }
  1039. var some;
  1040. if (Array.prototype.some) {
  1041. some = Array.prototype.some;
  1042. } else {
  1043. some = function (fun) {
  1044. var t = Object(this);
  1045. var len = t.length >>> 0;
  1046. for (var i = 0; i < len; i++) {
  1047. if (i in t && fun.call(this, t[i], i, t)) {
  1048. return true;
  1049. }
  1050. }
  1051. return false;
  1052. };
  1053. }
  1054. function isValid(m) {
  1055. if (m._isValid == null) {
  1056. var flags = getParsingFlags(m);
  1057. var parsedParts = some.call(flags.parsedDateParts, function (i) {
  1058. return i != null;
  1059. });
  1060. var isNowValid = !isNaN(m._d.getTime()) &&
  1061. flags.overflow < 0 &&
  1062. !flags.empty &&
  1063. !flags.invalidMonth &&
  1064. !flags.invalidWeekday &&
  1065. !flags.weekdayMismatch &&
  1066. !flags.nullInput &&
  1067. !flags.invalidFormat &&
  1068. !flags.userInvalidated &&
  1069. (!flags.meridiem || (flags.meridiem && parsedParts));
  1070. if (m._strict) {
  1071. isNowValid = isNowValid &&
  1072. flags.charsLeftOver === 0 &&
  1073. flags.unusedTokens.length === 0 &&
  1074. flags.bigHour === undefined;
  1075. }
  1076. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1077. m._isValid = isNowValid;
  1078. }
  1079. else {
  1080. return isNowValid;
  1081. }
  1082. }
  1083. return m._isValid;
  1084. }
  1085. function createInvalid (flags) {
  1086. var m = createUTC(NaN);
  1087. if (flags != null) {
  1088. extend(getParsingFlags(m), flags);
  1089. }
  1090. else {
  1091. getParsingFlags(m).userInvalidated = true;
  1092. }
  1093. return m;
  1094. }
  1095. // Plugins that add properties should also add the key here (null value),
  1096. // so we can properly clone ourselves.
  1097. var momentProperties = hooks.momentProperties = [];
  1098. function copyConfig(to, from) {
  1099. var i, prop, val;
  1100. if (!isUndefined(from._isAMomentObject)) {
  1101. to._isAMomentObject = from._isAMomentObject;
  1102. }
  1103. if (!isUndefined(from._i)) {
  1104. to._i = from._i;
  1105. }
  1106. if (!isUndefined(from._f)) {
  1107. to._f = from._f;
  1108. }
  1109. if (!isUndefined(from._l)) {
  1110. to._l = from._l;
  1111. }
  1112. if (!isUndefined(from._strict)) {
  1113. to._strict = from._strict;
  1114. }
  1115. if (!isUndefined(from._tzm)) {
  1116. to._tzm = from._tzm;
  1117. }
  1118. if (!isUndefined(from._isUTC)) {
  1119. to._isUTC = from._isUTC;
  1120. }
  1121. if (!isUndefined(from._offset)) {
  1122. to._offset = from._offset;
  1123. }
  1124. if (!isUndefined(from._pf)) {
  1125. to._pf = getParsingFlags(from);
  1126. }
  1127. if (!isUndefined(from._locale)) {
  1128. to._locale = from._locale;
  1129. }
  1130. if (momentProperties.length > 0) {
  1131. for (i = 0; i < momentProperties.length; i++) {
  1132. prop = momentProperties[i];
  1133. val = from[prop];
  1134. if (!isUndefined(val)) {
  1135. to[prop] = val;
  1136. }
  1137. }
  1138. }
  1139. return to;
  1140. }
  1141. var updateInProgress = false;
  1142. // Moment prototype object
  1143. function Moment(config) {
  1144. copyConfig(this, config);
  1145. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1146. if (!this.isValid()) {
  1147. this._d = new Date(NaN);
  1148. }
  1149. // Prevent infinite loop in case updateOffset creates new moment
  1150. // objects.
  1151. if (updateInProgress === false) {
  1152. updateInProgress = true;
  1153. hooks.updateOffset(this);
  1154. updateInProgress = false;
  1155. }
  1156. }
  1157. function isMoment (obj) {
  1158. return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
  1159. }
  1160. function absFloor (number) {
  1161. if (number < 0) {
  1162. // -0 -> 0
  1163. return Math.ceil(number) || 0;
  1164. } else {
  1165. return Math.floor(number);
  1166. }
  1167. }
  1168. function toInt(argumentForCoercion) {
  1169. var coercedNumber = +argumentForCoercion,
  1170. value = 0;
  1171. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1172. value = absFloor(coercedNumber);
  1173. }
  1174. return value;
  1175. }
  1176. // compare two arrays, return the number of differences
  1177. function compareArrays(array1, array2, dontConvert) {
  1178. var len = Math.min(array1.length, array2.length),
  1179. lengthDiff = Math.abs(array1.length - array2.length),
  1180. diffs = 0,
  1181. i;
  1182. for (i = 0; i < len; i++) {
  1183. if ((dontConvert && array1[i] !== array2[i]) ||
  1184. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
  1185. diffs++;
  1186. }
  1187. }
  1188. return diffs + lengthDiff;
  1189. }
  1190. function warn(msg) {
  1191. if (hooks.suppressDeprecationWarnings === false &&
  1192. (typeof console !== 'undefined') && console.warn) {
  1193. console.warn('Deprecation warning: ' + msg);
  1194. }
  1195. }
  1196. function deprecate(msg, fn) {
  1197. var firstTime = true;
  1198. return extend(function () {
  1199. if (hooks.deprecationHandler != null) {
  1200. hooks.deprecationHandler(null, msg);
  1201. }
  1202. if (firstTime) {
  1203. var args = [];
  1204. var arg;
  1205. for (var i = 0; i < arguments.length; i++) {
  1206. arg = '';
  1207. if (typeof arguments[i] === 'object') {
  1208. arg += '\n[' + i + '] ';
  1209. for (var key in arguments[0]) {
  1210. arg += key + ': ' + arguments[0][key] + ', ';
  1211. }
  1212. arg = arg.slice(0, -2); // Remove trailing comma and space
  1213. } else {
  1214. arg = arguments[i];
  1215. }
  1216. args.push(arg);
  1217. }
  1218. warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
  1219. firstTime = false;
  1220. }
  1221. return fn.apply(this, arguments);
  1222. }, fn);
  1223. }
  1224. var deprecations = {};
  1225. function deprecateSimple(name, msg) {
  1226. if (hooks.deprecationHandler != null) {
  1227. hooks.deprecationHandler(name, msg);
  1228. }
  1229. if (!deprecations[name]) {
  1230. warn(msg);
  1231. deprecations[name] = true;
  1232. }
  1233. }
  1234. hooks.suppressDeprecationWarnings = false;
  1235. hooks.deprecationHandler = null;
  1236. function isFunction(input) {
  1237. return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
  1238. }
  1239. function set (config) {
  1240. var prop, i;
  1241. for (i in config) {
  1242. prop = config[i];
  1243. if (isFunction(prop)) {
  1244. this[i] = prop;
  1245. } else {
  1246. this['_' + i] = prop;
  1247. }
  1248. }
  1249. this._config = config;
  1250. // Lenient ordinal parsing accepts just a number in addition to
  1251. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  1252. // TODO: Remove "ordinalParse" fallback in next major release.
  1253. this._dayOfMonthOrdinalParseLenient = new RegExp(
  1254. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  1255. '|' + (/\d{1,2}/).source);
  1256. }
  1257. function mergeConfigs(parentConfig, childConfig) {
  1258. var res = extend({}, parentConfig), prop;
  1259. for (prop in childConfig) {
  1260. if (hasOwnProp(childConfig, prop)) {
  1261. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1262. res[prop] = {};
  1263. extend(res[prop], parentConfig[prop]);
  1264. extend(res[prop], childConfig[prop]);
  1265. } else if (childConfig[prop] != null) {
  1266. res[prop] = childConfig[prop];
  1267. } else {
  1268. delete res[prop];
  1269. }
  1270. }
  1271. }
  1272. for (prop in parentConfig) {
  1273. if (hasOwnProp(parentConfig, prop) &&
  1274. !hasOwnProp(childConfig, prop) &&
  1275. isObject(parentConfig[prop])) {
  1276. // make sure changes to properties don't modify parent config
  1277. res[prop] = extend({}, res[prop]);
  1278. }
  1279. }
  1280. return res;
  1281. }
  1282. function Locale(config) {
  1283. if (config != null) {
  1284. this.set(config);
  1285. }
  1286. }
  1287. var keys;
  1288. if (Object.keys) {
  1289. keys = Object.keys;
  1290. } else {
  1291. keys = function (obj) {
  1292. var i, res = [];
  1293. for (i in obj) {
  1294. if (hasOwnProp(obj, i)) {
  1295. res.push(i);
  1296. }
  1297. }
  1298. return res;
  1299. };
  1300. }
  1301. var defaultCalendar = {
  1302. sameDay : '[Today at] LT',
  1303. nextDay : '[Tomorrow at] LT',
  1304. nextWeek : 'dddd [at] LT',
  1305. lastDay : '[Yesterday at] LT',
  1306. lastWeek : '[Last] dddd [at] LT',
  1307. sameElse : 'L'
  1308. };
  1309. function calendar (key, mom, now) {
  1310. var output = this._calendar[key] || this._calendar['sameElse'];
  1311. return isFunction(output) ? output.call(mom, now) : output;
  1312. }
  1313. var defaultLongDateFormat = {
  1314. LTS : 'h:mm:ss A',
  1315. LT : 'h:mm A',
  1316. L : 'MM/DD/YYYY',
  1317. LL : 'MMMM D, YYYY',
  1318. LLL : 'MMMM D, YYYY h:mm A',
  1319. LLLL : 'dddd, MMMM D, YYYY h:mm A'
  1320. };
  1321. function longDateFormat (key) {
  1322. var format = this._longDateFormat[key],
  1323. formatUpper = this._longDateFormat[key.toUpperCase()];
  1324. if (format || !formatUpper) {
  1325. return format;
  1326. }
  1327. this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
  1328. return val.slice(1);
  1329. });
  1330. return this._longDateFormat[key];
  1331. }
  1332. var defaultInvalidDate = 'Invalid date';
  1333. function invalidDate () {
  1334. return this._invalidDate;
  1335. }
  1336. var defaultOrdinal = '%d';
  1337. var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  1338. function ordinal (number) {
  1339. return this._ordinal.replace('%d', number);
  1340. }
  1341. var defaultRelativeTime = {
  1342. future : 'in %s',
  1343. past : '%s ago',
  1344. s : 'a few seconds',
  1345. ss : '%d seconds',
  1346. m : 'a minute',
  1347. mm : '%d minutes',
  1348. h : 'an hour',
  1349. hh : '%d hours',
  1350. d : 'a day',
  1351. dd : '%d days',
  1352. M : 'a month',
  1353. MM : '%d months',
  1354. y : 'a year',
  1355. yy : '%d years'
  1356. };
  1357. function relativeTime (number, withoutSuffix, string, isFuture) {
  1358. var output = this._relativeTime[string];
  1359. return (isFunction(output)) ?
  1360. output(number, withoutSuffix, string, isFuture) :
  1361. output.replace(/%d/i, number);
  1362. }
  1363. function pastFuture (diff, output) {
  1364. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1365. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1366. }
  1367. var aliases = {};
  1368. function addUnitAlias (unit, shorthand) {
  1369. var lowerCase = unit.toLowerCase();
  1370. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1371. }
  1372. function normalizeUnits(units) {
  1373. return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
  1374. }
  1375. function normalizeObjectUnits(inputObject) {
  1376. var normalizedInput = {},
  1377. normalizedProp,
  1378. prop;
  1379. for (prop in inputObject) {
  1380. if (hasOwnProp(inputObject, prop)) {
  1381. normalizedProp = normalizeUnits(prop);
  1382. if (normalizedProp) {
  1383. normalizedInput[normalizedProp] = inputObject[prop];
  1384. }
  1385. }
  1386. }
  1387. return normalizedInput;
  1388. }
  1389. var priorities = {};
  1390. function addUnitPriority(unit, priority) {
  1391. priorities[unit] = priority;
  1392. }
  1393. function getPrioritizedUnits(unitsObj) {
  1394. var units = [];
  1395. for (var u in unitsObj) {
  1396. units.push({unit: u, priority: priorities[u]});
  1397. }
  1398. units.sort(function (a, b) {
  1399. return a.priority - b.priority;
  1400. });
  1401. return units;
  1402. }
  1403. function zeroFill(number, targetLength, forceSign) {
  1404. var absNumber = '' + Math.abs(number),
  1405. zerosToFill = targetLength - absNumber.length,
  1406. sign = number >= 0;
  1407. return (sign ? (forceSign ? '+' : '') : '-') +
  1408. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  1409. }
  1410. 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;
  1411. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  1412. var formatFunctions = {};
  1413. var formatTokenFunctions = {};
  1414. // token: 'M'
  1415. // padded: ['MM', 2]
  1416. // ordinal: 'Mo'
  1417. // callback: function () { this.month() + 1 }
  1418. function addFormatToken (token, padded, ordinal, callback) {
  1419. var func = callback;
  1420. if (typeof callback === 'string') {
  1421. func = function () {
  1422. return this[callback]();
  1423. };
  1424. }
  1425. if (token) {
  1426. formatTokenFunctions[token] = func;
  1427. }
  1428. if (padded) {
  1429. formatTokenFunctions[padded[0]] = function () {
  1430. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1431. };
  1432. }
  1433. if (ordinal) {
  1434. formatTokenFunctions[ordinal] = function () {
  1435. return this.localeData().ordinal(func.apply(this, arguments), token);
  1436. };
  1437. }
  1438. }
  1439. function removeFormattingTokens(input) {
  1440. if (input.match(/\[[\s\S]/)) {
  1441. return input.replace(/^\[|\]$/g, '');
  1442. }
  1443. return input.replace(/\\/g, '');
  1444. }
  1445. function makeFormatFunction(format) {
  1446. var array = format.match(formattingTokens), i, length;
  1447. for (i = 0, length = array.length; i < length; i++) {
  1448. if (formatTokenFunctions[array[i]]) {
  1449. array[i] = formatTokenFunctions[array[i]];
  1450. } else {
  1451. array[i] = removeFormattingTokens(array[i]);
  1452. }
  1453. }
  1454. return function (mom) {
  1455. var output = '', i;
  1456. for (i = 0; i < length; i++) {
  1457. output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
  1458. }
  1459. return output;
  1460. };
  1461. }
  1462. // format date using native date object
  1463. function formatMoment(m, format) {
  1464. if (!m.isValid()) {
  1465. return m.localeData().invalidDate();
  1466. }
  1467. format = expandFormat(format, m.localeData());
  1468. formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
  1469. return formatFunctions[format](m);
  1470. }
  1471. function expandFormat(format, locale) {
  1472. var i = 5;
  1473. function replaceLongDateFormatTokens(input) {
  1474. return locale.longDateFormat(input) || input;
  1475. }
  1476. localFormattingTokens.lastIndex = 0;
  1477. while (i >= 0 && localFormattingTokens.test(format)) {
  1478. format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
  1479. localFormattingTokens.lastIndex = 0;
  1480. i -= 1;
  1481. }
  1482. return format;
  1483. }
  1484. var match1 = /\d/; // 0 - 9
  1485. var match2 = /\d\d/; // 00 - 99
  1486. var match3 = /\d{3}/; // 000 - 999
  1487. var match4 = /\d{4}/; // 0000 - 9999
  1488. var match6 = /[+-]?\d{6}/; // -999999 - 999999
  1489. var match1to2 = /\d\d?/; // 0 - 99
  1490. var match3to4 = /\d\d\d\d?/; // 999 - 9999
  1491. var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
  1492. var match1to3 = /\d{1,3}/; // 0 - 999
  1493. var match1to4 = /\d{1,4}/; // 0 - 9999
  1494. var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
  1495. var matchUnsigned = /\d+/; // 0 - inf
  1496. var matchSigned = /[+-]?\d+/; // -inf - inf
  1497. var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
  1498. var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1499. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  1500. // any word (or two) characters or numbers including two/three word month in arabic.
  1501. // includes scottish gaelic two word and hyphenated months
  1502. var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
  1503. var regexes = {};
  1504. function addRegexToken (token, regex, strictRegex) {
  1505. regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
  1506. return (isStrict && strictRegex) ? strictRegex : regex;
  1507. };
  1508. }
  1509. function getParseRegexForToken (token, config) {
  1510. if (!hasOwnProp(regexes, token)) {
  1511. return new RegExp(unescapeFormat(token));
  1512. }
  1513. return regexes[token](config._strict, config._locale);
  1514. }
  1515. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1516. function unescapeFormat(s) {
  1517. return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
  1518. return p1 || p2 || p3 || p4;
  1519. }));
  1520. }
  1521. function regexEscape(s) {
  1522. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1523. }
  1524. var tokens = {};
  1525. function addParseToken (token, callback) {
  1526. var i, func = callback;
  1527. if (typeof token === 'string') {
  1528. token = [token];
  1529. }
  1530. if (isNumber(callback)) {
  1531. func = function (input, array) {
  1532. array[callback] = toInt(input);
  1533. };
  1534. }
  1535. for (i = 0; i < token.length; i++) {
  1536. tokens[token[i]] = func;
  1537. }
  1538. }
  1539. function addWeekParseToken (token, callback) {
  1540. addParseToken(token, function (input, array, config, token) {
  1541. config._w = config._w || {};
  1542. callback(input, config._w, config, token);
  1543. });
  1544. }
  1545. function addTimeToArrayFromToken(token, input, config) {
  1546. if (input != null && hasOwnProp(tokens, token)) {
  1547. tokens[token](input, config._a, config, token);
  1548. }
  1549. }
  1550. var YEAR = 0;
  1551. var MONTH = 1;
  1552. var DATE = 2;
  1553. var HOUR = 3;
  1554. var MINUTE = 4;
  1555. var SECOND = 5;
  1556. var MILLISECOND = 6;
  1557. var WEEK = 7;
  1558. var WEEKDAY = 8;
  1559. // FORMATTING
  1560. addFormatToken('Y', 0, 0, function () {
  1561. var y = this.year();
  1562. return y <= 9999 ? '' + y : '+' + y;
  1563. });
  1564. addFormatToken(0, ['YY', 2], 0, function () {
  1565. return this.year() % 100;
  1566. });
  1567. addFormatToken(0, ['YYYY', 4], 0, 'year');
  1568. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  1569. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  1570. // ALIASES
  1571. addUnitAlias('year', 'y');
  1572. // PRIORITIES
  1573. addUnitPriority('year', 1);
  1574. // PARSING
  1575. addRegexToken('Y', matchSigned);
  1576. addRegexToken('YY', match1to2, match2);
  1577. addRegexToken('YYYY', match1to4, match4);
  1578. addRegexToken('YYYYY', match1to6, match6);
  1579. addRegexToken('YYYYYY', match1to6, match6);
  1580. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  1581. addParseToken('YYYY', function (input, array) {
  1582. array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  1583. });
  1584. addParseToken('YY', function (input, array) {
  1585. array[YEAR] = hooks.parseTwoDigitYear(input);
  1586. });
  1587. addParseToken('Y', function (input, array) {
  1588. array[YEAR] = parseInt(input, 10);
  1589. });
  1590. // HELPERS
  1591. function daysInYear(year) {
  1592. return isLeapYear(year) ? 366 : 365;
  1593. }
  1594. function isLeapYear(year) {
  1595. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1596. }
  1597. // HOOKS
  1598. hooks.parseTwoDigitYear = function (input) {
  1599. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  1600. };
  1601. // MOMENTS
  1602. var getSetYear = makeGetSet('FullYear', true);
  1603. function getIsLeapYear () {
  1604. return isLeapYear(this.year());
  1605. }
  1606. function makeGetSet (unit, keepTime) {
  1607. return function (value) {
  1608. if (value != null) {
  1609. set$1(this, unit, value);
  1610. hooks.updateOffset(this, keepTime);
  1611. return this;
  1612. } else {
  1613. return get(this, unit);
  1614. }
  1615. };
  1616. }
  1617. function get (mom, unit) {
  1618. return mom.isValid() ?
  1619. mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
  1620. }
  1621. function set$1 (mom, unit, value) {
  1622. if (mom.isValid() && !isNaN(value)) {
  1623. if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
  1624. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
  1625. }
  1626. else {
  1627. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1628. }
  1629. }
  1630. }
  1631. // MOMENTS
  1632. function stringGet (units) {
  1633. units = normalizeUnits(units);
  1634. if (isFunction(this[units])) {
  1635. return this[units]();
  1636. }
  1637. return this;
  1638. }
  1639. function stringSet (units, value) {
  1640. if (typeof units === 'object') {
  1641. units = normalizeObjectUnits(units);
  1642. var prioritized = getPrioritizedUnits(units);
  1643. for (var i = 0; i < prioritized.length; i++) {
  1644. this[prioritized[i].unit](units[prioritized[i].unit]);
  1645. }
  1646. } else {
  1647. units = normalizeUnits(units);
  1648. if (isFunction(this[units])) {
  1649. return this[units](value);
  1650. }
  1651. }
  1652. return this;
  1653. }
  1654. function mod(n, x) {
  1655. return ((n % x) + x) % x;
  1656. }
  1657. var indexOf;
  1658. if (Array.prototype.indexOf) {
  1659. indexOf = Array.prototype.indexOf;
  1660. } else {
  1661. indexOf = function (o) {
  1662. // I know
  1663. var i;
  1664. for (i = 0; i < this.length; ++i) {
  1665. if (this[i] === o) {
  1666. return i;
  1667. }
  1668. }
  1669. return -1;
  1670. };
  1671. }
  1672. function daysInMonth(year, month) {
  1673. if (isNaN(year) || isNaN(month)) {
  1674. return NaN;
  1675. }
  1676. var modMonth = mod(month, 12);
  1677. year += (month - modMonth) / 12;
  1678. return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
  1679. }
  1680. // FORMATTING
  1681. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1682. return this.month() + 1;
  1683. });
  1684. addFormatToken('MMM', 0, 0, function (format) {
  1685. return this.localeData().monthsShort(this, format);
  1686. });
  1687. addFormatToken('MMMM', 0, 0, function (format) {
  1688. return this.localeData().months(this, format);
  1689. });
  1690. // ALIASES
  1691. addUnitAlias('month', 'M');
  1692. // PRIORITY
  1693. addUnitPriority('month', 8);
  1694. // PARSING
  1695. addRegexToken('M', match1to2);
  1696. addRegexToken('MM', match1to2, match2);
  1697. addRegexToken('MMM', function (isStrict, locale) {
  1698. return locale.monthsShortRegex(isStrict);
  1699. });
  1700. addRegexToken('MMMM', function (isStrict, locale) {
  1701. return locale.monthsRegex(isStrict);
  1702. });
  1703. addParseToken(['M', 'MM'], function (input, array) {
  1704. array[MONTH] = toInt(input) - 1;
  1705. });
  1706. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1707. var month = config._locale.monthsParse(input, token, config._strict);
  1708. // if we didn't find a month name, mark the date as invalid.
  1709. if (month != null) {
  1710. array[MONTH] = month;
  1711. } else {
  1712. getParsingFlags(config).invalidMonth = input;
  1713. }
  1714. });
  1715. // LOCALES
  1716. var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
  1717. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
  1718. function localeMonths (m, format) {
  1719. if (!m) {
  1720. return isArray(this._months) ? this._months :
  1721. this._months['standalone'];
  1722. }
  1723. return isArray(this._months) ? this._months[m.month()] :
  1724. this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
  1725. }
  1726. var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
  1727. function localeMonthsShort (m, format) {
  1728. if (!m) {
  1729. return isArray(this._monthsShort) ? this._monthsShort :
  1730. this._monthsShort['standalone'];
  1731. }
  1732. return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
  1733. this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
  1734. }
  1735. function handleStrictParse(monthName, format, strict) {
  1736. var i, ii, mom, llc = monthName.toLocaleLowerCase();
  1737. if (!this._monthsParse) {
  1738. // this is not used
  1739. this._monthsParse = [];
  1740. this._longMonthsParse = [];
  1741. this._shortMonthsParse = [];
  1742. for (i = 0; i < 12; ++i) {
  1743. mom = createUTC([2000, i]);
  1744. this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
  1745. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1746. }
  1747. }
  1748. if (strict) {
  1749. if (format === 'MMM') {
  1750. ii = indexOf.call(this._shortMonthsParse, llc);
  1751. return ii !== -1 ? ii : null;
  1752. } else {
  1753. ii = indexOf.call(this._longMonthsParse, llc);
  1754. return ii !== -1 ? ii : null;
  1755. }
  1756. } else {
  1757. if (format === 'MMM') {
  1758. ii = indexOf.call(this._shortMonthsParse, llc);
  1759. if (ii !== -1) {
  1760. return ii;
  1761. }
  1762. ii = indexOf.call(this._longMonthsParse, llc);
  1763. return ii !== -1 ? ii : null;
  1764. } else {
  1765. ii = indexOf.call(this._longMonthsParse, llc);
  1766. if (ii !== -1) {
  1767. return ii;
  1768. }
  1769. ii = indexOf.call(this._shortMonthsParse, llc);
  1770. return ii !== -1 ? ii : null;
  1771. }
  1772. }
  1773. }
  1774. function localeMonthsParse (monthName, format, strict) {
  1775. var i, mom, regex;
  1776. if (this._monthsParseExact) {
  1777. return handleStrictParse.call(this, monthName, format, strict);
  1778. }
  1779. if (!this._monthsParse) {
  1780. this._monthsParse = [];
  1781. this._longMonthsParse = [];
  1782. this._shortMonthsParse = [];
  1783. }
  1784. // TODO: add sorting
  1785. // Sorting makes sure if one month (or abbr) is a prefix of another
  1786. // see sorting in computeMonthsParse
  1787. for (i = 0; i < 12; i++) {
  1788. // make the regex if we don't have it already
  1789. mom = createUTC([2000, i]);
  1790. if (strict && !this._longMonthsParse[i]) {
  1791. this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
  1792. this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
  1793. }
  1794. if (!strict && !this._monthsParse[i]) {
  1795. regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1796. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1797. }
  1798. // test the regex
  1799. if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
  1800. return i;
  1801. } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
  1802. return i;
  1803. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1804. return i;
  1805. }
  1806. }
  1807. }
  1808. // MOMENTS
  1809. function setMonth (mom, value) {
  1810. var dayOfMonth;
  1811. if (!mom.isValid()) {
  1812. // No op
  1813. return mom;
  1814. }
  1815. if (typeof value === 'string') {
  1816. if (/^\d+$/.test(value)) {
  1817. value = toInt(value);
  1818. } else {
  1819. value = mom.localeData().monthsParse(value);
  1820. // TODO: Another silent failure?
  1821. if (!isNumber(value)) {
  1822. return mom;
  1823. }
  1824. }
  1825. }
  1826. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1827. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1828. return mom;
  1829. }
  1830. function getSetMonth (value) {
  1831. if (value != null) {
  1832. setMonth(this, value);
  1833. hooks.updateOffset(this, true);
  1834. return this;
  1835. } else {
  1836. return get(this, 'Month');
  1837. }
  1838. }
  1839. function getDaysInMonth () {
  1840. return daysInMonth(this.year(), this.month());
  1841. }
  1842. var defaultMonthsShortRegex = matchWord;
  1843. function monthsShortRegex (isStrict) {
  1844. if (this._monthsParseExact) {
  1845. if (!hasOwnProp(this, '_monthsRegex')) {
  1846. computeMonthsParse.call(this);
  1847. }
  1848. if (isStrict) {
  1849. return this._monthsShortStrictRegex;
  1850. } else {
  1851. return this._monthsShortRegex;
  1852. }
  1853. } else {
  1854. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1855. this._monthsShortRegex = defaultMonthsShortRegex;
  1856. }
  1857. return this._monthsShortStrictRegex && isStrict ?
  1858. this._monthsShortStrictRegex : this._monthsShortRegex;
  1859. }
  1860. }
  1861. var defaultMonthsRegex = matchWord;
  1862. function monthsRegex (isStrict) {
  1863. if (this._monthsParseExact) {
  1864. if (!hasOwnProp(this, '_monthsRegex')) {
  1865. computeMonthsParse.call(this);
  1866. }
  1867. if (isStrict) {
  1868. return this._monthsStrictRegex;
  1869. } else {
  1870. return this._monthsRegex;
  1871. }
  1872. } else {
  1873. if (!hasOwnProp(this, '_monthsRegex')) {
  1874. this._monthsRegex = defaultMonthsRegex;
  1875. }
  1876. return this._monthsStrictRegex && isStrict ?
  1877. this._monthsStrictRegex : this._monthsRegex;
  1878. }
  1879. }
  1880. function computeMonthsParse () {
  1881. function cmpLenRev(a, b) {
  1882. return b.length - a.length;
  1883. }
  1884. var shortPieces = [], longPieces = [], mixedPieces = [],
  1885. i, mom;
  1886. for (i = 0; i < 12; i++) {
  1887. // make the regex if we don't have it already
  1888. mom = createUTC([2000, i]);
  1889. shortPieces.push(this.monthsShort(mom, ''));
  1890. longPieces.push(this.months(mom, ''));
  1891. mixedPieces.push(this.months(mom, ''));
  1892. mixedPieces.push(this.monthsShort(mom, ''));
  1893. }
  1894. // Sorting makes sure if one month (or abbr) is a prefix of another it
  1895. // will match the longer piece.
  1896. shortPieces.sort(cmpLenRev);
  1897. longPieces.sort(cmpLenRev);
  1898. mixedPieces.sort(cmpLenRev);
  1899. for (i = 0; i < 12; i++) {
  1900. shortPieces[i] = regexEscape(shortPieces[i]);
  1901. longPieces[i] = regexEscape(longPieces[i]);
  1902. }
  1903. for (i = 0; i < 24; i++) {
  1904. mixedPieces[i] = regexEscape(mixedPieces[i]);
  1905. }
  1906. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  1907. this._monthsShortRegex = this._monthsRegex;
  1908. this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  1909. this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  1910. }
  1911. function createDate (y, m, d, h, M, s, ms) {
  1912. // can't just apply() to create a date:
  1913. // https://stackoverflow.com/q/181348
  1914. var date;
  1915. // the date constructor remaps years 0-99 to 1900-1999
  1916. if (y < 100 && y >= 0) {
  1917. // preserve leap years using a full 400 year cycle, then reset
  1918. date = new Date(y + 400, m, d, h, M, s, ms);
  1919. if (isFinite(date.getFullYear())) {
  1920. date.setFullYear(y);
  1921. }
  1922. } else {
  1923. date = new Date(y, m, d, h, M, s, ms);
  1924. }
  1925. return date;
  1926. }
  1927. function createUTCDate (y) {
  1928. var date;
  1929. // the Date.UTC function remaps years 0-99 to 1900-1999
  1930. if (y < 100 && y >= 0) {
  1931. var args = Array.prototype.slice.call(arguments);
  1932. // preserve leap years using a full 400 year cycle, then reset
  1933. args[0] = y + 400;
  1934. date = new Date(Date.UTC.apply(null, args));
  1935. if (isFinite(date.getUTCFullYear())) {
  1936. date.setUTCFullYear(y);
  1937. }
  1938. } else {
  1939. date = new Date(Date.UTC.apply(null, arguments));
  1940. }
  1941. return date;
  1942. }
  1943. // start-of-first-week - start-of-year
  1944. function firstWeekOffset(year, dow, doy) {
  1945. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  1946. fwd = 7 + dow - doy,
  1947. // first-week day local weekday -- which local weekday is fwd
  1948. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  1949. return -fwdlw + fwd - 1;
  1950. }
  1951. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  1952. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  1953. var localWeekday = (7 + weekday - dow) % 7,
  1954. weekOffset = firstWeekOffset(year, dow, doy),
  1955. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  1956. resYear, resDayOfYear;
  1957. if (dayOfYear <= 0) {
  1958. resYear = year - 1;
  1959. resDayOfYear = daysInYear(resYear) + dayOfYear;
  1960. } else if (dayOfYear > daysInYear(year)) {
  1961. resYear = year + 1;
  1962. resDayOfYear = dayOfYear - daysInYear(year);
  1963. } else {
  1964. resYear = year;
  1965. resDayOfYear = dayOfYear;
  1966. }
  1967. return {
  1968. year: resYear,
  1969. dayOfYear: resDayOfYear
  1970. };
  1971. }
  1972. function weekOfYear(mom, dow, doy) {
  1973. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  1974. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  1975. resWeek, resYear;
  1976. if (week < 1) {
  1977. resYear = mom.year() - 1;
  1978. resWeek = week + weeksInYear(resYear, dow, doy);
  1979. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  1980. resWeek = week - weeksInYear(mom.year(), dow, doy);
  1981. resYear = mom.year() + 1;
  1982. } else {
  1983. resYear = mom.year();
  1984. resWeek = week;
  1985. }
  1986. return {
  1987. week: resWeek,
  1988. year: resYear
  1989. };
  1990. }
  1991. function weeksInYear(year, dow, doy) {
  1992. var weekOffset = firstWeekOffset(year, dow, doy),
  1993. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  1994. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  1995. }
  1996. // FORMATTING
  1997. addFormatToken('w', ['ww', 2], 'wo', 'week');
  1998. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  1999. // ALIASES
  2000. addUnitAlias('week', 'w');
  2001. addUnitAlias('isoWeek', 'W');
  2002. // PRIORITIES
  2003. addUnitPriority('week', 5);
  2004. addUnitPriority('isoWeek', 5);
  2005. // PARSING
  2006. addRegexToken('w', match1to2);
  2007. addRegexToken('ww', match1to2, match2);
  2008. addRegexToken('W', match1to2);
  2009. addRegexToken('WW', match1to2, match2);
  2010. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
  2011. week[token.substr(0, 1)] = toInt(input);
  2012. });
  2013. // HELPERS
  2014. // LOCALES
  2015. function localeWeek (mom) {
  2016. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2017. }
  2018. var defaultLocaleWeek = {
  2019. dow : 0, // Sunday is the first day of the week.
  2020. doy : 6 // The week that contains Jan 6th is the first week of the year.
  2021. };
  2022. function localeFirstDayOfWeek () {
  2023. return this._week.dow;
  2024. }
  2025. function localeFirstDayOfYear () {
  2026. return this._week.doy;
  2027. }
  2028. // MOMENTS
  2029. function getSetWeek (input) {
  2030. var week = this.localeData().week(this);
  2031. return input == null ? week : this.add((input - week) * 7, 'd');
  2032. }
  2033. function getSetISOWeek (input) {
  2034. var week = weekOfYear(this, 1, 4).week;
  2035. return input == null ? week : this.add((input - week) * 7, 'd');
  2036. }
  2037. // FORMATTING
  2038. addFormatToken('d', 0, 'do', 'day');
  2039. addFormatToken('dd', 0, 0, function (format) {
  2040. return this.localeData().weekdaysMin(this, format);
  2041. });
  2042. addFormatToken('ddd', 0, 0, function (format) {
  2043. return this.localeData().weekdaysShort(this, format);
  2044. });
  2045. addFormatToken('dddd', 0, 0, function (format) {
  2046. return this.localeData().weekdays(this, format);
  2047. });
  2048. addFormatToken('e', 0, 0, 'weekday');
  2049. addFormatToken('E', 0, 0, 'isoWeekday');
  2050. // ALIASES
  2051. addUnitAlias('day', 'd');
  2052. addUnitAlias('weekday', 'e');
  2053. addUnitAlias('isoWeekday', 'E');
  2054. // PRIORITY
  2055. addUnitPriority('day', 11);
  2056. addUnitPriority('weekday', 11);
  2057. addUnitPriority('isoWeekday', 11);
  2058. // PARSING
  2059. addRegexToken('d', match1to2);
  2060. addRegexToken('e', match1to2);
  2061. addRegexToken('E', match1to2);
  2062. addRegexToken('dd', function (isStrict, locale) {
  2063. return locale.weekdaysMinRegex(isStrict);
  2064. });
  2065. addRegexToken('ddd', function (isStrict, locale) {
  2066. return locale.weekdaysShortRegex(isStrict);
  2067. });
  2068. addRegexToken('dddd', function (isStrict, locale) {
  2069. return locale.weekdaysRegex(isStrict);
  2070. });
  2071. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2072. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2073. // if we didn't get a weekday name, mark the date as invalid
  2074. if (weekday != null) {
  2075. week.d = weekday;
  2076. } else {
  2077. getParsingFlags(config).invalidWeekday = input;
  2078. }
  2079. });
  2080. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2081. week[token] = toInt(input);
  2082. });
  2083. // HELPERS
  2084. function parseWeekday(input, locale) {
  2085. if (typeof input !== 'string') {
  2086. return input;
  2087. }
  2088. if (!isNaN(input)) {
  2089. return parseInt(input, 10);
  2090. }
  2091. input = locale.weekdaysParse(input);
  2092. if (typeof input === 'number') {
  2093. return input;
  2094. }
  2095. return null;
  2096. }
  2097. function parseIsoWeekday(input, locale) {
  2098. if (typeof input === 'string') {
  2099. return locale.weekdaysParse(input) % 7 || 7;
  2100. }
  2101. return isNaN(input) ? null : input;
  2102. }
  2103. // LOCALES
  2104. function shiftWeekdays (ws, n) {
  2105. return ws.slice(n, 7).concat(ws.slice(0, n));
  2106. }
  2107. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
  2108. function localeWeekdays (m, format) {
  2109. var weekdays = isArray(this._weekdays) ? this._weekdays :
  2110. this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
  2111. return (m === true) ? shiftWeekdays(weekdays, this._week.dow)
  2112. : (m) ? weekdays[m.day()] : weekdays;
  2113. }
  2114. var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
  2115. function localeWeekdaysShort (m) {
  2116. return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  2117. : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
  2118. }
  2119. var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
  2120. function localeWeekdaysMin (m) {
  2121. return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  2122. : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
  2123. }
  2124. function handleStrictParse$1(weekdayName, format, strict) {
  2125. var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
  2126. if (!this._weekdaysParse) {
  2127. this._weekdaysParse = [];
  2128. this._shortWeekdaysParse = [];
  2129. this._minWeekdaysParse = [];
  2130. for (i = 0; i < 7; ++i) {
  2131. mom = createUTC([2000, 1]).day(i);
  2132. this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
  2133. this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
  2134. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2135. }
  2136. }
  2137. if (strict) {
  2138. if (format === 'dddd') {
  2139. ii = indexOf.call(this._weekdaysParse, llc);
  2140. return ii !== -1 ? ii : null;
  2141. } else if (format === 'ddd') {
  2142. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2143. return ii !== -1 ? ii : null;
  2144. } else {
  2145. ii = indexOf.call(this._minWeekdaysParse, llc);
  2146. return ii !== -1 ? ii : null;
  2147. }
  2148. } else {
  2149. if (format === 'dddd') {
  2150. ii = indexOf.call(this._weekdaysParse, llc);
  2151. if (ii !== -1) {
  2152. return ii;
  2153. }
  2154. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2155. if (ii !== -1) {
  2156. return ii;
  2157. }
  2158. ii = indexOf.call(this._minWeekdaysParse, llc);
  2159. return ii !== -1 ? ii : null;
  2160. } else if (format === 'ddd') {
  2161. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2162. if (ii !== -1) {
  2163. return ii;
  2164. }
  2165. ii = indexOf.call(this._weekdaysParse, llc);
  2166. if (ii !== -1) {
  2167. return ii;
  2168. }
  2169. ii = indexOf.call(this._minWeekdaysParse, llc);
  2170. return ii !== -1 ? ii : null;
  2171. } else {
  2172. ii = indexOf.call(this._minWeekdaysParse, llc);
  2173. if (ii !== -1) {
  2174. return ii;
  2175. }
  2176. ii = indexOf.call(this._weekdaysParse, llc);
  2177. if (ii !== -1) {
  2178. return ii;
  2179. }
  2180. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2181. return ii !== -1 ? ii : null;
  2182. }
  2183. }
  2184. }
  2185. function localeWeekdaysParse (weekdayName, format, strict) {
  2186. var i, mom, regex;
  2187. if (this._weekdaysParseExact) {
  2188. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2189. }
  2190. if (!this._weekdaysParse) {
  2191. this._weekdaysParse = [];
  2192. this._minWeekdaysParse = [];
  2193. this._shortWeekdaysParse = [];
  2194. this._fullWeekdaysParse = [];
  2195. }
  2196. for (i = 0; i < 7; i++) {
  2197. // make the regex if we don't have it already
  2198. mom = createUTC([2000, 1]).day(i);
  2199. if (strict && !this._fullWeekdaysParse[i]) {
  2200. this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
  2201. this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
  2202. this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
  2203. }
  2204. if (!this._weekdaysParse[i]) {
  2205. regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
  2206. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2207. }
  2208. // test the regex
  2209. if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
  2210. return i;
  2211. } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
  2212. return i;
  2213. } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
  2214. return i;
  2215. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2216. return i;
  2217. }
  2218. }
  2219. }
  2220. // MOMENTS
  2221. function getSetDayOfWeek (input) {
  2222. if (!this.isValid()) {
  2223. return input != null ? this : NaN;
  2224. }
  2225. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2226. if (input != null) {
  2227. input = parseWeekday(input, this.localeData());
  2228. return this.add(input - day, 'd');
  2229. } else {
  2230. return day;
  2231. }
  2232. }
  2233. function getSetLocaleDayOfWeek (input) {
  2234. if (!this.isValid()) {
  2235. return input != null ? this : NaN;
  2236. }
  2237. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2238. return input == null ? weekday : this.add(input - weekday, 'd');
  2239. }
  2240. function getSetISODayOfWeek (input) {
  2241. if (!this.isValid()) {
  2242. return input != null ? this : NaN;
  2243. }
  2244. // behaves the same as moment#day except
  2245. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2246. // as a setter, sunday should belong to the previous week.
  2247. if (input != null) {
  2248. var weekday = parseIsoWeekday(input, this.localeData());
  2249. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2250. } else {
  2251. return this.day() || 7;
  2252. }
  2253. }
  2254. var defaultWeekdaysRegex = matchWord;
  2255. function weekdaysRegex (isStrict) {
  2256. if (this._weekdaysParseExact) {
  2257. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2258. computeWeekdaysParse.call(this);
  2259. }
  2260. if (isStrict) {
  2261. return this._weekdaysStrictRegex;
  2262. } else {
  2263. return this._weekdaysRegex;
  2264. }
  2265. } else {
  2266. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2267. this._weekdaysRegex = defaultWeekdaysRegex;
  2268. }
  2269. return this._weekdaysStrictRegex && isStrict ?
  2270. this._weekdaysStrictRegex : this._weekdaysRegex;
  2271. }
  2272. }
  2273. var defaultWeekdaysShortRegex = matchWord;
  2274. function weekdaysShortRegex (isStrict) {
  2275. if (this._weekdaysParseExact) {
  2276. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2277. computeWeekdaysParse.call(this);
  2278. }
  2279. if (isStrict) {
  2280. return this._weekdaysShortStrictRegex;
  2281. } else {
  2282. return this._weekdaysShortRegex;
  2283. }
  2284. } else {
  2285. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2286. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2287. }
  2288. return this._weekdaysShortStrictRegex && isStrict ?
  2289. this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  2290. }
  2291. }
  2292. var defaultWeekdaysMinRegex = matchWord;
  2293. function weekdaysMinRegex (isStrict) {
  2294. if (this._weekdaysParseExact) {
  2295. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2296. computeWeekdaysParse.call(this);
  2297. }
  2298. if (isStrict) {
  2299. return this._weekdaysMinStrictRegex;
  2300. } else {
  2301. return this._weekdaysMinRegex;
  2302. }
  2303. } else {
  2304. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2305. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2306. }
  2307. return this._weekdaysMinStrictRegex && isStrict ?
  2308. this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  2309. }
  2310. }
  2311. function computeWeekdaysParse () {
  2312. function cmpLenRev(a, b) {
  2313. return b.length - a.length;
  2314. }
  2315. var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
  2316. i, mom, minp, shortp, longp;
  2317. for (i = 0; i < 7; i++) {
  2318. // make the regex if we don't have it already
  2319. mom = createUTC([2000, 1]).day(i);
  2320. minp = this.weekdaysMin(mom, '');
  2321. shortp = this.weekdaysShort(mom, '');
  2322. longp = this.weekdays(mom, '');
  2323. minPieces.push(minp);
  2324. shortPieces.push(shortp);
  2325. longPieces.push(longp);
  2326. mixedPieces.push(minp);
  2327. mixedPieces.push(shortp);
  2328. mixedPieces.push(longp);
  2329. }
  2330. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2331. // will match the longer piece.
  2332. minPieces.sort(cmpLenRev);
  2333. shortPieces.sort(cmpLenRev);
  2334. longPieces.sort(cmpLenRev);
  2335. mixedPieces.sort(cmpLenRev);
  2336. for (i = 0; i < 7; i++) {
  2337. shortPieces[i] = regexEscape(shortPieces[i]);
  2338. longPieces[i] = regexEscape(longPieces[i]);
  2339. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2340. }
  2341. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2342. this._weekdaysShortRegex = this._weekdaysRegex;
  2343. this._weekdaysMinRegex = this._weekdaysRegex;
  2344. this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  2345. this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  2346. this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
  2347. }
  2348. // FORMATTING
  2349. function hFormat() {
  2350. return this.hours() % 12 || 12;
  2351. }
  2352. function kFormat() {
  2353. return this.hours() || 24;
  2354. }
  2355. addFormatToken('H', ['HH', 2], 0, 'hour');
  2356. addFormatToken('h', ['hh', 2], 0, hFormat);
  2357. addFormatToken('k', ['kk', 2], 0, kFormat);
  2358. addFormatToken('hmm', 0, 0, function () {
  2359. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2360. });
  2361. addFormatToken('hmmss', 0, 0, function () {
  2362. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
  2363. zeroFill(this.seconds(), 2);
  2364. });
  2365. addFormatToken('Hmm', 0, 0, function () {
  2366. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2367. });
  2368. addFormatToken('Hmmss', 0, 0, function () {
  2369. return '' + this.hours() + zeroFill(this.minutes(), 2) +
  2370. zeroFill(this.seconds(), 2);
  2371. });
  2372. function meridiem (token, lowercase) {
  2373. addFormatToken(token, 0, 0, function () {
  2374. return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
  2375. });
  2376. }
  2377. meridiem('a', true);
  2378. meridiem('A', false);
  2379. // ALIASES
  2380. addUnitAlias('hour', 'h');
  2381. // PRIORITY
  2382. addUnitPriority('hour', 13);
  2383. // PARSING
  2384. function matchMeridiem (isStrict, locale) {
  2385. return locale._meridiemParse;
  2386. }
  2387. addRegexToken('a', matchMeridiem);
  2388. addRegexToken('A', matchMeridiem);
  2389. addRegexToken('H', match1to2);
  2390. addRegexToken('h', match1to2);
  2391. addRegexToken('k', match1to2);
  2392. addRegexToken('HH', match1to2, match2);
  2393. addRegexToken('hh', match1to2, match2);
  2394. addRegexToken('kk', match1to2, match2);
  2395. addRegexToken('hmm', match3to4);
  2396. addRegexToken('hmmss', match5to6);
  2397. addRegexToken('Hmm', match3to4);
  2398. addRegexToken('Hmmss', match5to6);
  2399. addParseToken(['H', 'HH'], HOUR);
  2400. addParseToken(['k', 'kk'], function (input, array, config) {
  2401. var kInput = toInt(input);
  2402. array[HOUR] = kInput === 24 ? 0 : kInput;
  2403. });
  2404. addParseToken(['a', 'A'], function (input, array, config) {
  2405. config._isPm = config._locale.isPM(input);
  2406. config._meridiem = input;
  2407. });
  2408. addParseToken(['h', 'hh'], function (input, array, config) {
  2409. array[HOUR] = toInt(input);
  2410. getParsingFlags(config).bigHour = true;
  2411. });
  2412. addParseToken('hmm', function (input, array, config) {
  2413. var pos = input.length - 2;
  2414. array[HOUR] = toInt(input.substr(0, pos));
  2415. array[MINUTE] = toInt(input.substr(pos));
  2416. getParsingFlags(config).bigHour = true;
  2417. });
  2418. addParseToken('hmmss', function (input, array, config) {
  2419. var pos1 = input.length - 4;
  2420. var pos2 = input.length - 2;
  2421. array[HOUR] = toInt(input.substr(0, pos1));
  2422. array[MINUTE] = toInt(input.substr(pos1, 2));
  2423. array[SECOND] = toInt(input.substr(pos2));
  2424. getParsingFlags(config).bigHour = true;
  2425. });
  2426. addParseToken('Hmm', function (input, array, config) {
  2427. var pos = input.length - 2;
  2428. array[HOUR] = toInt(input.substr(0, pos));
  2429. array[MINUTE] = toInt(input.substr(pos));
  2430. });
  2431. addParseToken('Hmmss', function (input, array, config) {
  2432. var pos1 = input.length - 4;
  2433. var pos2 = input.length - 2;
  2434. array[HOUR] = toInt(input.substr(0, pos1));
  2435. array[MINUTE] = toInt(input.substr(pos1, 2));
  2436. array[SECOND] = toInt(input.substr(pos2));
  2437. });
  2438. // LOCALES
  2439. function localeIsPM (input) {
  2440. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2441. // Using charAt should be more compatible.
  2442. return ((input + '').toLowerCase().charAt(0) === 'p');
  2443. }
  2444. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  2445. function localeMeridiem (hours, minutes, isLower) {
  2446. if (hours > 11) {
  2447. return isLower ? 'pm' : 'PM';
  2448. } else {
  2449. return isLower ? 'am' : 'AM';
  2450. }
  2451. }
  2452. // MOMENTS
  2453. // Setting the hour should keep the time, because the user explicitly
  2454. // specified which hour they want. So trying to maintain the same hour (in
  2455. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2456. // this rule.
  2457. var getSetHour = makeGetSet('Hours', true);
  2458. var baseConfig = {
  2459. calendar: defaultCalendar,
  2460. longDateFormat: defaultLongDateFormat,
  2461. invalidDate: defaultInvalidDate,
  2462. ordinal: defaultOrdinal,
  2463. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  2464. relativeTime: defaultRelativeTime,
  2465. months: defaultLocaleMonths,
  2466. monthsShort: defaultLocaleMonthsShort,
  2467. week: defaultLocaleWeek,
  2468. weekdays: defaultLocaleWeekdays,
  2469. weekdaysMin: defaultLocaleWeekdaysMin,
  2470. weekdaysShort: defaultLocaleWeekdaysShort,
  2471. meridiemParse: defaultLocaleMeridiemParse
  2472. };
  2473. // internal storage for locale config files
  2474. var locales = {};
  2475. var localeFamilies = {};
  2476. var globalLocale;
  2477. function normalizeLocale(key) {
  2478. return key ? key.toLowerCase().replace('_', '-') : key;
  2479. }
  2480. // pick the locale from the array
  2481. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2482. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2483. function chooseLocale(names) {
  2484. var i = 0, j, next, locale, split;
  2485. while (i < names.length) {
  2486. split = normalizeLocale(names[i]).split('-');
  2487. j = split.length;
  2488. next = normalizeLocale(names[i + 1]);
  2489. next = next ? next.split('-') : null;
  2490. while (j > 0) {
  2491. locale = loadLocale(split.slice(0, j).join('-'));
  2492. if (locale) {
  2493. return locale;
  2494. }
  2495. if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
  2496. //the next array item is better than a shallower substring of this one
  2497. break;
  2498. }
  2499. j--;
  2500. }
  2501. i++;
  2502. }
  2503. return globalLocale;
  2504. }
  2505. function loadLocale(name) {
  2506. var oldLocale = null;
  2507. // TODO: Find a better way to register and load all the locales in Node
  2508. if (!locales[name] && (typeof module !== 'undefined') &&
  2509. module && module.exports) {
  2510. try {
  2511. oldLocale = globalLocale._abbr;
  2512. var aliasedRequire = require;
  2513. aliasedRequire('./locale/' + name);
  2514. getSetGlobalLocale(oldLocale);
  2515. } catch (e) {}
  2516. }
  2517. return locales[name];
  2518. }
  2519. // This function will load locale and then set the global locale. If
  2520. // no arguments are passed in, it will simply return the current global
  2521. // locale key.
  2522. function getSetGlobalLocale (key, values) {
  2523. var data;
  2524. if (key) {
  2525. if (isUndefined(values)) {
  2526. data = getLocale(key);
  2527. }
  2528. else {
  2529. data = defineLocale(key, values);
  2530. }
  2531. if (data) {
  2532. // moment.duration._locale = moment._locale = data;
  2533. globalLocale = data;
  2534. }
  2535. else {
  2536. if ((typeof console !== 'undefined') && console.warn) {
  2537. //warn user if arguments are passed but the locale could not be set
  2538. console.warn('Locale ' + key + ' not found. Did you forget to load it?');
  2539. }
  2540. }
  2541. }
  2542. return globalLocale._abbr;
  2543. }
  2544. function defineLocale (name, config) {
  2545. if (config !== null) {
  2546. var locale, parentConfig = baseConfig;
  2547. config.abbr = name;
  2548. if (locales[name] != null) {
  2549. deprecateSimple('defineLocaleOverride',
  2550. 'use moment.updateLocale(localeName, config) to change ' +
  2551. 'an existing locale. moment.defineLocale(localeName, ' +
  2552. 'config) should only be used for creating a new locale ' +
  2553. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
  2554. parentConfig = locales[name]._config;
  2555. } else if (config.parentLocale != null) {
  2556. if (locales[config.parentLocale] != null) {
  2557. parentConfig = locales[config.parentLocale]._config;
  2558. } else {
  2559. locale = loadLocale(config.parentLocale);
  2560. if (locale != null) {
  2561. parentConfig = locale._config;
  2562. } else {
  2563. if (!localeFamilies[config.parentLocale]) {
  2564. localeFamilies[config.parentLocale] = [];
  2565. }
  2566. localeFamilies[config.parentLocale].push({
  2567. name: name,
  2568. config: config
  2569. });
  2570. return null;
  2571. }
  2572. }
  2573. }
  2574. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2575. if (localeFamilies[name]) {
  2576. localeFamilies[name].forEach(function (x) {
  2577. defineLocale(x.name, x.config);
  2578. });
  2579. }
  2580. // backwards compat for now: also set the locale
  2581. // make sure we set the locale AFTER all child locales have been
  2582. // created, so we won't end up with the child locale set.
  2583. getSetGlobalLocale(name);
  2584. return locales[name];
  2585. } else {
  2586. // useful for testing
  2587. delete locales[name];
  2588. return null;
  2589. }
  2590. }
  2591. function updateLocale(name, config) {
  2592. if (config != null) {
  2593. var locale, tmpLocale, parentConfig = baseConfig;
  2594. // MERGE
  2595. tmpLocale = loadLocale(name);
  2596. if (tmpLocale != null) {
  2597. parentConfig = tmpLocale._config;
  2598. }
  2599. config = mergeConfigs(parentConfig, config);
  2600. locale = new Locale(config);
  2601. locale.parentLocale = locales[name];
  2602. locales[name] = locale;
  2603. // backwards compat for now: also set the locale
  2604. getSetGlobalLocale(name);
  2605. } else {
  2606. // pass null for config to unupdate, useful for tests
  2607. if (locales[name] != null) {
  2608. if (locales[name].parentLocale != null) {
  2609. locales[name] = locales[name].parentLocale;
  2610. } else if (locales[name] != null) {
  2611. delete locales[name];
  2612. }
  2613. }
  2614. }
  2615. return locales[name];
  2616. }
  2617. // returns locale data
  2618. function getLocale (key) {
  2619. var locale;
  2620. if (key && key._locale && key._locale._abbr) {
  2621. key = key._locale._abbr;
  2622. }
  2623. if (!key) {
  2624. return globalLocale;
  2625. }
  2626. if (!isArray(key)) {
  2627. //short-circuit everything else
  2628. locale = loadLocale(key);
  2629. if (locale) {
  2630. return locale;
  2631. }
  2632. key = [key];
  2633. }
  2634. return chooseLocale(key);
  2635. }
  2636. function listLocales() {
  2637. return keys(locales);
  2638. }
  2639. function checkOverflow (m) {
  2640. var overflow;
  2641. var a = m._a;
  2642. if (a && getParsingFlags(m).overflow === -2) {
  2643. overflow =
  2644. a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
  2645. a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
  2646. a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
  2647. a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
  2648. a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
  2649. a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
  2650. -1;
  2651. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  2652. overflow = DATE;
  2653. }
  2654. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2655. overflow = WEEK;
  2656. }
  2657. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2658. overflow = WEEKDAY;
  2659. }
  2660. getParsingFlags(m).overflow = overflow;
  2661. }
  2662. return m;
  2663. }
  2664. // Pick the first defined of two or three arguments.
  2665. function defaults(a, b, c) {
  2666. if (a != null) {
  2667. return a;
  2668. }
  2669. if (b != null) {
  2670. return b;
  2671. }
  2672. return c;
  2673. }
  2674. function currentDateArray(config) {
  2675. // hooks is actually the exported moment object
  2676. var nowValue = new Date(hooks.now());
  2677. if (config._useUTC) {
  2678. return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
  2679. }
  2680. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  2681. }
  2682. // convert an array to a date.
  2683. // the array should mirror the parameters below
  2684. // note: all values past the year are optional and will default to the lowest possible value.
  2685. // [year, month, day , hour, minute, second, millisecond]
  2686. function configFromArray (config) {
  2687. var i, date, input = [], currentDate, expectedWeekday, yearToUse;
  2688. if (config._d) {
  2689. return;
  2690. }
  2691. currentDate = currentDateArray(config);
  2692. //compute day of the year from weeks and weekdays
  2693. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  2694. dayOfYearFromWeekInfo(config);
  2695. }
  2696. //if the day of the year is set, figure out what it is
  2697. if (config._dayOfYear != null) {
  2698. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  2699. if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
  2700. getParsingFlags(config)._overflowDayOfYear = true;
  2701. }
  2702. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  2703. config._a[MONTH] = date.getUTCMonth();
  2704. config._a[DATE] = date.getUTCDate();
  2705. }
  2706. // Default to current date.
  2707. // * if no year, month, day of month are given, default to today
  2708. // * if day of month is given, default month and year
  2709. // * if month is given, default only year
  2710. // * if year is given, don't default anything
  2711. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  2712. config._a[i] = input[i] = currentDate[i];
  2713. }
  2714. // Zero out whatever was not defaulted, including time
  2715. for (; i < 7; i++) {
  2716. config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
  2717. }
  2718. // Check for 24:00:00.000
  2719. if (config._a[HOUR] === 24 &&
  2720. config._a[MINUTE] === 0 &&
  2721. config._a[SECOND] === 0 &&
  2722. config._a[MILLISECOND] === 0) {
  2723. config._nextDay = true;
  2724. config._a[HOUR] = 0;
  2725. }
  2726. config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
  2727. expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
  2728. // Apply timezone offset from input. The actual utcOffset can be changed
  2729. // with parseZone.
  2730. if (config._tzm != null) {
  2731. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  2732. }
  2733. if (config._nextDay) {
  2734. config._a[HOUR] = 24;
  2735. }
  2736. // check for mismatching day of week
  2737. if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
  2738. getParsingFlags(config).weekdayMismatch = true;
  2739. }
  2740. }
  2741. function dayOfYearFromWeekInfo(config) {
  2742. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
  2743. w = config._w;
  2744. if (w.GG != null || w.W != null || w.E != null) {
  2745. dow = 1;
  2746. doy = 4;
  2747. // TODO: We need to take the current isoWeekYear, but that depends on
  2748. // how we interpret now (local, utc, fixed offset). So create
  2749. // a now version of current config (take local/utc/offset flags, and
  2750. // create now).
  2751. weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
  2752. week = defaults(w.W, 1);
  2753. weekday = defaults(w.E, 1);
  2754. if (weekday < 1 || weekday > 7) {
  2755. weekdayOverflow = true;
  2756. }
  2757. } else {
  2758. dow = config._locale._week.dow;
  2759. doy = config._locale._week.doy;
  2760. var curWeek = weekOfYear(createLocal(), dow, doy);
  2761. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  2762. // Default to current week.
  2763. week = defaults(w.w, curWeek.week);
  2764. if (w.d != null) {
  2765. // weekday -- low day numbers are considered next week
  2766. weekday = w.d;
  2767. if (weekday < 0 || weekday > 6) {
  2768. weekdayOverflow = true;
  2769. }
  2770. } else if (w.e != null) {
  2771. // local weekday -- counting starts from beginning of week
  2772. weekday = w.e + dow;
  2773. if (w.e < 0 || w.e > 6) {
  2774. weekdayOverflow = true;
  2775. }
  2776. } else {
  2777. // default to beginning of week
  2778. weekday = dow;
  2779. }
  2780. }
  2781. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  2782. getParsingFlags(config)._overflowWeeks = true;
  2783. } else if (weekdayOverflow != null) {
  2784. getParsingFlags(config)._overflowWeekday = true;
  2785. } else {
  2786. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  2787. config._a[YEAR] = temp.year;
  2788. config._dayOfYear = temp.dayOfYear;
  2789. }
  2790. }
  2791. // iso 8601 regex
  2792. // 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)
  2793. 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)?)?$/;
  2794. 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)?)?$/;
  2795. var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
  2796. var isoDates = [
  2797. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2798. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2799. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2800. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2801. ['YYYY-DDD', /\d{4}-\d{3}/],
  2802. ['YYYY-MM', /\d{4}-\d\d/, false],
  2803. ['YYYYYYMMDD', /[+-]\d{10}/],
  2804. ['YYYYMMDD', /\d{8}/],
  2805. // YYYYMM is NOT allowed by the standard
  2806. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2807. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2808. ['YYYYDDD', /\d{7}/]
  2809. ];
  2810. // iso time formats and regexes
  2811. var isoTimes = [
  2812. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2813. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2814. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2815. ['HH:mm', /\d\d:\d\d/],
  2816. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2817. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2818. ['HHmmss', /\d\d\d\d\d\d/],
  2819. ['HHmm', /\d\d\d\d/],
  2820. ['HH', /\d\d/]
  2821. ];
  2822. var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
  2823. // date from iso format
  2824. function configFromISO(config) {
  2825. var i, l,
  2826. string = config._i,
  2827. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  2828. allowTime, dateFormat, timeFormat, tzFormat;
  2829. if (match) {
  2830. getParsingFlags(config).iso = true;
  2831. for (i = 0, l = isoDates.length; i < l; i++) {
  2832. if (isoDates[i][1].exec(match[1])) {
  2833. dateFormat = isoDates[i][0];
  2834. allowTime = isoDates[i][2] !== false;
  2835. break;
  2836. }
  2837. }
  2838. if (dateFormat == null) {
  2839. config._isValid = false;
  2840. return;
  2841. }
  2842. if (match[3]) {
  2843. for (i = 0, l = isoTimes.length; i < l; i++) {
  2844. if (isoTimes[i][1].exec(match[3])) {
  2845. // match[2] should be 'T' or space
  2846. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  2847. break;
  2848. }
  2849. }
  2850. if (timeFormat == null) {
  2851. config._isValid = false;
  2852. return;
  2853. }
  2854. }
  2855. if (!allowTime && timeFormat != null) {
  2856. config._isValid = false;
  2857. return;
  2858. }
  2859. if (match[4]) {
  2860. if (tzRegex.exec(match[4])) {
  2861. tzFormat = 'Z';
  2862. } else {
  2863. config._isValid = false;
  2864. return;
  2865. }
  2866. }
  2867. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  2868. configFromStringAndFormat(config);
  2869. } else {
  2870. config._isValid = false;
  2871. }
  2872. }
  2873. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  2874. var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
  2875. function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
  2876. var result = [
  2877. untruncateYear(yearStr),
  2878. defaultLocaleMonthsShort.indexOf(monthStr),
  2879. parseInt(dayStr, 10),
  2880. parseInt(hourStr, 10),
  2881. parseInt(minuteStr, 10)
  2882. ];
  2883. if (secondStr) {
  2884. result.push(parseInt(secondStr, 10));
  2885. }
  2886. return result;
  2887. }
  2888. function untruncateYear(yearStr) {
  2889. var year = parseInt(yearStr, 10);
  2890. if (year <= 49) {
  2891. return 2000 + year;
  2892. } else if (year <= 999) {
  2893. return 1900 + year;
  2894. }
  2895. return year;
  2896. }
  2897. function preprocessRFC2822(s) {
  2898. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  2899. return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  2900. }
  2901. function checkWeekday(weekdayStr, parsedInput, config) {
  2902. if (weekdayStr) {
  2903. // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
  2904. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  2905. weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
  2906. if (weekdayProvided !== weekdayActual) {
  2907. getParsingFlags(config).weekdayMismatch = true;
  2908. config._isValid = false;
  2909. return false;
  2910. }
  2911. }
  2912. return true;
  2913. }
  2914. var obsOffsets = {
  2915. UT: 0,
  2916. GMT: 0,
  2917. EDT: -4 * 60,
  2918. EST: -5 * 60,
  2919. CDT: -5 * 60,
  2920. CST: -6 * 60,
  2921. MDT: -6 * 60,
  2922. MST: -7 * 60,
  2923. PDT: -7 * 60,
  2924. PST: -8 * 60
  2925. };
  2926. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  2927. if (obsOffset) {
  2928. return obsOffsets[obsOffset];
  2929. } else if (militaryOffset) {
  2930. // the only allowed military tz is Z
  2931. return 0;
  2932. } else {
  2933. var hm = parseInt(numOffset, 10);
  2934. var m = hm % 100, h = (hm - m) / 100;
  2935. return h * 60 + m;
  2936. }
  2937. }
  2938. // date and time from ref 2822 format
  2939. function configFromRFC2822(config) {
  2940. var match = rfc2822.exec(preprocessRFC2822(config._i));
  2941. if (match) {
  2942. var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
  2943. if (!checkWeekday(match[1], parsedArray, config)) {
  2944. return;
  2945. }
  2946. config._a = parsedArray;
  2947. config._tzm = calculateOffset(match[8], match[9], match[10]);
  2948. config._d = createUTCDate.apply(null, config._a);
  2949. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  2950. getParsingFlags(config).rfc2822 = true;
  2951. } else {
  2952. config._isValid = false;
  2953. }
  2954. }
  2955. // date from iso format or fallback
  2956. function configFromString(config) {
  2957. var matched = aspNetJsonRegex.exec(config._i);
  2958. if (matched !== null) {
  2959. config._d = new Date(+matched[1]);
  2960. return;
  2961. }
  2962. configFromISO(config);
  2963. if (config._isValid === false) {
  2964. delete config._isValid;
  2965. } else {
  2966. return;
  2967. }
  2968. configFromRFC2822(config);
  2969. if (config._isValid === false) {
  2970. delete config._isValid;
  2971. } else {
  2972. return;
  2973. }
  2974. // Final attempt, use Input Fallback
  2975. hooks.createFromInputFallback(config);
  2976. }
  2977. hooks.createFromInputFallback = deprecate(
  2978. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  2979. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  2980. 'discouraged and will be removed in an upcoming major release. Please refer to ' +
  2981. 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  2982. function (config) {
  2983. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  2984. }
  2985. );
  2986. // constant that refers to the ISO standard
  2987. hooks.ISO_8601 = function () {};
  2988. // constant that refers to the RFC 2822 form
  2989. hooks.RFC_2822 = function () {};
  2990. // date from string and format string
  2991. function configFromStringAndFormat(config) {
  2992. // TODO: Move this to another part of the creation flow to prevent circular deps
  2993. if (config._f === hooks.ISO_8601) {
  2994. configFromISO(config);
  2995. return;
  2996. }
  2997. if (config._f === hooks.RFC_2822) {
  2998. configFromRFC2822(config);
  2999. return;
  3000. }
  3001. config._a = [];
  3002. getParsingFlags(config).empty = true;
  3003. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3004. var string = '' + config._i,
  3005. i, parsedInput, tokens, token, skipped,
  3006. stringLength = string.length,
  3007. totalParsedInputLength = 0;
  3008. tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3009. for (i = 0; i < tokens.length; i++) {
  3010. token = tokens[i];
  3011. parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
  3012. // console.log('token', token, 'parsedInput', parsedInput,
  3013. // 'regex', getParseRegexForToken(token, config));
  3014. if (parsedInput) {
  3015. skipped = string.substr(0, string.indexOf(parsedInput));
  3016. if (skipped.length > 0) {
  3017. getParsingFlags(config).unusedInput.push(skipped);
  3018. }
  3019. string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
  3020. totalParsedInputLength += parsedInput.length;
  3021. }
  3022. // don't parse if it's not a known token
  3023. if (formatTokenFunctions[token]) {
  3024. if (parsedInput) {
  3025. getParsingFlags(config).empty = false;
  3026. }
  3027. else {
  3028. getParsingFlags(config).unusedTokens.push(token);
  3029. }
  3030. addTimeToArrayFromToken(token, parsedInput, config);
  3031. }
  3032. else if (config._strict && !parsedInput) {
  3033. getParsingFlags(config).unusedTokens.push(token);
  3034. }
  3035. }
  3036. // add remaining unparsed input length to the string
  3037. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  3038. if (string.length > 0) {
  3039. getParsingFlags(config).unusedInput.push(string);
  3040. }
  3041. // clear _12h flag if hour is <= 12
  3042. if (config._a[HOUR] <= 12 &&
  3043. getParsingFlags(config).bigHour === true &&
  3044. config._a[HOUR] > 0) {
  3045. getParsingFlags(config).bigHour = undefined;
  3046. }
  3047. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3048. getParsingFlags(config).meridiem = config._meridiem;
  3049. // handle meridiem
  3050. config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
  3051. configFromArray(config);
  3052. checkOverflow(config);
  3053. }
  3054. function meridiemFixWrap (locale, hour, meridiem) {
  3055. var isPm;
  3056. if (meridiem == null) {
  3057. // nothing to do
  3058. return hour;
  3059. }
  3060. if (locale.meridiemHour != null) {
  3061. return locale.meridiemHour(hour, meridiem);
  3062. } else if (locale.isPM != null) {
  3063. // Fallback
  3064. isPm = locale.isPM(meridiem);
  3065. if (isPm && hour < 12) {
  3066. hour += 12;
  3067. }
  3068. if (!isPm && hour === 12) {
  3069. hour = 0;
  3070. }
  3071. return hour;
  3072. } else {
  3073. // this is not supposed to happen
  3074. return hour;
  3075. }
  3076. }
  3077. // date from string and array of format strings
  3078. function configFromStringAndArray(config) {
  3079. var tempConfig,
  3080. bestMoment,
  3081. scoreToBeat,
  3082. i,
  3083. currentScore;
  3084. if (config._f.length === 0) {
  3085. getParsingFlags(config).invalidFormat = true;
  3086. config._d = new Date(NaN);
  3087. return;
  3088. }
  3089. for (i = 0; i < config._f.length; i++) {
  3090. currentScore = 0;
  3091. tempConfig = copyConfig({}, config);
  3092. if (config._useUTC != null) {
  3093. tempConfig._useUTC = config._useUTC;
  3094. }
  3095. tempConfig._f = config._f[i];
  3096. configFromStringAndFormat(tempConfig);
  3097. if (!isValid(tempConfig)) {
  3098. continue;
  3099. }
  3100. // if there is any input that was not parsed add a penalty for that format
  3101. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3102. //or tokens
  3103. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3104. getParsingFlags(tempConfig).score = currentScore;
  3105. if (scoreToBeat == null || currentScore < scoreToBeat) {
  3106. scoreToBeat = currentScore;
  3107. bestMoment = tempConfig;
  3108. }
  3109. }
  3110. extend(config, bestMoment || tempConfig);
  3111. }
  3112. function configFromObject(config) {
  3113. if (config._d) {
  3114. return;
  3115. }
  3116. var i = normalizeObjectUnits(config._i);
  3117. config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
  3118. return obj && parseInt(obj, 10);
  3119. });
  3120. configFromArray(config);
  3121. }
  3122. function createFromConfig (config) {
  3123. var res = new Moment(checkOverflow(prepareConfig(config)));
  3124. if (res._nextDay) {
  3125. // Adding is smart enough around DST
  3126. res.add(1, 'd');
  3127. res._nextDay = undefined;
  3128. }
  3129. return res;
  3130. }
  3131. function prepareConfig (config) {
  3132. var input = config._i,
  3133. format = config._f;
  3134. config._locale = config._locale || getLocale(config._l);
  3135. if (input === null || (format === undefined && input === '')) {
  3136. return createInvalid({nullInput: true});
  3137. }
  3138. if (typeof input === 'string') {
  3139. config._i = input = config._locale.preparse(input);
  3140. }
  3141. if (isMoment(input)) {
  3142. return new Moment(checkOverflow(input));
  3143. } else if (isDate(input)) {
  3144. config._d = input;
  3145. } else if (isArray(format)) {
  3146. configFromStringAndArray(config);
  3147. } else if (format) {
  3148. configFromStringAndFormat(config);
  3149. } else {
  3150. configFromInput(config);
  3151. }
  3152. if (!isValid(config)) {
  3153. config._d = null;
  3154. }
  3155. return config;
  3156. }
  3157. function configFromInput(config) {
  3158. var input = config._i;
  3159. if (isUndefined(input)) {
  3160. config._d = new Date(hooks.now());
  3161. } else if (isDate(input)) {
  3162. config._d = new Date(input.valueOf());
  3163. } else if (typeof input === 'string') {
  3164. configFromString(config);
  3165. } else if (isArray(input)) {
  3166. config._a = map(input.slice(0), function (obj) {
  3167. return parseInt(obj, 10);
  3168. });
  3169. configFromArray(config);
  3170. } else if (isObject(input)) {
  3171. configFromObject(config);
  3172. } else if (isNumber(input)) {
  3173. // from milliseconds
  3174. config._d = new Date(input);
  3175. } else {
  3176. hooks.createFromInputFallback(config);
  3177. }
  3178. }
  3179. function createLocalOrUTC (input, format, locale, strict, isUTC) {
  3180. var c = {};
  3181. if (locale === true || locale === false) {
  3182. strict = locale;
  3183. locale = undefined;
  3184. }
  3185. if ((isObject(input) && isObjectEmpty(input)) ||
  3186. (isArray(input) && input.length === 0)) {
  3187. input = undefined;
  3188. }
  3189. // object construction must be done this way.
  3190. // https://github.com/moment/moment/issues/1423
  3191. c._isAMomentObject = true;
  3192. c._useUTC = c._isUTC = isUTC;
  3193. c._l = locale;
  3194. c._i = input;
  3195. c._f = format;
  3196. c._strict = strict;
  3197. return createFromConfig(c);
  3198. }
  3199. function createLocal (input, format, locale, strict) {
  3200. return createLocalOrUTC(input, format, locale, strict, false);
  3201. }
  3202. var prototypeMin = deprecate(
  3203. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3204. function () {
  3205. var other = createLocal.apply(null, arguments);
  3206. if (this.isValid() && other.isValid()) {
  3207. return other < this ? this : other;
  3208. } else {
  3209. return createInvalid();
  3210. }
  3211. }
  3212. );
  3213. var prototypeMax = deprecate(
  3214. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3215. function () {
  3216. var other = createLocal.apply(null, arguments);
  3217. if (this.isValid() && other.isValid()) {
  3218. return other > this ? this : other;
  3219. } else {
  3220. return createInvalid();
  3221. }
  3222. }
  3223. );
  3224. // Pick a moment m from moments so that m[fn](other) is true for all
  3225. // other. This relies on the function fn to be transitive.
  3226. //
  3227. // moments should either be an array of moment objects or an array, whose
  3228. // first element is an array of moment objects.
  3229. function pickBy(fn, moments) {
  3230. var res, i;
  3231. if (moments.length === 1 && isArray(moments[0])) {
  3232. moments = moments[0];
  3233. }
  3234. if (!moments.length) {
  3235. return createLocal();
  3236. }
  3237. res = moments[0];
  3238. for (i = 1; i < moments.length; ++i) {
  3239. if (!moments[i].isValid() || moments[i][fn](res)) {
  3240. res = moments[i];
  3241. }
  3242. }
  3243. return res;
  3244. }
  3245. // TODO: Use [].sort instead?
  3246. function min () {
  3247. var args = [].slice.call(arguments, 0);
  3248. return pickBy('isBefore', args);
  3249. }
  3250. function max () {
  3251. var args = [].slice.call(arguments, 0);
  3252. return pickBy('isAfter', args);
  3253. }
  3254. var now = function () {
  3255. return Date.now ? Date.now() : +(new Date());
  3256. };
  3257. var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
  3258. function isDurationValid(m) {
  3259. for (var key in m) {
  3260. if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
  3261. return false;
  3262. }
  3263. }
  3264. var unitHasDecimal = false;
  3265. for (var i = 0; i < ordering.length; ++i) {
  3266. if (m[ordering[i]]) {
  3267. if (unitHasDecimal) {
  3268. return false; // only allow non-integers for smallest unit
  3269. }
  3270. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  3271. unitHasDecimal = true;
  3272. }
  3273. }
  3274. }
  3275. return true;
  3276. }
  3277. function isValid$1() {
  3278. return this._isValid;
  3279. }
  3280. function createInvalid$1() {
  3281. return createDuration(NaN);
  3282. }
  3283. function Duration (duration) {
  3284. var normalizedInput = normalizeObjectUnits(duration),
  3285. years = normalizedInput.year || 0,
  3286. quarters = normalizedInput.quarter || 0,
  3287. months = normalizedInput.month || 0,
  3288. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  3289. days = normalizedInput.day || 0,
  3290. hours = normalizedInput.hour || 0,
  3291. minutes = normalizedInput.minute || 0,
  3292. seconds = normalizedInput.second || 0,
  3293. milliseconds = normalizedInput.millisecond || 0;
  3294. this._isValid = isDurationValid(normalizedInput);
  3295. // representation for dateAddRemove
  3296. this._milliseconds = +milliseconds +
  3297. seconds * 1e3 + // 1000
  3298. minutes * 6e4 + // 1000 * 60
  3299. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3300. // Because of dateAddRemove treats 24 hours as different from a
  3301. // day when working around DST, we need to store them separately
  3302. this._days = +days +
  3303. weeks * 7;
  3304. // It is impossible to translate months into days without knowing
  3305. // which months you are are talking about, so we have to store
  3306. // it separately.
  3307. this._months = +months +
  3308. quarters * 3 +
  3309. years * 12;
  3310. this._data = {};
  3311. this._locale = getLocale();
  3312. this._bubble();
  3313. }
  3314. function isDuration (obj) {
  3315. return obj instanceof Duration;
  3316. }
  3317. function absRound (number) {
  3318. if (number < 0) {
  3319. return Math.round(-1 * number) * -1;
  3320. } else {
  3321. return Math.round(number);
  3322. }
  3323. }
  3324. // FORMATTING
  3325. function offset (token, separator) {
  3326. addFormatToken(token, 0, 0, function () {
  3327. var offset = this.utcOffset();
  3328. var sign = '+';
  3329. if (offset < 0) {
  3330. offset = -offset;
  3331. sign = '-';
  3332. }
  3333. return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
  3334. });
  3335. }
  3336. offset('Z', ':');
  3337. offset('ZZ', '');
  3338. // PARSING
  3339. addRegexToken('Z', matchShortOffset);
  3340. addRegexToken('ZZ', matchShortOffset);
  3341. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3342. config._useUTC = true;
  3343. config._tzm = offsetFromString(matchShortOffset, input);
  3344. });
  3345. // HELPERS
  3346. // timezone chunker
  3347. // '+10:00' > ['10', '00']
  3348. // '-1530' > ['-15', '30']
  3349. var chunkOffset = /([\+\-]|\d\d)/gi;
  3350. function offsetFromString(matcher, string) {
  3351. var matches = (string || '').match(matcher);
  3352. if (matches === null) {
  3353. return null;
  3354. }
  3355. var chunk = matches[matches.length - 1] || [];
  3356. var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3357. var minutes = +(parts[1] * 60) + toInt(parts[2]);
  3358. return minutes === 0 ?
  3359. 0 :
  3360. parts[0] === '+' ? minutes : -minutes;
  3361. }
  3362. // Return a moment from input, that is local/utc/zone equivalent to model.
  3363. function cloneWithOffset(input, model) {
  3364. var res, diff;
  3365. if (model._isUTC) {
  3366. res = model.clone();
  3367. diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
  3368. // Use low-level api, because this fn is low-level api.
  3369. res._d.setTime(res._d.valueOf() + diff);
  3370. hooks.updateOffset(res, false);
  3371. return res;
  3372. } else {
  3373. return createLocal(input).local();
  3374. }
  3375. }
  3376. function getDateOffset (m) {
  3377. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3378. // https://github.com/moment/moment/pull/1871
  3379. return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
  3380. }
  3381. // HOOKS
  3382. // This function will be called whenever a moment is mutated.
  3383. // It is intended to keep the offset in sync with the timezone.
  3384. hooks.updateOffset = function () {};
  3385. // MOMENTS
  3386. // keepLocalTime = true means only change the timezone, without
  3387. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3388. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3389. // +0200, so we adjust the time as needed, to be valid.
  3390. //
  3391. // Keeping the time actually adds/subtracts (one hour)
  3392. // from the actual represented time. That is why we call updateOffset
  3393. // a second time. In case it wants us to change the offset again
  3394. // _changeInProgress == true case, then we have to adjust, because
  3395. // there is no such time in the given timezone.
  3396. function getSetOffset (input, keepLocalTime, keepMinutes) {
  3397. var offset = this._offset || 0,
  3398. localAdjust;
  3399. if (!this.isValid()) {
  3400. return input != null ? this : NaN;
  3401. }
  3402. if (input != null) {
  3403. if (typeof input === 'string') {
  3404. input = offsetFromString(matchShortOffset, input);
  3405. if (input === null) {
  3406. return this;
  3407. }
  3408. } else if (Math.abs(input) < 16 && !keepMinutes) {
  3409. input = input * 60;
  3410. }
  3411. if (!this._isUTC && keepLocalTime) {
  3412. localAdjust = getDateOffset(this);
  3413. }
  3414. this._offset = input;
  3415. this._isUTC = true;
  3416. if (localAdjust != null) {
  3417. this.add(localAdjust, 'm');
  3418. }
  3419. if (offset !== input) {
  3420. if (!keepLocalTime || this._changeInProgress) {
  3421. addSubtract(this, createDuration(input - offset, 'm'), 1, false);
  3422. } else if (!this._changeInProgress) {
  3423. this._changeInProgress = true;
  3424. hooks.updateOffset(this, true);
  3425. this._changeInProgress = null;
  3426. }
  3427. }
  3428. return this;
  3429. } else {
  3430. return this._isUTC ? offset : getDateOffset(this);
  3431. }
  3432. }
  3433. function getSetZone (input, keepLocalTime) {
  3434. if (input != null) {
  3435. if (typeof input !== 'string') {
  3436. input = -input;
  3437. }
  3438. this.utcOffset(input, keepLocalTime);
  3439. return this;
  3440. } else {
  3441. return -this.utcOffset();
  3442. }
  3443. }
  3444. function setOffsetToUTC (keepLocalTime) {
  3445. return this.utcOffset(0, keepLocalTime);
  3446. }
  3447. function setOffsetToLocal (keepLocalTime) {
  3448. if (this._isUTC) {
  3449. this.utcOffset(0, keepLocalTime);
  3450. this._isUTC = false;
  3451. if (keepLocalTime) {
  3452. this.subtract(getDateOffset(this), 'm');
  3453. }
  3454. }
  3455. return this;
  3456. }
  3457. function setOffsetToParsedOffset () {
  3458. if (this._tzm != null) {
  3459. this.utcOffset(this._tzm, false, true);
  3460. } else if (typeof this._i === 'string') {
  3461. var tZone = offsetFromString(matchOffset, this._i);
  3462. if (tZone != null) {
  3463. this.utcOffset(tZone);
  3464. }
  3465. else {
  3466. this.utcOffset(0, true);
  3467. }
  3468. }
  3469. return this;
  3470. }
  3471. function hasAlignedHourOffset (input) {
  3472. if (!this.isValid()) {
  3473. return false;
  3474. }
  3475. input = input ? createLocal(input).utcOffset() : 0;
  3476. return (this.utcOffset() - input) % 60 === 0;
  3477. }
  3478. function isDaylightSavingTime () {
  3479. return (
  3480. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3481. this.utcOffset() > this.clone().month(5).utcOffset()
  3482. );
  3483. }
  3484. function isDaylightSavingTimeShifted () {
  3485. if (!isUndefined(this._isDSTShifted)) {
  3486. return this._isDSTShifted;
  3487. }
  3488. var c = {};
  3489. copyConfig(c, this);
  3490. c = prepareConfig(c);
  3491. if (c._a) {
  3492. var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  3493. this._isDSTShifted = this.isValid() &&
  3494. compareArrays(c._a, other.toArray()) > 0;
  3495. } else {
  3496. this._isDSTShifted = false;
  3497. }
  3498. return this._isDSTShifted;
  3499. }
  3500. function isLocal () {
  3501. return this.isValid() ? !this._isUTC : false;
  3502. }
  3503. function isUtcOffset () {
  3504. return this.isValid() ? this._isUTC : false;
  3505. }
  3506. function isUtc () {
  3507. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3508. }
  3509. // ASP.NET json date format regex
  3510. var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
  3511. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3512. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3513. // and further modified to allow for strings containing both week and day
  3514. 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)?)?$/;
  3515. function createDuration (input, key) {
  3516. var duration = input,
  3517. // matching against regexp is expensive, do it on demand
  3518. match = null,
  3519. sign,
  3520. ret,
  3521. diffRes;
  3522. if (isDuration(input)) {
  3523. duration = {
  3524. ms : input._milliseconds,
  3525. d : input._days,
  3526. M : input._months
  3527. };
  3528. } else if (isNumber(input)) {
  3529. duration = {};
  3530. if (key) {
  3531. duration[key] = input;
  3532. } else {
  3533. duration.milliseconds = input;
  3534. }
  3535. } else if (!!(match = aspNetRegex.exec(input))) {
  3536. sign = (match[1] === '-') ? -1 : 1;
  3537. duration = {
  3538. y : 0,
  3539. d : toInt(match[DATE]) * sign,
  3540. h : toInt(match[HOUR]) * sign,
  3541. m : toInt(match[MINUTE]) * sign,
  3542. s : toInt(match[SECOND]) * sign,
  3543. ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
  3544. };
  3545. } else if (!!(match = isoRegex.exec(input))) {
  3546. sign = (match[1] === '-') ? -1 : 1;
  3547. duration = {
  3548. y : parseIso(match[2], sign),
  3549. M : parseIso(match[3], sign),
  3550. w : parseIso(match[4], sign),
  3551. d : parseIso(match[5], sign),
  3552. h : parseIso(match[6], sign),
  3553. m : parseIso(match[7], sign),
  3554. s : parseIso(match[8], sign)
  3555. };
  3556. } else if (duration == null) {// checks for null or undefined
  3557. duration = {};
  3558. } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
  3559. diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
  3560. duration = {};
  3561. duration.ms = diffRes.milliseconds;
  3562. duration.M = diffRes.months;
  3563. }
  3564. ret = new Duration(duration);
  3565. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  3566. ret._locale = input._locale;
  3567. }
  3568. return ret;
  3569. }
  3570. createDuration.fn = Duration.prototype;
  3571. createDuration.invalid = createInvalid$1;
  3572. function parseIso (inp, sign) {
  3573. // We'd normally use ~~inp for this, but unfortunately it also
  3574. // converts floats to ints.
  3575. // inp may be undefined, so careful calling replace on it.
  3576. var res = inp && parseFloat(inp.replace(',', '.'));
  3577. // apply sign while we're at it
  3578. return (isNaN(res) ? 0 : res) * sign;
  3579. }
  3580. function positiveMomentsDifference(base, other) {
  3581. var res = {};
  3582. res.months = other.month() - base.month() +
  3583. (other.year() - base.year()) * 12;
  3584. if (base.clone().add(res.months, 'M').isAfter(other)) {
  3585. --res.months;
  3586. }
  3587. res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
  3588. return res;
  3589. }
  3590. function momentsDifference(base, other) {
  3591. var res;
  3592. if (!(base.isValid() && other.isValid())) {
  3593. return {milliseconds: 0, months: 0};
  3594. }
  3595. other = cloneWithOffset(other, base);
  3596. if (base.isBefore(other)) {
  3597. res = positiveMomentsDifference(base, other);
  3598. } else {
  3599. res = positiveMomentsDifference(other, base);
  3600. res.milliseconds = -res.milliseconds;
  3601. res.months = -res.months;
  3602. }
  3603. return res;
  3604. }
  3605. // TODO: remove 'name' arg after deprecation is removed
  3606. function createAdder(direction, name) {
  3607. return function (val, period) {
  3608. var dur, tmp;
  3609. //invert the arguments, but complain about it
  3610. if (period !== null && !isNaN(+period)) {
  3611. deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
  3612. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
  3613. tmp = val; val = period; period = tmp;
  3614. }
  3615. val = typeof val === 'string' ? +val : val;
  3616. dur = createDuration(val, period);
  3617. addSubtract(this, dur, direction);
  3618. return this;
  3619. };
  3620. }
  3621. function addSubtract (mom, duration, isAdding, updateOffset) {
  3622. var milliseconds = duration._milliseconds,
  3623. days = absRound(duration._days),
  3624. months = absRound(duration._months);
  3625. if (!mom.isValid()) {
  3626. // No op
  3627. return;
  3628. }
  3629. updateOffset = updateOffset == null ? true : updateOffset;
  3630. if (months) {
  3631. setMonth(mom, get(mom, 'Month') + months * isAdding);
  3632. }
  3633. if (days) {
  3634. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  3635. }
  3636. if (milliseconds) {
  3637. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  3638. }
  3639. if (updateOffset) {
  3640. hooks.updateOffset(mom, days || months);
  3641. }
  3642. }
  3643. var add = createAdder(1, 'add');
  3644. var subtract = createAdder(-1, 'subtract');
  3645. function getCalendarFormat(myMoment, now) {
  3646. var diff = myMoment.diff(now, 'days', true);
  3647. return diff < -6 ? 'sameElse' :
  3648. diff < -1 ? 'lastWeek' :
  3649. diff < 0 ? 'lastDay' :
  3650. diff < 1 ? 'sameDay' :
  3651. diff < 2 ? 'nextDay' :
  3652. diff < 7 ? 'nextWeek' : 'sameElse';
  3653. }
  3654. function calendar$1 (time, formats) {
  3655. // We want to compare the start of today, vs this.
  3656. // Getting start-of-today depends on whether we're local/utc/offset or not.
  3657. var now = time || createLocal(),
  3658. sod = cloneWithOffset(now, this).startOf('day'),
  3659. format = hooks.calendarFormat(this, sod) || 'sameElse';
  3660. var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
  3661. return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
  3662. }
  3663. function clone () {
  3664. return new Moment(this);
  3665. }
  3666. function isAfter (input, units) {
  3667. var localInput = isMoment(input) ? input : createLocal(input);
  3668. if (!(this.isValid() && localInput.isValid())) {
  3669. return false;
  3670. }
  3671. units = normalizeUnits(units) || 'millisecond';
  3672. if (units === 'millisecond') {
  3673. return this.valueOf() > localInput.valueOf();
  3674. } else {
  3675. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  3676. }
  3677. }
  3678. function isBefore (input, units) {
  3679. var localInput = isMoment(input) ? input : createLocal(input);
  3680. if (!(this.isValid() && localInput.isValid())) {
  3681. return false;
  3682. }
  3683. units = normalizeUnits(units) || 'millisecond';
  3684. if (units === 'millisecond') {
  3685. return this.valueOf() < localInput.valueOf();
  3686. } else {
  3687. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  3688. }
  3689. }
  3690. function isBetween (from, to, units, inclusivity) {
  3691. var localFrom = isMoment(from) ? from : createLocal(from),
  3692. localTo = isMoment(to) ? to : createLocal(to);
  3693. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  3694. return false;
  3695. }
  3696. inclusivity = inclusivity || '()';
  3697. return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) &&
  3698. (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
  3699. }
  3700. function isSame (input, units) {
  3701. var localInput = isMoment(input) ? input : createLocal(input),
  3702. inputMs;
  3703. if (!(this.isValid() && localInput.isValid())) {
  3704. return false;
  3705. }
  3706. units = normalizeUnits(units) || 'millisecond';
  3707. if (units === 'millisecond') {
  3708. return this.valueOf() === localInput.valueOf();
  3709. } else {
  3710. inputMs = localInput.valueOf();
  3711. return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  3712. }
  3713. }
  3714. function isSameOrAfter (input, units) {
  3715. return this.isSame(input, units) || this.isAfter(input, units);
  3716. }
  3717. function isSameOrBefore (input, units) {
  3718. return this.isSame(input, units) || this.isBefore(input, units);
  3719. }
  3720. function diff (input, units, asFloat) {
  3721. var that,
  3722. zoneDelta,
  3723. output;
  3724. if (!this.isValid()) {
  3725. return NaN;
  3726. }
  3727. that = cloneWithOffset(input, this);
  3728. if (!that.isValid()) {
  3729. return NaN;
  3730. }
  3731. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  3732. units = normalizeUnits(units);
  3733. switch (units) {
  3734. case 'year': output = monthDiff(this, that) / 12; break;
  3735. case 'month': output = monthDiff(this, that); break;
  3736. case 'quarter': output = monthDiff(this, that) / 3; break;
  3737. case 'second': output = (this - that) / 1e3; break; // 1000
  3738. case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
  3739. case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
  3740. case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
  3741. case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
  3742. default: output = this - that;
  3743. }
  3744. return asFloat ? output : absFloor(output);
  3745. }
  3746. function monthDiff (a, b) {
  3747. // difference in months
  3748. var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
  3749. // b is in (anchor - 1 month, anchor + 1 month)
  3750. anchor = a.clone().add(wholeMonthDiff, 'months'),
  3751. anchor2, adjust;
  3752. if (b - anchor < 0) {
  3753. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  3754. // linear across the month
  3755. adjust = (b - anchor) / (anchor - anchor2);
  3756. } else {
  3757. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  3758. // linear across the month
  3759. adjust = (b - anchor) / (anchor2 - anchor);
  3760. }
  3761. //check for negative zero, return zero if negative zero
  3762. return -(wholeMonthDiff + adjust) || 0;
  3763. }
  3764. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  3765. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  3766. function toString () {
  3767. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  3768. }
  3769. function toISOString(keepOffset) {
  3770. if (!this.isValid()) {
  3771. return null;
  3772. }
  3773. var utc = keepOffset !== true;
  3774. var m = utc ? this.clone().utc() : this;
  3775. if (m.year() < 0 || m.year() > 9999) {
  3776. return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
  3777. }
  3778. if (isFunction(Date.prototype.toISOString)) {
  3779. // native implementation is ~50x faster, use it when we can
  3780. if (utc) {
  3781. return this.toDate().toISOString();
  3782. } else {
  3783. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
  3784. }
  3785. }
  3786. return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
  3787. }
  3788. /**
  3789. * Return a human readable representation of a moment that can
  3790. * also be evaluated to get a new moment which is the same
  3791. *
  3792. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  3793. */
  3794. function inspect () {
  3795. if (!this.isValid()) {
  3796. return 'moment.invalid(/* ' + this._i + ' */)';
  3797. }
  3798. var func = 'moment';
  3799. var zone = '';
  3800. if (!this.isLocal()) {
  3801. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  3802. zone = 'Z';
  3803. }
  3804. var prefix = '[' + func + '("]';
  3805. var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
  3806. var datetime = '-MM-DD[T]HH:mm:ss.SSS';
  3807. var suffix = zone + '[")]';
  3808. return this.format(prefix + year + datetime + suffix);
  3809. }
  3810. function format (inputString) {
  3811. if (!inputString) {
  3812. inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
  3813. }
  3814. var output = formatMoment(this, inputString);
  3815. return this.localeData().postformat(output);
  3816. }
  3817. function from (time, withoutSuffix) {
  3818. if (this.isValid() &&
  3819. ((isMoment(time) && time.isValid()) ||
  3820. createLocal(time).isValid())) {
  3821. return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
  3822. } else {
  3823. return this.localeData().invalidDate();
  3824. }
  3825. }
  3826. function fromNow (withoutSuffix) {
  3827. return this.from(createLocal(), withoutSuffix);
  3828. }
  3829. function to (time, withoutSuffix) {
  3830. if (this.isValid() &&
  3831. ((isMoment(time) && time.isValid()) ||
  3832. createLocal(time).isValid())) {
  3833. return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
  3834. } else {
  3835. return this.localeData().invalidDate();
  3836. }
  3837. }
  3838. function toNow (withoutSuffix) {
  3839. return this.to(createLocal(), withoutSuffix);
  3840. }
  3841. // If passed a locale key, it will set the locale for this
  3842. // instance. Otherwise, it will return the locale configuration
  3843. // variables for this instance.
  3844. function locale (key) {
  3845. var newLocaleData;
  3846. if (key === undefined) {
  3847. return this._locale._abbr;
  3848. } else {
  3849. newLocaleData = getLocale(key);
  3850. if (newLocaleData != null) {
  3851. this._locale = newLocaleData;
  3852. }
  3853. return this;
  3854. }
  3855. }
  3856. var lang = deprecate(
  3857. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  3858. function (key) {
  3859. if (key === undefined) {
  3860. return this.localeData();
  3861. } else {
  3862. return this.locale(key);
  3863. }
  3864. }
  3865. );
  3866. function localeData () {
  3867. return this._locale;
  3868. }
  3869. var MS_PER_SECOND = 1000;
  3870. var MS_PER_MINUTE = 60 * MS_PER_SECOND;
  3871. var MS_PER_HOUR = 60 * MS_PER_MINUTE;
  3872. var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  3873. // actual modulo - handles negative numbers (for dates before 1970):
  3874. function mod$1(dividend, divisor) {
  3875. return (dividend % divisor + divisor) % divisor;
  3876. }
  3877. function localStartOfDate(y, m, d) {
  3878. // the date constructor remaps years 0-99 to 1900-1999
  3879. if (y < 100 && y >= 0) {
  3880. // preserve leap years using a full 400 year cycle, then reset
  3881. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  3882. } else {
  3883. return new Date(y, m, d).valueOf();
  3884. }
  3885. }
  3886. function utcStartOfDate(y, m, d) {
  3887. // Date.UTC remaps years 0-99 to 1900-1999
  3888. if (y < 100 && y >= 0) {
  3889. // preserve leap years using a full 400 year cycle, then reset
  3890. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  3891. } else {
  3892. return Date.UTC(y, m, d);
  3893. }
  3894. }
  3895. function startOf (units) {
  3896. var time;
  3897. units = normalizeUnits(units);
  3898. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  3899. return this;
  3900. }
  3901. var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  3902. switch (units) {
  3903. case 'year':
  3904. time = startOfDate(this.year(), 0, 1);
  3905. break;
  3906. case 'quarter':
  3907. time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
  3908. break;
  3909. case 'month':
  3910. time = startOfDate(this.year(), this.month(), 1);
  3911. break;
  3912. case 'week':
  3913. time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
  3914. break;
  3915. case 'isoWeek':
  3916. time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
  3917. break;
  3918. case 'day':
  3919. case 'date':
  3920. time = startOfDate(this.year(), this.month(), this.date());
  3921. break;
  3922. case 'hour':
  3923. time = this._d.valueOf();
  3924. time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
  3925. break;
  3926. case 'minute':
  3927. time = this._d.valueOf();
  3928. time -= mod$1(time, MS_PER_MINUTE);
  3929. break;
  3930. case 'second':
  3931. time = this._d.valueOf();
  3932. time -= mod$1(time, MS_PER_SECOND);
  3933. break;
  3934. }
  3935. this._d.setTime(time);
  3936. hooks.updateOffset(this, true);
  3937. return this;
  3938. }
  3939. function endOf (units) {
  3940. var time;
  3941. units = normalizeUnits(units);
  3942. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  3943. return this;
  3944. }
  3945. var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  3946. switch (units) {
  3947. case 'year':
  3948. time = startOfDate(this.year() + 1, 0, 1) - 1;
  3949. break;
  3950. case 'quarter':
  3951. time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
  3952. break;
  3953. case 'month':
  3954. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  3955. break;
  3956. case 'week':
  3957. time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
  3958. break;
  3959. case 'isoWeek':
  3960. time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
  3961. break;
  3962. case 'day':
  3963. case 'date':
  3964. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  3965. break;
  3966. case 'hour':
  3967. time = this._d.valueOf();
  3968. time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
  3969. break;
  3970. case 'minute':
  3971. time = this._d.valueOf();
  3972. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  3973. break;
  3974. case 'second':
  3975. time = this._d.valueOf();
  3976. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  3977. break;
  3978. }
  3979. this._d.setTime(time);
  3980. hooks.updateOffset(this, true);
  3981. return this;
  3982. }
  3983. function valueOf () {
  3984. return this._d.valueOf() - ((this._offset || 0) * 60000);
  3985. }
  3986. function unix () {
  3987. return Math.floor(this.valueOf() / 1000);
  3988. }
  3989. function toDate () {
  3990. return new Date(this.valueOf());
  3991. }
  3992. function toArray () {
  3993. var m = this;
  3994. return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
  3995. }
  3996. function toObject () {
  3997. var m = this;
  3998. return {
  3999. years: m.year(),
  4000. months: m.month(),
  4001. date: m.date(),
  4002. hours: m.hours(),
  4003. minutes: m.minutes(),
  4004. seconds: m.seconds(),
  4005. milliseconds: m.milliseconds()
  4006. };
  4007. }
  4008. function toJSON () {
  4009. // new Date(NaN).toJSON() === null
  4010. return this.isValid() ? this.toISOString() : null;
  4011. }
  4012. function isValid$2 () {
  4013. return isValid(this);
  4014. }
  4015. function parsingFlags () {
  4016. return extend({}, getParsingFlags(this));
  4017. }
  4018. function invalidAt () {
  4019. return getParsingFlags(this).overflow;
  4020. }
  4021. function creationData() {
  4022. return {
  4023. input: this._i,
  4024. format: this._f,
  4025. locale: this._locale,
  4026. isUTC: this._isUTC,
  4027. strict: this._strict
  4028. };
  4029. }
  4030. // FORMATTING
  4031. addFormatToken(0, ['gg', 2], 0, function () {
  4032. return this.weekYear() % 100;
  4033. });
  4034. addFormatToken(0, ['GG', 2], 0, function () {
  4035. return this.isoWeekYear() % 100;
  4036. });
  4037. function addWeekYearFormatToken (token, getter) {
  4038. addFormatToken(0, [token, token.length], 0, getter);
  4039. }
  4040. addWeekYearFormatToken('gggg', 'weekYear');
  4041. addWeekYearFormatToken('ggggg', 'weekYear');
  4042. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4043. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4044. // ALIASES
  4045. addUnitAlias('weekYear', 'gg');
  4046. addUnitAlias('isoWeekYear', 'GG');
  4047. // PRIORITY
  4048. addUnitPriority('weekYear', 1);
  4049. addUnitPriority('isoWeekYear', 1);
  4050. // PARSING
  4051. addRegexToken('G', matchSigned);
  4052. addRegexToken('g', matchSigned);
  4053. addRegexToken('GG', match1to2, match2);
  4054. addRegexToken('gg', match1to2, match2);
  4055. addRegexToken('GGGG', match1to4, match4);
  4056. addRegexToken('gggg', match1to4, match4);
  4057. addRegexToken('GGGGG', match1to6, match6);
  4058. addRegexToken('ggggg', match1to6, match6);
  4059. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
  4060. week[token.substr(0, 2)] = toInt(input);
  4061. });
  4062. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4063. week[token] = hooks.parseTwoDigitYear(input);
  4064. });
  4065. // MOMENTS
  4066. function getSetWeekYear (input) {
  4067. return getSetWeekYearHelper.call(this,
  4068. input,
  4069. this.week(),
  4070. this.weekday(),
  4071. this.localeData()._week.dow,
  4072. this.localeData()._week.doy);
  4073. }
  4074. function getSetISOWeekYear (input) {
  4075. return getSetWeekYearHelper.call(this,
  4076. input, this.isoWeek(), this.isoWeekday(), 1, 4);
  4077. }
  4078. function getISOWeeksInYear () {
  4079. return weeksInYear(this.year(), 1, 4);
  4080. }
  4081. function getWeeksInYear () {
  4082. var weekInfo = this.localeData()._week;
  4083. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  4084. }
  4085. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  4086. var weeksTarget;
  4087. if (input == null) {
  4088. return weekOfYear(this, dow, doy).year;
  4089. } else {
  4090. weeksTarget = weeksInYear(input, dow, doy);
  4091. if (week > weeksTarget) {
  4092. week = weeksTarget;
  4093. }
  4094. return setWeekAll.call(this, input, week, weekday, dow, doy);
  4095. }
  4096. }
  4097. function setWeekAll(weekYear, week, weekday, dow, doy) {
  4098. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  4099. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  4100. this.year(date.getUTCFullYear());
  4101. this.month(date.getUTCMonth());
  4102. this.date(date.getUTCDate());
  4103. return this;
  4104. }
  4105. // FORMATTING
  4106. addFormatToken('Q', 0, 'Qo', 'quarter');
  4107. // ALIASES
  4108. addUnitAlias('quarter', 'Q');
  4109. // PRIORITY
  4110. addUnitPriority('quarter', 7);
  4111. // PARSING
  4112. addRegexToken('Q', match1);
  4113. addParseToken('Q', function (input, array) {
  4114. array[MONTH] = (toInt(input) - 1) * 3;
  4115. });
  4116. // MOMENTS
  4117. function getSetQuarter (input) {
  4118. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  4119. }
  4120. // FORMATTING
  4121. addFormatToken('D', ['DD', 2], 'Do', 'date');
  4122. // ALIASES
  4123. addUnitAlias('date', 'D');
  4124. // PRIORITY
  4125. addUnitPriority('date', 9);
  4126. // PARSING
  4127. addRegexToken('D', match1to2);
  4128. addRegexToken('DD', match1to2, match2);
  4129. addRegexToken('Do', function (isStrict, locale) {
  4130. // TODO: Remove "ordinalParse" fallback in next major release.
  4131. return isStrict ?
  4132. (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
  4133. locale._dayOfMonthOrdinalParseLenient;
  4134. });
  4135. addParseToken(['D', 'DD'], DATE);
  4136. addParseToken('Do', function (input, array) {
  4137. array[DATE] = toInt(input.match(match1to2)[0]);
  4138. });
  4139. // MOMENTS
  4140. var getSetDayOfMonth = makeGetSet('Date', true);
  4141. // FORMATTING
  4142. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  4143. // ALIASES
  4144. addUnitAlias('dayOfYear', 'DDD');
  4145. // PRIORITY
  4146. addUnitPriority('dayOfYear', 4);
  4147. // PARSING
  4148. addRegexToken('DDD', match1to3);
  4149. addRegexToken('DDDD', match3);
  4150. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  4151. config._dayOfYear = toInt(input);
  4152. });
  4153. // HELPERS
  4154. // MOMENTS
  4155. function getSetDayOfYear (input) {
  4156. var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
  4157. return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
  4158. }
  4159. // FORMATTING
  4160. addFormatToken('m', ['mm', 2], 0, 'minute');
  4161. // ALIASES
  4162. addUnitAlias('minute', 'm');
  4163. // PRIORITY
  4164. addUnitPriority('minute', 14);
  4165. // PARSING
  4166. addRegexToken('m', match1to2);
  4167. addRegexToken('mm', match1to2, match2);
  4168. addParseToken(['m', 'mm'], MINUTE);
  4169. // MOMENTS
  4170. var getSetMinute = makeGetSet('Minutes', false);
  4171. // FORMATTING
  4172. addFormatToken('s', ['ss', 2], 0, 'second');
  4173. // ALIASES
  4174. addUnitAlias('second', 's');
  4175. // PRIORITY
  4176. addUnitPriority('second', 15);
  4177. // PARSING
  4178. addRegexToken('s', match1to2);
  4179. addRegexToken('ss', match1to2, match2);
  4180. addParseToken(['s', 'ss'], SECOND);
  4181. // MOMENTS
  4182. var getSetSecond = makeGetSet('Seconds', false);
  4183. // FORMATTING
  4184. addFormatToken('S', 0, 0, function () {
  4185. return ~~(this.millisecond() / 100);
  4186. });
  4187. addFormatToken(0, ['SS', 2], 0, function () {
  4188. return ~~(this.millisecond() / 10);
  4189. });
  4190. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  4191. addFormatToken(0, ['SSSS', 4], 0, function () {
  4192. return this.millisecond() * 10;
  4193. });
  4194. addFormatToken(0, ['SSSSS', 5], 0, function () {
  4195. return this.millisecond() * 100;
  4196. });
  4197. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  4198. return this.millisecond() * 1000;
  4199. });
  4200. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  4201. return this.millisecond() * 10000;
  4202. });
  4203. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  4204. return this.millisecond() * 100000;
  4205. });
  4206. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  4207. return this.millisecond() * 1000000;
  4208. });
  4209. // ALIASES
  4210. addUnitAlias('millisecond', 'ms');
  4211. // PRIORITY
  4212. addUnitPriority('millisecond', 16);
  4213. // PARSING
  4214. addRegexToken('S', match1to3, match1);
  4215. addRegexToken('SS', match1to3, match2);
  4216. addRegexToken('SSS', match1to3, match3);
  4217. var token;
  4218. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  4219. addRegexToken(token, matchUnsigned);
  4220. }
  4221. function parseMs(input, array) {
  4222. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  4223. }
  4224. for (token = 'S'; token.length <= 9; token += 'S') {
  4225. addParseToken(token, parseMs);
  4226. }
  4227. // MOMENTS
  4228. var getSetMillisecond = makeGetSet('Milliseconds', false);
  4229. // FORMATTING
  4230. addFormatToken('z', 0, 0, 'zoneAbbr');
  4231. addFormatToken('zz', 0, 0, 'zoneName');
  4232. // MOMENTS
  4233. function getZoneAbbr () {
  4234. return this._isUTC ? 'UTC' : '';
  4235. }
  4236. function getZoneName () {
  4237. return this._isUTC ? 'Coordinated Universal Time' : '';
  4238. }
  4239. var proto = Moment.prototype;
  4240. proto.add = add;
  4241. proto.calendar = calendar$1;
  4242. proto.clone = clone;
  4243. proto.diff = diff;
  4244. proto.endOf = endOf;
  4245. proto.format = format;
  4246. proto.from = from;
  4247. proto.fromNow = fromNow;
  4248. proto.to = to;
  4249. proto.toNow = toNow;
  4250. proto.get = stringGet;
  4251. proto.invalidAt = invalidAt;
  4252. proto.isAfter = isAfter;
  4253. proto.isBefore = isBefore;
  4254. proto.isBetween = isBetween;
  4255. proto.isSame = isSame;
  4256. proto.isSameOrAfter = isSameOrAfter;
  4257. proto.isSameOrBefore = isSameOrBefore;
  4258. proto.isValid = isValid$2;
  4259. proto.lang = lang;
  4260. proto.locale = locale;
  4261. proto.localeData = localeData;
  4262. proto.max = prototypeMax;
  4263. proto.min = prototypeMin;
  4264. proto.parsingFlags = parsingFlags;
  4265. proto.set = stringSet;
  4266. proto.startOf = startOf;
  4267. proto.subtract = subtract;
  4268. proto.toArray = toArray;
  4269. proto.toObject = toObject;
  4270. proto.toDate = toDate;
  4271. proto.toISOString = toISOString;
  4272. proto.inspect = inspect;
  4273. proto.toJSON = toJSON;
  4274. proto.toString = toString;
  4275. proto.unix = unix;
  4276. proto.valueOf = valueOf;
  4277. proto.creationData = creationData;
  4278. proto.year = getSetYear;
  4279. proto.isLeapYear = getIsLeapYear;
  4280. proto.weekYear = getSetWeekYear;
  4281. proto.isoWeekYear = getSetISOWeekYear;
  4282. proto.quarter = proto.quarters = getSetQuarter;
  4283. proto.month = getSetMonth;
  4284. proto.daysInMonth = getDaysInMonth;
  4285. proto.week = proto.weeks = getSetWeek;
  4286. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  4287. proto.weeksInYear = getWeeksInYear;
  4288. proto.isoWeeksInYear = getISOWeeksInYear;
  4289. proto.date = getSetDayOfMonth;
  4290. proto.day = proto.days = getSetDayOfWeek;
  4291. proto.weekday = getSetLocaleDayOfWeek;
  4292. proto.isoWeekday = getSetISODayOfWeek;
  4293. proto.dayOfYear = getSetDayOfYear;
  4294. proto.hour = proto.hours = getSetHour;
  4295. proto.minute = proto.minutes = getSetMinute;
  4296. proto.second = proto.seconds = getSetSecond;
  4297. proto.millisecond = proto.milliseconds = getSetMillisecond;
  4298. proto.utcOffset = getSetOffset;
  4299. proto.utc = setOffsetToUTC;
  4300. proto.local = setOffsetToLocal;
  4301. proto.parseZone = setOffsetToParsedOffset;
  4302. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  4303. proto.isDST = isDaylightSavingTime;
  4304. proto.isLocal = isLocal;
  4305. proto.isUtcOffset = isUtcOffset;
  4306. proto.isUtc = isUtc;
  4307. proto.isUTC = isUtc;
  4308. proto.zoneAbbr = getZoneAbbr;
  4309. proto.zoneName = getZoneName;
  4310. proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  4311. proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  4312. proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  4313. proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
  4314. proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
  4315. function createUnix (input) {
  4316. return createLocal(input * 1000);
  4317. }
  4318. function createInZone () {
  4319. return createLocal.apply(null, arguments).parseZone();
  4320. }
  4321. function preParsePostFormat (string) {
  4322. return string;
  4323. }
  4324. var proto$1 = Locale.prototype;
  4325. proto$1.calendar = calendar;
  4326. proto$1.longDateFormat = longDateFormat;
  4327. proto$1.invalidDate = invalidDate;
  4328. proto$1.ordinal = ordinal;
  4329. proto$1.preparse = preParsePostFormat;
  4330. proto$1.postformat = preParsePostFormat;
  4331. proto$1.relativeTime = relativeTime;
  4332. proto$1.pastFuture = pastFuture;
  4333. proto$1.set = set;
  4334. proto$1.months = localeMonths;
  4335. proto$1.monthsShort = localeMonthsShort;
  4336. proto$1.monthsParse = localeMonthsParse;
  4337. proto$1.monthsRegex = monthsRegex;
  4338. proto$1.monthsShortRegex = monthsShortRegex;
  4339. proto$1.week = localeWeek;
  4340. proto$1.firstDayOfYear = localeFirstDayOfYear;
  4341. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  4342. proto$1.weekdays = localeWeekdays;
  4343. proto$1.weekdaysMin = localeWeekdaysMin;
  4344. proto$1.weekdaysShort = localeWeekdaysShort;
  4345. proto$1.weekdaysParse = localeWeekdaysParse;
  4346. proto$1.weekdaysRegex = weekdaysRegex;
  4347. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  4348. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  4349. proto$1.isPM = localeIsPM;
  4350. proto$1.meridiem = localeMeridiem;
  4351. function get$1 (format, index, field, setter) {
  4352. var locale = getLocale();
  4353. var utc = createUTC().set(setter, index);
  4354. return locale[field](utc, format);
  4355. }
  4356. function listMonthsImpl (format, index, field) {
  4357. if (isNumber(format)) {
  4358. index = format;
  4359. format = undefined;
  4360. }
  4361. format = format || '';
  4362. if (index != null) {
  4363. return get$1(format, index, field, 'month');
  4364. }
  4365. var i;
  4366. var out = [];
  4367. for (i = 0; i < 12; i++) {
  4368. out[i] = get$1(format, i, field, 'month');
  4369. }
  4370. return out;
  4371. }
  4372. // ()
  4373. // (5)
  4374. // (fmt, 5)
  4375. // (fmt)
  4376. // (true)
  4377. // (true, 5)
  4378. // (true, fmt, 5)
  4379. // (true, fmt)
  4380. function listWeekdaysImpl (localeSorted, format, index, field) {
  4381. if (typeof localeSorted === 'boolean') {
  4382. if (isNumber(format)) {
  4383. index = format;
  4384. format = undefined;
  4385. }
  4386. format = format || '';
  4387. } else {
  4388. format = localeSorted;
  4389. index = format;
  4390. localeSorted = false;
  4391. if (isNumber(format)) {
  4392. index = format;
  4393. format = undefined;
  4394. }
  4395. format = format || '';
  4396. }
  4397. var locale = getLocale(),
  4398. shift = localeSorted ? locale._week.dow : 0;
  4399. if (index != null) {
  4400. return get$1(format, (index + shift) % 7, field, 'day');
  4401. }
  4402. var i;
  4403. var out = [];
  4404. for (i = 0; i < 7; i++) {
  4405. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  4406. }
  4407. return out;
  4408. }
  4409. function listMonths (format, index) {
  4410. return listMonthsImpl(format, index, 'months');
  4411. }
  4412. function listMonthsShort (format, index) {
  4413. return listMonthsImpl(format, index, 'monthsShort');
  4414. }
  4415. function listWeekdays (localeSorted, format, index) {
  4416. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  4417. }
  4418. function listWeekdaysShort (localeSorted, format, index) {
  4419. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  4420. }
  4421. function listWeekdaysMin (localeSorted, format, index) {
  4422. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  4423. }
  4424. getSetGlobalLocale('en', {
  4425. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  4426. ordinal : function (number) {
  4427. var b = number % 10,
  4428. output = (toInt(number % 100 / 10) === 1) ? 'th' :
  4429. (b === 1) ? 'st' :
  4430. (b === 2) ? 'nd' :
  4431. (b === 3) ? 'rd' : 'th';
  4432. return number + output;
  4433. }
  4434. });
  4435. // Side effect imports
  4436. hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
  4437. hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
  4438. var mathAbs = Math.abs;
  4439. function abs () {
  4440. var data = this._data;
  4441. this._milliseconds = mathAbs(this._milliseconds);
  4442. this._days = mathAbs(this._days);
  4443. this._months = mathAbs(this._months);
  4444. data.milliseconds = mathAbs(data.milliseconds);
  4445. data.seconds = mathAbs(data.seconds);
  4446. data.minutes = mathAbs(data.minutes);
  4447. data.hours = mathAbs(data.hours);
  4448. data.months = mathAbs(data.months);
  4449. data.years = mathAbs(data.years);
  4450. return this;
  4451. }
  4452. function addSubtract$1 (duration, input, value, direction) {
  4453. var other = createDuration(input, value);
  4454. duration._milliseconds += direction * other._milliseconds;
  4455. duration._days += direction * other._days;
  4456. duration._months += direction * other._months;
  4457. return duration._bubble();
  4458. }
  4459. // supports only 2.0-style add(1, 's') or add(duration)
  4460. function add$1 (input, value) {
  4461. return addSubtract$1(this, input, value, 1);
  4462. }
  4463. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  4464. function subtract$1 (input, value) {
  4465. return addSubtract$1(this, input, value, -1);
  4466. }
  4467. function absCeil (number) {
  4468. if (number < 0) {
  4469. return Math.floor(number);
  4470. } else {
  4471. return Math.ceil(number);
  4472. }
  4473. }
  4474. function bubble () {
  4475. var milliseconds = this._milliseconds;
  4476. var days = this._days;
  4477. var months = this._months;
  4478. var data = this._data;
  4479. var seconds, minutes, hours, years, monthsFromDays;
  4480. // if we have a mix of positive and negative values, bubble down first
  4481. // check: https://github.com/moment/moment/issues/2166
  4482. if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
  4483. (milliseconds <= 0 && days <= 0 && months <= 0))) {
  4484. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  4485. days = 0;
  4486. months = 0;
  4487. }
  4488. // The following code bubbles up values, see the tests for
  4489. // examples of what that means.
  4490. data.milliseconds = milliseconds % 1000;
  4491. seconds = absFloor(milliseconds / 1000);
  4492. data.seconds = seconds % 60;
  4493. minutes = absFloor(seconds / 60);
  4494. data.minutes = minutes % 60;
  4495. hours = absFloor(minutes / 60);
  4496. data.hours = hours % 24;
  4497. days += absFloor(hours / 24);
  4498. // convert days to months
  4499. monthsFromDays = absFloor(daysToMonths(days));
  4500. months += monthsFromDays;
  4501. days -= absCeil(monthsToDays(monthsFromDays));
  4502. // 12 months -> 1 year
  4503. years = absFloor(months / 12);
  4504. months %= 12;
  4505. data.days = days;
  4506. data.months = months;
  4507. data.years = years;
  4508. return this;
  4509. }
  4510. function daysToMonths (days) {
  4511. // 400 years have 146097 days (taking into account leap year rules)
  4512. // 400 years have 12 months === 4800
  4513. return days * 4800 / 146097;
  4514. }
  4515. function monthsToDays (months) {
  4516. // the reverse of daysToMonths
  4517. return months * 146097 / 4800;
  4518. }
  4519. function as (units) {
  4520. if (!this.isValid()) {
  4521. return NaN;
  4522. }
  4523. var days;
  4524. var months;
  4525. var milliseconds = this._milliseconds;
  4526. units = normalizeUnits(units);
  4527. if (units === 'month' || units === 'quarter' || units === 'year') {
  4528. days = this._days + milliseconds / 864e5;
  4529. months = this._months + daysToMonths(days);
  4530. switch (units) {
  4531. case 'month': return months;
  4532. case 'quarter': return months / 3;
  4533. case 'year': return months / 12;
  4534. }
  4535. } else {
  4536. // handle milliseconds separately because of floating point math errors (issue #1867)
  4537. days = this._days + Math.round(monthsToDays(this._months));
  4538. switch (units) {
  4539. case 'week' : return days / 7 + milliseconds / 6048e5;
  4540. case 'day' : return days + milliseconds / 864e5;
  4541. case 'hour' : return days * 24 + milliseconds / 36e5;
  4542. case 'minute' : return days * 1440 + milliseconds / 6e4;
  4543. case 'second' : return days * 86400 + milliseconds / 1000;
  4544. // Math.floor prevents floating point math errors here
  4545. case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
  4546. default: throw new Error('Unknown unit ' + units);
  4547. }
  4548. }
  4549. }
  4550. // TODO: Use this.as('ms')?
  4551. function valueOf$1 () {
  4552. if (!this.isValid()) {
  4553. return NaN;
  4554. }
  4555. return (
  4556. this._milliseconds +
  4557. this._days * 864e5 +
  4558. (this._months % 12) * 2592e6 +
  4559. toInt(this._months / 12) * 31536e6
  4560. );
  4561. }
  4562. function makeAs (alias) {
  4563. return function () {
  4564. return this.as(alias);
  4565. };
  4566. }
  4567. var asMilliseconds = makeAs('ms');
  4568. var asSeconds = makeAs('s');
  4569. var asMinutes = makeAs('m');
  4570. var asHours = makeAs('h');
  4571. var asDays = makeAs('d');
  4572. var asWeeks = makeAs('w');
  4573. var asMonths = makeAs('M');
  4574. var asQuarters = makeAs('Q');
  4575. var asYears = makeAs('y');
  4576. function clone$1 () {
  4577. return createDuration(this);
  4578. }
  4579. function get$2 (units) {
  4580. units = normalizeUnits(units);
  4581. return this.isValid() ? this[units + 's']() : NaN;
  4582. }
  4583. function makeGetter(name) {
  4584. return function () {
  4585. return this.isValid() ? this._data[name] : NaN;
  4586. };
  4587. }
  4588. var milliseconds = makeGetter('milliseconds');
  4589. var seconds = makeGetter('seconds');
  4590. var minutes = makeGetter('minutes');
  4591. var hours = makeGetter('hours');
  4592. var days = makeGetter('days');
  4593. var months = makeGetter('months');
  4594. var years = makeGetter('years');
  4595. function weeks () {
  4596. return absFloor(this.days() / 7);
  4597. }
  4598. var round = Math.round;
  4599. var thresholds = {
  4600. ss: 44, // a few seconds to seconds
  4601. s : 45, // seconds to minute
  4602. m : 45, // minutes to hour
  4603. h : 22, // hours to day
  4604. d : 26, // days to month
  4605. M : 11 // months to year
  4606. };
  4607. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  4608. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  4609. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  4610. }
  4611. function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
  4612. var duration = createDuration(posNegDuration).abs();
  4613. var seconds = round(duration.as('s'));
  4614. var minutes = round(duration.as('m'));
  4615. var hours = round(duration.as('h'));
  4616. var days = round(duration.as('d'));
  4617. var months = round(duration.as('M'));
  4618. var years = round(duration.as('y'));
  4619. var a = seconds <= thresholds.ss && ['s', seconds] ||
  4620. seconds < thresholds.s && ['ss', seconds] ||
  4621. minutes <= 1 && ['m'] ||
  4622. minutes < thresholds.m && ['mm', minutes] ||
  4623. hours <= 1 && ['h'] ||
  4624. hours < thresholds.h && ['hh', hours] ||
  4625. days <= 1 && ['d'] ||
  4626. days < thresholds.d && ['dd', days] ||
  4627. months <= 1 && ['M'] ||
  4628. months < thresholds.M && ['MM', months] ||
  4629. years <= 1 && ['y'] || ['yy', years];
  4630. a[2] = withoutSuffix;
  4631. a[3] = +posNegDuration > 0;
  4632. a[4] = locale;
  4633. return substituteTimeAgo.apply(null, a);
  4634. }
  4635. // This function allows you to set the rounding function for relative time strings
  4636. function getSetRelativeTimeRounding (roundingFunction) {
  4637. if (roundingFunction === undefined) {
  4638. return round;
  4639. }
  4640. if (typeof(roundingFunction) === 'function') {
  4641. round = roundingFunction;
  4642. return true;
  4643. }
  4644. return false;
  4645. }
  4646. // This function allows you to set a threshold for relative time strings
  4647. function getSetRelativeTimeThreshold (threshold, limit) {
  4648. if (thresholds[threshold] === undefined) {
  4649. return false;
  4650. }
  4651. if (limit === undefined) {
  4652. return thresholds[threshold];
  4653. }
  4654. thresholds[threshold] = limit;
  4655. if (threshold === 's') {
  4656. thresholds.ss = limit - 1;
  4657. }
  4658. return true;
  4659. }
  4660. function humanize (withSuffix) {
  4661. if (!this.isValid()) {
  4662. return this.localeData().invalidDate();
  4663. }
  4664. var locale = this.localeData();
  4665. var output = relativeTime$1(this, !withSuffix, locale);
  4666. if (withSuffix) {
  4667. output = locale.pastFuture(+this, output);
  4668. }
  4669. return locale.postformat(output);
  4670. }
  4671. var abs$1 = Math.abs;
  4672. function sign(x) {
  4673. return ((x > 0) - (x < 0)) || +x;
  4674. }
  4675. function toISOString$1() {
  4676. // for ISO strings we do not use the normal bubbling rules:
  4677. // * milliseconds bubble up until they become hours
  4678. // * days do not bubble at all
  4679. // * months bubble up until they become years
  4680. // This is because there is no context-free conversion between hours and days
  4681. // (think of clock changes)
  4682. // and also not between days and months (28-31 days per month)
  4683. if (!this.isValid()) {
  4684. return this.localeData().invalidDate();
  4685. }
  4686. var seconds = abs$1(this._milliseconds) / 1000;
  4687. var days = abs$1(this._days);
  4688. var months = abs$1(this._months);
  4689. var minutes, hours, years;
  4690. // 3600 seconds -> 60 minutes -> 1 hour
  4691. minutes = absFloor(seconds / 60);
  4692. hours = absFloor(minutes / 60);
  4693. seconds %= 60;
  4694. minutes %= 60;
  4695. // 12 months -> 1 year
  4696. years = absFloor(months / 12);
  4697. months %= 12;
  4698. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  4699. var Y = years;
  4700. var M = months;
  4701. var D = days;
  4702. var h = hours;
  4703. var m = minutes;
  4704. var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  4705. var total = this.asSeconds();
  4706. if (!total) {
  4707. // this is the same as C#'s (Noda) and python (isodate)...
  4708. // but not other JS (goog.date)
  4709. return 'P0D';
  4710. }
  4711. var totalSign = total < 0 ? '-' : '';
  4712. var ymSign = sign(this._months) !== sign(total) ? '-' : '';
  4713. var daysSign = sign(this._days) !== sign(total) ? '-' : '';
  4714. var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  4715. return totalSign + 'P' +
  4716. (Y ? ymSign + Y + 'Y' : '') +
  4717. (M ? ymSign + M + 'M' : '') +
  4718. (D ? daysSign + D + 'D' : '') +
  4719. ((h || m || s) ? 'T' : '') +
  4720. (h ? hmsSign + h + 'H' : '') +
  4721. (m ? hmsSign + m + 'M' : '') +
  4722. (s ? hmsSign + s + 'S' : '');
  4723. }
  4724. var proto$2 = Duration.prototype;
  4725. proto$2.isValid = isValid$1;
  4726. proto$2.abs = abs;
  4727. proto$2.add = add$1;
  4728. proto$2.subtract = subtract$1;
  4729. proto$2.as = as;
  4730. proto$2.asMilliseconds = asMilliseconds;
  4731. proto$2.asSeconds = asSeconds;
  4732. proto$2.asMinutes = asMinutes;
  4733. proto$2.asHours = asHours;
  4734. proto$2.asDays = asDays;
  4735. proto$2.asWeeks = asWeeks;
  4736. proto$2.asMonths = asMonths;
  4737. proto$2.asQuarters = asQuarters;
  4738. proto$2.asYears = asYears;
  4739. proto$2.valueOf = valueOf$1;
  4740. proto$2._bubble = bubble;
  4741. proto$2.clone = clone$1;
  4742. proto$2.get = get$2;
  4743. proto$2.milliseconds = milliseconds;
  4744. proto$2.seconds = seconds;
  4745. proto$2.minutes = minutes;
  4746. proto$2.hours = hours;
  4747. proto$2.days = days;
  4748. proto$2.weeks = weeks;
  4749. proto$2.months = months;
  4750. proto$2.years = years;
  4751. proto$2.humanize = humanize;
  4752. proto$2.toISOString = toISOString$1;
  4753. proto$2.toString = toISOString$1;
  4754. proto$2.toJSON = toISOString$1;
  4755. proto$2.locale = locale;
  4756. proto$2.localeData = localeData;
  4757. proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
  4758. proto$2.lang = lang;
  4759. // Side effect imports
  4760. // FORMATTING
  4761. addFormatToken('X', 0, 0, 'unix');
  4762. addFormatToken('x', 0, 0, 'valueOf');
  4763. // PARSING
  4764. addRegexToken('x', matchSigned);
  4765. addRegexToken('X', matchTimestamp);
  4766. addParseToken('X', function (input, array, config) {
  4767. config._d = new Date(parseFloat(input, 10) * 1000);
  4768. });
  4769. addParseToken('x', function (input, array, config) {
  4770. config._d = new Date(toInt(input));
  4771. });
  4772. // Side effect imports
  4773. hooks.version = '2.24.0';
  4774. setHookCallback(createLocal);
  4775. hooks.fn = proto;
  4776. hooks.min = min;
  4777. hooks.max = max;
  4778. hooks.now = now;
  4779. hooks.utc = createUTC;
  4780. hooks.unix = createUnix;
  4781. hooks.months = listMonths;
  4782. hooks.isDate = isDate;
  4783. hooks.locale = getSetGlobalLocale;
  4784. hooks.invalid = createInvalid;
  4785. hooks.duration = createDuration;
  4786. hooks.isMoment = isMoment;
  4787. hooks.weekdays = listWeekdays;
  4788. hooks.parseZone = createInZone;
  4789. hooks.localeData = getLocale;
  4790. hooks.isDuration = isDuration;
  4791. hooks.monthsShort = listMonthsShort;
  4792. hooks.weekdaysMin = listWeekdaysMin;
  4793. hooks.defineLocale = defineLocale;
  4794. hooks.updateLocale = updateLocale;
  4795. hooks.locales = listLocales;
  4796. hooks.weekdaysShort = listWeekdaysShort;
  4797. hooks.normalizeUnits = normalizeUnits;
  4798. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  4799. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  4800. hooks.calendarFormat = getCalendarFormat;
  4801. hooks.prototype = proto;
  4802. // currently HTML5 input type only supports 24-hour formats
  4803. hooks.HTML5_FMT = {
  4804. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  4805. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  4806. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  4807. DATE: 'YYYY-MM-DD', // <input type="date" />
  4808. TIME: 'HH:mm', // <input type="time" />
  4809. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  4810. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  4811. WEEK: 'GGGG-[W]WW', // <input type="week" />
  4812. MONTH: 'YYYY-MM' // <input type="month" />
  4813. };
  4814. return hooks;
  4815. })));
  4816. define('moment', ['moment/moment'], function (main) { return main; });
  4817. define('backend',['fast', 'template', 'moment'], function (Fast, Template, Moment) {
  4818. var Backend = {
  4819. api: {
  4820. sidebar: function (params) {
  4821. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  4822. $colorNums = colorArr.length;
  4823. badgeList = {};
  4824. $.each(params, function (k, v) {
  4825. $url = Fast.api.fixurl(k);
  4826. if ($.isArray(v)) {
  4827. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  4828. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  4829. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  4830. } else {
  4831. $nums = v;
  4832. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  4833. $class = 'label';
  4834. }
  4835. //必须nums大于0才显示
  4836. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  4837. });
  4838. $.each(badgeList, function (k, v) {
  4839. var anchor = top.window.$("li a[addtabs][url='" + k + "']");
  4840. if (anchor) {
  4841. top.window.$(".pull-right-container", anchor).html(v);
  4842. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  4843. }
  4844. });
  4845. },
  4846. addtabs: function (url, title, icon) {
  4847. var dom = "a[url='{url}']"
  4848. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  4849. if (leftlink.size() > 0) {
  4850. leftlink.trigger("click");
  4851. } else {
  4852. url = Fast.api.fixurl(url);
  4853. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  4854. if (leftlink.size() > 0) {
  4855. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  4856. leftlink.trigger(event);
  4857. } else {
  4858. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  4859. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  4860. //能找到相对地址
  4861. if (leftlink.size() > 0) {
  4862. icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
  4863. title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
  4864. leftlink.trigger("fa.event.toggleitem");
  4865. }
  4866. var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  4867. if (navnode.size() > 0) {
  4868. navnode.trigger("click");
  4869. } else {
  4870. //追加新的tab
  4871. var id = Math.floor(new Date().valueOf() * Math.random());
  4872. icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
  4873. title = typeof title !== 'undefined' ? title : '';
  4874. top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({
  4875. url: url,
  4876. addtabs: id
  4877. }).addClass("hide").appendTo(top.window.document.body).trigger("click");
  4878. }
  4879. }
  4880. }
  4881. },
  4882. closetabs: function (url) {
  4883. if (typeof url === 'undefined') {
  4884. top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
  4885. } else {
  4886. var dom = "a[url='{url}']"
  4887. var navlink = top.window.$(dom.replace(/\{url\}/, url));
  4888. if (navlink.size() === 0) {
  4889. url = Fast.api.fixurl(url);
  4890. navlink = top.window.$(dom.replace(/\{url\}/, url));
  4891. if (navlink.size() === 0) {
  4892. } else {
  4893. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  4894. navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  4895. //能找到相对地址
  4896. if (navlink.size() === 0) {
  4897. navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  4898. }
  4899. }
  4900. }
  4901. if (navlink.size() > 0 && navlink.attr('addtabs')) {
  4902. top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
  4903. }
  4904. }
  4905. },
  4906. replaceids: function (elem, url) {
  4907. //如果有需要替换ids的
  4908. if (url.indexOf("{ids}") > -1) {
  4909. var ids = 0;
  4910. var tableId = $(elem).data("table-id");
  4911. if (tableId && $("#" + tableId).size() > 0 && $("#" + tableId).data("bootstrap.table")) {
  4912. var Table = require("table");
  4913. ids = Table.api.selectedids($("#" + tableId)).join(",");
  4914. }
  4915. url = url.replace(/\{ids\}/g, ids);
  4916. }
  4917. return url;
  4918. },
  4919. refreshmenu: function () {
  4920. top.window.$(".sidebar-menu").trigger("refresh");
  4921. },
  4922. gettablecolumnbutton: function (options) {
  4923. if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  4924. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  4925. if (tableOptions) {
  4926. var columnObj = null;
  4927. $.each(tableOptions.columns, function (i, columns) {
  4928. $.each(columns, function (j, column) {
  4929. if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
  4930. columnObj = column;
  4931. return false;
  4932. }
  4933. });
  4934. if (columnObj) {
  4935. return false;
  4936. }
  4937. });
  4938. if (columnObj) {
  4939. return columnObj['buttons'][options.buttonIndex];
  4940. }
  4941. }
  4942. }
  4943. return null;
  4944. },
  4945. },
  4946. init: function () {
  4947. //公共代码
  4948. //添加ios-fix兼容iOS下的iframe
  4949. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  4950. $("html").addClass("ios-fix");
  4951. }
  4952. //配置Toastr的参数
  4953. Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
  4954. //点击包含.btn-dialog的元素时弹出dialog
  4955. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  4956. var that = this;
  4957. var options = $.extend({}, $(that).data() || {});
  4958. var url = Backend.api.replaceids(that, $(that).attr('href'));
  4959. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  4960. var button = Backend.api.gettablecolumnbutton(options);
  4961. if (button && typeof button.callback === 'function') {
  4962. options.callback = button.callback;
  4963. }
  4964. if (typeof options.confirm !== 'undefined') {
  4965. Layer.confirm(options.confirm, function (index) {
  4966. Backend.api.open(url, title, options);
  4967. Layer.close(index);
  4968. });
  4969. } else {
  4970. Backend.api.open(url, title, options);
  4971. }
  4972. return false;
  4973. });
  4974. //点击包含.btn-addtabs的元素时新增选项卡
  4975. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  4976. var that = this;
  4977. var options = $.extend({}, $(that).data() || {});
  4978. var url = Backend.api.replaceids(that, $(that).attr('href'));
  4979. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  4980. if (typeof options.confirm !== 'undefined') {
  4981. Layer.confirm(options.confirm, function (index) {
  4982. Backend.api.addtabs(url, title);
  4983. Layer.close(index);
  4984. });
  4985. } else {
  4986. Backend.api.addtabs(url, title);
  4987. }
  4988. return false;
  4989. });
  4990. //点击包含.btn-ajax的元素时发送Ajax请求
  4991. $(document).on('click', '.btn-ajax,.ajaxit', function (e) {
  4992. var that = this;
  4993. var options = $.extend({}, $(that).data() || {});
  4994. if (typeof options.url === 'undefined' && $(that).attr("href")) {
  4995. options.url = $(that).attr("href");
  4996. }
  4997. options.url = Backend.api.replaceids(this, options.url);
  4998. var success = typeof options.success === 'function' ? options.success : null;
  4999. var error = typeof options.error === 'function' ? options.error : null;
  5000. delete options.success;
  5001. delete options.error;
  5002. var button = Backend.api.gettablecolumnbutton(options);
  5003. if (button) {
  5004. if (typeof button.success === 'function') {
  5005. success = button.success;
  5006. }
  5007. if (typeof button.error === 'function') {
  5008. error = button.error;
  5009. }
  5010. }
  5011. //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
  5012. if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
  5013. success = function () {
  5014. $("#" + options.tableId).bootstrapTable('refresh');
  5015. }
  5016. }
  5017. if (typeof options.confirm !== 'undefined') {
  5018. Layer.confirm(options.confirm, function (index) {
  5019. Backend.api.ajax(options, success, error);
  5020. Layer.close(index);
  5021. });
  5022. } else {
  5023. Backend.api.ajax(options, success, error);
  5024. }
  5025. return false;
  5026. });
  5027. $(document).on('click', '.btn-click,.clickit', function (e) {
  5028. var that = this;
  5029. var options = $.extend({}, $(that).data() || {});
  5030. var row = {};
  5031. if (typeof options.tableId !== 'undefined') {
  5032. var index = parseInt(options.rowIndex);
  5033. var data = $("#" + options.tableId).bootstrapTable('getData');
  5034. row = typeof data[index] !== 'undefined' ? data[index] : {};
  5035. }
  5036. var button = Backend.api.gettablecolumnbutton(options);
  5037. var click = typeof button.click === 'function' ? button.click : $.noop;
  5038. if (typeof options.confirm !== 'undefined') {
  5039. Layer.confirm(options.confirm, function (index) {
  5040. click.apply(that, [options, row, button]);
  5041. Layer.close(index);
  5042. });
  5043. } else {
  5044. click.apply(that, [options, row, button]);
  5045. }
  5046. return false;
  5047. });
  5048. //修复含有fixed-footer类的body边距
  5049. if ($(".fixed-footer").size() > 0) {
  5050. $(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
  5051. }
  5052. //修复不在iframe时layer-footer隐藏的问题
  5053. if ($(".layer-footer").size() > 0 && self === top) {
  5054. $(".layer-footer").show();
  5055. }
  5056. //tooltip和popover
  5057. if (!('ontouchstart' in document.documentElement)) {
  5058. $('body').tooltip({selector: '[data-toggle="tooltip"]'});
  5059. }
  5060. $('body').popover({selector: '[data-toggle="popover"]'});
  5061. }
  5062. };
  5063. Backend.api = $.extend(Fast.api, Backend.api);
  5064. //将Template渲染至全局,以便于在子框架中调用
  5065. window.Template = Template;
  5066. //将Moment渲染至全局,以便于在子框架中调用
  5067. window.Moment = Moment;
  5068. //将Backend渲染至全局,以便于在子框架中调用
  5069. window.Backend = Backend;
  5070. Backend.init();
  5071. return Backend;
  5072. });
  5073. define('backend-init',['backend'], function (Backend) {
  5074. });
  5075. //! moment.js locale configuration
  5076. ;(function (global, factory) {
  5077. typeof exports === 'object' && typeof module !== 'undefined'
  5078. && typeof require === 'function' ? factory(require('../moment')) :
  5079. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  5080. factory(global.moment)
  5081. }(this, (function (moment) { 'use strict';
  5082. var zhCn = moment.defineLocale('zh-cn', {
  5083. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  5084. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  5085. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  5086. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  5087. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  5088. longDateFormat : {
  5089. LT : 'HH:mm',
  5090. LTS : 'HH:mm:ss',
  5091. L : 'YYYY/MM/DD',
  5092. LL : 'YYYY年M月D日',
  5093. LLL : 'YYYY年M月D日Ah点mm分',
  5094. LLLL : 'YYYY年M月D日ddddAh点mm分',
  5095. l : 'YYYY/M/D',
  5096. ll : 'YYYY年M月D日',
  5097. lll : 'YYYY年M月D日 HH:mm',
  5098. llll : 'YYYY年M月D日dddd HH:mm'
  5099. },
  5100. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  5101. meridiemHour: function (hour, meridiem) {
  5102. if (hour === 12) {
  5103. hour = 0;
  5104. }
  5105. if (meridiem === '凌晨' || meridiem === '早上' ||
  5106. meridiem === '上午') {
  5107. return hour;
  5108. } else if (meridiem === '下午' || meridiem === '晚上') {
  5109. return hour + 12;
  5110. } else {
  5111. // '中午'
  5112. return hour >= 11 ? hour : hour + 12;
  5113. }
  5114. },
  5115. meridiem : function (hour, minute, isLower) {
  5116. var hm = hour * 100 + minute;
  5117. if (hm < 600) {
  5118. return '凌晨';
  5119. } else if (hm < 900) {
  5120. return '早上';
  5121. } else if (hm < 1130) {
  5122. return '上午';
  5123. } else if (hm < 1230) {
  5124. return '中午';
  5125. } else if (hm < 1800) {
  5126. return '下午';
  5127. } else {
  5128. return '晚上';
  5129. }
  5130. },
  5131. calendar : {
  5132. sameDay : '[今天]LT',
  5133. nextDay : '[明天]LT',
  5134. nextWeek : '[下]ddddLT',
  5135. lastDay : '[昨天]LT',
  5136. lastWeek : '[上]ddddLT',
  5137. sameElse : 'L'
  5138. },
  5139. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  5140. ordinal : function (number, period) {
  5141. switch (period) {
  5142. case 'd':
  5143. case 'D':
  5144. case 'DDD':
  5145. return number + '日';
  5146. case 'M':
  5147. return number + '月';
  5148. case 'w':
  5149. case 'W':
  5150. return number + '周';
  5151. default:
  5152. return number;
  5153. }
  5154. },
  5155. relativeTime : {
  5156. future : '%s内',
  5157. past : '%s前',
  5158. s : '几秒',
  5159. ss : '%d 秒',
  5160. m : '1 分钟',
  5161. mm : '%d 分钟',
  5162. h : '1 小时',
  5163. hh : '%d 小时',
  5164. d : '1 天',
  5165. dd : '%d 天',
  5166. M : '1 个月',
  5167. MM : '%d 个月',
  5168. y : '1 年',
  5169. yy : '%d 年'
  5170. },
  5171. week : {
  5172. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  5173. dow : 1, // Monday is the first day of the week.
  5174. doy : 4 // The week that contains Jan 4th is the first week of the year.
  5175. }
  5176. });
  5177. return zhCn;
  5178. })));
  5179. /*
  5180. * bootstrap-table - v1.11.1 - 2017-02-22
  5181. * https://github.com/wenzhixin/bootstrap-table
  5182. * Copyright (c) 2017 zhixin wen
  5183. * Licensed MIT License
  5184. */
  5185. !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++){
  5186. 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);
  5187. define("bootstrap-table", ["bootstrap"], (function (global) {
  5188. return function () {
  5189. var ret, fn;
  5190. return ret || global.$.fn.bootstrapTable;
  5191. };
  5192. }(this)));
  5193. /**
  5194. * Bootstrap Table Chinese translation
  5195. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  5196. */
  5197. (function ($) {
  5198. 'use strict';
  5199. $.fn.bootstrapTable.locales['zh-CN'] = {
  5200. formatLoadingMessage: function () {
  5201. return '正在努力地加载数据中,请稍候……';
  5202. },
  5203. formatRecordsPerPage: function (pageNumber) {
  5204. return '每页显示 ' + pageNumber + ' 条记录';
  5205. },
  5206. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  5207. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  5208. },
  5209. formatSearch: function () {
  5210. return '搜索';
  5211. },
  5212. formatNoMatches: function () {
  5213. return '没有找到匹配的记录';
  5214. },
  5215. formatPaginationSwitch: function () {
  5216. return '隐藏/显示分页';
  5217. },
  5218. formatRefresh: function () {
  5219. return '刷新';
  5220. },
  5221. formatToggle: function () {
  5222. return '切换';
  5223. },
  5224. formatColumns: function () {
  5225. return '列';
  5226. },
  5227. formatExport: function () {
  5228. return '导出数据';
  5229. },
  5230. formatClearFilters: function () {
  5231. return '清空过滤';
  5232. }
  5233. };
  5234. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  5235. })(jQuery);
  5236. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  5237. return function () {
  5238. var ret, fn;
  5239. return ret || global.$.fn.bootstrapTable.defaults;
  5240. };
  5241. }(this)));
  5242. /*
  5243. tableExport.jquery.plugin
  5244. Version 1.10.3
  5245. Copyright (c) 2015-2019 hhurz, https://github.com/hhurz
  5246. Original Work Copyright (c) 2014 Giri Raj
  5247. Licensed under the MIT License
  5248. */
  5249. var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,m,u){c instanceof String&&(c=String(c));for(var x=c.length,w=0;w<x;w++){var P=c[w];if(m.call(u,P,w,c))return{i:w,v:P}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,m,u){c!=Array.prototype&&c!=Object.prototype&&(c[m]=u.value)};
  5250. $jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,m,u,x){if(m){u=$jscomp.global;c=c.split(".");for(x=0;x<c.length-1;x++){var w=c[x];w in u||(u[w]={});u=u[w]}c=c[c.length-1];x=u[c];m=m(x);m!=x&&null!=m&&$jscomp.defineProperty(u,c,{configurable:!0,writable:!0,value:m})}};
  5251. $jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,u){return $jscomp.findInternal(this,c,u).v}},"es6","es3");
  5252. (function(c){c.fn.tableExport=function(m){function u(b){var d=[];w(b,"thead").each(function(){d.push.apply(d,w(c(this),a.theadSelector).toArray())});return d}function x(b){var d=[];w(b,"tbody").each(function(){d.push.apply(d,w(c(this),a.tbodySelector).toArray())});a.tfootSelector.length&&w(b,"tfoot").each(function(){d.push.apply(d,w(c(this),a.tfootSelector).toArray())});return d}function w(b,d){var a=b[0].tagName,h=b.parents(a).length;return b.find(d).filter(function(){return h===c(this).closest(a).parents(a).length})}
  5253. function P(b){var d=[];c(b).find("thead").first().find("th").each(function(b,a){void 0!==c(a).attr("data-field")?d[b]=c(a).attr("data-field"):d[b]=b.toString()});return d}function L(b){var d="undefined"!==typeof b[0].cellIndex,a="undefined"!==typeof b[0].rowIndex,h=d||a?Ca(b):b.is(":visible"),g=b.data("tableexport-display");d&&"none"!==g&&"always"!==g&&(b=c(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,g=b.data("tableexport-display"));a&&"none"!==g&&"always"!==g&&(g=b.closest("table").data("tableexport-display"));
  5254. return"none"!==g&&(!0===h||"always"===g)}function Ca(b){var a=[];R&&(a=G.filter(function(){var a=!1;this.nodeType===b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex===b[0].rowIndex?a=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex===b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&"undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex===b[0].parentNode.rowIndex&&(a=!0));return a}));return!1===R||0===a.length}function Da(b,d,e){var h=!1;L(b)?0<
  5255. a.ignoreColumn.length&&(-1!==c.inArray(e,a.ignoreColumn)||-1!==c.inArray(e-d,a.ignoreColumn)||Q.length>e&&"undefined"!==typeof Q[e]&&-1!==c.inArray(Q[e],a.ignoreColumn))&&(h=!0):h=!0;return h}function C(b,d,e,h,g){if("function"===typeof g){var l=!1;"function"===typeof a.onIgnoreRow&&(l=a.onIgnoreRow(c(b),e));if(!1===l&&-1===c.inArray(e,a.ignoreRow)&&-1===c.inArray(e-h,a.ignoreRow)&&L(c(b))){var y=w(c(b),d),q=0;y.each(function(b){var a=c(this),d,l=S(this),h=T(this);c.each(E,function(){if(e>=this.s.r&&
  5256. e<=this.e.r&&q>=this.s.c&&q<=this.e.c)for(d=0;d<=this.e.c-this.s.c;++d)g(null,e,q++)});if(!1===Da(a,y.length,b)){if(h||l)l=l||1,E.push({s:{r:e,c:q},e:{r:e+(h||1)-1,c:q+l-1}});g(this,e,q++)}if(l)for(d=0;d<l-1;++d)g(null,e,q++)});c.each(E,function(){if(e>=this.s.r&&e<=this.e.r&&q>=this.s.c&&q<=this.e.c)for(Z=0;Z<=this.e.c-this.s.c;++Z)g(null,e,q++)})}}}function na(b,a,e,c){if("undefined"!==typeof c.images&&(e=c.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect();var d=b.width/b.height,l=
  5257. a.width/a.height,h=b.width,q=b.height,f=19.049976/25.4,k=0;l<=d?(q=Math.min(b.height,a.height),h=a.width*q/a.height):l>d&&(h=Math.min(b.width,a.width),q=a.height*h/a.width);h*=f;q*=f;q<b.height&&(k=(b.height-q)/2);try{c.doc.addImage(e.src,b.textPos.x,b.y+k,h,q)}catch(Ia){}b.textPos.x+=h}}function oa(b,d){if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return H(b.output());if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));
  5258. else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(h){fa(a.fileName+".pdf","data:application/pdf"+(d?"":";base64")+",",d?b.output("blob"):b.output())}}function pa(b,a,e){var d=0;"undefined"!==typeof e&&(d=e.colspan);if(0<=d){for(var c=b.width,l=b.textPos.x,y=a.table.columns.indexOf(a.column),q=1;q<d;q++)c+=a.table.columns[y+q].width;1<d&&("right"===b.styles.halign?l=b.textPos.x+c-b.width:"center"===b.styles.halign&&(l=b.textPos.x+(c-b.width)/2));b.width=c;b.textPos.x=l;"undefined"!==
  5259. typeof e&&1<e.rowspan&&(b.height*=e.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1}function qa(b,a,e){"undefined"!==typeof b&&null!==b&&(b.hasAttribute("data-tableexport-canvas")?(a=(new Date).getTime(),c(b).attr("data-tableexport-canvas",a),e.images[a]={url:'[data-tableexport-canvas="'+a+'"]',src:null}):"undefined"!==a&&null!=
  5260. a&&a.each(function(){if(c(this).is("img")){var a=ra(this.src);e.images[a]={url:this.src,src:this.src}}qa(b,c(this).children(),e)}))}function Ea(b,a){function d(b){if(b.url)if(b.src){var d=new Image;h=++g;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 c=document.createElement("canvas"),e=c.getContext("2d");c.width=d.width;c.height=d.height;e.drawImage(d,0,0);
  5261. b.src=c.toDataURL("image/png")}--g||a(h)};d.src=b.url}else{var e=c(b.url);e.length&&(h=++g,html2canvas(e[0]).then(function(d){b.src=d.toDataURL("image/png");--g||a(h)}))}}var h=0,g=0;if("undefined"!==typeof b.images)for(var l in b.images)b.images.hasOwnProperty(l)&&d(b.images[l]);(b=g)||(a(h),b=void 0);return b}function sa(b,d,e){d.each(function(){if(c(this).is("div")){var d=aa(I(this,"background-color"),[255,255,255]),g=aa(I(this,"border-top-color"),[0,0,0]),l=ba(this,"border-top-width",a.jspdf.unit),
  5262. y=this.getBoundingClientRect(),q=this.offsetLeft*e.wScaleFactor,f=this.offsetTop*e.hScaleFactor,k=y.width*e.wScaleFactor;y=y.height*e.hScaleFactor;e.doc.setDrawColor.apply(void 0,g);e.doc.setFillColor.apply(void 0,d);e.doc.setLineWidth(l);e.doc.rect(b.x+q,b.y+f,k,y,l?"FD":"F")}else c(this).is("img")&&(d=ra(this.src),na(b,this,d,e));sa(b,c(this).children(),e)})}function ta(b,d,e){if("function"===typeof e.onAutotableText)e.onAutotableText(e.doc,b,d);else{var h=b.textPos.x,g=b.textPos.y,l={halign:b.styles.halign,
  5263. valign:b.styles.valign};if(d.length){for(d=d[0];d.previousSibling;)d=d.previousSibling;for(var y=!1,q=!1;d;){var f=d.innerText||d.textContent||"",k=f.length&&" "===f[0]?" ":"",m=1<f.length&&" "===f[f.length-1]?" ":"";!0!==a.preserve.leadingWS&&(f=k+ha(f));!0!==a.preserve.trailingWS&&(f=ia(f)+m);c(d).is("br")&&(h=b.textPos.x,g+=e.doc.internal.getFontSize());c(d).is("b")?y=!0:c(d).is("i")&&(q=!0);(y||q)&&e.doc.setFontType(y&&q?"bolditalic":y?"bold":"italic");if(k=e.doc.getStringUnitWidth(f)*e.doc.internal.getFontSize()){"linebreak"===
  5264. b.styles.overflow&&h>b.textPos.x&&h+k>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(f.charAt(0))&&(m=f.charAt(0),k=e.doc.getStringUnitWidth(m)*e.doc.internal.getFontSize(),h+k<=b.textPos.x+b.width&&(e.doc.autoTableText(m,h,g,l),f=f.substring(1,f.length)),k=e.doc.getStringUnitWidth(f)*e.doc.internal.getFontSize()),h=b.textPos.x,g+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;f.length&&h+k>b.textPos.x+b.width;)f=f.substring(0,f.length-1),k=e.doc.getStringUnitWidth(f)*e.doc.internal.getFontSize();
  5265. e.doc.autoTableText(f,h,g,l);h+=k}if(y||q)c(d).is("b")?y=!1:c(d).is("i")&&(q=!1),e.doc.setFontType(y||q?y?"bold":"italic":"normal");d=d.nextSibling}b.textPos.x=h;b.textPos.y=g}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,l)}}function ca(b,a,c){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),c)}function ha(b){return null==b?"":b.toString().replace(/^\s+/,"")}function ia(b){return null==b?"":b.toString().replace(/\s+$/,
  5266. "")}function ja(b){b=ca(b||"0",a.numbers.html.thousandsSeparator,"");b=ca(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Fa(b){-1<b.indexOf("%")?(b=ja(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function B(b,d,e){var h="";if(null!==b){var g=c(b);if(g[0].hasAttribute("data-tableexport-canvas"))var l="";else if(g[0].hasAttribute("data-tableexport-value"))l=(l=g.data("tableexport-value"))?l+"":"";else if(l=g.html(),"function"===typeof a.onCellHtmlData)l=
  5267. a.onCellHtmlData(g,d,e,l);else if(""!==l){var f=c.parseHTML(l),q=0,k=0;l="";c.each(f,function(){if(c(this).is("input"))l+=g.find("input").eq(q++).val();else if(c(this).is("select"))l+=g.find("select option:selected").eq(k++).text();else if(c(this).is("br"))l+="<br>";else if("undefined"===typeof c(this).html())l+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl")&&0===c(b).parents(".detail-view").length)l+=c(this).html()})}if(!0===a.htmlContent)h=c.trim(l);
  5268. else if(l&&""!==l)if(""!==c(b).data("tableexport-cellformat")){var m=l.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi,"\u2060"),n=c("<div/>").html(m).contents();f=!1;m="";c.each(n.text().split("\u2028"),function(b,d){0<b&&(m+=" ");!0!==a.preserve.leadingWS&&(d=ha(d));m+=!0!==a.preserve.trailingWS?ia(d):d});c.each(m.split("\u2060"),function(b,d){0<b&&(h+="\n");!0!==a.preserve.leadingWS&&(d=ha(d));!0!==a.preserve.trailingWS&&(d=ia(d));h+=d.replace(/\u00AD/g,"")});h=h.replace(/\u00A0/g," ");if("json"===
  5269. a.type||"excel"===a.type&&"xmlss"===a.mso.fileFormat||!1===a.numbers.output)f=ja(h),!1!==f&&(h=Number(f));else if(a.numbers.html.decimalMark!==a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!==a.numbers.output.thousandsSeparator)if(f=ja(h),!1!==f){n=(""+f.substr(0>f?1:0)).split(".");1===n.length&&(n[1]="");var p=3<n[0].length?n[0].length%3:0;h=(0>f?"-":"")+(a.numbers.output.thousandsSeparator?(p?n[0].substr(0,p)+a.numbers.output.thousandsSeparator:"")+n[0].substr(p).replace(/(\d{3})(?=\d)/g,
  5270. "$1"+a.numbers.output.thousandsSeparator):n[0])+(n[1].length?a.numbers.output.decimalMark+n[1]:"")}}else h=l;!0===a.escape&&(h=escape(h));"function"===typeof a.onCellData&&(h=a.onCellData(g,d,e,h))}return h}function ua(b){return 0<b.length&&!0===a.preventInjection&&0<="=+-@".indexOf(b.charAt(0))?"'"+b:b}function Ga(b,a,c){return a+"-"+c.toLowerCase()}function aa(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&(a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function va(b){var a=
  5271. I(b,"text-align"),c=I(b,"font-weight"),h=I(b,"font-style"),g="";"start"===a&&(a="rtl"===I(b,"direction")?"right":"left");700<=c&&(g="bold");"italic"===h&&(g+=h);""===g&&(g="normal");a={style:{align:a,bcolor:aa(I(b,"background-color"),[255,255,255]),color:aa(I(b,"color"),[0,0,0]),fstyle:g},colspan:S(b),rowspan:T(b)};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function S(b){var a=c(b).data("tableexport-colspan");"undefined"===typeof a&&c(b).is("[colspan]")&&
  5272. (a=c(b).attr("colspan"));return parseInt(a)||0}function T(b){var a=c(b).data("tableexport-rowspan");"undefined"===typeof a&&c(b).is("[rowspan]")&&(a=c(b).attr("rowspan"));return parseInt(a)||0}function I(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,Ga),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(e){}return""}function ba(b,a,c){a=I(b,a).match(/\d+/);if(null!==a){a=a[0];b=b.parentElement;var d=document.createElement("div");
  5273. d.style.overflow="hidden";d.style.visibility="hidden";b.appendChild(d);d.style.width=100+c;c=100/d.offsetWidth;b.removeChild(d);return a*c}return 0}function Ha(a){for(var b=new ArrayBuffer(a.length),c=new Uint8Array(b),h=0;h!==a.length;++h)c[h]=a.charCodeAt(h)&255;return b}function ra(a){var b=0,c;if(0===a.length)return b;var h=0;for(c=a.length;h<c;h++){var g=a.charCodeAt(h);b=(b<<5)-b+g;b|=0}return b}function J(b,d,c,h,g,l){var e=!0;"function"===typeof a.onBeforeSaveToFile&&(e=a.onBeforeSaveToFile(b,
  5274. d,c,h,g),"boolean"!==typeof e&&(e=!0));if(e)try{if(wa=new Blob([b],{type:c+";charset="+h}),saveAs(wa,d,!1===l),"function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(b,d)}catch(q){fa(d,"data:"+c+(h.length?";charset="+h:"")+(g.length?";"+g:"")+","+(l?"\ufeff":""),b)}}function fa(b,d,c){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([c]),b);else if(!1!==b&&(0<e.indexOf("MSIE ")||e.match(/Trident.*rv\:11\./))){if(d=document.createElement("iframe")){document.body.appendChild(d);
  5275. d.setAttribute("style","display:none");d.contentDocument.open("txt/plain","replace");d.contentDocument.write(c);d.contentDocument.close();d.contentDocument.focus();switch(b.substr(b.lastIndexOf(".")+1)){case "doc":case "json":case "png":case "pdf":case "xls":case "xlsx":b+=".txt"}d.contentDocument.execCommand("SaveAs",!0,b);document.body.removeChild(d)}}else{var g=document.createElement("a");if(g){var l=null;g.style.display="none";!1!==b?g.download=b:g.target="_blank";"object"===typeof c?(window.URL=
  5276. window.URL||window.webkitURL,e=[],e.push(c),l=window.URL.createObjectURL(new Blob(e,{type:d})),g.href=l):0<=d.toLowerCase().indexOf("base64,")?g.href=d+H(c):g.href=d+encodeURIComponent(c);document.body.appendChild(g);if(document.createEvent)null===da&&(da=document.createEvent("MouseEvents")),da.initEvent("click",!0,!1),g.dispatchEvent(da);else if(document.createEventObject)g.fireEvent("onclick");else if("function"===typeof g.onclick)g.onclick();setTimeout(function(){l&&window.URL.revokeObjectURL(l);
  5277. document.body.removeChild(g);if("function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(c,b)},100)}}}function H(a){var b,c="",h=0;if("string"===typeof a){a=a.replace(/\x0d\x0a/g,"\n");var g="";for(b=0;b<a.length;b++){var l=a.charCodeAt(b);128>l?g+=String.fromCharCode(l):(127<l&&2048>l?g+=String.fromCharCode(l>>6|192):(g+=String.fromCharCode(l>>12|224),g+=String.fromCharCode(l>>6&63|128)),g+=String.fromCharCode(l&63|128))}a=g}for(;h<a.length;){var f=a.charCodeAt(h++);g=a.charCodeAt(h++);b=a.charCodeAt(h++);
  5278. l=f>>2;f=(f&3)<<4|g>>4;var q=(g&15)<<2|b>>6;var k=b&63;isNaN(g)?q=k=64:isNaN(b)&&(k=64);c=c+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)}return c}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,exportHiddenCells:!1,
  5279. fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,
  5280. onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml",onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:""},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onIgnoreRow:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",
  5281. defaultStyle:{font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,trailingWS:!1},preventInjection:!0,tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},K={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],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],
  5282. b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},v=this,
  5283. da=null,r=[],t=[],n=0,p="",Q=[],E=[],wa,G=[],R=!1;c.extend(!0,a,m);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&&(a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&
  5284. "undefined"===a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&&"undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";Q=P(v);if("csv"===a.type||"tsv"===a.type||
  5285. "txt"===a.type){var M="",W=0;E=[];n=0;var ka=function(b,d,e){b.each(function(){p="";C(this,d,n,e+b.length,function(b,c,d){var g=p,e="";if(null!==b)if(b=B(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"===a.type)b instanceof Date&&b.toLocaleString(),e=ca(c,"\t"," ");else if(b instanceof Date)e=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(e=ua(c),e=ca(e,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=e.indexOf(a.csvSeparator)||/[\r\n ]/g.test(e))e=a.csvEnclosure+e+a.csvEnclosure;p=g+(e+
  5286. ("tsv"===a.type?"\t":a.csvSeparator))});p=c.trim(p).substring(0,p.length-1);0<p.length&&(0<M.length&&(M+="\n"),M+=p);n++});return b.length};W+=ka(c(v).find("thead").first().find(a.theadSelector),"th,td",W);w(c(v),"tbody").each(function(){W+=ka(w(c(this),a.tbodySelector),"td,th",W)});a.tfootSelector.length&&ka(c(v).find("tfoot").first().find(a.tfootSelector),"td,th",W);M+="\n";if("string"===a.outputMode)return M;if("base64"===a.outputMode)return H(M);if("window"===a.outputMode){fa(!1,"data:text/"+
  5287. ("csv"===a.type?"csv":"plain")+";charset=utf-8,",M);return}J(M,a.fileName+"."+a.type,"text/"+("csv"===a.type?"csv":"plain"),"utf-8","","csv"===a.type&&a.csvUseBOM)}else if("sql"===a.type){n=0;E=[];var A="INSERT INTO `"+a.tableName+"` (";r=u(c(v));c(r).each(function(){C(this,"th,td",n,r.length,function(a,c,e){A+="'"+B(a,c,e)+"',"});n++;A=c.trim(A).substring(0,A.length-1)});A+=") VALUES ";t=x(c(v));c(t).each(function(){p="";C(this,"td,th",n,r.length+t.length,function(a,c,e){p+="'"+B(a,c,e)+"',"});3<
  5288. p.length&&(A+="("+p,A=c.trim(A).substring(0,A.length-1),A+="),");n++});A=c.trim(A).substring(0,A.length-1);A+=";";if("string"===a.outputMode)return A;if("base64"===a.outputMode)return H(A);J(A,a.fileName+".sql","application/sql","utf-8","",!1)}else if("json"===a.type){var U=[];E=[];r=u(c(v));c(r).each(function(){var a=[];C(this,"th,td",n,r.length,function(b,c,f){a.push(B(b,c,f))});U.push(a)});var la=[];t=x(c(v));c(t).each(function(){var a={},d=0;C(this,"td,th",n,r.length+t.length,function(b,c,g){U.length?
  5289. a[U[U.length-1][d]]=B(b,c,g):a[d]=B(b,c,g);d++});!1===c.isEmptyObject(a)&&la.push(a);n++});m="";m="head"===a.jsonScope?JSON.stringify(U):"data"===a.jsonScope?JSON.stringify(la):JSON.stringify({header:U,data:la});if("string"===a.outputMode)return m;if("base64"===a.outputMode)return H(m);J(m,a.fileName+".json","application/json","utf-8","base64",!1)}else if("xml"===a.type){n=0;E=[];var N='<?xml version="1.0" encoding="utf-8"?>';N+="<tabledata><fields>";r=u(c(v));c(r).each(function(){C(this,"th,td",
  5290. n,r.length,function(a,c,e){N+="<field>"+B(a,c,e)+"</field>"});n++});N+="</fields><data>";var xa=1;t=x(c(v));c(t).each(function(){var a=1;p="";C(this,"td,th",n,r.length+t.length,function(b,c,f){p+="<column-"+a+">"+B(b,c,f)+"</column-"+a+">";a++});0<p.length&&"<column-1></column-1>"!==p&&(N+='<row id="'+xa+'">'+p+"</row>",xa++);n++});N+="</data></tabledata>";if("string"===a.outputMode)return N;if("base64"===a.outputMode)return H(N);J(N,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===
  5291. a.type&&"xmlss"===a.mso.fileFormat){var ma=[],z=[];c(v).filter(function(){return L(c(this))}).each(function(){function b(a,b,d){var e=[];c(a).each(function(){var b=0,g=0;p="";C(this,"td,th",n,d+a.length,function(a,d,l){if(null!==a){var f="";d=B(a,d,l);l="String";if(!1!==jQuery.isNumeric(d))l="Number";else{var h=Fa(d);!1!==h&&(d=h,l="Number",f+=' ss:StyleID="pct1"')}"Number"!==l&&(d=d.replace(/\n/g,"<br>"));h=S(a);a=T(a);c.each(e,function(){if(n>=this.s.r&&n<=this.e.r&&g>=this.s.c&&g<=this.e.c)for(var a=
  5292. 0;a<=this.e.c-this.s.c;++a)g++,b++});if(a||h)a=a||1,h=h||1,e.push({s:{r:n,c:g},e:{r:n+a-1,c:g+h-1}});1<h&&(f+=' ss:MergeAcross="'+(h-1)+'"',g+=h-1);1<a&&(f+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(f+=' ss:Index="'+(g+1)+'"',b=0);p+="<Cell"+f+'><Data ss:Type="'+l+'">'+c("<div />").text(d).html()+"</Data></Cell>\r";g++}});0<p.length&&(F+='<Row ss:AutoFitHeight="0">\r'+p+"</Row>\r");n++});return a.length}var d=c(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?
  5293. e=a.mso.worksheetName+" "+(z.length+1):"undefined"!==typeof a.mso.worksheetName[z.length]&&(e=a.mso.worksheetName[z.length]);e.length||(e=d.find("caption").text()||"");e.length||(e="Table "+(z.length+1));e=c.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));z.push(c("<div />").text(e).html());!1===a.exportHiddenCells&&(G=d.find("tr, th, td").filter(":hidden"),R=0<G.length);n=0;Q=P(this);F="<Table>\r";var f=b(u(d),"th,td",f);b(x(d),"td,th",f);F+="</Table>\r";ma.push(F)});m={};for(var D={},k,O,
  5294. V=0,Z=z.length;V<Z;V++)k=z[V],O=m[k],O=m[k]=null==O?1:O+1,2===O&&(z[D[k]]=z[D[k]].substring(0,29)+"-1"),1<m[k]?z[V]=z[V].substring(0,29)+"-"+m[k]:D[k]=V;m='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+
  5295. (new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';
  5296. for(D=0;D<ma.length;D++)m+='<Worksheet ss:Name="'+z[D]+'" ss:RightToLeft="'+(a.mso.rtl?"1":"0")+'">\r'+ma[D],m=a.mso.rtl?m+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':m+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',m+="</Worksheet>\r";m+="</Workbook>\r";if("string"===a.outputMode)return m;if("base64"===a.outputMode)return H(m);J(m,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===
  5297. a.type&&"xlsx"===a.mso.fileFormat){z=[];var ya=XLSX.utils.book_new();c(v).filter(function(){return L(c(this))}).each(function(){var b=c(this),d=XLSX.utils.table_to_sheet(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(z.length+1):"undefined"!==typeof a.mso.worksheetName[z.length]&&(e=a.mso.worksheetName[z.length]);e.length||(e=b.find("caption").text()||"");e.length||(e="Table "+(z.length+1));e=c.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,
  5298. 31));z.push(e);XLSX.utils.book_append_sheet(ya,d,e)});m=XLSX.write(ya,{type:"binary",bookType:a.mso.fileFormat,bookSST:!1});J(Ha(m),a.fileName+"."+a.mso.fileFormat,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","UTF-8","",!1)}else if("excel"===a.type||"xls"===a.type||"word"===a.type||"doc"===a.type){m="excel"===a.type||"xls"===a.type?"excel":"word";D="excel"===m?"xls":"doc";k='xmlns:x="urn:schemas-microsoft-com:office:'+m+'"';var F="",X="";c(v).filter(function(){return L(c(this))}).each(function(){var b=
  5299. c(this);""===X&&(X=a.mso.worksheetName||b.find("caption").text()||"Table",X=c.trim(X.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)));!1===a.exportHiddenCells&&(G=b.find("tr, th, td").filter(":hidden"),R=0<G.length);n=0;E=[];Q=P(this);F+="<table><thead>";r=u(b);c(r).each(function(){var b=c(this);p="";C(this,"th,td",n,r.length,function(c,d,g){if(null!==c){var e="",f=document.defaultView.getComputedStyle(c,null),h=document.defaultView.getComputedStyle(b[0],null);p+="<th";for(var k in a.mso.styles){var m=
  5300. f[a.mso.styles[k]];""===m&&(m=h[a.mso.styles[k]]);""!==m&&"0px none rgb(0, 0, 0)"!==m&&"rgba(0, 0, 0, 0)"!==m&&(e+=""===e?'style="':";",e+=a.mso.styles[k]+":"+m)}""!==e&&(p+=" "+e+'"');e=S(c);0<e&&(p+=' colspan="'+e+'"');e=T(c);0<e&&(p+=' rowspan="'+e+'"');p+=">"+B(c,d,g)+"</th>"}});0<p.length&&(F+="<tr>"+p+"</tr>");n++});F+="</thead><tbody>";t=x(b);c(t).each(function(){var b=c(this);p="";C(this,"td,th",n,r.length+t.length,function(d,f,g){if(null!==d){var e=B(d,f,g),h="",k=c(d).data("tableexport-msonumberformat"),
  5301. m=document.defaultView.getComputedStyle(d,null),n=document.defaultView.getComputedStyle(b[0],null);"undefined"===typeof k&&"function"===typeof a.mso.onMsoNumberFormat&&(k=a.mso.onMsoNumberFormat(d,f,g));"undefined"!==typeof k&&""!==k&&(h="style=\"mso-number-format:'"+k+"'");for(var r in a.mso.styles)k=m[a.mso.styles[r]],""===k&&(k=n[a.mso.styles[r]]),""!==k&&"0px none rgb(0, 0, 0)"!==k&&"rgba(0, 0, 0, 0)"!==k&&(h+=""===h?'style="':";",h+=a.mso.styles[r]+":"+k);p+="<td";""!==h&&(p+=" "+h+'"');f=S(d);
  5302. 0<f&&(p+=' colspan="'+f+'"');d=T(d);0<d&&(p+=' rowspan="'+d+'"');"string"===typeof e&&""!==e&&(e=ua(e),e=e.replace(/\n/g,"<br>"));p+=">"+e+"</td>"}});0<p.length&&(F+="<tr>"+p+"</tr>");n++});a.displayTableName&&(F+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+B(c("<p>"+a.tableName+"</p>"))+"</td></tr>");F+="</tbody></table>"});k='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+k+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+
  5303. m+'; charset=UTF-8">')+"<head>";"excel"===m&&(k+="\x3c!--[if gte mso 9]>",k+="<xml>",k+="<x:ExcelWorkbook>",k+="<x:ExcelWorksheets>",k+="<x:ExcelWorksheet>",k+="<x:Name>",k+=X,k+="</x:Name>",k+="<x:WorksheetOptions>",k+="<x:DisplayGridlines/>",a.mso.rtl&&(k+="<x:DisplayRightToLeft/>"),k+="</x:WorksheetOptions>",k+="</x:ExcelWorksheet>",k+="</x:ExcelWorksheets>",k+="</x:ExcelWorkbook>",k+="</xml>",k+="<![endif]--\x3e");k+="<style>";k+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+
  5304. a.mso.pageOrientation+"; }";k+="@page Section1 {size:"+K[a.mso.pageFormat][0]+"pt "+K[a.mso.pageFormat][1]+"pt";k+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";k+="div.Section1 {page:Section1;}";k+="@page Section2 {size:"+K[a.mso.pageFormat][1]+"pt "+K[a.mso.pageFormat][0]+"pt";k+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";k+="div.Section2 {page:Section2;}";
  5305. k+="br {mso-data-placement:same-cell;}";k+="</style>";k+="</head>";k+="<body>";k+='<div class="Section'+("landscape"===a.mso.pageOrientation?"2":"1")+'">';k+=F;k+="</div>";k+="</body>";k+="</html>";if("string"===a.outputMode)return k;if("base64"===a.outputMode)return H(k);J(k,a.fileName+"."+D,"application/vnd.ms-"+m,"","base64",!1)}else if("png"===a.type)html2canvas(c(v)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length),f=new Uint8Array(e),g=0;g<c.length;g++)f[g]=
  5306. c.charCodeAt(g);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return H(b);"window"===a.outputMode?window.open(b):J(e,a.fileName+".png","image/png","","",!1)});else if("pdf"===a.type)if(!0===a.pdfmake.enabled){m=[];var za=[];n=0;E=[];D=function(a,d,e){var b=0;c(a).each(function(){var a=[];C(this,d,n,e,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=S(b),g=T(b);b=B(b,c,d)||" ";1<e||1<g?a.push({colSpan:e||1,rowSpan:g||1,text:b}):a.push(b)}else a.push(" ")});a.length&&za.push(a);
  5307. b<a.length&&(b=a.length);n++});return b};r=u(c(this));k=D(r,"th,td",r.length);for(O=m.length;O<k;O++)m.push("*");t=x(c(this));D(t,"th,td",r.length+t.length);m={content:[{table:{headerRows:r.length,widths:m,body:za}}]};c.extend(!0,m,a.pdfmake.docDefinition);pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}};c.extend(!0,pdfMake.fonts,a.pdfmake.fonts);pdfMake.createPdf(m).getBuffer(function(b){J(b,a.fileName+
  5308. ".pdf","application/pdf","","",!1)})}else if(!1===a.jspdf.autotable){m={dim:{w:ba(c(v).first().get(0),"width","mm"),h:ba(c(v).first().get(0),"height","mm")},pagesplit:!1};var Aa=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);Aa.addHTML(c(v).first(),a.jspdf.margins.left,a.jspdf.margins.top,m,function(){oa(Aa,!1)})}else{var f=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var ea="",Y="",Ba=0;c(v).each(function(){if(L(c(this))){var a=
  5309. ba(c(this).get(0),"width","pt");if(a>Ba){a>K.a0[0]&&(ea="a0",Y="l");for(var d in K)K.hasOwnProperty(d)&&K[d][1]>a&&(ea=d,Y="l",K[d][0]>a&&(Y="p"));Ba=a}}});a.jspdf.format=""===ea?"a4":ea;a.jspdf.orientation=""===Y?"w":Y}if(null==f.doc&&(f.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),f.wScaleFactor=1,f.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(f.doc);!0===f.outputImages&&(f.images={});"undefined"!==typeof f.images&&(c(v).filter(function(){return L(c(this))}).each(function(){var b=
  5310. 0;E=[];!1===a.exportHiddenCells&&(G=c(this).find("tr, th, td").filter(":hidden"),R=0<G.length);r=u(c(this));t=x(c(this));c(t).each(function(){C(this,"td,th",r.length+b,r.length+t.length,function(a){qa(a,c(a).children(),f)});b++})}),r=[],t=[]);Ea(f,function(){c(v).filter(function(){return L(c(this))}).each(function(){var b;n=0;E=[];!1===a.exportHiddenCells&&(G=c(this).find("tr, th, td").filter(":hidden"),R=0<G.length);Q=P(this);f.columns=[];f.rows=[];f.teCells={};if("function"===typeof f.onTable&&
  5311. !1===f.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var d=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=f;d.margin={};c.extend(!0,d.margin,a.jspdf.margins);d.tableExport=f;"function"!==typeof d.beforePageContent&&(d.beforePageContent=function(a){if(1===a.pageCount){var b=a.table.rows.concat(a.table.headerRow);c.each(b,function(){0<this.height&&(this.height+=(2-1.15)/2*this.styles.fontSize,a.table.height+=(2-1.15)/2*this.styles.fontSize)})}});"function"!==typeof d.createdHeaderCell&&
  5312. (d.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!==typeof f.columns[b.column.dataKey]){var e=f.columns[b.column.dataKey];if("undefined"!==typeof e.rect){a.contentWidth=e.rect.width;if("undefined"===typeof f.heightRatio||0===f.heightRatio){var g=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;f.heightRatio=a.styles.rowHeight/g}g=b.row.raw[b.column.dataKey].rect.height*
  5313. f.heightRatio;g>a.styles.rowHeight&&(a.styles.rowHeight=g)}a.styles.halign="inherit"===d.headerStyles.halign?"center":d.headerStyles.halign;a.styles.valign=d.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===d.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});
  5314. "function"!==typeof d.createdCell&&(d.createdCell=function(a,b){b=f.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===d.styles.halign?"center":d.styles.halign;a.styles.valign=d.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===d.styles.halign&&(a.styles.halign=b.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===d.styles.fontStyle&&
  5315. (a.styles.fontStyle=b.style.fstyle))});"function"!==typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=f.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?pa(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var d=f.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof d&&d.isCanvas))pa(a,b,d)&&(f.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!==typeof d&&"undefined"!==typeof d.elements&&
  5316. d.elements.length?(b=a.height/d.rect.height,b>f.hScaleFactor&&(f.hScaleFactor=b),f.wScaleFactor=a.width/d.rect.width,b=a.textPos.y,sa(a,d.elements,f),a.textPos.y=b,ta(a,d.elements,f)):ta(a,{},f));else{d=d.elements[0];var e=c(d).attr("data-tableexport-canvas"),g=d.getBoundingClientRect();a.width=g.width*f.wScaleFactor;a.height=g.height*f.hScaleFactor;b.row.height=a.height;na(a,d,e,f)}return!1});f.headerrows=[];r=u(c(this));c(r).each(function(){b=0;f.headerrows[n]=[];C(this,"th,td",n,r.length,function(a,
  5317. c,d){var e=va(a);e.title=B(a,c,d);e.key=b++;e.rowIndex=n;f.headerrows[n].push(e)});n++});if(0<n)for(var e=n-1;0<=e;)c.each(f.headerrows[e],function(){var a=this;0<e&&null===this.rect&&(a=f.headerrows[e-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&f.columns.push(a)}),e=0<f.columns.length?-1:e-1;var h=0;t=[];t=x(c(this));c(t).each(function(){var a=[];b=0;C(this,"td,th",n,r.length+t.length,function(d,e,g){if("undefined"===typeof f.columns[b]){var k=
  5318. {title:"",key:b,style:{hidden:!0}};f.columns.push(k)}"undefined"!==typeof d&&null!==d?(k=va(d),k.isCanvas=d.hasAttribute("data-tableexport-canvas"),k.elements=k.isCanvas?c(d):c(d).children()):(k=c.extend(!0,{},f.teCells[h+":"+(b-1)]),k.colspan=-1);f.teCells[h+":"+b++]=k;a.push(B(d,e,g))});a.length&&(f.rows.push(a),h++);n++});if("function"===typeof f.onBeforeAutotable)f.onBeforeAutotable(c(this),f.columns,f.rows,d);f.doc.autoTable(f.columns,f.rows,d);if("function"===typeof f.onAfterAutotable)f.onAfterAutotable(c(this),
  5319. d);a.jspdf.autotable.startY=f.doc.autoTableEndPosY()+d.margin.top});oa(f.doc,"undefined"!==typeof f.images&&!1===jQuery.isEmptyObject(f.images));"undefined"!==typeof f.headerrows&&(f.headerrows.length=0);"undefined"!==typeof f.columns&&(f.columns.length=0);"undefined"!==typeof f.rows&&(f.rows.length=0);delete f.doc;f.doc=null})}return this}})(jQuery);
  5320. define("tableexport", ["jquery"], (function (global) {
  5321. return function () {
  5322. var ret, fn;
  5323. return ret || global.$.fn.extend;
  5324. };
  5325. }(this)));
  5326. /*
  5327. * bootstrap-table - v1.11.1 - 2017-02-22
  5328. * https://github.com/wenzhixin/bootstrap-table
  5329. * Copyright (c) 2017 zhixin wen
  5330. * Licensed MIT License
  5331. */
  5332. !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);
  5333. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  5334. return function () {
  5335. var ret, fn;
  5336. return ret || global.$.fn.bootstrapTable.defaults;
  5337. };
  5338. }(this)));
  5339. /**
  5340. * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
  5341. * v1.5.2
  5342. *
  5343. * Copyright 2013, Moxiecode Systems AB
  5344. * Released under GPL License.
  5345. *
  5346. * License: http://www.plupload.com/license
  5347. * Contributing: http://www.plupload.com/contributing
  5348. *
  5349. * Date: 2016-11-23
  5350. */
  5351. !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 y(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var w=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:w,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:y}}),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.split(/\s*,\s*/),o=0;o<n.length;o++){if("*"===n[o])return[];if(a=s.mimes[n[o]],a&&-1===e.inArray(a,u)&&u.push(a),i&&/^\w+$/.test(n[o]))u.push("."+n[o]);else if(!a)return[]}return u},mimes2exts:function(t){var i=this,n=[];return e.each(t,function(t){if("*"===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;
  5352. 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",[],function(){var e=function(t,i){for(var n=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=n.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[n[r]]=u[r]);if(!a.scheme){i&&"string"!=typeof i||(i=e(i||document.location.href)),a.scheme=i.scheme,a.host=i.host,a.port=i.port;var c="";/^[^\/]/.test(a.path)&&(c=i.path,c=/\/[^\/]*\.[^\/]*$/.test(c)?c.replace(/\/[^\/]+$/,"/"):c.replace(/\/?$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var i={http:80,https:443},n="object"==typeof t?t:e(t);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},i=function(t){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),i(e())===i(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:i}}),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:y,password:w,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,y,w,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(y=u||l.user,w=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);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"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(){d.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.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;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();
  5353. 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"},y={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=y[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,w.type)}function h(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t(this.result)},n.onerror=function(){r.trigger("error",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t(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),y=g=v=w=null,b=!1}var g,x,v,y,w,E=this,b=!1,R=!0;t.extend(this,{loadFromBlob:function(e){var t=this,n=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!n.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return w=e,e.isDetached()?(y=e.getSource(),m.call(this,y),void 0):(h.call(this,e.getSource(),function(e){r&&(y=l(e)),m.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,w=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?y=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&y&&i.can("access_image_binary")&&(x=new a(y)),t={width:e().width||0,height:e().height||0,type:w.type||u.getFileMime(w.name),size:y&&y.length||w.size||0,name:w.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:w.name||"",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:w.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 y||(y=l(E.getAsDataURL(e,t))),y;if("image/jpeg"!==e)y=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")}y=l(i),x&&(y=x.stripHeaders(y),R&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),y=x.writeHeaders(y)),x.purge(),x=null)}return b=!1,y},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 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)}),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)
  5354. }),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 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=y.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,y=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"),y.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)});
  5355. define("../libs/plupload/js/moxie.min", function(){});
  5356. /**
  5357. * Plupload - multi-runtime File Uploader
  5358. * v2.2.1
  5359. *
  5360. * Copyright 2013, Moxiecode Systems AB
  5361. * Released under GPL License.
  5362. *
  5363. * License: http://www.plupload.com/license
  5364. * Contributing: http://www.plupload.com/contributing
  5365. *
  5366. * Date: 2016-11-23
  5367. */
  5368. !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>0&&(n.slice_blob=!0),l.isEmptyObj(e.resize)&&e.multipart||(n.send_binary_string=!0),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.2.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<T.length;t++)e||T[t].status!=l.QUEUED?i++:(e=T[t],this.trigger("BeforeUpload",e)&&(e.status=l.UPLOADING,this.trigger("UploadFile",e)));i==T.length&&(this.state!==l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",T))}}function u(e){e.percent=e.size>0?Math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t;for(w.reset(),e=0;e<T.length;e++)t=T[e],t.size!==i?(w.size+=t.origSize,w.loaded+=t.loaded*t.origSize/t.size):w.size=i,t.status==l.DONE?w.uploaded++:t.status==l.FAILED?w.failed++:w.queued++;w.size===i?w.percent=T.length>0?Math.ceil(100*(w.uploaded/T.length)):0:(w.bytesPerSec=Math.ceil(w.loaded/((+new Date-S||1)/1e3)),w.percent=w.size>0?Math.ceil(100*(w.loaded/w.size)):0)}function c(){var e=A[0]||P[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",m),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:F,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++,A.push(this),s()},u.onchange=function(){n.addFile(this.files)},u.bind("mouseenter mouseleave mousedown mouseup",function(t){U||(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++,P.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 _(e,i,r){function s(e,i,n){var r=I[e];switch(e){case"max_file_size":"max_file_size"===e&&(I.max_file_size=I.filters.max_file_size=i);break;case"chunk_size":(i=l.parseSize(i))&&(I[e]=i,I.send_file_name=!0);break;case"multipart":I[e]=i,i||(I.send_file_name=!0);break;case"unique_names":I[e]=i,i&&(I.send_file_name=!0);break;case"filters":"array"===l.typeOf(i)&&(i={mime_types:i}),n?l.extend(I.filters,i):I.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),I.filters.mime_types=i.mime_types);break;case"resize":I.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":I.prevent_duplicates=I.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":I[e]=i,n||(u=!0);break;default:I[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?(I.required_features=n(l.extend({},I)),F=n(l.extend({},I,{required_features:!0}))):u&&(a.trigger("Destroy"),g.call(a,I,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 m(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(){d-->0?r(s,1e3):(i.loaded=p,e.trigger("Error",{code:l.HTTP_ERROR,message:l.translate("HTTP Error."),file:i,response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()}))}function s(){var f,g,h,_={};i.status===l.UPLOADING&&e.state!==l.STOPPED&&(e.settings.send_file_name&&(_.name=i.target_name||i.name),u&&c.chunks&&a.size>u?(h=Math.min(u,a.size-p),f=a.slice(p,p+h)):(h=a.size,f=a),u&&c.chunks&&(e.settings.send_chunk_number?(_.chunk=Math.ceil(p/u),_.chunks=Math.ceil(a.size/u)):(_.offset=p,_.total=a.size)),D=new t.xhr.XMLHttpRequest,D.upload&&(D.upload.onprogress=function(t){i.loaded=Math.min(i.size,p+t.loaded),e.trigger("UploadProgress",i)}),D.onload=function(){return D.status>=400?(n(),void 0):(d=e.settings.max_retries,h<a.size?(f.destroy(),p+=h,i.loaded=Math.min(p,a.size),e.trigger("ChunkUploaded",i,{offset:i.loaded,total:a.size,response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()}),"Android Browser"===l.ua.browser&&e.trigger("UploadProgress",i)):i.loaded=i.size,f=g=null,!p||p>=a.size?(i.size!=i.origSize&&(a.destroy(),a=null),e.trigger("UploadProgress",i),i.status=l.DONE,e.trigger("FileUploaded",i,{response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()})):r(s,1),void 0)},D.onerror=function(){n()},D.onloadend=function(){this.destroy(),D=null},e.settings.multipart&&c.multipart?(D.open("post",o,!0),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),g=new t.xhr.FormData,l.each(l.extend(_,e.settings.multipart_params),function(e,t){g.append(t,e)}),g.append(e.settings.file_data_name,f),D.send(g,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(o=l.buildUrl(e.settings.url,l.extend(_,e.settings.multipart_params)),D.open("post",o,!0),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),D.hasRequestHeader("Content-Type")||D.setRequestHeader("Content-Type","application/octet-stream"),D.send(f,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})))}var a,o=e.settings.url,u=e.settings.chunk_size,d=e.settings.max_retries,c=e.features,p=0;i.loaded&&(p=i.loaded=u?u*Math.floor(i.loaded/u):0),a=i.getSource(),!l.isEmptyObj(e.settings.resize)&&f(a,"send_binary_string")&&-1!==l.inArray(a.type,["image/jpeg","image/png"])?h.call(this,a,e.settings.resize,function(e){a=e,i.size=e.size,s()}):s()}function v(e,t){u(t)}function b(e){if(e.state==l.STARTED)S=+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(){D&&D.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,u(t.file),e.state==l.STARTED&&(e.trigger("CancelUpload"),r(function(){a.call(e)},1)))}function O(e){e.stop(),l.each(T,function(e){e.destroy()}),T=[],A.length&&(l.each(A,function(e){e.destroy()}),A=[]),P.length&&(l.each(P,function(e){e.destroy()}),P=[]),F={},U=!1,S=D=null,w.reset()}var I,S,w,D,x=l.guid(),T=[],F={},A=[],P=[],U=!1;I={runtimes:o.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:!1,send_file_name:!0,send_chunk_number:!0},_.call(this,e,null,!0),w=new l.QueueProgress,l.extend(this,{id:x,uid:x,state:l.STOPPED,features:{},runtime:null,files:T,settings:I,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):I.browse_button||I.drop_element?(g.call(i,I,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){_.call(this,e,t,!this.runtime)},getOption:function(e){return e?I[e]:I},refresh:function(){A.length&&l.each(A,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(){U=arguments[0]!==i?arguments[0]:!0,A.length&&l.each(A,function(e){e.disable(U)}),this.trigger("DisableBrowse",U)},getFile:function(e){var t;for(t=T.length-1;t>=0;t--)if(T[t].id===e)return T[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||(T.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=T.length-1;i>=0;i--)if(T[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=T.splice(e===i?0:e,t===i?T.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"),I=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(),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)});
  5369. define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined, Plupload, Template) {
  5370. var Upload = {
  5371. list: {},
  5372. config: {
  5373. container: document.body,
  5374. classname: '.plupload:not([initialized])',
  5375. previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" onerror="this.src=\'https://tool.fastadmin.net/icon/\'+\'<%=fullurl%>\'.split(\'.\').pop()+\'.png\';this.onerror=null;" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
  5376. },
  5377. events: {
  5378. onInit: function (up) {
  5379. //修复少数安卓浏览器无法上传图片的Bug
  5380. var input = $("input[type=file]", $(up.settings.button).next());
  5381. if (input && input.prop("accept") && input.prop("accept").match(/image\/jpeg/)) {
  5382. input.prop("accept", "image/jpg," + input.prop("accept"));
  5383. }
  5384. },
  5385. //初始化完成
  5386. onPostInit: function (up) {
  5387. },
  5388. //文件添加成功后
  5389. onFileAdded: function (up, files) {
  5390. var button = up.settings.button;
  5391. $(button).data("bakup-html", $(button).html());
  5392. var maxcount = $(button).data("maxcount");
  5393. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  5394. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  5395. if (maxcount > 0 && input_id) {
  5396. var inputObj = $("#" + input_id);
  5397. if (inputObj.size() > 0) {
  5398. var value = $.trim(inputObj.val());
  5399. var nums = value === '' ? 0 : value.split(/\,/).length;
  5400. var remains = maxcount - nums;
  5401. if (files.length > remains) {
  5402. for (var i = 0; i < files.length; i++) {
  5403. up.removeFile(files[i]);
  5404. }
  5405. Toastr.error(__('You can upload up to %d file%s', remains));
  5406. return false;
  5407. }
  5408. }
  5409. }
  5410. //添加后立即上传
  5411. setTimeout(function () {
  5412. up.start();
  5413. }, 1);
  5414. },
  5415. //上传进行中的回调
  5416. onUploadProgress: function (up, file) {
  5417. },
  5418. //上传之前的回调
  5419. onBeforeUpload: function (up, file) {
  5420. },
  5421. //上传成功的回调
  5422. onUploadSuccess: function (up, ret) {
  5423. var button = up.settings.button;
  5424. var onUploadSuccess = up.settings.onUploadSuccess;
  5425. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  5426. //上传成功后回调
  5427. if (button) {
  5428. //如果有文本框则填充
  5429. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  5430. if (input_id) {
  5431. var urlArr = [];
  5432. var inputObj = $("#" + input_id);
  5433. if ($(button).data("multiple") && inputObj.val() !== "") {
  5434. urlArr.push(inputObj.val());
  5435. }
  5436. urlArr.push(data.url);
  5437. inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
  5438. }
  5439. //如果有回调函数
  5440. var onDomUploadSuccess = $(button).data("upload-success");
  5441. if (onDomUploadSuccess) {
  5442. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  5443. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  5444. }
  5445. if (typeof onDomUploadSuccess === 'function') {
  5446. var result = onDomUploadSuccess.call(button, data, ret);
  5447. if (result === false)
  5448. return;
  5449. }
  5450. }
  5451. }
  5452. if (typeof onUploadSuccess === 'function') {
  5453. var result = onUploadSuccess.call(button, data, ret);
  5454. if (result === false)
  5455. return;
  5456. }
  5457. },
  5458. //上传错误的回调
  5459. onUploadError: function (up, ret) {
  5460. var button = up.settings.button;
  5461. var onUploadError = up.settings.onUploadError;
  5462. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  5463. if (button) {
  5464. var onDomUploadError = $(button).data("upload-error");
  5465. if (onDomUploadError) {
  5466. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  5467. onDomUploadError = Upload.api.custom[onDomUploadError];
  5468. }
  5469. if (typeof onDomUploadError === 'function') {
  5470. var result = onDomUploadError.call(button, data, ret);
  5471. if (result === false)
  5472. return;
  5473. }
  5474. }
  5475. }
  5476. if (typeof onUploadError === 'function') {
  5477. var result = onUploadError.call(button, data, ret);
  5478. if (result === false) {
  5479. return;
  5480. }
  5481. }
  5482. Toastr.error(ret.msg + "(code:" + ret.code + ")");
  5483. },
  5484. //服务器响应数据后
  5485. onUploadResponse: function (response) {
  5486. try {
  5487. var ret = typeof response === 'object' ? response : JSON.parse(response);
  5488. if (!ret.hasOwnProperty('code')) {
  5489. $.extend(ret, {code: -2, msg: response, data: null});
  5490. }
  5491. } catch (e) {
  5492. var ret = {code: -1, msg: e.message, data: null};
  5493. }
  5494. return ret;
  5495. },
  5496. //上传全部结束后
  5497. onUploadComplete: function (up, files) {
  5498. var button = up.settings.button;
  5499. var onUploadComplete = up.settings.onUploadComplete;
  5500. if (button) {
  5501. var onDomUploadComplete = $(button).data("upload-complete");
  5502. if (onDomUploadComplete) {
  5503. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  5504. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  5505. }
  5506. if (typeof onDomUploadComplete === 'function') {
  5507. var result = onDomUploadComplete.call(button, files);
  5508. if (result === false)
  5509. return;
  5510. }
  5511. }
  5512. }
  5513. if (typeof onUploadComplete === 'function') {
  5514. var result = onUploadComplete.call(button, files);
  5515. if (result === false) {
  5516. return;
  5517. }
  5518. }
  5519. }
  5520. },
  5521. api: {
  5522. //Plupload上传
  5523. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  5524. element = typeof element === 'undefined' ? Upload.config.classname : element;
  5525. $(element, Upload.config.container).each(function () {
  5526. if ($(this).attr("initialized")) {
  5527. return true;
  5528. }
  5529. $(this).attr("initialized", true);
  5530. var that = this;
  5531. var id = $(this).prop("id");
  5532. var url = $(this).data("url");
  5533. var maxsize = $(this).data("maxsize");
  5534. var mimetype = $(this).data("mimetype");
  5535. var multipart = $(this).data("multipart");
  5536. var multiple = $(this).data("multiple");
  5537. //填充ID
  5538. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  5539. //预览ID
  5540. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  5541. //上传URL
  5542. url = url ? url : Config.upload.uploadurl;
  5543. url = Fast.api.fixurl(url);
  5544. //最大可上传文件大小
  5545. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  5546. //文件类型
  5547. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  5548. //请求的表单参数
  5549. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  5550. //是否支持批量上传
  5551. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  5552. var mimetypeArr = new Array();
  5553. //支持后缀和Mimetype格式,以,分隔
  5554. if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1) {
  5555. var tempArr = mimetype.split(',');
  5556. for (var i = 0; i < tempArr.length; i++) {
  5557. mimetypeArr.push({title: __('Files'), extensions: tempArr[i]});
  5558. }
  5559. mimetype = mimetypeArr;
  5560. }
  5561. //生成Plupload实例
  5562. Upload.list[id] = new Plupload.Uploader({
  5563. runtimes: 'html5,flash,silverlight,html4',
  5564. multi_selection: multiple, //是否允许多选批量上传
  5565. browse_button: id, // 浏览按钮的ID
  5566. container: $(this).parent().get(0), //取按钮的上级元素
  5567. flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
  5568. silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
  5569. drop_element: [id, $(this).data("input-id")],
  5570. filters: {
  5571. max_file_size: maxsize,
  5572. mime_types: mimetype,
  5573. },
  5574. url: url,
  5575. multipart_params: $.isArray(multipart) ? {} : multipart,
  5576. init: {
  5577. PostInit: Upload.events.onPostInit,
  5578. FilesAdded: Upload.events.onFileAdded,
  5579. BeforeUpload: Upload.events.onBeforeUpload,
  5580. UploadProgress: function (up, file) {
  5581. var button = up.settings.button;
  5582. $(button).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + file.percent + "%");
  5583. Upload.events.onUploadProgress(up, file);
  5584. },
  5585. FileUploaded: function (up, file, info) {
  5586. var button = up.settings.button;
  5587. //还原按钮文字及状态
  5588. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  5589. var ret = Upload.events.onUploadResponse(info.response, info, up, file);
  5590. file.ret = ret;
  5591. if (ret.code === 1) {
  5592. Upload.events.onUploadSuccess(up, ret, file);
  5593. } else {
  5594. Upload.events.onUploadError(up, ret, file);
  5595. }
  5596. },
  5597. UploadComplete: Upload.events.onUploadComplete,
  5598. Error: function (up, err) {
  5599. var button = up.settings.button;
  5600. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  5601. var ret = {code: err.code, msg: err.message, data: null};
  5602. Upload.events.onUploadError(up, ret);
  5603. }
  5604. },
  5605. onUploadSuccess: onUploadSuccess,
  5606. onUploadError: onUploadError,
  5607. onUploadComplete: onUploadComplete,
  5608. button: that
  5609. });
  5610. //拖动排序
  5611. if (preview_id && multiple) {
  5612. require(['dragsort'], function () {
  5613. $("#" + preview_id).dragsort({
  5614. dragSelector: "li a:not(.btn-trash)",
  5615. dragEnd: function () {
  5616. $("#" + preview_id).trigger("fa.preview.change");
  5617. },
  5618. placeHolderTemplate: '<li class="col-xs-3"></li>'
  5619. });
  5620. });
  5621. }
  5622. //刷新隐藏textarea的值
  5623. var refresh = function (name) {
  5624. var data = {};
  5625. var textarea = $("textarea[name='" + name + "']");
  5626. var container = textarea.prev("ul");
  5627. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  5628. var reg = /\[?(\w+)\]?\[(\w+)\]$/g;
  5629. var match = reg.exec(j.name);
  5630. if (!match)
  5631. return true;
  5632. if (!isNaN(match[2])) {
  5633. data[i] = j.value;
  5634. } else {
  5635. match[1] = "x" + parseInt(match[1]);
  5636. if (typeof data[match[1]] === 'undefined') {
  5637. data[match[1]] = {};
  5638. }
  5639. data[match[1]][match[2]] = j.value;
  5640. }
  5641. });
  5642. var result = [];
  5643. $.each(data, function (i, j) {
  5644. result.push(j);
  5645. });
  5646. textarea.val(JSON.stringify(result));
  5647. };
  5648. if (preview_id && input_id) {
  5649. $(document.body).on("keyup change", "#" + input_id, function (e) {
  5650. var inputStr = $("#" + input_id).val();
  5651. var inputArr = inputStr.split(/\,/);
  5652. $("#" + preview_id).empty();
  5653. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  5654. var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}";
  5655. var json = {};
  5656. try {
  5657. json = JSON.parse(extend);
  5658. } catch (e) {
  5659. }
  5660. $.each(inputArr, function (i, j) {
  5661. if (!j) {
  5662. return true;
  5663. }
  5664. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: (json && typeof json[i] !== 'undefined' ? json[i] : null)};
  5665. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  5666. $("#" + preview_id).append(html);
  5667. });
  5668. });
  5669. $("#" + input_id).trigger("change");
  5670. }
  5671. if (preview_id) {
  5672. //监听文本框改变事件
  5673. $("#" + preview_id).on('change keyup', "input,textarea,select", function () {
  5674. refresh($(this).closest("ul").data("name"));
  5675. });
  5676. // 监听事件
  5677. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  5678. var urlArr = [];
  5679. $("#" + preview_id + " [data-url]").each(function (i, j) {
  5680. urlArr.push($(this).data("url"));
  5681. });
  5682. if (input_id) {
  5683. $("#" + input_id).val(urlArr.join(","));
  5684. }
  5685. refresh($("#" + preview_id).data("name"));
  5686. });
  5687. // 移除按钮事件
  5688. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  5689. $(this).closest("li").remove();
  5690. $("#" + preview_id).trigger("fa.preview.change");
  5691. });
  5692. }
  5693. if (input_id) {
  5694. //粘贴上传
  5695. $("body").on('paste', "#" + input_id, function (event) {
  5696. var that = this;
  5697. var image, pasteEvent;
  5698. pasteEvent = event.originalEvent;
  5699. if (pasteEvent.clipboardData && pasteEvent.clipboardData.items) {
  5700. image = Upload.api.getImageFromClipboard(pasteEvent);
  5701. if (image) {
  5702. event.preventDefault();
  5703. var button = $(".plupload[data-input-id='" + $(that).attr("id") + "']");
  5704. Upload.api.send(image, function (data) {
  5705. var urlArr = [];
  5706. if (button && button.data("multiple") && $(that).val() !== '') {
  5707. urlArr.push($(that).val());
  5708. }
  5709. urlArr.push(data.url);
  5710. $(that).val(urlArr.join(",")).trigger("change").trigger("validate");
  5711. });
  5712. }
  5713. }
  5714. });
  5715. //拖拽上传
  5716. $("body").on('drop', "#" + input_id, function (event) {
  5717. var that = this;
  5718. var images, pasteEvent;
  5719. pasteEvent = event.originalEvent;
  5720. if (pasteEvent.dataTransfer && pasteEvent.dataTransfer.files) {
  5721. images = Upload.api.getImageFromDrop(pasteEvent);
  5722. if (images.length > 0) {
  5723. event.preventDefault();
  5724. var button = $(".plupload[data-input-id='" + $(that).attr("id") + "']");
  5725. $.each(images, function (i, image) {
  5726. Upload.api.send(image, function (data) {
  5727. var urlArr = [];
  5728. if (button && button.data("multiple") && $(that).val() !== '') {
  5729. urlArr.push($(that).val());
  5730. }
  5731. urlArr.push(data.url);
  5732. $(that).val(urlArr.join(",")).trigger("change").trigger("validate");
  5733. });
  5734. });
  5735. }
  5736. }
  5737. });
  5738. }
  5739. Upload.list[id].init();
  5740. });
  5741. },
  5742. // AJAX异步上传
  5743. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  5744. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  5745. var id = Plupload.guid();
  5746. var _onPostInit = Upload.events.onPostInit;
  5747. Upload.events.onPostInit = function () {
  5748. // 当加载完成后添加文件并上传
  5749. Upload.list[id].addFile(file);
  5750. //Upload.list[id].start();
  5751. };
  5752. $('<button type="button" id="' + id + '" class="btn btn-danger hidden plupload" />').appendTo("body");
  5753. $("#" + id).data("upload-complete", function (files) {
  5754. Upload.events.onPostInit = _onPostInit;
  5755. Layer.close(index);
  5756. });
  5757. Upload.api.plupload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  5758. },
  5759. custom: {
  5760. //自定义上传完成回调
  5761. afteruploadcallback: function (response) {
  5762. console.log(this, response);
  5763. alert("Custom Callback,Response URL:" + response.url);
  5764. },
  5765. },
  5766. getImageFromClipboard: function (data) {
  5767. var i, item;
  5768. i = 0;
  5769. while (i < data.clipboardData.items.length) {
  5770. item = data.clipboardData.items[i];
  5771. if (item.type.indexOf("image") !== -1) {
  5772. return item.getAsFile() || false;
  5773. }
  5774. i++;
  5775. }
  5776. return false;
  5777. },
  5778. getImageFromDrop: function (data) {
  5779. var i, item, images;
  5780. i = 0;
  5781. images = [];
  5782. while (i < data.dataTransfer.files.length) {
  5783. item = data.dataTransfer.files[i];
  5784. if (item.type.indexOf("image") !== -1) {
  5785. images.push(item);
  5786. }
  5787. i++;
  5788. }
  5789. return images;
  5790. }
  5791. }
  5792. }
  5793. ;
  5794. return Upload;
  5795. });
  5796. /*! nice-validator 1.1.4
  5797. * (c) 2012-2018 Jony Zhang <niceue@live.com>, MIT Licensed
  5798. * https://github.com/niceue/nice-validator
  5799. */
  5800. ;(function(factory) {
  5801. typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
  5802. typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
  5803. factory(jQuery);
  5804. }(function($, undefined) {
  5805. 'use strict';
  5806. var NS = 'validator',
  5807. CLS_NS = '.' + NS,
  5808. CLS_NS_RULE = '.rule',
  5809. CLS_NS_FIELD = '.field',
  5810. CLS_NS_FORM = '.form',
  5811. CLS_WRAPPER = 'nice-' + NS,
  5812. CLS_MSG_BOX = 'msg-box',
  5813. ARIA_INVALID = 'aria-invalid',
  5814. DATA_RULE = 'data-rule',
  5815. DATA_MSG = 'data-msg',
  5816. DATA_TIP = 'data-tip',
  5817. DATA_OK = 'data-ok',
  5818. DATA_TIMELY = 'data-timely',
  5819. DATA_TARGET = 'data-target',
  5820. DATA_DISPLAY = 'data-display',
  5821. DATA_MUST = 'data-must',
  5822. NOVALIDATE = 'novalidate',
  5823. INPUT_SELECTOR = ':verifiable',
  5824. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  5825. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  5826. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  5827. rDoubleBytes = /[^\x00-\xff]/g,
  5828. rPos = /top|right|bottom|left/,
  5829. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  5830. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  5831. noop = $.noop,
  5832. proxy = $.proxy,
  5833. trim = $.trim,
  5834. isFunction = $.isFunction,
  5835. isString = function(s) {
  5836. return typeof s === 'string';
  5837. },
  5838. isObject = function(o) {
  5839. return o && Object.prototype.toString.call(o) === '[object Object]';
  5840. },
  5841. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  5842. attr = function(el, key, value) {
  5843. if (!el || !el.tagName) return null;
  5844. if (value !== undefined) {
  5845. if (value === null) el.removeAttribute(key);
  5846. else el.setAttribute(key, '' + value);
  5847. } else {
  5848. return el.getAttribute(key);
  5849. }
  5850. },
  5851. novalidateonce,
  5852. preinitialized = {},
  5853. defaults = {
  5854. debug: 0,
  5855. theme: 'default',
  5856. ignore: '',
  5857. focusInvalid: true,
  5858. focusCleanup: false,
  5859. stopOnError: false,
  5860. beforeSubmit: null,
  5861. valid: null,
  5862. invalid: null,
  5863. validation: null,
  5864. formClass: 'n-default',
  5865. validClass: 'n-valid',
  5866. invalidClass: 'n-invalid',
  5867. bindClassTo: null
  5868. },
  5869. fieldDefaults = {
  5870. timely: 1,
  5871. display: null,
  5872. target: null,
  5873. ignoreBlank: false,
  5874. showOk: true,
  5875. // Translate ajax response to validation result
  5876. dataFilter: function (data) {
  5877. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  5878. return data;
  5879. }
  5880. },
  5881. msgMaker: function(opt) {
  5882. var html;
  5883. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  5884. if (opt.result) {
  5885. $.each(opt.result, function(i, obj){
  5886. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  5887. });
  5888. } else {
  5889. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  5890. }
  5891. html += '</span>';
  5892. return html;
  5893. },
  5894. msgWrapper: 'span',
  5895. msgArrow: '',
  5896. msgIcon: '<span class="n-icon"></span>',
  5897. msgClass: 'n-right',
  5898. msgStyle: '',
  5899. msgShow: null,
  5900. msgHide: null
  5901. },
  5902. themes = {};
  5903. /** jQuery Plugin
  5904. * @param {Object} options
  5905. debug {Boolean} 0 Whether to enable debug mode
  5906. timely {Number} 1 Whether to enable timely validation
  5907. theme {String} 'default' Theme name
  5908. stopOnError {Boolean} false Whether to stop validate when found an error input
  5909. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  5910. focusInvalid {Boolean} true Whether to focus the field that is invalid
  5911. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  5912. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  5913. beforeSubmit {Function} Do something before submit form
  5914. dataFilter {Function} Convert ajax results
  5915. valid {Function} Triggered when the form is valid
  5916. invalid {Function} Triggered when the form is invalid
  5917. validClass {String} 'n-valid' Add this class name to a valid field
  5918. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  5919. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  5920. display {Function} Callback function to get dynamic display
  5921. target {Function} Callback function to get dynamic target
  5922. msgShow {Function} Trigger this callback when show message
  5923. msgHide {Function} Trigger this callback when hide message
  5924. msgWrapper {String} 'span' Message wrapper tag name
  5925. msgMaker {Function} Callback function to make message HTML
  5926. msgArrow {String} Message arrow template
  5927. msgIcon {String} Message icon template
  5928. msgStyle {String} Custom message css style
  5929. msgClass {String} Additional added to the message class names
  5930. formClass {String} Additional added to the form class names
  5931. messages {Object} Custom messages for the current instance
  5932. rules {Object} Custom rules for the current instance
  5933. fields {Object} Field validation configuration
  5934. {String} key name|#id
  5935. {String|Object} value Rule string or an object which can pass more arguments
  5936. fields[key][rule] {String} Rule string
  5937. fields[key][display] {String|Function}
  5938. fields[key][tip] {String} Custom tip message
  5939. fields[key][ok] {String} Custom success message
  5940. fields[key][msg] {Object} Custom error message
  5941. fields[key][msgStyle] {String} Custom message style
  5942. fields[key][msgClass] {String} A className which added to message placeholder element
  5943. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  5944. fields[key][msgMaker] {Function} A function to custom message HTML
  5945. fields[key][dataFilter] {Function} A function to convert ajax results
  5946. fields[key][valid] {Function} A function triggered when field is valid
  5947. fields[key][invalid] {Function} A function triggered when field is invalid
  5948. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  5949. fields[key][timely] {Boolean} Whether to enable timely validation
  5950. fields[key][target] {jqSelector} Define placement of a message
  5951. */
  5952. $.fn.validator = function(options) {
  5953. var that = this,
  5954. args = arguments;
  5955. if (that.is(INPUT_SELECTOR)) return that;
  5956. if (!that.is('form')) that = this.find('form');
  5957. if (!that.length) that = this;
  5958. that.each(function() {
  5959. var instance = $(this).data(NS);
  5960. if (instance) {
  5961. if ( isString(options) ) {
  5962. if ( options.charAt(0) === '_' ) return;
  5963. instance[options].apply(instance, [].slice.call(args, 1));
  5964. }
  5965. else if (options) {
  5966. instance._reset(true);
  5967. instance._init(this, options);
  5968. }
  5969. } else {
  5970. new Validator(this, options);
  5971. }
  5972. });
  5973. return this;
  5974. };
  5975. // Validate a field, or an area
  5976. $.fn.isValid = function(callback, hideMsg) {
  5977. var me = _getInstance(this[0]),
  5978. hasCallback = isFunction(callback),
  5979. ret, opt;
  5980. if (!me) return true;
  5981. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  5982. me.checkOnly = !!hideMsg;
  5983. opt = me.options;
  5984. ret = me._multiValidate(
  5985. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  5986. function(isValid){
  5987. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  5988. // navigate to the error element
  5989. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  5990. }
  5991. if (hasCallback) {
  5992. if (callback.length) {
  5993. callback(isValid);
  5994. } else if (isValid) {
  5995. callback();
  5996. }
  5997. }
  5998. me.checkOnly = false;
  5999. }
  6000. );
  6001. // If you pass a callback, we maintain the jQuery object chain
  6002. return hasCallback ? this : ret;
  6003. };
  6004. $.extend($.expr.pseudos || $.expr[':'], {
  6005. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  6006. verifiable: function(elem) {
  6007. var name = elem.nodeName.toLowerCase();
  6008. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  6009. name === 'select' ||
  6010. name === 'textarea' ||
  6011. elem.contentEditable === 'true'
  6012. ) && !elem.disabled;
  6013. },
  6014. // any value, but not only whitespace
  6015. filled: function(elem) {
  6016. return !!trim($(elem).val());
  6017. }
  6018. });
  6019. /**
  6020. * Creates a new Validator
  6021. *
  6022. * @class
  6023. * @param {Element} element - form element
  6024. * @param {Object} options - options for validator
  6025. */
  6026. function Validator(element, options) {
  6027. var me = this;
  6028. if ( !(me instanceof Validator) ) {
  6029. return new Validator(element, options);
  6030. }
  6031. if (Validator.pending) {
  6032. $(window).on('validatorready', init);
  6033. } else {
  6034. init();
  6035. }
  6036. function init() {
  6037. me.$el = $(element);
  6038. if (me.$el.length) {
  6039. me._init(me.$el[0], options);
  6040. }
  6041. else if (isString(element)) {
  6042. preinitialized[element] = options;
  6043. }
  6044. }
  6045. }
  6046. Validator.prototype = {
  6047. _init: function(element, options) {
  6048. var me = this,
  6049. opt, themeOpt, dataOpt;
  6050. // Initialization options
  6051. if ( isFunction(options) ) {
  6052. options = {
  6053. valid: options
  6054. };
  6055. }
  6056. options = me._opt = options || {};
  6057. dataOpt = attr(element, 'data-'+ NS +'-option');
  6058. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function('return ' + dataOpt))() : {};
  6059. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  6060. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  6061. me.rules = new Rules(opt.rules, true);
  6062. me.messages = new Messages(opt.messages, true);
  6063. me.Field = _createFieldFactory(me);
  6064. me.elements = me.elements || {};
  6065. me.deferred = {};
  6066. me.errors = {};
  6067. me.fields = {};
  6068. // Initialization fields
  6069. me._initFields(opt.fields);
  6070. // Initialization events and make a cache
  6071. if ( !me.$el.data(NS) ) {
  6072. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  6073. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  6074. me.vetoed = veto.veto = !me.isValid;
  6075. me.ajaxFormOptions = opts;
  6076. })
  6077. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  6078. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  6079. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  6080. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  6081. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  6082. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  6083. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  6084. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  6085. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  6086. // cache the novalidate attribute value
  6087. me._NOVALIDATE = attr(element, NOVALIDATE);
  6088. // Initialization is complete, stop off default HTML5 form validation
  6089. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  6090. attr(element, NOVALIDATE, NOVALIDATE);
  6091. }
  6092. // Display all messages in target container
  6093. if ( isString(opt.target) ) {
  6094. me.$el.find(opt.target).addClass('msg-container');
  6095. }
  6096. },
  6097. // Guess whether the form use ajax submit
  6098. _guessAjax: function(form) {
  6099. var me = this;
  6100. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  6101. // if there is a "valid.form" event
  6102. var events = ($._data || $.data)(form, 'events');
  6103. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  6104. }
  6105. function issetEvent(events, name, namespace) {
  6106. return !!(
  6107. events && events[name]
  6108. && $.map(events[name], function(e){
  6109. return ~e.namespace.indexOf(namespace) ? 1 : null;
  6110. }).length )
  6111. }
  6112. },
  6113. _initFields: function(fields) {
  6114. var me = this, k, arr, i,
  6115. clear = fields === null;
  6116. // Processing field information
  6117. if (clear) fields = me.fields;
  6118. if ( isObject(fields) ) {
  6119. for (k in fields) {
  6120. if (~k.indexOf(',')) {
  6121. arr = k.split(',');
  6122. i = arr.length;
  6123. while (i--) {
  6124. initField(trim(arr[i]), fields[k]);
  6125. }
  6126. } else {
  6127. initField(k, fields[k]);
  6128. }
  6129. }
  6130. }
  6131. // Parsing DOM rules
  6132. me.$el.find(INPUT_SELECTOR).each(function() {
  6133. me._parse(this);
  6134. });
  6135. function initField(k, v) {
  6136. // delete a field from settings
  6137. if ( v === null || clear ) {
  6138. var el = me.elements[k];
  6139. if (el) me._resetElement(el, true);
  6140. delete me.fields[k];
  6141. } else {
  6142. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  6143. }
  6144. }
  6145. },
  6146. // Parsing a field
  6147. _parse: function(el) {
  6148. var me = this,
  6149. field,
  6150. key = el.name,
  6151. display,
  6152. timely,
  6153. dataRule = attr(el, DATA_RULE);
  6154. dataRule && attr(el, DATA_RULE, null);
  6155. // If the field has passed the key as id mode, or it doesn't has a name
  6156. if ( el.id && (
  6157. ('#' + el.id in me.fields) ||
  6158. !key ||
  6159. // If dataRule and element are diffrent from old's, we use ID mode.
  6160. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  6161. )
  6162. ) {
  6163. key = '#' + el.id;
  6164. }
  6165. // Generate id
  6166. if (!key) {
  6167. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  6168. }
  6169. field = me.getField(key, true);
  6170. // The priority of passing parameter by DOM is higher than by JS.
  6171. field.rule = dataRule || field.rule;
  6172. if (display = attr(el, DATA_DISPLAY)) {
  6173. field.display = display;
  6174. }
  6175. if (field.rule) {
  6176. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  6177. field.must = true;
  6178. }
  6179. if ( /\brequired\b/.test(field.rule) ) {
  6180. field.required = true;
  6181. }
  6182. if (timely = attr(el, DATA_TIMELY)) {
  6183. field.timely = +timely;
  6184. } else if (field.timely > 3) {
  6185. attr(el, DATA_TIMELY, field.timely);
  6186. }
  6187. me._parseRule(field);
  6188. field.old = {};
  6189. }
  6190. if ( isString(field.target) ) {
  6191. attr(el, DATA_TARGET, field.target);
  6192. }
  6193. if ( isString(field.tip) ) {
  6194. attr(el, DATA_TIP, field.tip);
  6195. }
  6196. return me.fields[key] = field;
  6197. },
  6198. // Parsing field rules
  6199. _parseRule: function(field) {
  6200. var arr = rDisplay.exec(field.rule);
  6201. if (!arr) return;
  6202. // current rule index
  6203. field._i = 0;
  6204. if (arr[1]) {
  6205. field.display = arr[1];
  6206. }
  6207. if (arr[2]) {
  6208. field._rules = [];
  6209. arr[2].replace(rRules, function(){
  6210. var args = arguments;
  6211. args[4] = args[4] || args[5];
  6212. field._rules.push({
  6213. and: args[1] === '&',
  6214. not: args[2] === '!',
  6215. or: args[6] === '|',
  6216. method: args[3],
  6217. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  6218. });
  6219. });
  6220. }
  6221. },
  6222. // Verify a zone
  6223. _multiValidate: function($inputs, doneCallback){
  6224. var me = this,
  6225. opt = me.options;
  6226. me.hasError = false;
  6227. if (opt.ignore) {
  6228. $inputs = $inputs.not(opt.ignore);
  6229. }
  6230. $inputs.each(function() {
  6231. me._validate(this);
  6232. if (me.hasError && opt.stopOnError) {
  6233. // stop the validation
  6234. return false;
  6235. }
  6236. });
  6237. // Need to wait for all fields validation complete, especially asynchronous validation
  6238. if (doneCallback) {
  6239. me.validating = true;
  6240. $.when.apply(
  6241. null,
  6242. $.map(me.deferred, function(v){return v;})
  6243. ).done(function(){
  6244. doneCallback.call(me, !me.hasError);
  6245. me.validating = false;
  6246. });
  6247. }
  6248. // If the form does not contain asynchronous validation, the return value is correct.
  6249. // Otherwise, you should detect form validation result through "doneCallback".
  6250. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  6251. },
  6252. // Validate the whole form
  6253. _submit: function(e) {
  6254. var me = this,
  6255. opt = me.options,
  6256. form = e.target,
  6257. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  6258. e.preventDefault();
  6259. if (
  6260. novalidateonce && ~(novalidateonce = false) ||
  6261. // Prevent duplicate submission
  6262. me.submiting ||
  6263. // Receive the "validate" event only from the form.
  6264. e.type === 'validate' && me.$el[0] !== form ||
  6265. // trigger the beforeSubmit callback.
  6266. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  6267. ) {
  6268. return;
  6269. }
  6270. if (me.isAjaxSubmit === undefined) {
  6271. me._guessAjax(form);
  6272. }
  6273. me._debug('log', '\n<<< event: ' + e.type);
  6274. me._reset();
  6275. me.submiting = true;
  6276. me._multiValidate(
  6277. me.$el.find(INPUT_SELECTOR),
  6278. function(isValid){
  6279. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  6280. errors;
  6281. if (!isValid) {
  6282. if (opt.focusInvalid) {
  6283. // navigate to the error element
  6284. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  6285. }
  6286. errors = $.map(me.errors, function(err){return err;});
  6287. }
  6288. // releasing submit
  6289. me.submiting = false;
  6290. me.isValid = isValid;
  6291. // trigger callback and event
  6292. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  6293. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  6294. me._debug('log', '>>> ' + ret);
  6295. if (!isValid) return;
  6296. // For jquery.form plugin
  6297. if (me.vetoed) {
  6298. $(form).ajaxSubmit(me.ajaxFormOptions);
  6299. }
  6300. else if (canSubmit && !me.isAjaxSubmit) {
  6301. document.createElement('form').submit.call(form);
  6302. }
  6303. }
  6304. );
  6305. },
  6306. _reset: function(e) {
  6307. var me = this;
  6308. me.errors = {};
  6309. if (e) {
  6310. me.reseting = true;
  6311. me.$el.find(INPUT_SELECTOR).each( function(){
  6312. me._resetElement(this);
  6313. });
  6314. delete me.reseting;
  6315. }
  6316. },
  6317. _resetElement: function(el, all) {
  6318. this._setClass(el, null);
  6319. this.hideMsg(el);
  6320. },
  6321. // Handle events: "focusin/click"
  6322. _focusin: function(e) {
  6323. var me = this,
  6324. opt = me.options,
  6325. el = e.target,
  6326. timely,
  6327. msg;
  6328. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  6329. return;
  6330. }
  6331. if (opt.focusCleanup) {
  6332. if ( attr(el, ARIA_INVALID) === 'true' ) {
  6333. me._setClass(el, null);
  6334. me.hideMsg(el);
  6335. }
  6336. }
  6337. msg = attr(el, DATA_TIP);
  6338. if (msg) {
  6339. me.showMsg(el, {
  6340. type: 'tip',
  6341. msg: msg
  6342. });
  6343. } else {
  6344. if (attr(el, DATA_RULE)) {
  6345. me._parse(el);
  6346. }
  6347. if (timely = attr(el, DATA_TIMELY)) {
  6348. if ( timely === 8 || timely === 9 ) {
  6349. me._focusout(e);
  6350. }
  6351. }
  6352. }
  6353. },
  6354. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  6355. _focusout: function(e) {
  6356. var me = this,
  6357. opt = me.options,
  6358. el = e.target,
  6359. etype = e.type,
  6360. etype0,
  6361. focusin = etype === 'focusin',
  6362. special = etype === 'validate',
  6363. elem,
  6364. field,
  6365. old,
  6366. value,
  6367. timestamp,
  6368. key, specialKey,
  6369. timely,
  6370. timer = 0;
  6371. if (etype === 'compositionstart') {
  6372. me.pauseValidate = true;
  6373. }
  6374. if (etype === 'compositionend') {
  6375. me.pauseValidate = false;
  6376. }
  6377. if (me.pauseValidate) {
  6378. return;
  6379. }
  6380. // For checkbox and radio
  6381. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  6382. // Get field
  6383. if (!(field = me.getField(elem)) || !field.rule) {
  6384. if(!field.rule){
  6385. me.hideMsg(el);
  6386. }
  6387. return;
  6388. }
  6389. // Cache event type
  6390. etype0 = field._e;
  6391. field._e = etype;
  6392. timely = field.timely;
  6393. if (!special) {
  6394. if (!timely || (_checkable(el) && etype !== 'click')) {
  6395. return;
  6396. }
  6397. value = field.getValue();
  6398. // not validate field unless fill a value
  6399. if ( field.ignoreBlank && !value && !focusin ) {
  6400. me.hideMsg(el);
  6401. return;
  6402. }
  6403. if ( etype === 'focusout' ) {
  6404. if (etype0 === 'change') {
  6405. return;
  6406. }
  6407. if ( timely === 2 || timely === 8 ) {
  6408. old = field.old;
  6409. if (value && old) {
  6410. if (field.isValid && !old.showOk) {
  6411. me.hideMsg(el);
  6412. } else {
  6413. me._makeMsg(el, field, old);
  6414. }
  6415. } else {
  6416. return;
  6417. }
  6418. }
  6419. }
  6420. else {
  6421. if ( timely < 2 && !e.data ) {
  6422. return;
  6423. }
  6424. // mark timestamp to reduce the frequency of the received event
  6425. timestamp = +new Date();
  6426. if ( timestamp - (el._ts || 0) < 100 ) {
  6427. return;
  6428. }
  6429. el._ts = timestamp;
  6430. // handle keyup
  6431. if ( etype === 'keyup' ) {
  6432. if (etype0 === 'input') {
  6433. return;
  6434. }
  6435. key = e.keyCode;
  6436. specialKey = {
  6437. 8: 1, // Backspace
  6438. 9: 1, // Tab
  6439. 16: 1, // Shift
  6440. 32: 1, // Space
  6441. 46: 1 // Delete
  6442. };
  6443. // only gets focus, no validation
  6444. if ( key === 9 && !value ) {
  6445. return;
  6446. }
  6447. // do not validate, if triggered by these keys
  6448. if ( key < 48 && !specialKey[key] ) {
  6449. return;
  6450. }
  6451. }
  6452. if ( !focusin ) {
  6453. // keyboard events, reducing the frequency of validation
  6454. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  6455. }
  6456. }
  6457. }
  6458. // if the current field is ignored
  6459. if ( opt.ignore && $(el).is(opt.ignore) ) {
  6460. return;
  6461. }
  6462. clearTimeout(field._t);
  6463. if (timer) {
  6464. field._t = setTimeout(function() {
  6465. me._validate(el, field);
  6466. }, timer);
  6467. } else {
  6468. if (special) field.old = {};
  6469. me._validate(el, field);
  6470. }
  6471. },
  6472. _setClass: function(el, isValid) {
  6473. var $el = $(el), opt = this.options;
  6474. if (opt.bindClassTo) {
  6475. $el = $el.closest(opt.bindClassTo);
  6476. }
  6477. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  6478. if (isValid !== null) {
  6479. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  6480. }
  6481. },
  6482. _showmsg: function(e, type, msg) {
  6483. var me = this,
  6484. el = e.target;
  6485. if ( me.$el.is(el) ) {
  6486. if (isObject(type)) {
  6487. me.showMsg(type)
  6488. }
  6489. else if ( type === 'tip' ) {
  6490. me.$el.find(INPUT_SELECTOR +'['+ DATA_TIP +']', el).each(function(){
  6491. me.showMsg(this, {type: type, msg: msg});
  6492. });
  6493. }
  6494. }
  6495. else {
  6496. me.showMsg(el, {type: type, msg: msg});
  6497. }
  6498. },
  6499. _hidemsg: function(e) {
  6500. var $el = $(e.target);
  6501. if ( $el.is(INPUT_SELECTOR) ) {
  6502. this.hideMsg($el);
  6503. }
  6504. },
  6505. // Validated a field
  6506. _validatedField: function(el, field, ret) {
  6507. var me = this,
  6508. opt = me.options,
  6509. isValid = field.isValid = ret.isValid = !!ret.isValid,
  6510. callback = isValid ? 'valid' : 'invalid';
  6511. ret.key = field.key;
  6512. ret.ruleName = field._r;
  6513. ret.id = el.id;
  6514. ret.value = field.value;
  6515. me.elements[field.key] = ret.element = el;
  6516. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  6517. if (isValid) {
  6518. ret.type = 'ok';
  6519. } else {
  6520. if (me.submiting) {
  6521. me.errors[field.key] = ret.msg;
  6522. }
  6523. me.hasError = true;
  6524. }
  6525. // cache result
  6526. field.old = ret;
  6527. // trigger callback
  6528. isFunction(field[callback]) && field[callback].call(me, el, ret);
  6529. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  6530. // trigger event
  6531. $(el).attr( ARIA_INVALID, isValid ? null : true )
  6532. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  6533. me.$el.triggerHandler('validation', [ret, me]);
  6534. if (me.checkOnly) return;
  6535. // set className
  6536. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  6537. me._makeMsg.apply(me, arguments);
  6538. },
  6539. _makeMsg: function(el, field, ret) {
  6540. // show or hide the message
  6541. if (field.msgMaker) {
  6542. ret = $.extend({}, ret);
  6543. if (field._e === 'focusin') {
  6544. ret.type = 'tip';
  6545. }
  6546. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  6547. }
  6548. },
  6549. // Validated a rule
  6550. _validatedRule: function(el, field, ret, msgOpt) {
  6551. field = field || me.getField(el);
  6552. msgOpt = msgOpt || {};
  6553. var me = this,
  6554. msg,
  6555. rule,
  6556. method = field._r,
  6557. timely = field.timely,
  6558. special = timely === 9 || timely === 8,
  6559. transfer,
  6560. temp,
  6561. isValid = false;
  6562. // use null to break validation from a field
  6563. if (ret === null) {
  6564. me._validatedField(el, field, {isValid: true, skip: true});
  6565. field._i = 0;
  6566. return;
  6567. }
  6568. else if (ret === undefined) {
  6569. transfer = true;
  6570. }
  6571. else if (ret === true || ret === '') {
  6572. isValid = true;
  6573. }
  6574. else if (isString(ret)) {
  6575. msg = ret;
  6576. }
  6577. else if (isObject(ret)) {
  6578. if (ret.error) {
  6579. msg = ret.error;
  6580. } else {
  6581. msg = ret.ok;
  6582. isValid = true;
  6583. }
  6584. }
  6585. else {
  6586. isValid = !!ret
  6587. }
  6588. rule = field._rules[field._i];
  6589. if (rule.not) {
  6590. msg = undefined;
  6591. isValid = method === 'required' || !isValid;
  6592. }
  6593. if (rule.or) {
  6594. if (isValid) {
  6595. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  6596. field._i++;
  6597. }
  6598. } else {
  6599. transfer = true;
  6600. }
  6601. }
  6602. else if (rule.and) {
  6603. if (!field.isValid) transfer = true;
  6604. }
  6605. if (transfer) {
  6606. isValid = true;
  6607. }
  6608. // message analysis, and throw rule level event
  6609. else {
  6610. if (isValid) {
  6611. if (field.showOk !== false) {
  6612. temp = attr(el, DATA_OK);
  6613. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  6614. if (!isString(msg) && isString(field.showOk)) {
  6615. msg = field.showOk;
  6616. }
  6617. if (isString(msg)) {
  6618. msgOpt.showOk = isValid;
  6619. }
  6620. }
  6621. }
  6622. if (!isValid || special) {
  6623. /* rule message priority:
  6624. 1. custom DOM message
  6625. 2. custom field message;
  6626. 3. global defined message;
  6627. 4. rule returned message;
  6628. 5. default message;
  6629. */
  6630. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  6631. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  6632. });
  6633. }
  6634. if (!isValid) field.isValid = isValid;
  6635. msgOpt.msg = msg;
  6636. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  6637. }
  6638. if (special && (!transfer || rule.and)) {
  6639. if (!isValid && !field._m) field._m = msg;
  6640. field._v = field._v || [];
  6641. field._v.push({
  6642. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  6643. msg: msg || rule.msg
  6644. });
  6645. }
  6646. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  6647. // the current rule has passed, continue to validate
  6648. if ( (isValid || special) && field._i < field._rules.length - 1) {
  6649. field._i++;
  6650. me._checkRule(el, field);
  6651. }
  6652. // field was invalid, or all fields was valid
  6653. else {
  6654. field._i = 0;
  6655. if (special) {
  6656. msgOpt.isValid = field.isValid;
  6657. msgOpt.result = field._v;
  6658. msgOpt.msg = field._m || '';
  6659. if (!field.value && (field._e === 'focusin')) {
  6660. msgOpt.type = 'tip';
  6661. }
  6662. } else {
  6663. msgOpt.isValid = isValid;
  6664. }
  6665. me._validatedField(el, field, msgOpt);
  6666. delete field._m;
  6667. delete field._v;
  6668. }
  6669. },
  6670. // Verify a rule form a field
  6671. _checkRule: function(el, field) {
  6672. var me = this,
  6673. ret,
  6674. fn,
  6675. old,
  6676. key = field.key,
  6677. rule = field._rules[field._i],
  6678. method = rule.method,
  6679. params = rule.params;
  6680. // request has been sent, wait it
  6681. if (me.submiting && me.deferred[key]) {
  6682. return;
  6683. }
  6684. old = field.old;
  6685. field._r = method;
  6686. if (old && !field.must && !rule.must && rule.result !== undefined &&
  6687. old.ruleName === method && old.id === el.id &&
  6688. field.value && old.value === field.value )
  6689. {
  6690. // get result from cache
  6691. ret = rule.result;
  6692. }
  6693. else {
  6694. // get result from current rule
  6695. fn = _getDataRule(el, method) || me.rules[method] || noop;
  6696. ret = fn.call(field, el, params, field);
  6697. if (fn.msg) rule.msg = fn.msg;
  6698. }
  6699. // asynchronous validation
  6700. if (isObject(ret) && isFunction(ret.then)) {
  6701. me.deferred[key] = ret;
  6702. // whether the field valid is unknown
  6703. field.isValid = undefined;
  6704. // show loading message
  6705. !me.checkOnly && me.showMsg(el, {
  6706. type: 'loading',
  6707. msg: me.messages.loading
  6708. }, field);
  6709. // waiting to parse the response data
  6710. ret.then(
  6711. function(d, textStatus, jqXHR) {
  6712. var data = trim(jqXHR.responseText),
  6713. result,
  6714. dataFilter = field.dataFilter;
  6715. // detect if data is json or jsonp format
  6716. if (/jsonp?/.test(this.dataType)) {
  6717. data = d;
  6718. } else if (data.charAt(0) === '{') {
  6719. data = $.parseJSON(data);
  6720. }
  6721. // filter data
  6722. result = dataFilter.call(this, data, field);
  6723. if (result === undefined) result = dataFilter.call(this, data.data, field);
  6724. rule.data = this.data;
  6725. rule.result = field.old ? result : undefined;
  6726. me._validatedRule(el, field, result);
  6727. },
  6728. function(jqXHR, textStatus){
  6729. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  6730. }
  6731. ).always(function(){
  6732. delete me.deferred[key];
  6733. });
  6734. }
  6735. // other result
  6736. else {
  6737. me._validatedRule(el, field, ret);
  6738. }
  6739. },
  6740. // Processing the validation
  6741. _validate: function(el, field) {
  6742. var me = this;
  6743. // doesn't validate the element that has "disabled" or "novalidate" attribute
  6744. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  6745. return;
  6746. }
  6747. field = field || me.getField(el);
  6748. if (!field) return;
  6749. if (!field._rules) me._parse(el);
  6750. if (!field._rules) return;
  6751. me._debug('info', field.key);
  6752. field.isValid = true;
  6753. field.element = el;
  6754. // Cache the value
  6755. field.value = field.getValue();
  6756. // if the field is not required, and that has a blank value
  6757. if (!field.required && !field.must && !field.value) {
  6758. if (!_checkable(el)) {
  6759. me._validatedField(el, field, {isValid: true});
  6760. return true;
  6761. }
  6762. }
  6763. me._checkRule(el, field);
  6764. return field.isValid;
  6765. },
  6766. _debug: function(type, messages) {
  6767. if (window.console && this.options.debug) {
  6768. console[type](messages);
  6769. }
  6770. },
  6771. /**
  6772. * Detecting whether the value of an element that matches a rule
  6773. *
  6774. * @method test
  6775. * @param {Element} el - input element
  6776. * @param {String} rule - rule name
  6777. */
  6778. test: function(el, rule) {
  6779. var me = this,
  6780. ret,
  6781. parts = rRule.exec(rule),
  6782. field,
  6783. method,
  6784. params;
  6785. if (parts) {
  6786. method = parts[1];
  6787. if (method in me.rules) {
  6788. params = parts[2] || parts[3];
  6789. params = params ? params.split(', ') : undefined;
  6790. field = me.getField(el, true);
  6791. field._r = method;
  6792. field.value = field.getValue();
  6793. ret = me.rules[method].call(field, el, params);
  6794. }
  6795. }
  6796. return ret === true || ret === undefined || ret === null;
  6797. },
  6798. _getDisplay: function(el, str) {
  6799. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  6800. },
  6801. _getMsgOpt: function(obj, field) {
  6802. var opt = field ? field : this.options;
  6803. return $.extend({
  6804. type: 'error',
  6805. pos: _getPos(opt.msgClass),
  6806. target: opt.target,
  6807. wrapper: opt.msgWrapper,
  6808. style: opt.msgStyle,
  6809. cls: opt.msgClass,
  6810. arrow: opt.msgArrow,
  6811. icon: opt.msgIcon
  6812. }, isString(obj) ? {msg: obj} : obj);
  6813. },
  6814. _getMsgDOM: function(el, msgOpt) {
  6815. var $el = $(el), $msgbox, datafor, tgt, container;
  6816. if ( $el.is(INPUT_SELECTOR) ) {
  6817. tgt = msgOpt.target || attr(el, DATA_TARGET);
  6818. if (tgt) {
  6819. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  6820. if (tgt.length) {
  6821. if ( tgt.is(INPUT_SELECTOR) ) {
  6822. $el = tgt
  6823. el = tgt.get(0);
  6824. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  6825. $msgbox = tgt;
  6826. } else {
  6827. container = tgt;
  6828. }
  6829. }
  6830. }
  6831. if (!$msgbox) {
  6832. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  6833. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  6834. }
  6835. } else {
  6836. $msgbox = $el;
  6837. }
  6838. // Create new message box
  6839. if (!msgOpt.hide && !$msgbox.length) {
  6840. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  6841. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  6842. 'style': msgOpt.style || undefined,
  6843. 'for': datafor
  6844. });
  6845. if (container) {
  6846. $msgbox.appendTo(container);
  6847. } else {
  6848. if ( _checkable(el) ) {
  6849. var $parent = $el.parent();
  6850. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  6851. } else {
  6852. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  6853. }
  6854. }
  6855. }
  6856. return $msgbox;
  6857. },
  6858. /**
  6859. * Show validation message
  6860. *
  6861. * @method showMsg
  6862. * @param {Element} el - input element
  6863. * @param {Object} msgOpt
  6864. */
  6865. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  6866. if (!el) return;
  6867. var me = this,
  6868. opt = me.options,
  6869. msgShow,
  6870. msgMaker,
  6871. temp,
  6872. $msgbox;
  6873. if (isObject(el) && !el.jquery && !msgOpt) {
  6874. $.each(el, function(key, msg) {
  6875. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  6876. me.showMsg(el, msg);
  6877. });
  6878. return;
  6879. }
  6880. if ($(el).is(INPUT_SELECTOR)) {
  6881. field = field || me.getField(el);
  6882. }
  6883. if (!(msgMaker = (field || opt).msgMaker)) {
  6884. return;
  6885. }
  6886. msgOpt = me._getMsgOpt(msgOpt, field);
  6887. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  6888. // ok or tip
  6889. if (!msgOpt.msg && msgOpt.type !== 'error') {
  6890. temp = attr(el, 'data-' + msgOpt.type);
  6891. if (temp !== null) msgOpt.msg = temp;
  6892. }
  6893. if ( !isString(msgOpt.msg) ) {
  6894. return;
  6895. }
  6896. $msgbox = me._getMsgDOM(el, msgOpt);
  6897. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  6898. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  6899. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  6900. }
  6901. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  6902. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  6903. msgShow.call(me, $msgbox, msgOpt.type);
  6904. }
  6905. },
  6906. /**
  6907. * Hide validation message
  6908. *
  6909. * @method hideMsg
  6910. * @param {Element} el - input element
  6911. * @param {Object} msgOpt optional
  6912. */
  6913. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  6914. var me = this,
  6915. opt = me.options,
  6916. msgHide,
  6917. $msgbox;
  6918. el = $(el).get(0);
  6919. if ($(el).is(INPUT_SELECTOR)) {
  6920. field = field || me.getField(el);
  6921. if (field) {
  6922. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  6923. }
  6924. }
  6925. msgOpt = me._getMsgOpt(msgOpt, field);
  6926. msgOpt.hide = true;
  6927. $msgbox = me._getMsgDOM(el, msgOpt);
  6928. if (!$msgbox.length) return;
  6929. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  6930. msgHide.call(me, $msgbox, msgOpt.type);
  6931. } else {
  6932. $msgbox[0].style.display = 'none';
  6933. $msgbox[0].innerHTML = '';
  6934. }
  6935. },
  6936. /**
  6937. * Get field information
  6938. *
  6939. * @method getField
  6940. * @param {Element} - input element
  6941. * @return {Object} field
  6942. */
  6943. getField: function(el, must) {
  6944. var me = this,
  6945. key,
  6946. field;
  6947. if (isString(el)) {
  6948. key = el;
  6949. el = undefined;
  6950. } else {
  6951. if (attr(el, DATA_RULE)) {
  6952. return me._parse(el);
  6953. }
  6954. if (el.id && '#' + el.id in me.fields || !el.name) {
  6955. key = '#' + el.id;
  6956. } else {
  6957. key = el.name;
  6958. }
  6959. }
  6960. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  6961. field.element = el;
  6962. }
  6963. return field;
  6964. },
  6965. /**
  6966. * Config a field
  6967. *
  6968. * @method: setField
  6969. * @param {String} key
  6970. * @param {Object} obj
  6971. */
  6972. setField: function(key, obj) {
  6973. var fields = {};
  6974. if (!key) return;
  6975. // update this field
  6976. if (isString(key)) {
  6977. fields[key] = obj;
  6978. }
  6979. // update fields
  6980. else {
  6981. fields = key;
  6982. }
  6983. this._initFields(fields);
  6984. },
  6985. /**
  6986. * Detecting whether the form is valid
  6987. *
  6988. * @method isFormValid
  6989. * @return {Boolean}
  6990. */
  6991. isFormValid: function() {
  6992. var fields = this.fields, k, field;
  6993. for (k in fields) {
  6994. field = fields[k];
  6995. if (!field._rules || !field.required && !field.must && !field.value) continue;
  6996. if (!field.isValid) return false;
  6997. }
  6998. return true;
  6999. },
  7000. /**
  7001. * Prevent submission form
  7002. *
  7003. * @method holdSubmit
  7004. * @param {Boolean} hold - If set to false, will release the hold
  7005. */
  7006. holdSubmit: function(hold) {
  7007. this.submiting = hold === undefined || hold;
  7008. },
  7009. /**
  7010. * Clean validation messages
  7011. *
  7012. * @method cleanUp
  7013. */
  7014. cleanUp: function() {
  7015. this._reset(1);
  7016. },
  7017. /**
  7018. * Destroy the validation
  7019. *
  7020. * @method destroy
  7021. */
  7022. destroy: function() {
  7023. this._reset(1);
  7024. this.$el.off(CLS_NS).removeData(NS);
  7025. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  7026. }
  7027. };
  7028. /**
  7029. * Create Field Factory
  7030. *
  7031. * @class
  7032. * @param {Object} context
  7033. * @return {Function} Factory
  7034. */
  7035. function _createFieldFactory(context) {
  7036. function FieldFactory() {
  7037. var options = this.options;
  7038. for (var i in options) {
  7039. if (i in fieldDefaults) this[i] = options[i];
  7040. }
  7041. $.extend(this, {
  7042. _valHook: function() {
  7043. return this.element.contentEditable === 'true' ? 'text' : 'val';
  7044. },
  7045. getValue: function() {
  7046. var elem = this.element;
  7047. if (elem.type === 'number' && elem.validity && elem.validity.badInput) {
  7048. return 'NaN';
  7049. }
  7050. return $(elem)[this._valHook()]();
  7051. },
  7052. setValue: function(value) {
  7053. $(this.element)[this._valHook()](this.value = value);
  7054. },
  7055. // Get a range of validation messages
  7056. getRangeMsg: function(value, params, suffix) {
  7057. if (!params) return;
  7058. var me = this,
  7059. msg = me.messages[me._r] || '',
  7060. result,
  7061. p = params[0].split('~'),
  7062. e = params[1] === 'false',
  7063. a = p[0],
  7064. b = p[1],
  7065. c = 'rg',
  7066. args = [''],
  7067. isNumber = trim(value) && +value === +value;
  7068. function compare(large, small) {
  7069. return !e ? large >= small : large > small;
  7070. }
  7071. if (p.length === 2) {
  7072. if (a && b) {
  7073. if (isNumber && compare(value, +a) && compare(+b, value)) {
  7074. result = true;
  7075. }
  7076. args = args.concat(p);
  7077. c = e ? 'gtlt' : 'rg';
  7078. }
  7079. else if (a && !b) {
  7080. if (isNumber && compare(value, +a)) {
  7081. result = true;
  7082. }
  7083. args.push(a);
  7084. c = e ? 'gt' : 'gte';
  7085. }
  7086. else if (!a && b) {
  7087. if (isNumber && compare(+b, value)) {
  7088. result = true;
  7089. }
  7090. args.push(b);
  7091. c = e ? 'lt' : 'lte';
  7092. }
  7093. }
  7094. else {
  7095. if (value === +a) {
  7096. result = true;
  7097. }
  7098. args.push(a);
  7099. c = 'eq';
  7100. }
  7101. if (msg) {
  7102. if (suffix && msg[c + suffix]) {
  7103. c += suffix;
  7104. }
  7105. args[0] = msg[c];
  7106. }
  7107. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  7108. },
  7109. // Render message template
  7110. renderMsg: function() {
  7111. var args = arguments,
  7112. tpl = args[0],
  7113. i = args.length;
  7114. if (!tpl) return;
  7115. while (--i) {
  7116. tpl = tpl.replace('{' + i + '}', args[i]);
  7117. }
  7118. return tpl;
  7119. }
  7120. });
  7121. }
  7122. function Field(key, obj, oldField) {
  7123. this.key = key;
  7124. this.validator = context;
  7125. $.extend(this, oldField, obj);
  7126. }
  7127. FieldFactory.prototype = context;
  7128. Field.prototype = new FieldFactory();
  7129. return Field;
  7130. }
  7131. /**
  7132. * Create Rules
  7133. *
  7134. * @class
  7135. * @param {Object} obj rules
  7136. * @param {Object} context context
  7137. */
  7138. function Rules(obj, context) {
  7139. if (!isObject(obj)) return;
  7140. var k, that = context ? context === true ? this : context : Rules.prototype;
  7141. for (k in obj) {
  7142. if (_checkRuleName(k)) {
  7143. that[k] = _getRule(obj[k]);
  7144. }
  7145. }
  7146. }
  7147. /**
  7148. * Create Messages
  7149. *
  7150. * @class
  7151. * @param {Object} obj rules
  7152. * @param {Object} context context
  7153. */
  7154. function Messages(obj, context) {
  7155. if (!isObject(obj)) return;
  7156. var k, that = context ? context === true ? this : context : Messages.prototype;
  7157. for (k in obj) {
  7158. that[k] = obj[k];
  7159. }
  7160. }
  7161. // Rule converted factory
  7162. function _getRule(fn) {
  7163. switch ($.type(fn)) {
  7164. case 'function':
  7165. return fn;
  7166. case 'array':
  7167. var f = function() {
  7168. return fn[0].test(this.value) || fn[1] || false;
  7169. };
  7170. f.msg = fn[1];
  7171. return f;
  7172. case 'regexp':
  7173. return function() {
  7174. return fn.test(this.value);
  7175. };
  7176. }
  7177. }
  7178. // Get instance by an element
  7179. function _getInstance(el) {
  7180. var wrap, k, options;
  7181. if (!el || !el.tagName) return;
  7182. switch (el.tagName) {
  7183. case 'INPUT':
  7184. case 'SELECT':
  7185. case 'TEXTAREA':
  7186. case 'BUTTON':
  7187. case 'FIELDSET':
  7188. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  7189. break;
  7190. case 'FORM':
  7191. wrap = el;
  7192. break;
  7193. default:
  7194. wrap = $(el).closest('.' + CLS_WRAPPER);
  7195. }
  7196. for (k in preinitialized) {
  7197. if ($(wrap).is(k)) {
  7198. options = preinitialized[k];
  7199. break;
  7200. }
  7201. }
  7202. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  7203. }
  7204. // Get custom rules on the node
  7205. function _getDataRule(el, method) {
  7206. var fn = trim(attr(el, DATA_RULE + '-' + method));
  7207. if ( fn && (fn = new Function('return ' + fn)()) ) {
  7208. return _getRule(fn);
  7209. }
  7210. }
  7211. // Get custom messages on the node
  7212. function _getDataMsg(el, field, m) {
  7213. var msg = field.msg,
  7214. item = field._r;
  7215. if ( isObject(msg) ) msg = msg[item];
  7216. if ( !isString(msg) ) {
  7217. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  7218. }
  7219. return msg;
  7220. }
  7221. // Get message position
  7222. function _getPos(str) {
  7223. var pos;
  7224. if (str) pos = rPos.exec(str);
  7225. return pos && pos[0];
  7226. }
  7227. // Check whether the element is checkbox or radio
  7228. function _checkable(el) {
  7229. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  7230. }
  7231. // Parse date string to timestamp
  7232. function _parseDate(str) {
  7233. return Date.parse(str.replace(/\.|\-/g, '/'));
  7234. }
  7235. // Rule name only allows alphanumeric characters and underscores
  7236. function _checkRuleName(name) {
  7237. return /^\w+$/.test(name);
  7238. }
  7239. // Translate field key to jQuery selector.
  7240. function _key2selector(key) {
  7241. var isID = key.charAt(0) === '#';
  7242. key = key.replace(/([:.{(|)}/\[\]])/g, '\\$1');
  7243. return isID ? key : '[name="'+ key +'"]:first';
  7244. }
  7245. // Fixed a issue cause by refresh page in IE.
  7246. $(window).on('beforeunload', function(){
  7247. this.focus();
  7248. });
  7249. $(document)
  7250. .on('click', ':submit', function(){
  7251. var input = this, attrNode;
  7252. if (!input.form) return;
  7253. // Shim for "formnovalidate"
  7254. attrNode = input.getAttributeNode('formnovalidate');
  7255. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  7256. novalidateonce = true;
  7257. }
  7258. })
  7259. // Automatic initializing form validation
  7260. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  7261. if ( attr(this, NOVALIDATE) !== null ) return;
  7262. var $form = $(this), me;
  7263. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  7264. if ( !$.isEmptyObject(me.fields) ) {
  7265. // Execute event handler
  7266. if (e.type === 'focusin') {
  7267. me._focusin(e);
  7268. } else {
  7269. me._submit(e);
  7270. }
  7271. } else {
  7272. attr(this, NOVALIDATE, NOVALIDATE);
  7273. $form.off(CLS_NS).removeData(NS);
  7274. }
  7275. }
  7276. });
  7277. new Messages({
  7278. fallback: 'This field is not valid.',
  7279. loading: 'Validating...'
  7280. });
  7281. // Built-in rules (global)
  7282. new Rules({
  7283. /**
  7284. * required
  7285. *
  7286. * @example:
  7287. required
  7288. required(jqSelector)
  7289. required(anotherRule)
  7290. required(not, -1)
  7291. required(from, .contact)
  7292. */
  7293. required: function(element, params) {
  7294. var me = this,
  7295. val = trim(me.value),
  7296. isValid = true;
  7297. if (params) {
  7298. if ( params.length === 1 ) {
  7299. if ( !_checkRuleName(params[0]) ) {
  7300. if (!val && !$(params[0], me.$el).length ) {
  7301. return null;
  7302. }
  7303. }
  7304. else if ( me.rules[params[0]] ) {
  7305. if ( !val && !me.test(element, params[0]) ) {
  7306. return null;
  7307. }
  7308. }
  7309. }
  7310. else if ( params[0] === 'not' ) {
  7311. $.each(params.slice(1), function() {
  7312. return (isValid = val !== trim(this));
  7313. });
  7314. }
  7315. else if ( params[0] === 'from' ) {
  7316. var $elements = me.$el.find(params[1]),
  7317. VALIDATED = '_validated_',
  7318. ret;
  7319. isValid = $elements.filter(function(){
  7320. var field = me.getField(this);
  7321. return field && !!trim(field.getValue());
  7322. }).length >= (params[2] || 1);
  7323. if (isValid) {
  7324. if (!val) ret = null;
  7325. } else {
  7326. ret = _getDataMsg($elements[0], me) || false;
  7327. }
  7328. if ( !$(element).data(VALIDATED) ) {
  7329. $elements.data(VALIDATED, 1).each(function(){
  7330. if (element !== this) {
  7331. me._validate(this);
  7332. }
  7333. }).removeData(VALIDATED);
  7334. }
  7335. return ret;
  7336. }
  7337. }
  7338. return isValid && !!val;
  7339. },
  7340. /**
  7341. * integer
  7342. *
  7343. * @example:
  7344. integer
  7345. integer[+]
  7346. integer[+0]
  7347. integer[-]
  7348. integer[-0]
  7349. */
  7350. integer: function(element, params) {
  7351. var re, z = '0|',
  7352. p = '[1-9]\\d*',
  7353. key = params ? params[0] : '*';
  7354. switch (key) {
  7355. case '+':
  7356. re = p;
  7357. break;
  7358. case '-':
  7359. re = '-' + p;
  7360. break;
  7361. case '+0':
  7362. re = z + p;
  7363. break;
  7364. case '-0':
  7365. re = z + '-' + p;
  7366. break;
  7367. default:
  7368. re = z + '-?' + p;
  7369. }
  7370. re = '^(?:' + re + ')$';
  7371. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  7372. },
  7373. /**
  7374. * match another field
  7375. *
  7376. * @example:
  7377. match[password] Match the password field (two values ​​must be the same)
  7378. match[eq, password] Ditto
  7379. match[neq, count] The value must be not equal to the value of the count field
  7380. match[lt, count] The value must be less than the value of the count field
  7381. match[lte, count] The value must be less than or equal to the value of the count field
  7382. match[gt, count] The value must be greater than the value of the count field
  7383. match[gte, count] The value must be greater than or equal to the value of the count field
  7384. match[gte, startDate, date]
  7385. match[gte, startTime, time]
  7386. **/
  7387. match: function(element, params) {
  7388. if (!params) return;
  7389. var me = this,
  7390. isValid = true,
  7391. a, b,
  7392. key, msg, type = 'eq', parser,
  7393. selector2, elem2, field2;
  7394. if (params.length === 1) {
  7395. key = params[0];
  7396. } else {
  7397. type = params[0];
  7398. key = params[1];
  7399. }
  7400. selector2 = _key2selector(key);
  7401. elem2 = me.$el.find(selector2)[0];
  7402. // If the compared field is not exist
  7403. if (!elem2) return;
  7404. field2 = me.getField(elem2);
  7405. a = me.value;
  7406. b = field2.getValue();
  7407. if (!me._match) {
  7408. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  7409. $(element).trigger('validate');
  7410. });
  7411. me._match = field2._match = 1;
  7412. }
  7413. // If both fields are blank
  7414. if (!me.required && a === '' && b === '') {
  7415. return null;
  7416. }
  7417. parser = params[2];
  7418. if (parser) {
  7419. if (/^date(time)?$/i.test(parser)) {
  7420. a = _parseDate(a);
  7421. b = _parseDate(b);
  7422. } else if (parser === 'time') {
  7423. a = +a.replace(/:/g, '');
  7424. b = +b.replace(/:/g, '');
  7425. }
  7426. }
  7427. // If the compared field is incorrect, we only ensure that this field is correct.
  7428. if (type !== 'eq' && !isNaN(+a) && isNaN(+b)) {
  7429. return true;
  7430. }
  7431. switch (type) {
  7432. case 'lt':
  7433. isValid = +a < +b; break;
  7434. case 'lte':
  7435. isValid = +a <= +b; break;
  7436. case 'gte':
  7437. isValid = +a >= +b; break;
  7438. case 'gt':
  7439. isValid = +a > +b; break;
  7440. case 'neq':
  7441. isValid = a !== b; break;
  7442. default:
  7443. isValid = a === b;
  7444. }
  7445. return isValid || (
  7446. isObject(me.messages.match)
  7447. && me.messages.match[type].replace( '{1}', me._getDisplay( elem2, field2.display || key ) )
  7448. );
  7449. },
  7450. /**
  7451. * range numbers
  7452. *
  7453. * @example:
  7454. range[0~99] Number 0-99
  7455. range[0~] Number greater than or equal to 0
  7456. range[~100] Number less than or equal to 100
  7457. **/
  7458. range: function(element, params) {
  7459. return this.getRangeMsg(this.value, params);
  7460. },
  7461. /**
  7462. * how many checkbox or radio inputs that checked
  7463. *
  7464. * @example:
  7465. checked; no empty, same to required
  7466. checked[1~3] 1-3 items
  7467. checked[1~] greater than 1 item
  7468. checked[~3] less than 3 items
  7469. checked[3] 3 items
  7470. **/
  7471. checked: function(element, params) {
  7472. if ( !_checkable(element) ) return;
  7473. var me = this,
  7474. elem, count;
  7475. if (element.name) {
  7476. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  7477. var el = this;
  7478. if (!elem && _checkable(el)) elem = el;
  7479. return !el.disabled && el.checked;
  7480. }).length;
  7481. } else {
  7482. elem = element;
  7483. count = elem.checked;
  7484. }
  7485. if (params) {
  7486. return me.getRangeMsg(count, params);
  7487. } else {
  7488. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  7489. }
  7490. },
  7491. /**
  7492. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  7493. *
  7494. * @example:
  7495. length[6~16] 6-16 characters
  7496. length[6~] Greater than 6 characters
  7497. length[~16] Less than 16 characters
  7498. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  7499. **/
  7500. length: function(element, params) {
  7501. var value = this.value,
  7502. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  7503. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  7504. },
  7505. /**
  7506. * remote validation
  7507. *
  7508. * @description
  7509. * remote([get:]url [, name1, [name2 ...]]);
  7510. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  7511. 1. text:
  7512. '' 'Error Message'
  7513. 2. json:
  7514. {"ok": ""} {"error": "Error Message"}
  7515. 3. json wrapper:
  7516. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  7517. * @example
  7518. The simplest: remote(path/to/server);
  7519. With parameters: remote(path/to/server, name1, name2, ...);
  7520. By GET: remote(get:path/to/server, name1, name2, ...);
  7521. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  7522. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  7523. CORS remote(cors:path/to/server)
  7524. JSONP remote(jsonp:path/to/server)
  7525. */
  7526. remote: function(element, params) {
  7527. if (!params) return;
  7528. var me = this,
  7529. arr = rAjaxType.exec(params[0]),
  7530. rule = me._rules[me._i],
  7531. data = {},
  7532. queryString = '',
  7533. url = arr[3],
  7534. type = arr[2] || 'POST', // GET / POST
  7535. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  7536. dataType;
  7537. rule.must = true;
  7538. data[element.name] = me.value;
  7539. // There are extra fields
  7540. if (params[1]) {
  7541. $.map(params.slice(1), function(name) {
  7542. var arr, key;
  7543. if (~name.indexOf('=')) {
  7544. queryString += '&' + name;
  7545. } else {
  7546. arr = name.split(':');
  7547. name = trim(arr[0]);
  7548. key = trim(arr[1]) || name;
  7549. data[ name ] = me.$el.find( _key2selector(key) ).val();
  7550. }
  7551. });
  7552. }
  7553. data = $.param(data) + queryString;
  7554. if (!me.must && rule.data && rule.data === data) {
  7555. return rule.result;
  7556. }
  7557. // Cross-domain request, force jsonp dataType
  7558. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  7559. dataType = 'jsonp';
  7560. }
  7561. // Asynchronous validation need return jqXHR objects
  7562. return $.ajax({
  7563. url: url,
  7564. type: type,
  7565. data: data,
  7566. dataType: dataType
  7567. });
  7568. },
  7569. /**
  7570. * filter characters, direct filtration without prompting error (support custom regular expressions)
  7571. *
  7572. * @example
  7573. * filter filtering unsafe characters
  7574. * filter(regexp) filtering the "regexp" matched characters
  7575. */
  7576. filter: function(element, params) {
  7577. var value = this.value,
  7578. temp = value.replace( params ? (new RegExp('[' + params[0] + ']', 'gm')) : rUnsafe, '' );
  7579. if (temp !== value) this.setValue(temp);
  7580. }
  7581. });
  7582. /**
  7583. * Config global options
  7584. *
  7585. * @static config
  7586. * @param {Object} options
  7587. */
  7588. Validator.config = function(key, value) {
  7589. if (isObject(key)) {
  7590. $.each(key, _config);
  7591. }
  7592. else if (isString(key)) {
  7593. _config(key, value);
  7594. }
  7595. function _config(k, o) {
  7596. if (k === 'rules') {
  7597. new Rules(o);
  7598. }
  7599. else if (k === 'messages') {
  7600. new Messages(o);
  7601. }
  7602. else if (k in fieldDefaults) {
  7603. fieldDefaults[k] = o;
  7604. }
  7605. else {
  7606. defaults[k] = o;
  7607. }
  7608. }
  7609. };
  7610. /**
  7611. * Config themes
  7612. *
  7613. * @static setTheme
  7614. * @param {String|Object} name
  7615. * @param {Object} obj
  7616. * @example
  7617. .setTheme( themeName, themeOptions )
  7618. .setTheme( multiThemes )
  7619. */
  7620. Validator.setTheme = function(name, obj) {
  7621. if ( isObject(name) ) {
  7622. $.extend(true, themes, name);
  7623. }
  7624. else if ( isString(name) && isObject(obj) ) {
  7625. themes[name] = $.extend(themes[name], obj);
  7626. }
  7627. };
  7628. /**
  7629. * Resource loader
  7630. *
  7631. * @static load
  7632. * @param {String} str
  7633. * @example
  7634. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  7635. .load('local=zh-CN&css=') // load: local/zh-CN.js
  7636. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  7637. .load('local') // dito
  7638. */
  7639. Validator.load = function(str) {
  7640. if (!str) return;
  7641. var doc = document,
  7642. params = {},
  7643. node = doc.scripts[0],
  7644. dir, el, ONLOAD;
  7645. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  7646. params[key] = value;
  7647. });
  7648. dir = params.dir || Validator.dir;
  7649. if (!Validator.css && params.css !== '') {
  7650. el = doc.createElement('link');
  7651. el.rel = 'stylesheet';
  7652. el.href = Validator.css = dir + 'jquery.validator.css';
  7653. node.parentNode.insertBefore(el, node);
  7654. }
  7655. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  7656. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  7657. Validator.pending = 1;
  7658. el = doc.createElement('script');
  7659. el.src = dir + 'local/' + Validator.local + '.js';
  7660. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  7661. el[ONLOAD] = function() {
  7662. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  7663. el = el[ONLOAD] = null;
  7664. delete Validator.pending;
  7665. $(window).triggerHandler('validatorready');
  7666. }
  7667. };
  7668. node.parentNode.insertBefore(el, node);
  7669. }
  7670. };
  7671. // Auto loading resources
  7672. (function(){
  7673. var scripts = document.scripts,
  7674. i = scripts.length, node, arr,
  7675. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  7676. while (i-- && !arr) {
  7677. node = scripts[i];
  7678. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  7679. }
  7680. if (!arr) return;
  7681. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  7682. Validator.load(arr[2]);
  7683. })();
  7684. return $[NS] = Validator;
  7685. }));
  7686. /*********************************
  7687. * Themes, rules, and i18n support
  7688. * Locale: Chinese; 中文
  7689. *********************************/
  7690. (function(factory) {
  7691. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  7692. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  7693. factory(jQuery);
  7694. }(function($) {
  7695. /* Global configuration
  7696. */
  7697. $.validator.config({
  7698. //stopOnError: true,
  7699. //focusCleanup: true,
  7700. //theme: 'yellow_right',
  7701. //timely: 2,
  7702. // Custom rules
  7703. rules: {
  7704. digits: [/^\d+$/, "请填写数字"]
  7705. ,letters: [/^[a-z]+$/i, "请填写字母"]
  7706. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  7707. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  7708. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  7709. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  7710. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  7711. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  7712. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  7713. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  7714. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  7715. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  7716. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  7717. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  7718. ,accept: function (element, params){
  7719. if (!params) return true;
  7720. var ext = params[0],
  7721. value = $(element).val();
  7722. return (ext === '*') ||
  7723. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  7724. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  7725. }
  7726. },
  7727. // Default error messages
  7728. messages: {
  7729. 0: "此处",
  7730. fallback: "{0}格式不正确",
  7731. loading: "正在验证...",
  7732. error: "网络异常",
  7733. timeout: "请求超时",
  7734. required: "{0}不能为空",
  7735. remote: "{0}已被使用",
  7736. integer: {
  7737. '*': "请填写整数",
  7738. '+': "请填写正整数",
  7739. '+0': "请填写正整数或0",
  7740. '-': "请填写负整数",
  7741. '-0': "请填写负整数或0"
  7742. },
  7743. match: {
  7744. eq: "{0}与{1}不一致",
  7745. neq: "{0}与{1}不能相同",
  7746. lt: "{0}必须小于{1}",
  7747. gt: "{0}必须大于{1}",
  7748. lte: "{0}不能大于{1}",
  7749. gte: "{0}不能小于{1}"
  7750. },
  7751. range: {
  7752. rg: "请填写{1}到{2}的数",
  7753. gte: "请填写不小于{1}的数",
  7754. lte: "请填写最大{1}的数",
  7755. gtlt: "请填写{1}到{2}之间的数",
  7756. gt: "请填写大于{1}的数",
  7757. lt: "请填写小于{1}的数"
  7758. },
  7759. checked: {
  7760. eq: "请选择{1}项",
  7761. rg: "请选择{1}到{2}项",
  7762. gte: "请至少选择{1}项",
  7763. lte: "请最多选择{1}项"
  7764. },
  7765. length: {
  7766. eq: "请填写{1}个字符",
  7767. rg: "请填写{1}到{2}个字符",
  7768. gte: "请至少填写{1}个字符",
  7769. lte: "请最多填写{1}个字符",
  7770. eq_2: "",
  7771. rg_2: "",
  7772. gte_2: "",
  7773. lte_2: ""
  7774. }
  7775. }
  7776. });
  7777. /* Themes
  7778. */
  7779. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  7780. $.validator.setTheme({
  7781. 'simple_right': {
  7782. formClass: 'n-simple',
  7783. msgClass: 'n-right'
  7784. },
  7785. 'simple_bottom': {
  7786. formClass: 'n-simple',
  7787. msgClass: 'n-bottom'
  7788. },
  7789. 'yellow_top': {
  7790. formClass: 'n-yellow',
  7791. msgClass: 'n-top',
  7792. msgArrow: TPL_ARROW
  7793. },
  7794. 'yellow_right': {
  7795. formClass: 'n-yellow',
  7796. msgClass: 'n-right',
  7797. msgArrow: TPL_ARROW
  7798. },
  7799. 'yellow_right_effect': {
  7800. formClass: 'n-yellow',
  7801. msgClass: 'n-right',
  7802. msgArrow: TPL_ARROW,
  7803. msgShow: function($msgbox, type){
  7804. var $el = $msgbox.children();
  7805. if ($el.is(':animated')) return;
  7806. if (type === 'error') {
  7807. $el.css({left: '20px', opacity: 0})
  7808. .delay(100).show().stop()
  7809. .animate({left: '-4px', opacity: 1}, 150)
  7810. .animate({left: '3px'}, 80)
  7811. .animate({left: 0}, 80);
  7812. } else {
  7813. $el.css({left: 0, opacity: 1}).fadeIn(200);
  7814. }
  7815. },
  7816. msgHide: function($msgbox, type){
  7817. var $el = $msgbox.children();
  7818. $el.stop().delay(100).show()
  7819. .animate({left: '20px', opacity: 0}, 300, function(){
  7820. $msgbox.hide();
  7821. });
  7822. }
  7823. }
  7824. });
  7825. }));
  7826. define('validator',['validator-core', 'validator-lang'], function (Validator, undefined) {
  7827. return Validator;
  7828. });
  7829. define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, Upload, Validator) {
  7830. var Form = {
  7831. config: {
  7832. fieldlisttpl: '<dd class="form-inline"><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=row.key%>" size="10" /> <input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" value="<%=row.value%>" /> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></dd>'
  7833. },
  7834. events: {
  7835. validator: function (form, success, error, submit) {
  7836. if (!form.is("form"))
  7837. return;
  7838. //绑定表单事件
  7839. form.validator($.extend({
  7840. validClass: 'has-success',
  7841. invalidClass: 'has-error',
  7842. bindClassTo: '.form-group',
  7843. formClass: 'n-default n-bootstrap',
  7844. msgClass: 'n-right',
  7845. stopOnError: true,
  7846. display: function (elem) {
  7847. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  7848. },
  7849. dataFilter: function (data) {
  7850. if (data.code === 1) {
  7851. return data.msg ? { "ok": data.msg } : '';
  7852. } else {
  7853. return data.msg;
  7854. }
  7855. },
  7856. target: function (input) {
  7857. var target = $(input).data("target");
  7858. if (target && $(target).size() > 0) {
  7859. return $(target);
  7860. }
  7861. var $formitem = $(input).closest('.form-group'),
  7862. $msgbox = $formitem.find('span.msg-box');
  7863. if (!$msgbox.length) {
  7864. return [];
  7865. }
  7866. return $msgbox;
  7867. },
  7868. valid: function (ret) {
  7869. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  7870. that.holdSubmit(true);
  7871. submitBtn.addClass("disabled");
  7872. //验证通过提交表单
  7873. var submitResult = Form.api.submit($(ret), function (data, ret) {
  7874. that.holdSubmit(false);
  7875. submitBtn.removeClass("disabled");
  7876. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  7877. return false;
  7878. }
  7879. if (typeof success === 'function') {
  7880. if (false === success.call($(this), data, ret)) {
  7881. return false;
  7882. }
  7883. }
  7884. //提示及关闭当前窗口
  7885. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  7886. parent.Toastr.success(msg);
  7887. parent.$(".btn-refresh").trigger("click");
  7888. var index = parent.Layer.getFrameIndex(window.name);
  7889. parent.Layer.close(index);
  7890. return false;
  7891. }, function (data, ret) {
  7892. that.holdSubmit(false);
  7893. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  7894. return false;
  7895. }
  7896. submitBtn.removeClass("disabled");
  7897. if (typeof error === 'function') {
  7898. if (false === error.call($(this), data, ret)) {
  7899. return false;
  7900. }
  7901. }
  7902. }, submit);
  7903. //如果提交失败则释放锁定
  7904. if (!submitResult) {
  7905. that.holdSubmit(false);
  7906. submitBtn.removeClass("disabled");
  7907. }
  7908. return false;
  7909. }
  7910. }, form.data("validator-options") || {}));
  7911. //移除提交按钮的disabled类
  7912. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  7913. },
  7914. selectpicker: function (form) {
  7915. //绑定select元素事件
  7916. if ($(".selectpicker", form).size() > 0) {
  7917. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  7918. $('.selectpicker', form).selectpicker();
  7919. $(form).on("reset", function () {
  7920. setTimeout(function () {
  7921. $('.selectpicker').selectpicker('refresh').trigger("change");
  7922. }, 1);
  7923. });
  7924. });
  7925. }
  7926. },
  7927. selectpage: function (form) {
  7928. //绑定selectpage元素事件
  7929. if ($(".selectpage", form).size() > 0) {
  7930. require(['selectpage'], function () {
  7931. $('.selectpage', form).selectPage({
  7932. eAjaxSuccess: function (data) {
  7933. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  7934. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  7935. return data;
  7936. }
  7937. });
  7938. });
  7939. //给隐藏的元素添加上validate验证触发事件
  7940. $(document).on("change", ".sp_hidden", function () {
  7941. $(this).trigger("validate");
  7942. });
  7943. $(document).on("change", ".sp_input", function () {
  7944. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  7945. });
  7946. $(form).on("reset", function () {
  7947. setTimeout(function () {
  7948. $('.selectpage', form).selectPageClear();
  7949. }, 1);
  7950. });
  7951. }
  7952. },
  7953. cxselect: function (form) {
  7954. //绑定cxselect元素事件
  7955. if ($("[data-toggle='cxselect']", form).size() > 0) {
  7956. require(['cxselect'], function () {
  7957. $.cxSelect.defaults.jsonName = 'name';
  7958. $.cxSelect.defaults.jsonValue = 'value';
  7959. $.cxSelect.defaults.jsonSpace = 'data';
  7960. $("[data-toggle='cxselect']", form).cxSelect();
  7961. });
  7962. }
  7963. },
  7964. citypicker: function (form) {
  7965. //绑定城市远程插件
  7966. if ($("[data-toggle='city-picker']", form).size() > 0) {
  7967. require(['citypicker'], function () {
  7968. $(form).on("reset", function () {
  7969. setTimeout(function () {
  7970. $("[data-toggle='city-picker']").citypicker('refresh');
  7971. }, 1);
  7972. });
  7973. });
  7974. }
  7975. },
  7976. datetimepicker: function (form) {
  7977. //绑定日期时间元素事件
  7978. if ($(".datetimepicker", form).size() > 0) {
  7979. require(['bootstrap-datetimepicker'], function () {
  7980. var options = {
  7981. format: 'YYYY-MM-DD HH:mm:ss',
  7982. icons: {
  7983. time: 'fa fa-clock-o',
  7984. date: 'fa fa-calendar',
  7985. up: 'fa fa-chevron-up',
  7986. down: 'fa fa-chevron-down',
  7987. previous: 'fa fa-chevron-left',
  7988. next: 'fa fa-chevron-right',
  7989. today: 'fa fa-history',
  7990. clear: 'fa fa-trash',
  7991. close: 'fa fa-remove'
  7992. },
  7993. showTodayButton: true,
  7994. showClose: true
  7995. };
  7996. $('.datetimepicker', form).parent().css('position', 'relative');
  7997. $('.datetimepicker', form).datetimepicker(options);
  7998. });
  7999. }
  8000. },
  8001. daterangepicker: function (form) {
  8002. //绑定日期时间元素事件
  8003. if ($(".datetimerange", form).size() > 0) {
  8004. require(['bootstrap-daterangepicker'], function () {
  8005. var ranges = {};
  8006. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  8007. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  8008. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  8009. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  8010. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  8011. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  8012. var options = {
  8013. timePicker: false,
  8014. autoUpdateInput: false,
  8015. timePickerSeconds: true,
  8016. timePicker24Hour: true,
  8017. autoApply: true,
  8018. locale: {
  8019. format: 'YYYY-MM-DD HH:mm:ss',
  8020. customRangeLabel: __("Custom Range"),
  8021. applyLabel: __("Apply"),
  8022. cancelLabel: __("Clear"),
  8023. },
  8024. ranges: ranges,
  8025. };
  8026. var origincallback = function (start, end) {
  8027. $(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
  8028. $(this.element).trigger('blur');
  8029. };
  8030. $(".datetimerange", form).each(function () {
  8031. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  8032. $(this).on('apply.daterangepicker', function (ev, picker) {
  8033. callback.call(picker, picker.startDate, picker.endDate);
  8034. });
  8035. $(this).on('cancel.daterangepicker', function (ev, picker) {
  8036. $(this).val('').trigger('blur');
  8037. });
  8038. $(this).daterangepicker($.extend({}, options, $(this).data()), callback);
  8039. });
  8040. });
  8041. }
  8042. },
  8043. plupload: function (form) {
  8044. //绑定plupload上传元素事件
  8045. if ($(".plupload", form).size() > 0) {
  8046. Upload.api.plupload($(".plupload", form));
  8047. }
  8048. },
  8049. faselect: function (form) {
  8050. //绑定fachoose选择附件事件
  8051. if ($(".fachoose", form).size() > 0) {
  8052. $(".fachoose", form).on('click', function () {
  8053. var that = this;
  8054. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  8055. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  8056. var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
  8057. var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
  8058. parent.Fast.api.open("general/attachment/select?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
  8059. callback: function (data) {
  8060. var button = $("#" + $(that).attr("id"));
  8061. var maxcount = $(button).data("maxcount");
  8062. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  8063. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  8064. if (input_id && data.multiple) {
  8065. var urlArr = [];
  8066. var inputObj = $("#" + input_id);
  8067. var value = $.trim(inputObj.val());
  8068. if (value !== "") {
  8069. urlArr.push(inputObj.val());
  8070. }
  8071. urlArr.push(data.url)
  8072. var result = urlArr.join(",");
  8073. if (maxcount > 0) {
  8074. var nums = value === '' ? 0 : value.split(/\,/).length;
  8075. var files = data.url !== "" ? data.url.split(/\,/) : [];
  8076. var remains = maxcount - nums;
  8077. if (files.length > remains) {
  8078. Toastr.error(__('You can choose up to %d file%s', remains));
  8079. return false;
  8080. }
  8081. }
  8082. inputObj.val(result).trigger("change").trigger("validate");
  8083. } else {
  8084. $("#" + input_id).val(data.url).trigger("change").trigger("validate");
  8085. }
  8086. }
  8087. });
  8088. return false;
  8089. });
  8090. }
  8091. },
  8092. fieldlist: function (form) {
  8093. //绑定fieldlist
  8094. if ($(".fieldlist", form).size() > 0) {
  8095. require(['dragsort', 'template'], function (undefined, Template) {
  8096. //刷新隐藏textarea的值
  8097. var refresh = function (name) {
  8098. var data = {};
  8099. var textarea = $("textarea[name='" + name + "']", form);
  8100. var container = textarea.closest("dl");
  8101. var template = container.data("template");
  8102. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  8103. var reg = /\[(\w+)\]\[(\w+)\]$/g;
  8104. var match = reg.exec(j.name);
  8105. if (!match)
  8106. return true;
  8107. match[1] = "x" + parseInt(match[1]);
  8108. if (typeof data[match[1]] == 'undefined') {
  8109. data[match[1]] = {};
  8110. }
  8111. data[match[1]][match[2]] = j.value;
  8112. });
  8113. var result = template ? [] : {};
  8114. $.each(data, function (i, j) {
  8115. if (j) {
  8116. if (!template) {
  8117. if (j.key != '') {
  8118. result[j.key] = j.value;
  8119. }
  8120. } else {
  8121. result.push(j);
  8122. }
  8123. }
  8124. });
  8125. textarea.val(JSON.stringify(result));
  8126. };
  8127. //监听文本框改变事件
  8128. $(document).on('change keyup', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
  8129. refresh($(this).closest("dl").data("name"));
  8130. });
  8131. //追加控制
  8132. $(".fieldlist", form).on("click", ".btn-append,.append", function (e, row) {
  8133. var container = $(this).closest("dl");
  8134. var index = container.data("index");
  8135. var name = container.data("name");
  8136. var template = container.data("template");
  8137. var data = container.data();
  8138. index = index ? parseInt(index) : 0;
  8139. container.data("index", index + 1);
  8140. var row = row ? row : {};
  8141. var vars = {index: index, name: name, data: data, row: row};
  8142. var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
  8143. $(html).insertBefore($(this).closest("dd"));
  8144. $(this).trigger("fa.event.appendfieldlist", $(this).closest("dd").prev());
  8145. });
  8146. //移除控制
  8147. $(".fieldlist", form).on("click", "dd .btn-remove", function () {
  8148. var container = $(this).closest("dl");
  8149. $(this).closest("dd").remove();
  8150. refresh(container.data("name"));
  8151. });
  8152. //拖拽排序
  8153. $("dl.fieldlist", form).dragsort({
  8154. itemSelector: 'dd',
  8155. dragSelector: ".btn-dragsort",
  8156. dragEnd: function () {
  8157. refresh($(this).closest("dl").data("name"));
  8158. },
  8159. placeHolderTemplate: "<dd></dd>"
  8160. });
  8161. //渲染数据
  8162. $(".fieldlist", form).each(function () {
  8163. var container = this;
  8164. var textarea = $("textarea[name='" + $(this).data("name") + "']", form);
  8165. if (textarea.val() == '') {
  8166. return true;
  8167. }
  8168. var template = $(this).data("template");
  8169. var json = {};
  8170. try {
  8171. json = JSON.parse(textarea.val());
  8172. } catch (e) {
  8173. }
  8174. $.each(json, function (i, j) {
  8175. $(".btn-append,.append", container).trigger('click', template ? j : {
  8176. key: i,
  8177. value: j
  8178. });
  8179. });
  8180. });
  8181. });
  8182. }
  8183. },
  8184. switcher: function (form) {
  8185. form.on("click", "[data-toggle='switcher']", function () {
  8186. if ($(this).hasClass("disabled")) {
  8187. return false;
  8188. }
  8189. var input = $(this).prev("input");
  8190. input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input;
  8191. if (input.size() > 0) {
  8192. var yes = $(this).data("yes");
  8193. var no = $(this).data("no");
  8194. if (input.val() == yes) {
  8195. input.val(no);
  8196. $("i", this).addClass("fa-flip-horizontal text-gray");
  8197. } else {
  8198. input.val(yes);
  8199. $("i", this).removeClass("fa-flip-horizontal text-gray");
  8200. }
  8201. input.trigger('change');
  8202. }
  8203. return false;
  8204. });
  8205. },
  8206. bindevent: function (form) {
  8207. },
  8208. slider: function (form) {
  8209. if ($(".slider", form).size() > 0) {
  8210. require(['bootstrap-slider'], function () {
  8211. $('.slider').removeClass('hidden').css('width', function (index, value) {
  8212. return $(this).parents('.form-control').width();
  8213. }).slider().on('slide', function (ev) {
  8214. var data = $(this).data();
  8215. if (typeof data.unit !== 'undefined') {
  8216. $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  8217. }
  8218. });
  8219. });
  8220. }
  8221. }
  8222. },
  8223. api: {
  8224. submit: function (form, success, error, submit) {
  8225. if (form.size() === 0) {
  8226. Toastr.error("表单未初始化完成,无法提交");
  8227. return false;
  8228. }
  8229. if (typeof submit === 'function') {
  8230. if (false === submit.call(form, success, error)) {
  8231. return false;
  8232. }
  8233. }
  8234. var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
  8235. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  8236. url = form.attr("action");
  8237. url = url ? url : location.href;
  8238. //修复当存在多选项元素时提交的BUG
  8239. var params = {};
  8240. var multipleList = $("[name$='[]']", form);
  8241. if (multipleList.size() > 0) {
  8242. var postFields = form.serializeArray().map(function (obj) {
  8243. return $(obj).prop("name");
  8244. });
  8245. $.each(multipleList, function (i, j) {
  8246. if (postFields.indexOf($(this).prop("name")) < 0) {
  8247. params[$(this).prop("name")] = '';
  8248. }
  8249. });
  8250. }
  8251. //调用Ajax请求方法
  8252. Fast.api.ajax({
  8253. type: type,
  8254. url: url,
  8255. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  8256. dataType: 'json',
  8257. complete: function (xhr) {
  8258. var token = xhr.getResponseHeader('__token__');
  8259. if (token) {
  8260. $("input[name='__token__']").val(token);
  8261. }
  8262. }
  8263. }, function (data, ret) {
  8264. $('.form-group', form).removeClass('has-feedback has-success has-error');
  8265. if (data && typeof data === 'object') {
  8266. //刷新客户端token
  8267. if (typeof data.token !== 'undefined') {
  8268. $("input[name='__token__']").val(data.token);
  8269. }
  8270. //调用客户端事件
  8271. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  8272. data.callback.call(form, data);
  8273. }
  8274. }
  8275. if (typeof success === 'function') {
  8276. if (false === success.call(form, data, ret)) {
  8277. return false;
  8278. }
  8279. }
  8280. }, function (data, ret) {
  8281. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  8282. $("input[name='__token__']").val(data.token);
  8283. }
  8284. if (typeof error === 'function') {
  8285. if (false === error.call(form, data, ret)) {
  8286. return false;
  8287. }
  8288. }
  8289. });
  8290. return true;
  8291. },
  8292. bindevent: function (form, success, error, submit) {
  8293. form = typeof form === 'object' ? form : $(form);
  8294. var events = Form.events;
  8295. events.bindevent(form);
  8296. events.validator(form, success, error, submit);
  8297. events.selectpicker(form);
  8298. events.daterangepicker(form);
  8299. events.selectpage(form);
  8300. events.cxselect(form);
  8301. events.citypicker(form);
  8302. events.datetimepicker(form);
  8303. events.plupload(form);
  8304. events.faselect(form);
  8305. events.fieldlist(form);
  8306. events.slider(form);
  8307. events.switcher(form);
  8308. },
  8309. custom: {}
  8310. },
  8311. };
  8312. return Form;
  8313. });
  8314. /**
  8315. * FastAdmin通用搜索
  8316. *
  8317. * @author: pppscn <35696959@qq.com>
  8318. * @update 2017-05-07 <https://gitee.com/pp/fastadmin>
  8319. *
  8320. * @author: Karson <karsonzhang@163.com>
  8321. * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
  8322. */
  8323. !function ($) {
  8324. 'use strict';
  8325. var ColumnsForSearch = [];
  8326. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  8327. var initCommonSearch = function (pColumns, that) {
  8328. var vFormCommon = createFormCommon(pColumns, that);
  8329. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  8330. vModal += vFormCommon;
  8331. vModal += "</div>";
  8332. that.$container.prepend($(vModal));
  8333. that.$commonsearch = $(".commonsearch-table", that.$container);
  8334. var form = $("form.form-commonsearch", that.$commonsearch);
  8335. require(['form'], function (Form) {
  8336. Form.api.bindevent(form);
  8337. form.validator("destroy");
  8338. });
  8339. // 表单提交
  8340. form.on("submit", function (event) {
  8341. event.preventDefault();
  8342. that.onCommonSearch();
  8343. return false;
  8344. });
  8345. // 重置搜索
  8346. form.on("click", "button[type=reset]", function (event) {
  8347. form[0].reset();
  8348. setTimeout(function () {
  8349. that.onCommonSearch();
  8350. }, 0);
  8351. });
  8352. };
  8353. var createFormCommon = function (pColumns, that) {
  8354. // 如果有使用模板则直接返回模板的内容
  8355. if (that.options.searchFormTemplate) {
  8356. return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
  8357. }
  8358. var htmlForm = [];
  8359. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
  8360. htmlForm.push('<fieldset>');
  8361. if (that.options.titleForm.length > 0)
  8362. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  8363. htmlForm.push('<div class="row">');
  8364. for (var i in pColumns) {
  8365. var vObjCol = pColumns[i];
  8366. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  8367. var query = Fast.api.query(vObjCol.field);
  8368. var operate = Fast.api.query(vObjCol.field + "-operate");
  8369. vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  8370. vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
  8371. ColumnsForSearch.push(vObjCol);
  8372. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  8373. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  8374. htmlForm.push('<div class="col-xs-8">');
  8375. vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
  8376. htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
  8377. var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
  8378. var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
  8379. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  8380. extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
  8381. if (vObjCol.searchList) {
  8382. if (typeof vObjCol.searchList === 'function') {
  8383. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  8384. } else {
  8385. var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
  8386. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  8387. (function (vObjCol, that) {
  8388. $.when(vObjCol.searchList).done(function (ret) {
  8389. var searchList = [];
  8390. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  8391. searchList = ret.data.searchlist;
  8392. } else if (ret.constructor === Array || ret.constructor === Object) {
  8393. searchList = ret;
  8394. }
  8395. var optionList = createOptionList(searchList, vObjCol, that);
  8396. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join(''));
  8397. });
  8398. })(vObjCol, that);
  8399. } else {
  8400. optionList = createOptionList(vObjCol.searchList, vObjCol, that);
  8401. }
  8402. htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
  8403. }
  8404. } else {
  8405. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  8406. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  8407. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  8408. if (/BETWEEN$/.test(vObjCol.operate)) {
  8409. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  8410. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  8411. htmlForm.push('<div class="row row-between">');
  8412. htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[0], placeholderArr[0], vObjCol.field, i, style, extend));
  8413. htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[1], placeholderArr[1], vObjCol.field, i, style, extend));
  8414. htmlForm.push('</div>');
  8415. } else {
  8416. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s>', type, addClass, vObjCol.field, defaultValue, placeholder, vObjCol.field, i, style, extend));
  8417. }
  8418. }
  8419. htmlForm.push('</div>');
  8420. htmlForm.push('</div>');
  8421. }
  8422. }
  8423. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  8424. htmlForm.push(createFormBtn(that).join(''));
  8425. htmlForm.push('</div>');
  8426. htmlForm.push('</div>');
  8427. htmlForm.push('</fieldset>');
  8428. htmlForm.push('</form>');
  8429. return htmlForm.join('');
  8430. };
  8431. var createFormBtn = function (that) {
  8432. var htmlBtn = [];
  8433. var searchSubmit = that.options.formatCommonSubmitButton();
  8434. var searchReset = that.options.formatCommonResetButton();
  8435. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  8436. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
  8437. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  8438. htmlBtn.push('</div>');
  8439. return htmlBtn;
  8440. };
  8441. var createOptionList = function (searchList, vObjCol, that) {
  8442. var isArray = searchList.constructor === Array;
  8443. var optionList = [];
  8444. optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  8445. $.each(searchList, function (key, value) {
  8446. if (value.constructor === Object) {
  8447. key = value.id;
  8448. value = value.name;
  8449. } else {
  8450. key = isArray ? value : key;
  8451. }
  8452. optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
  8453. });
  8454. return optionList;
  8455. };
  8456. var isSearchAvailble = function (that) {
  8457. //只支持服务端搜索
  8458. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  8459. return false;
  8460. }
  8461. return true;
  8462. };
  8463. var getSearchQuery = function (that, removeempty) {
  8464. var op = {};
  8465. var filter = {};
  8466. var value = '';
  8467. $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
  8468. var name = $(this).data("name");
  8469. var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
  8470. var obj = $("[name='" + name + "']", that.$commonsearch);
  8471. if (obj.size() == 0)
  8472. return true;
  8473. var vObjCol = ColumnsForSearch[i];
  8474. var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
  8475. if (obj.size() > 1) {
  8476. if (/BETWEEN$/.test(sym)) {
  8477. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
  8478. value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  8479. if (value_begin.length || value_end.length) {
  8480. if (process) {
  8481. value_begin = process(value_begin, 'begin');
  8482. value_end = process(value_end, 'end');
  8483. }
  8484. value = value_begin + ',' + value_end;
  8485. } else {
  8486. value = '';
  8487. }
  8488. //如果是时间筛选,将operate置为RANGE
  8489. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  8490. sym = 'RANGE';
  8491. }
  8492. } else {
  8493. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  8494. value = process ? process(value) : value;
  8495. }
  8496. } else {
  8497. value = process ? process(obj.val()) : obj.val();
  8498. }
  8499. if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
  8500. return true;
  8501. }
  8502. op[name] = sym;
  8503. filter[name] = value;
  8504. });
  8505. return {op: op, filter: filter};
  8506. };
  8507. var getQueryParams = function (params, searchQuery, removeempty) {
  8508. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  8509. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  8510. params.filter = $.extend({}, params.filter, searchQuery.filter);
  8511. params.op = $.extend({}, params.op, searchQuery.op);
  8512. //移除empty的值
  8513. if (removeempty) {
  8514. $.each(params.filter, function (i, j) {
  8515. if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
  8516. delete params.filter[i];
  8517. delete params.op[i];
  8518. }
  8519. });
  8520. }
  8521. params.filter = JSON.stringify(params.filter);
  8522. params.op = JSON.stringify(params.op);
  8523. return params;
  8524. };
  8525. $.extend($.fn.bootstrapTable.defaults, {
  8526. commonSearch: false,
  8527. titleForm: "Common search",
  8528. actionForm: "",
  8529. searchFormTemplate: "",
  8530. searchFormVisible: true,
  8531. searchClass: 'searchit',
  8532. showSearch: true,
  8533. renderDefault: true,
  8534. onCommonSearch: function (field, text) {
  8535. return false;
  8536. },
  8537. onPostCommonSearch: function (table) {
  8538. return false;
  8539. }
  8540. });
  8541. $.extend($.fn.bootstrapTable.defaults.icons, {
  8542. commonSearchIcon: 'glyphicon-search'
  8543. });
  8544. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  8545. 'common-search.bs.table': 'onCommonSearch',
  8546. 'post-common-search.bs.table': 'onPostCommonSearch'
  8547. });
  8548. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  8549. formatCommonSearch: function () {
  8550. return "Common search";
  8551. },
  8552. formatCommonSubmitButton: function () {
  8553. return "Submit";
  8554. },
  8555. formatCommonResetButton: function () {
  8556. return "Reset";
  8557. },
  8558. formatCommonCloseButton: function () {
  8559. return "Close";
  8560. },
  8561. formatCommonChoose: function () {
  8562. return "Choose";
  8563. }
  8564. });
  8565. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  8566. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  8567. _initHeader = BootstrapTable.prototype.initHeader,
  8568. _initToolbar = BootstrapTable.prototype.initToolbar,
  8569. _load = BootstrapTable.prototype.load,
  8570. _initSearch = BootstrapTable.prototype.initSearch;
  8571. BootstrapTable.prototype.initHeader = function () {
  8572. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  8573. this.$header.find('th[data-field]').each(function (i) {
  8574. var column = $(this).data();
  8575. if (typeof column['width'] !== 'undefined') {
  8576. $(this).css("min-width", column['width']);
  8577. }
  8578. });
  8579. };
  8580. BootstrapTable.prototype.initToolbar = function () {
  8581. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  8582. if (!isSearchAvailble(this)) {
  8583. return;
  8584. }
  8585. var that = this,
  8586. html = [];
  8587. if (that.options.showSearch) {
  8588. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  8589. 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()));
  8590. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  8591. html.push('</button></div>');
  8592. }
  8593. if (that.$toolbar.find(".pull-right").size() > 0) {
  8594. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  8595. } else {
  8596. that.$toolbar.append(html.join(''));
  8597. }
  8598. initCommonSearch(that.columns, that);
  8599. that.$toolbar.find('button[name="commonSearch"]')
  8600. .off('click').on('click', function () {
  8601. that.$commonsearch.toggleClass("hidden");
  8602. return;
  8603. });
  8604. that.$container.on("click", "." + that.options.searchClass, function () {
  8605. var obj = $("form [name='" + $(this).data("field") + "']", that.$commonsearch);
  8606. if (obj.size() > 0) {
  8607. var value = $(this).data("value");
  8608. if (obj.is("select")) {
  8609. $("option[value='" + value + "']", obj).prop("selected", true);
  8610. } else if (obj.size() > 1) {
  8611. $("form [name='" + $(this).data("field") + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
  8612. } else {
  8613. obj.val(value);
  8614. }
  8615. obj.trigger("change");
  8616. $("form", that.$commonsearch).trigger("submit");
  8617. }
  8618. });
  8619. var queryParams = that.options.queryParams;
  8620. //匹配默认搜索值
  8621. this.options.queryParams = function (params) {
  8622. return queryParams(getQueryParams(params, getSearchQuery(that, true)));
  8623. };
  8624. this.trigger('post-common-search', that);
  8625. };
  8626. BootstrapTable.prototype.onCommonSearch = function () {
  8627. var searchQuery = getSearchQuery(this);
  8628. this.trigger('common-search', this, searchQuery);
  8629. this.options.pageNumber = 1;
  8630. //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
  8631. this.refresh({});
  8632. };
  8633. BootstrapTable.prototype.load = function (data) {
  8634. _load.apply(this, Array.prototype.slice.apply(arguments));
  8635. if (!isSearchAvailble(this)) {
  8636. return;
  8637. }
  8638. };
  8639. BootstrapTable.prototype.initSearch = function () {
  8640. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  8641. if (!isSearchAvailble(this)) {
  8642. return;
  8643. }
  8644. var that = this;
  8645. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  8646. this.data = fp ? $.grep(this.data, function (item, i) {
  8647. for (var key in fp) {
  8648. var fval = fp[key].toLowerCase();
  8649. var value = item[key];
  8650. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  8651. that.header.formatters[$.inArray(key, that.header.fields)],
  8652. [value, item, i], value);
  8653. if (!($.inArray(key, that.header.fields) !== -1 &&
  8654. (typeof value === 'string' || typeof value === 'number') &&
  8655. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  8656. return false;
  8657. }
  8658. }
  8659. return true;
  8660. }) : this.data;
  8661. };
  8662. }(jQuery);
  8663. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  8664. return function () {
  8665. var ret, fn;
  8666. return ret || global.$.fn.bootstrapTable.defaults;
  8667. };
  8668. }(this)));
  8669. /**
  8670. * 将BootstrapTable的行使用自定义的模板来渲染
  8671. *
  8672. * @author: karson
  8673. * @version: v0.0.1
  8674. *
  8675. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  8676. */
  8677. !function ($) {
  8678. 'use strict';
  8679. $.extend($.fn.bootstrapTable.defaults, {
  8680. //是否启用模板渲染
  8681. templateView: false,
  8682. //数据格式化的模板ID或格式函数
  8683. templateFormatter: "itemtpl",
  8684. //添加的父类的class
  8685. templateParentClass: "row row-flex",
  8686. //向table添加的class
  8687. templateTableClass: "table-template",
  8688. });
  8689. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  8690. _initContainer = BootstrapTable.prototype.initContainer,
  8691. _initBody = BootstrapTable.prototype.initBody,
  8692. _initRow = BootstrapTable.prototype.initRow;
  8693. BootstrapTable.prototype.initContainer = function () {
  8694. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  8695. var that = this;
  8696. if (!that.options.templateView) {
  8697. return;
  8698. }
  8699. that.options.cardView = true;
  8700. };
  8701. BootstrapTable.prototype.initBody = function () {
  8702. var that = this;
  8703. $.extend(that.options, {
  8704. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  8705. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  8706. });
  8707. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  8708. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  8709. if (!that.options.templateView) {
  8710. return;
  8711. } else {
  8712. //由于Bootstrap是基于Table的,添加一个父类容器
  8713. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  8714. }
  8715. };
  8716. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  8717. var that = this;
  8718. //如果未启用则使用原生的initRow方法
  8719. if (!that.options.templateView) {
  8720. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  8721. }
  8722. var $content = '';
  8723. if (typeof that.options.templateFormatter === 'function') {
  8724. $content = that.options.templateFormatter.call(that, item, i, data);
  8725. } else {
  8726. var Template = require('template');
  8727. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  8728. }
  8729. return $content;
  8730. };
  8731. }(jQuery);
  8732. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  8733. return function () {
  8734. var ret, fn;
  8735. return ret || global.$.fn.bootstrapTable.defaults;
  8736. };
  8737. }(this)));
  8738. define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template'], function ($, undefined, Moment) {
  8739. var Table = {
  8740. list: {},
  8741. // Bootstrap-table 基础配置
  8742. defaults: {
  8743. url: '',
  8744. sidePagination: 'server',
  8745. method: 'get', //请求方法
  8746. toolbar: ".toolbar", //工具栏
  8747. search: true, //是否启用快速搜索
  8748. cache: false,
  8749. commonSearch: true, //是否启用通用搜索
  8750. searchFormVisible: false, //是否始终显示搜索表单
  8751. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  8752. idTable: 'commonTable',
  8753. showExport: true,
  8754. exportDataType: "all",
  8755. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  8756. exportOptions: {
  8757. fileName: 'export_' + Moment().format("YYYY-MM-DD"),
  8758. ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
  8759. },
  8760. pageSize: 10,
  8761. pageList: [10, 25, 50, 'All'],
  8762. pagination: true,
  8763. clickToSelect: true, //是否启用点击选中
  8764. dblClickToEdit: true, //是否启用双击编辑
  8765. singleSelect: false, //是否启用单选
  8766. showRefresh: false,
  8767. locale: 'zh-CN',
  8768. showToggle: true,
  8769. showColumns: true,
  8770. pk: 'id',
  8771. sortName: 'id',
  8772. sortOrder: 'desc',
  8773. paginationFirstText: __("First"),
  8774. paginationPreText: __("Previous"),
  8775. paginationNextText: __("Next"),
  8776. paginationLastText: __("Last"),
  8777. cardView: false, //卡片视图
  8778. checkOnInit: true, //是否在初始化时判断
  8779. escape: true, //是否对内容进行转义
  8780. extend: {
  8781. index_url: '',
  8782. add_url: '',
  8783. edit_url: '',
  8784. del_url: '',
  8785. import_url: '',
  8786. multi_url: '',
  8787. dragsort_url: 'ajax/weigh',
  8788. }
  8789. },
  8790. // Bootstrap-table 列配置
  8791. columnDefaults: {
  8792. align: 'center',
  8793. valign: 'middle',
  8794. },
  8795. config: {
  8796. firsttd: 'tbody tr td:first-child:not(:has(div.card-views))',
  8797. toolbar: '.toolbar',
  8798. refreshbtn: '.btn-refresh',
  8799. addbtn: '.btn-add',
  8800. editbtn: '.btn-edit',
  8801. delbtn: '.btn-del',
  8802. importbtn: '.btn-import',
  8803. multibtn: '.btn-multi',
  8804. disabledbtn: '.btn-disabled',
  8805. editonebtn: '.btn-editone',
  8806. restoreonebtn: '.btn-restoreone',
  8807. destroyonebtn: '.btn-destroyone',
  8808. restoreallbtn: '.btn-restoreall',
  8809. destroyallbtn: '.btn-destroyall',
  8810. dragsortfield: 'weigh',
  8811. },
  8812. api: {
  8813. init: function (defaults, columnDefaults, locales) {
  8814. defaults = defaults ? defaults : {};
  8815. columnDefaults = columnDefaults ? columnDefaults : {};
  8816. locales = locales ? locales : {};
  8817. // 如果是iOS设备则启用卡片视图
  8818. if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  8819. Table.defaults.cardView = true;
  8820. }
  8821. // 写入bootstrap-table默认配置
  8822. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  8823. // 写入bootstrap-table column配置
  8824. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  8825. // 写入bootstrap-table locale配置
  8826. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  8827. formatCommonSearch: function () {
  8828. return __('Common search');
  8829. },
  8830. formatCommonSubmitButton: function () {
  8831. return __('Submit');
  8832. },
  8833. formatCommonResetButton: function () {
  8834. return __('Reset');
  8835. },
  8836. formatCommonCloseButton: function () {
  8837. return __('Close');
  8838. },
  8839. formatCommonChoose: function () {
  8840. return __('Choose');
  8841. }
  8842. }, locales);
  8843. if (typeof defaults.exportTypes != 'undefined') {
  8844. $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
  8845. }
  8846. },
  8847. // 绑定事件
  8848. bindevent: function (table) {
  8849. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  8850. var parenttable = table.closest('.bootstrap-table');
  8851. //Bootstrap-table配置
  8852. var options = table.bootstrapTable('getOptions');
  8853. //Bootstrap操作区
  8854. var toolbar = $(options.toolbar, parenttable);
  8855. //当刷新表格时
  8856. table.on('load-error.bs.table', function (status, res, e) {
  8857. if (e.status === 0) {
  8858. return;
  8859. }
  8860. Toastr.error(__('Unknown data format'));
  8861. });
  8862. //当刷新表格时
  8863. table.on('refresh.bs.table', function (e, settings, data) {
  8864. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  8865. });
  8866. if (options.dblClickToEdit) {
  8867. //当双击单元格时
  8868. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  8869. $(Table.config.editonebtn, element).trigger("click");
  8870. });
  8871. }
  8872. //当内容渲染完成后
  8873. table.on('post-body.bs.table', function (e, settings, json, xhr) {
  8874. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  8875. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
  8876. if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {
  8877. // 挺拽选择,需要重新绑定事件
  8878. require(['drag', 'drop'], function () {
  8879. $(Table.config.firsttd, table).drag("start", function (ev, dd) {
  8880. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  8881. }).drag(function (ev, dd) {
  8882. $(dd.proxy).css({
  8883. top: Math.min(ev.pageY, dd.startY),
  8884. left: Math.min(ev.pageX, dd.startX),
  8885. height: Math.abs(ev.pageY - dd.startY),
  8886. width: Math.abs(ev.pageX - dd.startX)
  8887. });
  8888. }).drag("end", function (ev, dd) {
  8889. $(dd.proxy).remove();
  8890. });
  8891. $(Table.config.firsttd, table).drop("start", function () {
  8892. Table.api.toggleattr(this);
  8893. }).drop(function () {
  8894. Table.api.toggleattr(this);
  8895. }).drop("end", function () {
  8896. Table.api.toggleattr(this);
  8897. });
  8898. $.drop({
  8899. multi: true
  8900. });
  8901. });
  8902. }
  8903. });
  8904. // 处理选中筛选框后按钮的状态统一变更
  8905. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
  8906. var ids = Table.api.selectedids(table);
  8907. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
  8908. });
  8909. // 绑定TAB事件
  8910. $('.panel-heading ul[data-field] li a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  8911. var field = $(this).closest("ul").data("field");
  8912. var value = $(this).data("value");
  8913. $("select[name='" + field + "'] option[value='" + value + "']", table.closest(".bootstrap-table").find(".commonsearch-table")).prop("selected", true);
  8914. table.bootstrapTable('refresh', {pageNumber: 1});
  8915. return false;
  8916. });
  8917. // 刷新按钮事件
  8918. $(toolbar).on('click', Table.config.refreshbtn, function () {
  8919. table.bootstrapTable('refresh');
  8920. });
  8921. // 添加按钮事件
  8922. $(toolbar).on('click', Table.config.addbtn, function () {
  8923. var ids = Table.api.selectedids(table);
  8924. var url = options.extend.add_url;
  8925. if (url.indexOf("{ids}") !== -1) {
  8926. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  8927. }
  8928. Fast.api.open(url, __('Add'), $(this).data() || {});
  8929. });
  8930. // 导入按钮事件
  8931. if ($(Table.config.importbtn, toolbar).size() > 0) {
  8932. require(['upload'], function (Upload) {
  8933. Upload.api.plupload($(Table.config.importbtn, toolbar), function (data, ret) {
  8934. Fast.api.ajax({
  8935. url: options.extend.import_url,
  8936. data: {file: data.url},
  8937. }, function (data, ret) {
  8938. table.bootstrapTable('refresh');
  8939. });
  8940. });
  8941. });
  8942. }
  8943. // 批量编辑按钮事件
  8944. $(toolbar).on('click', Table.config.editbtn, function () {
  8945. var that = this;
  8946. //循环弹出多个编辑框
  8947. $.each(table.bootstrapTable('getSelections'), function (index, row) {
  8948. var url = options.extend.edit_url;
  8949. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  8950. var url = Table.api.replaceurl(url, row, table);
  8951. Fast.api.open(url, __('Edit'), $(that).data() || {});
  8952. });
  8953. });
  8954. //清空回收站
  8955. $(document).on('click', Table.config.destroyallbtn, function () {
  8956. var that = this;
  8957. Layer.confirm(__('Are you sure you want to truncate?'), function () {
  8958. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  8959. Fast.api.ajax(url, function () {
  8960. Layer.closeAll();
  8961. table.bootstrapTable('refresh');
  8962. }, function () {
  8963. Layer.closeAll();
  8964. });
  8965. });
  8966. return false;
  8967. });
  8968. //还原或删除
  8969. $(document).on('click', Table.config.restoreallbtn + ',' + Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () {
  8970. var that = this;
  8971. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  8972. Fast.api.ajax(url, function () {
  8973. table.bootstrapTable('refresh');
  8974. });
  8975. return false;
  8976. });
  8977. // 批量操作按钮事件
  8978. $(toolbar).on('click', Table.config.multibtn, function () {
  8979. var ids = Table.api.selectedids(table);
  8980. Table.api.multi($(this).data("action"), ids, table, this);
  8981. });
  8982. // 批量删除按钮事件
  8983. $(toolbar).on('click', Table.config.delbtn, function () {
  8984. var that = this;
  8985. var ids = Table.api.selectedids(table);
  8986. Layer.confirm(
  8987. __('Are you sure you want to delete the %s selected item?', ids.length),
  8988. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
  8989. function (index) {
  8990. Table.api.multi("del", ids, table, that);
  8991. Layer.close(index);
  8992. }
  8993. );
  8994. });
  8995. // 拖拽排序
  8996. require(['dragsort'], function () {
  8997. //绑定拖动排序
  8998. $("tbody", table).dragsort({
  8999. itemSelector: 'tr:visible',
  9000. dragSelector: "a.btn-dragsort",
  9001. dragEnd: function (a, b) {
  9002. var element = $("a.btn-dragsort", this);
  9003. var data = table.bootstrapTable('getData');
  9004. var current = data[parseInt($(this).data("index"))];
  9005. var options = table.bootstrapTable('getOptions');
  9006. //改变的值和改变的ID集合
  9007. var ids = $.map($("tbody tr:visible", table), function (tr) {
  9008. return data[parseInt($(tr).data("index"))][options.pk];
  9009. });
  9010. var changeid = current[options.pk];
  9011. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  9012. var params = {
  9013. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  9014. data: {
  9015. ids: ids.join(','),
  9016. changeid: changeid,
  9017. pid: pid,
  9018. field: Table.config.dragsortfield,
  9019. orderway: options.sortOrder,
  9020. table: options.extend.table,
  9021. pk: options.pk
  9022. }
  9023. };
  9024. Fast.api.ajax(params, function (data, ret) {
  9025. var success = $(element).data("success") || $.noop;
  9026. if (typeof success === 'function') {
  9027. if (false === success.call(element, data, ret)) {
  9028. return false;
  9029. }
  9030. }
  9031. table.bootstrapTable('refresh');
  9032. }, function (data, ret) {
  9033. var error = $(element).data("error") || $.noop;
  9034. if (typeof error === 'function') {
  9035. if (false === error.call(element, data, ret)) {
  9036. return false;
  9037. }
  9038. }
  9039. table.bootstrapTable('refresh');
  9040. });
  9041. },
  9042. placeHolderTemplate: ""
  9043. });
  9044. });
  9045. $(table).on("click", "input[data-id][name='checkbox']", function (e) {
  9046. var ids = $(this).data("id");
  9047. var row = Table.api.getrowbyid(table, ids);
  9048. table.trigger('check.bs.table', [row, this]);
  9049. });
  9050. $(table).on("click", "[data-id].btn-change", function (e) {
  9051. e.preventDefault();
  9052. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  9053. });
  9054. $(table).on("click", "[data-id].btn-edit", function (e) {
  9055. e.preventDefault();
  9056. var ids = $(this).data("id");
  9057. var row = Table.api.getrowbyid(table, ids);
  9058. row.ids = ids;
  9059. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  9060. Fast.api.open(url, __('Edit'), $(this).data() || {});
  9061. });
  9062. $(table).on("click", "[data-id].btn-del", function (e) {
  9063. e.preventDefault();
  9064. var id = $(this).data("id");
  9065. var that = this;
  9066. Layer.confirm(
  9067. __('Are you sure you want to delete this item?'),
  9068. {icon: 3, title: __('Warning'), shadeClose: true},
  9069. function (index) {
  9070. Table.api.multi("del", id, table, that);
  9071. Layer.close(index);
  9072. }
  9073. );
  9074. });
  9075. var id = table.attr("id");
  9076. Table.list[id] = table;
  9077. return table;
  9078. },
  9079. // 批量操作请求
  9080. multi: function (action, ids, table, element) {
  9081. var options = table.bootstrapTable('getOptions');
  9082. var data = element ? $(element).data() : {};
  9083. var ids = ($.isArray(ids) ? ids.join(",") : ids);
  9084. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  9085. url = this.replaceurl(url, {ids: ids}, table);
  9086. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  9087. var options = {url: url, data: {action: action, ids: ids, params: params}};
  9088. Fast.api.ajax(options, function (data, ret) {
  9089. var success = $(element).data("success") || $.noop;
  9090. if (typeof success === 'function') {
  9091. if (false === success.call(element, data, ret)) {
  9092. return false;
  9093. }
  9094. }
  9095. table.bootstrapTable('refresh');
  9096. }, function (data, ret) {
  9097. var error = $(element).data("error") || $.noop;
  9098. if (typeof error === 'function') {
  9099. if (false === error.call(element, data, ret)) {
  9100. return false;
  9101. }
  9102. }
  9103. });
  9104. },
  9105. // 单元格元素事件
  9106. events: {
  9107. operate: {
  9108. 'click .btn-editone': function (e, value, row, index) {
  9109. e.stopPropagation();
  9110. e.preventDefault();
  9111. var table = $(this).closest('table');
  9112. var options = table.bootstrapTable('getOptions');
  9113. var ids = row[options.pk];
  9114. row = $.extend({}, row ? row : {}, {ids: ids});
  9115. var url = options.extend.edit_url;
  9116. Fast.api.open(Table.api.replaceurl(url, row, table), __('Edit'), $(this).data() || {});
  9117. },
  9118. 'click .btn-delone': function (e, value, row, index) {
  9119. e.stopPropagation();
  9120. e.preventDefault();
  9121. var that = this;
  9122. var top = $(that).offset().top - $(window).scrollTop();
  9123. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  9124. if (top + 154 > $(window).height()) {
  9125. top = top - 154;
  9126. }
  9127. if ($(window).width() < 480) {
  9128. top = left = undefined;
  9129. }
  9130. Layer.confirm(
  9131. __('Are you sure you want to delete this item?'),
  9132. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
  9133. function (index) {
  9134. var table = $(that).closest('table');
  9135. var options = table.bootstrapTable('getOptions');
  9136. Table.api.multi("del", row[options.pk], table, that);
  9137. Layer.close(index);
  9138. }
  9139. );
  9140. }
  9141. },//单元格图片预览
  9142. image: {
  9143. 'click .img-center': function (e, value, row, index) {
  9144. var data = [];
  9145. value = value.split(",");
  9146. $.each(value, function (index, value) {
  9147. data.push({
  9148. src: Fast.api.cdnurl(value),
  9149. });
  9150. });
  9151. Layer.photos({
  9152. photos: {
  9153. "start": $(this).parent().index(),
  9154. "data": data
  9155. },
  9156. anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  9157. });
  9158. },
  9159. }
  9160. },
  9161. // 单元格数据格式化
  9162. formatter: {
  9163. icon: function (value, row, index) {
  9164. if (!value)
  9165. return '';
  9166. value = value === null ? '' : value.toString();
  9167. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  9168. //渲染fontawesome图标
  9169. return '<i class="' + value + '"></i> ' + value;
  9170. },
  9171. image: function (value, row, index) {
  9172. value = value ? value : '/assets/img/blank.gif';
  9173. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  9174. return '<a href="javascript:"><img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" /></a>';
  9175. },
  9176. images: function (value, row, index) {
  9177. value = value === null ? '' : value.toString();
  9178. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  9179. var arr = value.split(',');
  9180. var html = [];
  9181. $.each(arr, function (i, value) {
  9182. value = value ? value : '/assets/img/blank.gif';
  9183. html.push('<a href="javascript:"><img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" /></a>');
  9184. });
  9185. return html.join(' ');
  9186. },
  9187. content: function (value, row, index) {
  9188. var width = this.width != undefined ? this.width : 250;
  9189. return "<div style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + "px;'>" + value + "</div>";
  9190. },
  9191. status: function (value, row, index) {
  9192. var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
  9193. if (typeof this.custom !== 'undefined') {
  9194. custom = $.extend(custom, this.custom);
  9195. }
  9196. this.custom = custom;
  9197. this.icon = 'fa fa-circle';
  9198. return Table.api.formatter.normal.call(this, value, row, index);
  9199. },
  9200. normal: function (value, row, index) {
  9201. var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
  9202. var custom = {};
  9203. if (typeof this.custom !== 'undefined') {
  9204. custom = $.extend(custom, this.custom);
  9205. }
  9206. value = value === null ? '' : value.toString();
  9207. var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : [];
  9208. var index = keys.indexOf(value);
  9209. var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null;
  9210. var display = index > -1 ? this.searchList[value] : null;
  9211. var icon = typeof this.icon !== 'undefined' ? this.icon : null;
  9212. if (!color) {
  9213. color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary';
  9214. }
  9215. if (!display) {
  9216. display = __(value.charAt(0).toUpperCase() + value.slice(1));
  9217. }
  9218. var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
  9219. if (this.operate != false) {
  9220. html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
  9221. }
  9222. return html;
  9223. },
  9224. toggle: function (value, row, index) {
  9225. var color = typeof this.color !== 'undefined' ? this.color : 'success';
  9226. var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
  9227. var no = typeof this.no !== 'undefined' ? this.no : 0;
  9228. var url = typeof this.url !== 'undefined' ? this.url : '';
  9229. var disable = false;
  9230. if (typeof this.disable !== "undefined") {
  9231. disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
  9232. }
  9233. return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled' : '') + "' data-id='"
  9234. + row.id + "' " + (url ? "data-url='" + url + "'" : "") + " data-params='" + this.field + "=" + (value == yes ? no : yes) + "'><i class='fa fa-toggle-on " + (value == yes ? 'text-' + color : 'fa-flip-horizontal text-gray') + " fa-2x'></i></a>";
  9235. },
  9236. url: function (value, row, index) {
  9237. return '<div class="input-group input-group-sm" style="width:250px;margin:0 auto;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
  9238. },
  9239. search: function (value, row, index) {
  9240. var field = this.field;
  9241. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  9242. value = row[this.customField];
  9243. field = this.customField;
  9244. }
  9245. return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
  9246. },
  9247. addtabs: function (value, row, index) {
  9248. var url = Table.api.replaceurl(this.url, row, this.table);
  9249. var title = this.atitle ? this.atitle : __("Search %s", value);
  9250. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  9251. },
  9252. dialog: function (value, row, index) {
  9253. var url = Table.api.replaceurl(this.url, row, this.table);
  9254. var title = this.atitle ? this.atitle : __("View %s", value);
  9255. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  9256. },
  9257. flag: function (value, row, index) {
  9258. var that = this;
  9259. value = value === null ? '' : value.toString();
  9260. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  9261. //如果字段列有定义custom
  9262. if (typeof this.custom !== 'undefined') {
  9263. colorArr = $.extend(colorArr, this.custom);
  9264. }
  9265. var field = this.field;
  9266. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  9267. value = row[this.customField];
  9268. field = this.customField;
  9269. }
  9270. //渲染Flag
  9271. var html = [];
  9272. var arr = value.split(',');
  9273. var color, display, label;
  9274. $.each(arr, function (i, value) {
  9275. value = value === null ? '' : value.toString();
  9276. if (value == '')
  9277. return true;
  9278. color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  9279. display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1));
  9280. label = '<span class="label label-' + color + '">' + display + '</span>';
  9281. if (that.operate) {
  9282. html.push('<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + field + '" data-value="' + value + '">' + label + '</a>');
  9283. } else {
  9284. html.push(label);
  9285. }
  9286. });
  9287. return html.join(' ');
  9288. },
  9289. label: function (value, row, index) {
  9290. return Table.api.formatter.flag.call(this, value, row, index);
  9291. },
  9292. datetime: function (value, row, index) {
  9293. var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat;
  9294. if (isNaN(value)) {
  9295. return value ? Moment(value).format(datetimeFormat) : __('None');
  9296. } else {
  9297. return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
  9298. }
  9299. },
  9300. operate: function (value, row, index) {
  9301. var table = this.table;
  9302. // 操作配置
  9303. var options = table ? table.bootstrapTable('getOptions') : {};
  9304. // 默认按钮组
  9305. var buttons = $.extend([], this.buttons || []);
  9306. // 所有按钮名称
  9307. var names = [];
  9308. buttons.forEach(function (item) {
  9309. names.push(item.name);
  9310. });
  9311. if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
  9312. buttons.push({
  9313. name: 'dragsort',
  9314. icon: 'fa fa-arrows',
  9315. title: __('Drag to sort'),
  9316. extend: 'data-toggle="tooltip"',
  9317. classname: 'btn btn-xs btn-primary btn-dragsort'
  9318. });
  9319. }
  9320. if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
  9321. buttons.push({
  9322. name: 'edit',
  9323. icon: 'fa fa-pencil',
  9324. title: __('Edit'),
  9325. extend: 'data-toggle="tooltip"',
  9326. classname: 'btn btn-xs btn-success btn-editone',
  9327. url: options.extend.edit_url
  9328. });
  9329. }
  9330. if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
  9331. buttons.push({
  9332. name: 'del',
  9333. icon: 'fa fa-trash',
  9334. title: __('Del'),
  9335. extend: 'data-toggle="tooltip"',
  9336. classname: 'btn btn-xs btn-danger btn-delone'
  9337. });
  9338. }
  9339. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  9340. }
  9341. ,
  9342. buttons: function (value, row, index) {
  9343. // 默认按钮组
  9344. var buttons = $.extend([], this.buttons || []);
  9345. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  9346. }
  9347. },
  9348. buttonlink: function (column, buttons, value, row, index, type) {
  9349. var table = column.table;
  9350. type = typeof type === 'undefined' ? 'buttons' : type;
  9351. var options = table ? table.bootstrapTable('getOptions') : {};
  9352. var html = [];
  9353. var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend,
  9354. dropdown, link;
  9355. var fieldIndex = column.fieldIndex;
  9356. var dropdowns = {};
  9357. $.each(buttons, function (i, j) {
  9358. if (type === 'operate') {
  9359. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  9360. return true;
  9361. }
  9362. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  9363. return true;
  9364. }
  9365. }
  9366. var attr = table.data(type + "-" + j.name);
  9367. if (typeof attr === 'undefined' || attr) {
  9368. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false);
  9369. if (hidden) {
  9370. return true;
  9371. }
  9372. visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true);
  9373. if (!visible) {
  9374. return true;
  9375. }
  9376. dropdown = j.dropdown ? j.dropdown : '';
  9377. url = j.url ? j.url : '';
  9378. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  9379. classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
  9380. icon = j.icon ? j.icon : '';
  9381. text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
  9382. title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
  9383. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  9384. confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false);
  9385. confirm = confirm ? 'data-confirm="' + confirm + '"' : '';
  9386. extend = j.extend ? j.extend : '';
  9387. disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false);
  9388. if (disable) {
  9389. classname = classname + ' disabled';
  9390. }
  9391. link = '<a href="' + url + '" class="' + classname + '" ' + (confirm ? confirm + ' ' : '') + (refresh ? refresh + ' ' : '') + extend + ' title="' + title + '" data-table-id="' + (table ? table.attr("id") : '') + '" data-field-index="' + fieldIndex + '" data-row-index="' + index + '" data-button-index="' + i + '"><i class="' + icon + '"></i>' + (text ? ' ' + text : '') + '</a>';
  9392. if (dropdown) {
  9393. if (typeof dropdowns[dropdown] == 'undefined') {
  9394. dropdowns[dropdown] = [];
  9395. }
  9396. dropdowns[dropdown].push(link);
  9397. } else {
  9398. html.push(link);
  9399. }
  9400. }
  9401. });
  9402. if (!$.isEmptyObject(dropdowns)) {
  9403. var dropdownHtml = [];
  9404. $.each(dropdowns, function (i, j) {
  9405. dropdownHtml.push('<div class="btn-group"><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown">' + i + '</button><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown"><span class="caret"></span></button><ul class="dropdown-menu pull-right"><li>' + j.join('</li><li>') + '</li></ul></div>');
  9406. });
  9407. html.unshift(dropdownHtml);
  9408. }
  9409. return html.join(' ');
  9410. },
  9411. //替换URL中的数据
  9412. replaceurl: function (url, row, table) {
  9413. var options = table ? table.bootstrapTable('getOptions') : null;
  9414. var ids = options ? row[options.pk] : 0;
  9415. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  9416. //自动添加ids参数
  9417. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  9418. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  9419. matched = matched.substring(1, matched.length - 1);
  9420. if (matched.indexOf(".") !== -1) {
  9421. var temp = row;
  9422. var arr = matched.split(/\./);
  9423. for (var i = 0; i < arr.length; i++) {
  9424. if (typeof temp[arr[i]] !== 'undefined') {
  9425. temp = temp[arr[i]];
  9426. }
  9427. }
  9428. return typeof temp === 'object' ? '' : temp;
  9429. }
  9430. return row[matched];
  9431. });
  9432. return url;
  9433. },
  9434. // 获取选中的条目ID集合
  9435. selectedids: function (table) {
  9436. var options = table.bootstrapTable('getOptions');
  9437. if (options.templateView) {
  9438. return $.map($("input[data-id][name='checkbox']:checked"), function (dom) {
  9439. return $(dom).data("id");
  9440. });
  9441. } else {
  9442. return $.map(table.bootstrapTable('getSelections'), function (row) {
  9443. return row[options.pk];
  9444. });
  9445. }
  9446. },
  9447. // 切换复选框状态
  9448. toggleattr: function (table) {
  9449. $("input[type='checkbox']", table).trigger('click');
  9450. },
  9451. // 根据行索引获取行数据
  9452. getrowdata: function (table, index) {
  9453. index = parseInt(index);
  9454. var data = table.bootstrapTable('getData');
  9455. return typeof data[index] !== 'undefined' ? data[index] : null;
  9456. },
  9457. // 根据行索引获取行数据
  9458. getrowbyindex: function (table, index) {
  9459. return Table.api.getrowdata(table, index);
  9460. },
  9461. // 根据主键ID获取行数据
  9462. getrowbyid: function (table, id) {
  9463. var row = {};
  9464. var options = table.bootstrapTable("getOptions");
  9465. $.each(table.bootstrapTable('getData'), function (i, j) {
  9466. if (j[options.pk] == id) {
  9467. row = j;
  9468. return false;
  9469. }
  9470. });
  9471. return row;
  9472. }
  9473. },
  9474. };
  9475. return Table;
  9476. });
  9477. // jQuery List DragSort v0.5.2
  9478. // Website: http://dragsort.codeplex.com/
  9479. // License: http://dragsort.codeplex.com/license
  9480. (function($) {
  9481. $.fn.dragsort = function(options) {
  9482. if (options == "destroy") {
  9483. $(this.selector).trigger("dragsort-uninit");
  9484. return;
  9485. }
  9486. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  9487. var lists = [];
  9488. var list = null, lastPos = null;
  9489. this.each(function(i, cont) {
  9490. //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
  9491. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  9492. cont = $(cont).children().get(0);
  9493. var newList = {
  9494. draggedItem: null,
  9495. placeHolderItem: null,
  9496. pos: null,
  9497. offset: null,
  9498. offsetLimit: null,
  9499. scroll: null,
  9500. container: cont,
  9501. init: function() {
  9502. //set options to default values if not set
  9503. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  9504. if (opts.itemSelector == "")
  9505. opts.itemSelector = opts.tagName;
  9506. if (opts.dragSelector == "")
  9507. opts.dragSelector = opts.tagName;
  9508. if (opts.placeHolderTemplate == "")
  9509. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  9510. //listidx allows reference back to correct list variable instance
  9511. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  9512. this.styleDragHandlers(true);
  9513. },
  9514. uninit: function() {
  9515. var list = lists[$(this).attr("data-listidx")];
  9516. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  9517. list.styleDragHandlers(false);
  9518. },
  9519. getItems: function() {
  9520. return $(this.container).children(opts.itemSelector);
  9521. },
  9522. styleDragHandlers: function(cursor) {
  9523. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  9524. },
  9525. grabItem: function(e) {
  9526. var list = lists[$(this).attr("data-listidx")];
  9527. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  9528. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  9529. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  9530. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  9531. return;
  9532. //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,
  9533. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  9534. //e.preventDefault();
  9535. //change cursor to move while dragging
  9536. var dragHandle = e.target;
  9537. while (!$(dragHandle).is(opts.dragSelector)) {
  9538. if (dragHandle == this) return;
  9539. dragHandle = dragHandle.parentNode;
  9540. }
  9541. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  9542. $(dragHandle).css("cursor", "move");
  9543. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  9544. var listElem = this;
  9545. var trigger = function() {
  9546. list.dragStart.call(listElem, e);
  9547. $(list.container).unbind("mousemove", trigger);
  9548. };
  9549. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  9550. },
  9551. dragStart: function(e) {
  9552. if (list != null && list.draggedItem != null)
  9553. list.dropItem();
  9554. list = lists[$(this).attr("data-listidx")];
  9555. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  9556. //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
  9557. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  9558. //calculate mouse offset relative to draggedItem
  9559. var mt = parseInt(list.draggedItem.css("marginTop"));
  9560. var ml = parseInt(list.draggedItem.css("marginLeft"));
  9561. list.offset = list.draggedItem.offset();
  9562. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  9563. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  9564. //calculate box the dragged item can't be dragged outside of
  9565. if (!opts.dragBetween) {
  9566. 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();
  9567. list.offsetLimit = $(list.container).offset();
  9568. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  9569. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  9570. }
  9571. //create placeholder item
  9572. var h = list.draggedItem.height();
  9573. var w = list.draggedItem.width();
  9574. if (opts.tagName == "tr") {
  9575. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  9576. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  9577. list.draggedItem.after(list.placeHolderItem);
  9578. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  9579. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  9580. } else {
  9581. list.draggedItem.after(opts.placeHolderTemplate);
  9582. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  9583. }
  9584. if (opts.tagName == "td") {
  9585. var listTable = list.draggedItem.closest("table").get(0);
  9586. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  9587. }
  9588. //style draggedItem while dragging
  9589. var orig = list.draggedItem.attr("style");
  9590. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  9591. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  9592. //auto-scroll setup
  9593. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  9594. list.scroll.scrollY = window.setInterval(function() {
  9595. if (opts.scrollContainer != window) {
  9596. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  9597. return;
  9598. }
  9599. var t = $(opts.scrollContainer).scrollTop();
  9600. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  9601. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  9602. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  9603. }
  9604. }, 10);
  9605. list.scroll.scrollX = window.setInterval(function() {
  9606. if (opts.scrollContainer != window) {
  9607. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  9608. return;
  9609. }
  9610. var l = $(opts.scrollContainer).scrollLeft();
  9611. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  9612. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  9613. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  9614. }
  9615. }, 10);
  9616. //misc
  9617. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9618. list.setPos(e.pageX, e.pageY);
  9619. $(document).bind("mousemove", list.swapItems);
  9620. $(document).bind("mouseup", list.dropItem);
  9621. if (opts.scrollContainer != window)
  9622. $(window).bind("wheel", list.wheel);
  9623. },
  9624. //set position of draggedItem
  9625. setPos: function(x, y) {
  9626. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  9627. var top = y - this.offset.top;
  9628. var left = x - this.offset.left;
  9629. //limit top, left to within box draggedItem can't be dragged outside of
  9630. if (!opts.dragBetween) {
  9631. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  9632. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  9633. }
  9634. //adjust top & left calculations to parent offset
  9635. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  9636. if (parent != null) {
  9637. top -= parent.top;
  9638. left -= parent.left;
  9639. }
  9640. //set x or y auto-scroll amount
  9641. if (opts.scrollContainer == window) {
  9642. y -= $(window).scrollTop();
  9643. x -= $(window).scrollLeft();
  9644. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  9645. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  9646. } else {
  9647. var cont = $(opts.scrollContainer);
  9648. var offset = cont.offset();
  9649. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  9650. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  9651. }
  9652. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  9653. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  9654. //move draggedItem to new mouse cursor location
  9655. this.draggedItem.css({ top: top, left: left });
  9656. },
  9657. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  9658. wheel: function(e) {
  9659. if (list && opts.scrollContainer != window) {
  9660. var cont = $(opts.scrollContainer);
  9661. var offset = cont.offset();
  9662. e = e.originalEvent;
  9663. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  9664. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  9665. cont.scrollTop(cont.scrollTop() + deltaY);
  9666. e.preventDefault();
  9667. }
  9668. }
  9669. },
  9670. //build a table recording all the positions of the moveable list items
  9671. buildPositionTable: function() {
  9672. var pos = [];
  9673. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  9674. var loc = $(this).offset();
  9675. loc.right = loc.left + $(this).outerWidth();
  9676. loc.bottom = loc.top + $(this).outerHeight();
  9677. loc.elm = this;
  9678. pos[i] = loc;
  9679. });
  9680. this.pos = pos;
  9681. },
  9682. dropItem: function() {
  9683. if (list.draggedItem == null)
  9684. return;
  9685. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  9686. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  9687. var orig = list.draggedItem.attr("data-origstyle");
  9688. list.draggedItem.attr("style", orig);
  9689. if (orig == "")
  9690. list.draggedItem.removeAttr("style");
  9691. list.draggedItem.removeAttr("data-origstyle");
  9692. list.styleDragHandlers(true);
  9693. list.placeHolderItem.before(list.draggedItem);
  9694. list.placeHolderItem.remove();
  9695. $("[data-droptarget], .dragSortItem").remove();
  9696. window.clearInterval(list.scroll.scrollY);
  9697. window.clearInterval(list.scroll.scrollX);
  9698. //if position changed call dragEnd
  9699. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  9700. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  9701. var pos = list.draggedItem.attr("data-origpos").split('-');
  9702. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  9703. if (nextItem.size() > 0)
  9704. nextItem.before(list.draggedItem);
  9705. else if (pos[1] == 0) //was the only item in list
  9706. $(lists[pos[0]].container).prepend(list.draggedItem);
  9707. else //was the last item in list
  9708. $(lists[pos[0]].container).append(list.draggedItem);
  9709. }
  9710. list.draggedItem.removeAttr("data-origpos");
  9711. list.draggedItem = null;
  9712. $(document).unbind("mousemove", list.swapItems);
  9713. $(document).unbind("mouseup", list.dropItem);
  9714. if (opts.scrollContainer != window)
  9715. $(window).unbind("wheel", list.wheel);
  9716. return false;
  9717. },
  9718. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  9719. swapItems: function(e) {
  9720. if (list.draggedItem == null)
  9721. return false;
  9722. //move draggedItem to mouse location
  9723. list.setPos(e.pageX, e.pageY);
  9724. //retrieve list and item position mouse cursor is over
  9725. var ei = list.findPos(e.pageX, e.pageY);
  9726. var nlist = list;
  9727. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  9728. ei = lists[i].findPos(e.pageX, e.pageY);
  9729. nlist = lists[i];
  9730. }
  9731. //if not over another moveable list item return
  9732. if (ei == -1)
  9733. return false;
  9734. //save fixed items locations
  9735. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  9736. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  9737. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  9738. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  9739. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  9740. else
  9741. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  9742. //restore fixed items location
  9743. fixed.each(function() {
  9744. var elm = children().eq(this.idx).get(0);
  9745. if (this != elm && children().index(this) < this.idx)
  9746. $(this).insertAfter(elm);
  9747. else if (this != elm)
  9748. $(this).insertBefore(elm);
  9749. });
  9750. //misc
  9751. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9752. lastPos = list.draggedItem.offset();
  9753. return false;
  9754. },
  9755. //returns the index of the list item the mouse is over
  9756. findPos: function(x, y) {
  9757. for (var i = 0; i < this.pos.length; i++) {
  9758. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  9759. return i;
  9760. }
  9761. return -1;
  9762. },
  9763. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  9764. createDropTargets: function() {
  9765. if (!opts.dragBetween)
  9766. return;
  9767. $(lists).each(function() {
  9768. var ph = $(this.container).find("[data-placeholder]");
  9769. var dt = $(this.container).find("[data-droptarget]");
  9770. if (ph.size() > 0 && dt.size() > 0)
  9771. dt.remove();
  9772. else if (ph.size() == 0 && dt.size() == 0) {
  9773. if (opts.tagName == "td")
  9774. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  9775. else
  9776. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  9777. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  9778. list.placeHolderItem.attr("data-placeholder", true);
  9779. }
  9780. });
  9781. }
  9782. };
  9783. newList.init();
  9784. lists.push(newList);
  9785. });
  9786. return this;
  9787. };
  9788. $.fn.dragsort.defaults = {
  9789. tagName:"",
  9790. itemSelector: "",
  9791. dragSelector: "",
  9792. dragSelectorExclude: "input, textarea",
  9793. dragEnd: function() { },
  9794. dragBetween: false,
  9795. placeHolderTemplate: "",
  9796. scrollContainer: window,
  9797. scrollSpeed: 5
  9798. };
  9799. })(jQuery);
  9800. define("dragsort", function(){});
  9801. /*!
  9802. * jquery.event.drag - v 2.2
  9803. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9804. * Open Source MIT License - http://threedubmedia.com/code/license
  9805. */
  9806. ;(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);
  9807. define("drag", function(){});
  9808. /*!
  9809. * jquery.event.drop - v 2.2
  9810. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9811. * Open Source MIT License - http://threedubmedia.com/code/license
  9812. */
  9813. ;(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);
  9814. define("drop", function(){});
  9815. /**
  9816. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  9817. * Created by joe on 2015-12-19.
  9818. * Modified by Karson
  9819. */
  9820. (function ($) {
  9821. $.fn.addtabs = function (options) {
  9822. var obj = $(this);
  9823. options = $.extend({
  9824. content: '', //直接指定所有页面TABS内容
  9825. close: true, //是否可以关闭
  9826. monitor: 'body', //监视的区域
  9827. nav: '.nav-addtabs',
  9828. tab: '.tab-addtabs',
  9829. iframeUse: true, //使用iframe还是ajax
  9830. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  9831. iframeForceRefresh: false, //点击后强制加载对应的iframe
  9832. iframeForceRefreshTable: false, //点击后强制刷新对应的iframe中的table
  9833. callback: function () {
  9834. //关闭后回调函数
  9835. }
  9836. }, options || {});
  9837. var navobj = $(options.nav);
  9838. var tabobj = $(options.tab);
  9839. if (history.pushState) {
  9840. //浏览器前进后退事件
  9841. $(window).on("popstate", function (e) {
  9842. var state = e.originalEvent.state;
  9843. if (state) {
  9844. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  9845. }
  9846. });
  9847. }
  9848. $(options.monitor).on('click', '[addtabs]', function (e) {
  9849. if ($(this).attr('url').indexOf("javascript:") !== 0) {
  9850. if ($(this).is("a")) {
  9851. e.preventDefault();
  9852. }
  9853. var id = $(this).attr('addtabs');
  9854. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  9855. var url = $(this).attr('url');
  9856. var content = options.content ? options.content : $(this).attr('content');
  9857. var ajax = $(this).attr('ajax') === '1' || $(this).attr('ajax') === 'true';
  9858. var state = ({
  9859. url: url, title: title, id: id, content: content, ajax: ajax
  9860. });
  9861. document.title = title;
  9862. if (history.pushState && !$(this).data("pushstate")) {
  9863. var pushurl = url.indexOf("ref=addtabs") === -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
  9864. try {
  9865. window.history.pushState(state, title, pushurl);
  9866. } catch (e) {
  9867. }
  9868. }
  9869. $(this).data("pushstate", null);
  9870. _add.call(this, {
  9871. id: id,
  9872. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  9873. content: content,
  9874. url: url,
  9875. ajax: ajax
  9876. });
  9877. }
  9878. });
  9879. navobj.on('click', '.close-tab', function () {
  9880. var id = $(this).prev("a").attr("aria-controls");
  9881. _close(id);
  9882. return false;
  9883. });
  9884. navobj.on('dblclick', 'li[role=presentation]', function () {
  9885. $(this).find(".close-tab").trigger("click");
  9886. });
  9887. navobj.on('click', 'li[role=presentation]', function () {
  9888. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  9889. });
  9890. $(window).resize(function () {
  9891. if (typeof options.nav === 'object') {
  9892. var siblingsWidth = 0;
  9893. navobj.siblings().each(function () {
  9894. siblingsWidth += $(this).outerWidth();
  9895. });
  9896. navobj.width(navobj.parent().width() - siblingsWidth);
  9897. } else {
  9898. $("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  9899. }
  9900. _drop();
  9901. });
  9902. var _add = function (opts) {
  9903. var id, tabid, conid, url;
  9904. id = opts.id;
  9905. tabid = 'tab_' + opts.id;
  9906. conid = 'con_' + opts.id;
  9907. url = opts.url;
  9908. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  9909. var tabitem = $('#' + tabid, navobj);
  9910. var conitem = $('#' + conid, tabobj);
  9911. navobj.find("[role='presentation']").removeClass('active');
  9912. tabobj.find("[role='tabpanel']").removeClass('active');
  9913. //如果TAB不存在,创建一个新的TAB
  9914. if (tabitem.size() === 0) {
  9915. //创建新TAB的title
  9916. tabitem = $('<li role="presentation" id="' + tabid + '"><a href="#' + conid + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
  9917. //是否允许关闭
  9918. if (options.close && $("li", navobj).size() > 0) {
  9919. tabitem.append(' <i class="close-tab fa fa-remove"></i>');
  9920. }
  9921. if (conitem.size() === 0) {
  9922. //创建新TAB的内容
  9923. conitem = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
  9924. //是否指定TAB内容
  9925. if (opts.content) {
  9926. conitem.append(opts.content);
  9927. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  9928. var height = options.iframeHeight;
  9929. conitem.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>');
  9930. } else {
  9931. $.get(url, function (data) {
  9932. conitem.append(data);
  9933. });
  9934. }
  9935. tabobj.append(conitem);
  9936. }
  9937. //加入TABS
  9938. if ($('.tabdrop li', navobj).size() > 0) {
  9939. $('.tabdrop ul', navobj).append(tabitem);
  9940. } else {
  9941. navobj.append(tabitem);
  9942. }
  9943. } else {
  9944. //强制刷新iframe
  9945. if (options.iframeForceRefresh) {
  9946. $("#" + conid + " iframe").attr('src', function (i, val) {
  9947. return val;
  9948. });
  9949. } else if (options.iframeForceRefreshTable) {
  9950. try {
  9951. //检测iframe中是否存在刷新按钮
  9952. if ($("#" + conid + " iframe").contents().find(".btn-refresh").size() > 0) {
  9953. $("#" + conid + " iframe")[0].contentWindow.$(".btn-refresh").trigger("click");
  9954. }
  9955. } catch (e) {
  9956. }
  9957. }
  9958. }
  9959. localStorage.setItem("addtabs", $(this).prop('outerHTML'));
  9960. //激活TAB
  9961. tabitem.addClass('active');
  9962. conitem.addClass("active");
  9963. _drop();
  9964. };
  9965. var _close = function (id) {
  9966. var tabid = 'tab_' + id;
  9967. var conid = 'con_' + id;
  9968. var tabitem = $('#' + tabid, navobj);
  9969. var conitem = $('#' + conid, tabobj);
  9970. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  9971. if (obj.find("li.active").not('.tabdrop').attr('id') === tabid) {
  9972. var prev = tabitem.prev().not(".tabdrop");
  9973. var next = tabitem.next().not(".tabdrop");
  9974. if (prev.size() > 0) {
  9975. prev.find('a').trigger("click");
  9976. } else if (next.size() > 0) {
  9977. next.find('a').trigger("click");
  9978. } else {
  9979. $(">li:not(.tabdrop):last > a", navobj).trigger('click');
  9980. }
  9981. }
  9982. //关闭TAB
  9983. tabitem.remove();
  9984. conitem.remove();
  9985. _drop();
  9986. options.callback();
  9987. };
  9988. var _drop = function () {
  9989. navobj.refreshAddtabs();
  9990. };
  9991. };
  9992. //刷新Addtabs
  9993. $.fn.refreshAddtabs = function () {
  9994. var navobj = $(this);
  9995. var dropdown = $(".tabdrop", navobj);
  9996. if (dropdown.size() === 0) {
  9997. dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  9998. '<i class="glyphicon glyphicon-align-justify"></i>' +
  9999. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  10000. dropdown.prependTo(navobj);
  10001. }
  10002. //检测是否有下拉样式
  10003. if (navobj.parent().is('.tabs-below')) {
  10004. dropdown.addClass('dropup');
  10005. }
  10006. var collection = 0;
  10007. var maxwidth = navobj.width() - 65;
  10008. var liwidth = 0;
  10009. //检查超过一行的标签页
  10010. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  10011. var totalwidth = 0;
  10012. litabs.each(function () {
  10013. totalwidth += $(this).outerWidth(true);
  10014. });
  10015. if (navobj.width() < totalwidth) {
  10016. litabs.each(function () {
  10017. liwidth += $(this).outerWidth(true);
  10018. if (liwidth > maxwidth) {
  10019. dropdown.find('ul').append($(this));
  10020. collection++;
  10021. }
  10022. });
  10023. if (collection > 0) {
  10024. dropdown.removeClass('hide');
  10025. if (dropdown.find('.active').length === 1) {
  10026. dropdown.addClass('active');
  10027. } else {
  10028. dropdown.removeClass('active');
  10029. }
  10030. }
  10031. } else {
  10032. dropdown.addClass('hide');
  10033. }
  10034. };
  10035. })(jQuery);
  10036. define("addtabs", function(){});
  10037. /**
  10038. * @summary SelectPage
  10039. * @desc Simple and powerful selection plugin
  10040. * @file selectpage.js
  10041. * @version 2.18
  10042. * @author TerryZeng
  10043. * @contact https://terryz.github.io/
  10044. * @license MIT License
  10045. *
  10046. */
  10047. ;
  10048. (function ($) {
  10049. "use strict";
  10050. /**
  10051. * Default options
  10052. */
  10053. var defaults = {
  10054. /**
  10055. * Data source
  10056. * @type {string|Object}
  10057. *
  10058. * string:server side request url address
  10059. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  10060. */
  10061. data: undefined,
  10062. /**
  10063. * Language ('cn', 'en', 'ja', 'es', 'pt-br')
  10064. * @type string
  10065. * @default 'cn'
  10066. */
  10067. lang: 'cn',
  10068. /**
  10069. * Multiple select mode(tags)
  10070. * @type boolean
  10071. * @default false
  10072. */
  10073. multiple: false,
  10074. /**
  10075. * pagination or not
  10076. * @type boolean
  10077. * @default true
  10078. */
  10079. pagination: true,
  10080. /**
  10081. * Show up menu button
  10082. * @type boolean
  10083. * @default true
  10084. */
  10085. dropButton: true,
  10086. /**
  10087. * Result list visible size in pagination bar close
  10088. * @type number
  10089. * @default 10
  10090. */
  10091. listSize: 10,
  10092. /**
  10093. * Show control bar in multiple select mode
  10094. * @type boolean
  10095. * @default true
  10096. */
  10097. multipleControlbar: true,
  10098. /**
  10099. * Max selected item limited in multiple select mode
  10100. * @type number
  10101. * @default 0(unlimited)
  10102. */
  10103. maxSelectLimit: 0,
  10104. /**
  10105. * Select result item to close list, work on multiple select mode
  10106. * @type boolean
  10107. * @default false
  10108. */
  10109. selectToCloseList: false,
  10110. /**
  10111. * Init selected item key, the result will match to option.keyField option
  10112. * @type string
  10113. */
  10114. initRecord: undefined,
  10115. /**
  10116. * The table parameter in server side mode
  10117. * @type string
  10118. */
  10119. dbTable: 'tbl',
  10120. /**
  10121. * The value field, the value will fill to hidden element
  10122. * @type string
  10123. * @default 'id'
  10124. */
  10125. keyField: 'id',
  10126. /**
  10127. * The show text field, the text will show to input element or tags(multiple mode)
  10128. * @type string
  10129. * @default 'name'
  10130. */
  10131. showField: 'name',
  10132. /**
  10133. * Actually used to search field
  10134. * @type string
  10135. */
  10136. searchField: undefined,
  10137. /**
  10138. * Search type ('AND' or 'OR')
  10139. * @type string
  10140. * @default 'AND'
  10141. */
  10142. andOr: 'AND',
  10143. /**
  10144. * Result sort type
  10145. * @type array - if not set, will default used showField field
  10146. * @example
  10147. * orderBy : ['id desc']
  10148. */
  10149. orderBy: undefined,
  10150. /**
  10151. * Page size
  10152. * @type number
  10153. * @default 10
  10154. */
  10155. pageSize: 10,
  10156. /**
  10157. * Server side request parameters
  10158. * @type function
  10159. * @return object
  10160. * @example params : function(){return {'name':'aa','sex':1};}
  10161. */
  10162. params: undefined,
  10163. /**
  10164. * Custom result list item show text
  10165. * @type function
  10166. * @param data {object} row data
  10167. * @return string
  10168. */
  10169. formatItem: undefined,
  10170. /**
  10171. * Have some highlight item and lost focus, auto select the highlight item
  10172. * @type boolean
  10173. * @default false
  10174. */
  10175. autoFillResult: false,
  10176. /**
  10177. * Auto select first item in show up result list or search result
  10178. * depend on `autoFillResult` option set to true
  10179. * @type boolean
  10180. * @default false
  10181. */
  10182. autoSelectFirst: false,
  10183. /**
  10184. * Whether clear input element text when enter some keywords to search and no result return
  10185. * @type boolean
  10186. * @default true
  10187. */
  10188. noResultClean: true,
  10189. /**
  10190. * Select only mode
  10191. * @type boolean
  10192. */
  10193. selectOnly: false,
  10194. /**
  10195. * Input to search delay time, work on ajax data source
  10196. * @type number
  10197. * @default 0.5
  10198. */
  10199. inputDelay: 0.5,
  10200. /**
  10201. * -----------------------------------------Callback--------------------------------------------
  10202. */
  10203. /**
  10204. * Result list item selected callback
  10205. * @type function
  10206. * @param object - selected item json data
  10207. * @param self - plugin object
  10208. */
  10209. eSelect: undefined,
  10210. /**
  10211. * Before result list show up callback, you can do anything prepared
  10212. * @param self - plugin object
  10213. */
  10214. eOpen: undefined,
  10215. /**
  10216. * Server side return data convert callback
  10217. * @type function
  10218. * @param data {object} server side return data
  10219. * @param self {object} plugin object
  10220. * @return {object} return data format:
  10221. * @example
  10222. * {
  10223. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  10224. * totalRow : 100
  10225. * }
  10226. */
  10227. eAjaxSuccess: undefined,
  10228. /**
  10229. * Close selected item tag callback (multiple mode)
  10230. * @type function
  10231. * @param removeCount {number} remove item count
  10232. * @param self {object} plugin object
  10233. */
  10234. eTagRemove: undefined,
  10235. /**
  10236. * Clear selected item callback(single select mode)
  10237. * @type function
  10238. * @param self {object} plugin object
  10239. */
  10240. eClear: undefined
  10241. };
  10242. /**
  10243. * SelectPage class definition
  10244. * @constructor
  10245. * @param {Object} input - input element
  10246. * @param {Object} option
  10247. */
  10248. var SelectPage = function (input, option) {
  10249. //特殊字段处理
  10250. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  10251. if (typeof option[j] !== 'undefined') {
  10252. option[i] = option[j];
  10253. delete option[j];
  10254. }
  10255. });
  10256. this.setOption(option);
  10257. this.setLanguage();
  10258. this.setCssClass();
  10259. this.setProp();
  10260. this.setElem(input);
  10261. this.setButtonAttrDefault();
  10262. this.setInitRecord();
  10263. this.eDropdownButton();
  10264. this.eInput();
  10265. this.eWhole();
  10266. };
  10267. /**
  10268. * Plugin version number
  10269. */
  10270. SelectPage.version = '2.18';
  10271. /**
  10272. * Plugin object cache key
  10273. */
  10274. SelectPage.dataKey = 'selectPageObject';
  10275. /**
  10276. * Options set
  10277. * @param {Object} option
  10278. */
  10279. SelectPage.prototype.setOption = function (option) {
  10280. //use showField to default
  10281. option.searchField = option.searchField || option.showField;
  10282. option.andOr = option.andOr.toUpperCase();
  10283. if (option.andOr !== 'AND' && option.andOr !== 'OR')
  10284. option.andOr = 'AND';
  10285. //support multiple field set
  10286. var arr = ['searchField'];
  10287. for (var i = 0; i < arr.length; i++) {
  10288. option[arr[i]] = this.strToArray(option[arr[i]]);
  10289. }
  10290. //set default order field
  10291. option.orderBy = option.orderBy || option.showField;
  10292. //set multiple order field
  10293. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  10294. option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  10295. //close auto fill result and auto select first in multiple mode and select item not close list
  10296. if (option.multiple && !option.selectToCloseList) {
  10297. option.autoFillResult = false;
  10298. option.autoSelectFirst = false;
  10299. }
  10300. //show all item when pagination bar close, limited 200
  10301. if (!option.pagination)
  10302. option.pageSize = 200;
  10303. if ($.type(option.listSize) !== 'number' || option.listSize < 0)
  10304. option.listSize = 10;
  10305. this.option = option;
  10306. };
  10307. /**
  10308. * String convert to array
  10309. * @param str {string}
  10310. * @return {Array}
  10311. */
  10312. SelectPage.prototype.strToArray = function (str) {
  10313. if (!str)
  10314. return '';
  10315. return str.replace(/[\s ]+/g, '').split(',');
  10316. };
  10317. /**
  10318. * Set order field
  10319. * @param {Array} arg_order
  10320. * @param {string} arg_field
  10321. * @return {Array}
  10322. */
  10323. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  10324. var arr = [], orders = [];
  10325. if (typeof arg_order == 'object') {
  10326. for (var i = 0; i < arg_order.length; i++) {
  10327. orders = $.trim(arg_order[i]).split(' ');
  10328. arr[i] = (orders.length == 2) ? orders : [orders[0], 'ASC'];
  10329. }
  10330. } else {
  10331. orders = $.trim(arg_order).split(' ');
  10332. arr[0] = (orders.length == 2) ? orders : (orders[0].match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0]] : [orders[0], 'ASC'];
  10333. }
  10334. return arr;
  10335. };
  10336. /**
  10337. * i18n
  10338. */
  10339. SelectPage.prototype.setLanguage = function () {
  10340. var message, p = this.option;
  10341. switch (p.lang) {
  10342. // English
  10343. case 'en':
  10344. message = {
  10345. add_btn: 'Add button',
  10346. add_title: 'add a box',
  10347. del_btn: 'Del button',
  10348. del_title: 'delete a box',
  10349. next: 'Next',
  10350. next_title: 'Next' + p.pageSize + ' (Right key)',
  10351. prev: 'Prev',
  10352. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  10353. first_title: 'First (Shift + Left key)',
  10354. last_title: 'Last (Shift + Right key)',
  10355. get_all_btn: 'Get All (Down key)',
  10356. get_all_alt: '(button)',
  10357. close_btn: 'Close (Tab key)',
  10358. close_alt: '(button)',
  10359. loading: 'loading...',
  10360. loading_alt: '(loading)',
  10361. page_info: 'page_num of page_count',
  10362. select_ng: 'Attention : Please choose from among the list.',
  10363. select_ok: 'OK : Correctly selected.',
  10364. not_found: 'not found',
  10365. ajax_error: 'An error occurred while connecting to server.',
  10366. clear: 'Clear content',
  10367. select_all: 'Select current page',
  10368. unselect_all: 'Clear current page',
  10369. clear_all: 'Clear all selected',
  10370. max_selected: 'You can only select up to max_selected_limit items'
  10371. };
  10372. break;
  10373. // 中文
  10374. case 'cn':
  10375. default:
  10376. message = {
  10377. add_btn: '添加按钮',
  10378. add_title: '添加区域',
  10379. del_btn: '删除按钮',
  10380. del_title: '删除区域',
  10381. next: '下一页',
  10382. next_title: '下' + p.pageSize + ' (→)',
  10383. prev: '上一页',
  10384. prev_title: '上' + p.pageSize + ' (←)',
  10385. first_title: '首页 (Shift + ←)',
  10386. last_title: '尾页 (Shift + →)',
  10387. get_all_btn: '获得全部 (↓)',
  10388. get_all_alt: '(按钮)',
  10389. close_btn: '关闭 (Tab键)',
  10390. close_alt: '(按钮)',
  10391. loading: '读取中...',
  10392. loading_alt: '(读取中)',
  10393. page_info: '第 page_num 页(共page_count页)',
  10394. select_ng: '请注意:请从列表中选择.',
  10395. select_ok: 'OK : 已经选择.',
  10396. not_found: '无查询结果',
  10397. ajax_error: '连接到服务器时发生错误!',
  10398. clear: '清除内容',
  10399. select_all: '选择当前页项目',
  10400. unselect_all: '取消选择当前页项目',
  10401. clear_all: '清除全部已选择项目',
  10402. max_selected: '最多只能选择 max_selected_limit 个项目'
  10403. };
  10404. break;
  10405. }
  10406. this.message = message;
  10407. };
  10408. /**
  10409. * Css classname defined
  10410. */
  10411. SelectPage.prototype.setCssClass = function () {
  10412. var css_class = {
  10413. container: 'sp_container',
  10414. container_open: 'sp_container_open',
  10415. re_area: 'sp_result_area',
  10416. result_open: 'sp_result_area_open',
  10417. control_box: 'sp_control_box',
  10418. //multiple select mode
  10419. element_box: 'sp_element_box',
  10420. navi: 'sp_navi',
  10421. //result list
  10422. results: 'sp_results',
  10423. re_off: 'sp_results_off',
  10424. select: 'sp_over',
  10425. select_ok: 'sp_select_ok',
  10426. select_ng: 'sp_select_ng',
  10427. selected: 'sp_selected',
  10428. input_off: 'sp_input_off',
  10429. message_box: 'sp_message_box',
  10430. disabled: 'sp_disabled',
  10431. button: 'sp_button',
  10432. btn_on: 'sp_btn_on',
  10433. btn_out: 'sp_btn_out',
  10434. input: 'sp_input',
  10435. clear_btn: 'sp_clear_btn',
  10436. align_right: 'sp_align_right'
  10437. };
  10438. this.css_class = css_class;
  10439. };
  10440. /**
  10441. * Plugin inner properties
  10442. */
  10443. SelectPage.prototype.setProp = function () {
  10444. this.prop = {
  10445. //input disabled status
  10446. disabled: false,
  10447. current_page: 1,
  10448. //total page
  10449. max_page: 1,
  10450. //ajax data loading status
  10451. is_loading: false,
  10452. xhr: false,
  10453. key_paging: false,
  10454. key_select: false,
  10455. //last selected item value
  10456. prev_value: '',
  10457. //last selected item text
  10458. selected_text: '',
  10459. last_input_time: undefined,
  10460. init_set: false
  10461. };
  10462. this.template = {
  10463. tag: {
  10464. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  10465. textKey: '#item_text#',
  10466. valueKey: '#item_value#'
  10467. },
  10468. page: {
  10469. current: 'page_num',
  10470. total: 'page_count'
  10471. },
  10472. msg: {
  10473. maxSelectLimit: 'max_selected_limit'
  10474. }
  10475. };
  10476. };
  10477. /**
  10478. * Get the actual width/height of invisible DOM elements with jQuery.
  10479. * Source code come from dreamerslab/jquery.actual
  10480. * @param element
  10481. * @param method
  10482. * @returns {*}
  10483. */
  10484. SelectPage.prototype.elementRealSize = function (element, method) {
  10485. var defaults = {
  10486. absolute: false,
  10487. clone: false,
  10488. includeMargin: false,
  10489. display: 'block'
  10490. };
  10491. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  10492. fix = function () {
  10493. // get all hidden parents
  10494. $hidden = $target.parents().addBack().filter(':hidden');
  10495. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  10496. if (configs.absolute === true)
  10497. style += 'position: absolute !important;';
  10498. // save the origin style props
  10499. // set the hidden el css to be got the actual value later
  10500. $hidden.each(function () {
  10501. // Save original style. If no style was set, attr() returns undefined
  10502. var $this = $(this), thisStyle = $this.attr('style');
  10503. tmp.push(thisStyle);
  10504. // Retain as much of the original style as possible, if there is one
  10505. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  10506. });
  10507. };
  10508. restore = function () {
  10509. // restore origin style values
  10510. $hidden.each(function (i) {
  10511. var $this = $(this), _tmp = tmp[i];
  10512. if (_tmp === undefined)
  10513. $this.removeAttr('style');
  10514. else
  10515. $this.attr('style', _tmp);
  10516. });
  10517. };
  10518. fix();
  10519. // get the actual value with user specific methed
  10520. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  10521. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  10522. var actual = /(outer)/.test(method) ?
  10523. $target[method](configs.includeMargin) :
  10524. $target[method]();
  10525. restore();
  10526. // IMPORTANT, this plugin only return the value of the first element
  10527. return actual;
  10528. };
  10529. /**
  10530. * Dom building
  10531. * @param {Object} combo_input - original input element
  10532. */
  10533. SelectPage.prototype.setElem = function (combo_input) {
  10534. // 1. build Dom object
  10535. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  10536. var cssWidth = input.css("width");
  10537. var orgWidth = input.outerWidth();
  10538. if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
  10539. orgWidth = "100%";
  10540. } else {
  10541. // fix input width in hidden situation
  10542. if (orgWidth <= 0)
  10543. orgWidth = this.elementRealSize(input, 'outerWidth');
  10544. if (orgWidth < 150)
  10545. orgWidth = 150;
  10546. }
  10547. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  10548. if (p.selectOnly)
  10549. elem.combo_input.prop('readonly', true);
  10550. elem.container = elem.combo_input.parent().addClass(css.container);
  10551. if (elem.combo_input.prop('disabled')) {
  10552. if (p.multiple)
  10553. elem.container.addClass(css.disabled);
  10554. else
  10555. elem.combo_input.addClass(css.input_off);
  10556. }
  10557. // set outer box width
  10558. elem.container.width(orgWidth);
  10559. elem.button = $('<div>').addClass(css.button);
  10560. //drop down button
  10561. elem.dropdown = $('<span class="sp_caret"></span>');
  10562. //clear button 'X' in single mode
  10563. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  10564. if (!p.dropButton)
  10565. elem.clear_btn.addClass(css.align_right);
  10566. //main box in multiple mode
  10567. elem.element_box = $('<ul>').addClass(css.element_box);
  10568. if (p.multiple && p.multipleControlbar)
  10569. elem.control = $('<div>').addClass(css.control_box);
  10570. //result list box
  10571. elem.result_area = $('<div>').addClass(css.re_area);
  10572. //pagination bar
  10573. if (p.pagination)
  10574. elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  10575. elem.results = $('<ul>').addClass(css.results);
  10576. var namePrefix = '_text',
  10577. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  10578. input_name = elem.combo_input.attr('name') || 'selectPage',
  10579. hidden_name = input_name,
  10580. hidden_id = input_id;
  10581. //switch the id and name attributes of input/hidden element
  10582. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  10583. name: hidden_name,
  10584. id: hidden_id
  10585. }).val('');
  10586. elem.combo_input.attr({
  10587. name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
  10588. id: input_id + namePrefix
  10589. });
  10590. // 2. DOM element put
  10591. elem.container.append(elem.hidden);
  10592. if (p.dropButton) {
  10593. elem.container.append(elem.button)
  10594. elem.button.append(elem.dropdown);
  10595. }
  10596. $(document.body).append(elem.result_area);
  10597. elem.result_area.append(elem.results);
  10598. if (p.pagination)
  10599. elem.result_area.append(elem.navi);
  10600. //Multiple select mode
  10601. if (p.multiple) {
  10602. if (p.multipleControlbar) {
  10603. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  10604. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  10605. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  10606. elem.control_text = $('<p>');
  10607. elem.control.append(elem.control_text);
  10608. elem.result_area.prepend(elem.control);
  10609. }
  10610. elem.container.addClass('sp_container_combo');
  10611. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  10612. var li = $('<li>').addClass('input_box');
  10613. li.append(elem.combo_input);
  10614. elem.element_box.append(li);
  10615. if (elem.combo_input.attr('placeholder'))
  10616. elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  10617. }
  10618. this.elem = elem;
  10619. };
  10620. /**
  10621. * Drop down button set to default
  10622. */
  10623. SelectPage.prototype.setButtonAttrDefault = function () {
  10624. /*
  10625. if (this.option.selectOnly) {
  10626. if ($(this.elem.combo_input).val() !== '') {
  10627. if ($(this.elem.hidden).val() !== '') {
  10628. //选择条件
  10629. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  10630. } else {
  10631. //输入方式
  10632. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  10633. }
  10634. } else {
  10635. $(this.elem.hidden).val('');
  10636. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  10637. }
  10638. }
  10639. */
  10640. //this.elem.button.attr('title', this.message.get_all_btn);
  10641. if (this.option.dropButton)
  10642. this.elem.button.attr('title', this.message.close_btn);
  10643. };
  10644. /**
  10645. * Set item need selected after init
  10646. * set selected item ways:
  10647. * <input value="key">
  10648. * <input data-init="key">
  10649. */
  10650. SelectPage.prototype.setInitRecord = function (refresh) {
  10651. var self = this, p = self.option, el = self.elem, key = '';
  10652. if ($.type(el.combo_input.data('init')) != 'undefined')
  10653. p.initRecord = String(el.combo_input.data('init'));
  10654. //data-init and value attribute can be init plugin selected item
  10655. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  10656. if (!refresh && !p.initRecord && el.combo_input.val())
  10657. p.initRecord = el.combo_input.val();
  10658. el.combo_input.val('');
  10659. if (!refresh)
  10660. el.hidden.val(p.initRecord);
  10661. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  10662. if (key) {
  10663. if (typeof p.data === 'object') {
  10664. var data = new Array();
  10665. var keyarr = key.split(',');
  10666. $.each(keyarr, function (index, row) {
  10667. for (var i = 0; i < p.data.length; i++) {
  10668. if (p.data[i][p.keyField] == row) {
  10669. data.push(p.data[i]);
  10670. break;
  10671. }
  10672. }
  10673. });
  10674. if (!p.multiple && data.length > 1)
  10675. data = [data[0]];
  10676. self.afterInit(self, data);
  10677. } else {//ajax data source mode to init selected item
  10678. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  10679. var _orgParams = {
  10680. searchTable: p.dbTable,
  10681. searchKey: p.keyField,
  10682. searchValue: key,
  10683. orderBy: p.orderBy,
  10684. showField: p.showField,
  10685. keyField: p.keyField,
  10686. keyValue: key,
  10687. searchField: p.searchField
  10688. };
  10689. if (_paramsFunc) {
  10690. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  10691. if (result && $.isPlainObject(result)) {
  10692. _params = $.extend({}, _orgParams, result);
  10693. } else {
  10694. _params = _orgParams;
  10695. }
  10696. } else {
  10697. _params = _orgParams;
  10698. }
  10699. $.ajax({
  10700. dataType: 'json',
  10701. type: 'POST',
  10702. url: p.data,
  10703. data: _params,
  10704. success: function (json) {
  10705. var d = null;
  10706. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  10707. d = p.eAjaxSuccess(json);
  10708. self.afterInit(self, d.list);
  10709. },
  10710. error: function (jqXHR, textStatus, errorThrown) {
  10711. self.ajaxErrorNotify(self, errorThrown);
  10712. }
  10713. });
  10714. }
  10715. }
  10716. };
  10717. /**
  10718. * Selected item set to plugin
  10719. * @param {Object} self
  10720. * @param {Object} data - selected item data
  10721. */
  10722. SelectPage.prototype.afterInit = function (self, data) {
  10723. if (!data || ($.isArray(data) && data.length === 0))
  10724. return;
  10725. if (!$.isArray(data))
  10726. data = [data];
  10727. var p = self.option, css = self.css_class;
  10728. var getText = function (row) {
  10729. var text = row[p.showField];
  10730. if (p.formatItem && $.isFunction(p.formatItem)) {
  10731. try {
  10732. text = p.formatItem(row);
  10733. } catch (e) {
  10734. }
  10735. }
  10736. return text;
  10737. };
  10738. if (p.multiple) {
  10739. self.prop.init_set = true;
  10740. self.clearAll(self);
  10741. $.each(data, function (i, row) {
  10742. var item = {text: getText(row), value: row[p.keyField]};
  10743. if (!self.isAlreadySelected(self, item))
  10744. self.addNewTag(self, item);
  10745. });
  10746. self.tagValuesSet(self);
  10747. self.inputResize(self);
  10748. console.log(self.elem.hidden.blur());
  10749. self.prop.init_set = false;
  10750. } else {
  10751. var row = data[0];
  10752. self.elem.combo_input.val(getText(row));
  10753. self.elem.hidden.val(row[p.keyField]);
  10754. self.prop.prev_value = getText(row);
  10755. self.prop.selected_text = getText(row);
  10756. if (p.selectOnly) {
  10757. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  10758. }
  10759. self.putClearButton();
  10760. }
  10761. };
  10762. /**
  10763. * Drop down button event bind
  10764. */
  10765. SelectPage.prototype.eDropdownButton = function () {
  10766. var self = this;
  10767. if (self.option.dropButton) {
  10768. self.elem.button.mouseup(function (ev) {
  10769. ev.stopPropagation();
  10770. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  10771. self.elem.combo_input.focus();
  10772. } else
  10773. self.hideResults(self);
  10774. });
  10775. }
  10776. };
  10777. /**
  10778. * Events bind
  10779. */
  10780. SelectPage.prototype.eInput = function () {
  10781. var self = this, p = self.option, el = self.elem, msg = self.message;
  10782. var showList = function () {
  10783. self.prop.page_move = false;
  10784. self.suggest(self);
  10785. self.setCssFocusedInput(self);
  10786. };
  10787. el.combo_input.keyup(function (e) {
  10788. self.processKey(self, e);
  10789. }).keydown(function (e) {
  10790. self.processControl(self, e);
  10791. }).focus(function (e) {
  10792. //When focus on input, show the result list
  10793. if (el.result_area.is(':hidden')) {
  10794. e.stopPropagation();
  10795. self.prop.first_show = true;
  10796. showList();
  10797. }
  10798. });
  10799. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  10800. e.stopPropagation();
  10801. if (!self.disabled(self)) {
  10802. self.clearAll(self);
  10803. self.elem.hidden.change();
  10804. if (p.eClear && $.isFunction(p.eClear))
  10805. p.eClear(self);
  10806. }
  10807. });
  10808. el.result_area.on('mousedown.SelectPage', function (e) {
  10809. e.stopPropagation();
  10810. });
  10811. if (p.multiple) {
  10812. if (p.multipleControlbar) {
  10813. //Select all item of current page
  10814. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  10815. self.selectAllLine(self);
  10816. }).hover(function () {
  10817. el.control_text.html(msg.select_all);
  10818. }, function () {
  10819. el.control_text.html('');
  10820. });
  10821. //Cancel select all item of current page
  10822. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  10823. self.unSelectAllLine(self);
  10824. }).hover(function () {
  10825. el.control_text.html(msg.unselect_all);
  10826. }, function () {
  10827. el.control_text.html('');
  10828. });
  10829. //Clear all selected item
  10830. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  10831. self.clearAll(self);
  10832. }).hover(function () {
  10833. el.control_text.html(msg.clear_all);
  10834. }, function () {
  10835. el.control_text.html('');
  10836. });
  10837. }
  10838. el.element_box.on('click.SelectPage', function (e) {
  10839. var srcEl = e.target || e.srcElement;
  10840. if ($(srcEl).is('ul'))
  10841. el.combo_input.focus();
  10842. });
  10843. //Tag close
  10844. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  10845. var li = $(this).closest('li');
  10846. self.removeTag(self, li);
  10847. showList();
  10848. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  10849. p.eTagRemove(1, self);
  10850. });
  10851. self.inputResize(self);
  10852. }
  10853. };
  10854. /**
  10855. * Out of plugin area click event handler
  10856. */
  10857. SelectPage.prototype.eWhole = function () {
  10858. var self = this, css = self.css_class;
  10859. var cleanContent = function (obj) {
  10860. obj.elem.combo_input.val('');
  10861. if (!obj.option.multiple)
  10862. obj.elem.hidden.val('');
  10863. obj.prop.selected_text = '';
  10864. };
  10865. //Out of plugin area
  10866. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  10867. var ele = e.target || e.srcElement;
  10868. var sp = $(ele).closest('div.' + css.container);
  10869. //Open status result list
  10870. $('div.' + css.container + '.' + css.container_open).each(function () {
  10871. if (this == sp[0])
  10872. return;
  10873. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  10874. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  10875. d.prop.current_page = 1;//reset page to 1
  10876. cleanContent(d);
  10877. d.hideResults(d);
  10878. return true;
  10879. }
  10880. if (d.elem.results.find('li').not('.' + css.message_box).size()) {
  10881. if (d.option.autoFillResult) {
  10882. //have selected item, then hide result list
  10883. if (d.elem.hidden.val())
  10884. d.hideResults(d);
  10885. else if (d.elem.results.find('li.sp_over').size()) {
  10886. //no one selected and have highlight item, select the highlight item
  10887. d.selectCurrentLine(d, true);
  10888. } else if (d.option.autoSelectFirst) {
  10889. //no one selected, no one highlight, select the first item
  10890. d.nextLine(d);
  10891. d.selectCurrentLine(d, true);
  10892. } else
  10893. d.hideResults(d);
  10894. } else
  10895. d.hideResults(d);
  10896. } else {
  10897. //when no one item match, clear search keywords
  10898. if (d.option.noResultClean)
  10899. cleanContent(d);
  10900. else {
  10901. if (!d.option.multiple)
  10902. d.elem.hidden.val('');
  10903. }
  10904. d.hideResults(d);
  10905. }
  10906. });
  10907. });
  10908. };
  10909. /**
  10910. * Result list event bind
  10911. */
  10912. SelectPage.prototype.eResultList = function () {
  10913. var self = this, css = this.css_class;
  10914. self.elem.results.children('li').hover(function () {
  10915. if (self.prop.key_select) {
  10916. self.prop.key_select = false;
  10917. return;
  10918. }
  10919. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  10920. $(this).addClass(css.select);
  10921. self.setCssFocusedResults(self);
  10922. }
  10923. }, function () {
  10924. $(this).removeClass(css.select);
  10925. }).click(function (e) {
  10926. if (self.prop.key_select) {
  10927. self.prop.key_select = false;
  10928. return;
  10929. }
  10930. e.preventDefault();
  10931. e.stopPropagation();
  10932. if (!$(this).hasClass(css.selected))
  10933. self.selectCurrentLine(self, false);
  10934. });
  10935. };
  10936. /**
  10937. * Reposition result list when list beyond the visible area
  10938. */
  10939. SelectPage.prototype.eScroll = function () {
  10940. var self = this, css = this.css_class;
  10941. $(window).on('scroll.SelectPage', function (e) {
  10942. $('div.' + css.container + '.' + css.container_open).each(function () {
  10943. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  10944. offset = d.elem.result_area.offset(),
  10945. screenScrollTop = $(window).scrollTop(),
  10946. docHeight = $(document).height(),
  10947. viewHeight = $(window).height(),
  10948. listHeight = d.elem.result_area.outerHeight(),
  10949. listBottom = offset.top + listHeight,
  10950. hasOverflow = docHeight > viewHeight,
  10951. down = d.elem.result_area.hasClass('shadowDown');
  10952. if (hasOverflow) {
  10953. if (down) {//open down
  10954. if (listBottom > (viewHeight + screenScrollTop))
  10955. d.calcResultsSize(d);
  10956. } else {//open up
  10957. if (offset.top < screenScrollTop)
  10958. d.calcResultsSize(d);
  10959. }
  10960. }
  10961. });
  10962. });
  10963. };
  10964. /**
  10965. * Page bar button event bind
  10966. */
  10967. SelectPage.prototype.ePaging = function () {
  10968. var self = this;
  10969. if (!self.option.pagination)
  10970. return;
  10971. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  10972. //$(self.elem.combo_input).focus();
  10973. ev.preventDefault();
  10974. self.firstPage(self);
  10975. });
  10976. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  10977. //$(self.elem.combo_input).focus();
  10978. ev.preventDefault();
  10979. self.prevPage(self);
  10980. });
  10981. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  10982. //$(self.elem.combo_input).focus();
  10983. ev.preventDefault();
  10984. self.nextPage(self);
  10985. });
  10986. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  10987. //$(self.elem.combo_input).focus();
  10988. ev.preventDefault();
  10989. self.lastPage(self);
  10990. });
  10991. };
  10992. /**
  10993. * Ajax request fail
  10994. * @param {Object} self
  10995. * @param {string} errorThrown
  10996. */
  10997. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  10998. self.showMessage(self.message.ajax_error);
  10999. };
  11000. /**
  11001. * Message box
  11002. * @param {Object} self
  11003. * @param msg {string} the text need to show
  11004. */
  11005. SelectPage.prototype.showMessage = function (self, msg) {
  11006. if (!msg)
  11007. return;
  11008. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  11009. self.elem.results.empty().append(msgLi).show();
  11010. self.calcResultsSize(self);
  11011. self.setOpenStatus(self, true);
  11012. self.elem.control.hide();
  11013. if (self.option.pagination)
  11014. self.elem.navi.hide();
  11015. };
  11016. /**
  11017. * @desc Scroll
  11018. * @param {Object} self
  11019. * @param {boolean} enforce
  11020. */
  11021. SelectPage.prototype.scrollWindow = function (self, enforce) {
  11022. var current_result = self.getCurrentLine(self),
  11023. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  11024. target_size;
  11025. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  11026. target_size = self.prop.size_li;
  11027. var gap, client_height = $(window).height(),
  11028. scroll_top = $(window).scrollTop(),
  11029. scroll_bottom = scroll_top + client_height - target_size;
  11030. if (current_result.length) {
  11031. if (target_top < scroll_top || target_size > client_height) {
  11032. //scroll to top
  11033. gap = target_top - scroll_top;
  11034. } else if (target_top > scroll_bottom) {
  11035. //scroll down
  11036. gap = target_top - scroll_bottom;
  11037. } else
  11038. return; //do not scroll
  11039. } else if (target_top < scroll_top)
  11040. gap = target_top - scroll_top;
  11041. window.scrollBy(0, gap);
  11042. };
  11043. /**
  11044. * change css class by status
  11045. * @param self
  11046. * @param status {boolean} true: open, false: close
  11047. */
  11048. SelectPage.prototype.setOpenStatus = function (self, status) {
  11049. var el = self.elem, css = self.css_class;
  11050. if (status) {
  11051. el.container.addClass(css.container_open);
  11052. el.result_area.addClass(css.result_open);
  11053. } else {
  11054. el.container.removeClass(css.container_open);
  11055. el.result_area.removeClass(css.result_open);
  11056. }
  11057. };
  11058. /**
  11059. * input element in focus css class set
  11060. * @param {Object} self
  11061. */
  11062. SelectPage.prototype.setCssFocusedInput = function (self) {
  11063. //$(self.elem.results).addClass(self.css_class.re_off);
  11064. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  11065. };
  11066. /**
  11067. * set result list get focus and input element lost focus
  11068. * @param {Object} self
  11069. */
  11070. SelectPage.prototype.setCssFocusedResults = function (self) {
  11071. //$(self.elem.results).removeClass(self.css_class.re_off);
  11072. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  11073. };
  11074. /**
  11075. * Quick search input keywords listener
  11076. * @param {Object} self
  11077. */
  11078. SelectPage.prototype.checkValue = function (self) {
  11079. var now_value = self.elem.combo_input.val();
  11080. if (now_value != self.prop.prev_value) {
  11081. self.prop.prev_value = now_value;
  11082. self.prop.first_show = false;
  11083. if (self.option.selectOnly)
  11084. self.setButtonAttrDefault();
  11085. if (!self.option.multiple && !now_value) {
  11086. self.elem.combo_input.val('');
  11087. self.elem.hidden.val('');
  11088. self.elem.clear_btn.remove();
  11089. }
  11090. self.suggest(self);
  11091. }
  11092. };
  11093. /**
  11094. * Input handle(regular input)
  11095. * @param {Object} self
  11096. * @param {Object} e - event object
  11097. */
  11098. SelectPage.prototype.processKey = function (self, e) {
  11099. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  11100. if (e.keyCode != 16)
  11101. self.setCssFocusedInput(self); // except Shift(16)
  11102. self.inputResize(self);
  11103. if ($.type(self.option.data) === 'string') {
  11104. self.prop.last_input_time = e.timeStamp;
  11105. setTimeout(function () {
  11106. if ((e.timeStamp - self.prop.last_input_time) === 0)
  11107. self.checkValue(self);
  11108. }, self.option.inputDelay * 1000);
  11109. } else {
  11110. self.checkValue(self);
  11111. }
  11112. }
  11113. }
  11114. /**
  11115. * Input handle(control key)
  11116. * @param {Object} self
  11117. * @param {Object} e - event object
  11118. */
  11119. SelectPage.prototype.processControl = function (self, e) {
  11120. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  11121. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  11122. e.preventDefault();
  11123. e.stopPropagation();
  11124. e.cancelBubble = true;
  11125. e.returnValue = false;
  11126. switch (e.keyCode) {
  11127. case 37:// left
  11128. if (e.shiftKey)
  11129. self.firstPage(self);
  11130. else
  11131. self.prevPage(self);
  11132. break;
  11133. case 38:// up
  11134. self.prop.key_select = true;
  11135. self.prevLine(self);
  11136. break;
  11137. case 39:// right
  11138. if (e.shiftKey)
  11139. self.lastPage(self);
  11140. else
  11141. self.nextPage(self);
  11142. break;
  11143. case 40:// down
  11144. if (self.elem.results.children('li').length) {
  11145. self.prop.key_select = true;
  11146. self.nextLine(self);
  11147. } else
  11148. self.suggest(self);
  11149. break;
  11150. case 9:// tab
  11151. self.prop.key_paging = true;
  11152. self.selectCurrentLine(self, true);
  11153. //self.hideResults(self);
  11154. break;
  11155. case 13:// return
  11156. self.selectCurrentLine(self, true);
  11157. break;
  11158. case 27:// escape
  11159. self.prop.key_paging = true;
  11160. self.hideResults(self);
  11161. break;
  11162. }
  11163. }
  11164. };
  11165. /**
  11166. * Abort Ajax request
  11167. * @param {Object} self
  11168. */
  11169. SelectPage.prototype.abortAjax = function (self) {
  11170. if (self.prop.xhr) {
  11171. self.prop.xhr.abort();
  11172. self.prop.xhr = false;
  11173. }
  11174. };
  11175. /**
  11176. * Suggest result of search keywords
  11177. * @param {Object} self
  11178. */
  11179. SelectPage.prototype.suggest = function (self) {
  11180. var q_word, val = $.trim(self.elem.combo_input.val());
  11181. if (self.option.multiple)
  11182. q_word = val;
  11183. else {
  11184. if (val && val === self.prop.selected_text)
  11185. q_word = '';
  11186. else
  11187. q_word = val;
  11188. }
  11189. q_word = q_word.split(/[\s ]+/);
  11190. //Before show up result list callback
  11191. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  11192. self.option.eOpen.call(self);
  11193. self.abortAjax(self);
  11194. //self.setLoading(self);
  11195. var which_page_num = self.prop.current_page || 1;
  11196. if (typeof self.option.data == 'object')
  11197. self.searchForJson(self, q_word, which_page_num);
  11198. else
  11199. self.searchForDb(self, q_word, which_page_num);
  11200. };
  11201. /**
  11202. * Loading
  11203. * @param {Object} self
  11204. */
  11205. SelectPage.prototype.setLoading = function (self) {
  11206. if (self.elem.results.html() === '') {
  11207. //self.calcResultsSize(self);
  11208. self.setOpenStatus(self, true);
  11209. }
  11210. };
  11211. /**
  11212. * Search for ajax
  11213. * @param {Object} self
  11214. * @param {Array} q_word - query keyword
  11215. * @param {number} which_page_num - target page number
  11216. */
  11217. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  11218. var p = self.option;
  11219. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess))
  11220. self.hideResults(self);
  11221. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  11222. //when have new query keyword, then reset page number to 1.
  11223. if (q_word.length && q_word[0] && q_word[0] !== self.prop.prev_value)
  11224. which_page_num = 1;
  11225. var _orgParams = {
  11226. q_word: q_word,
  11227. pageNumber: which_page_num,
  11228. pageSize: p.pageSize,
  11229. andOr: p.andOr,
  11230. orderBy: p.orderBy,
  11231. searchTable: p.dbTable,
  11232. showField: self.option.showField,
  11233. keyField: self.option.keyField,
  11234. searchField: self.option.searchField
  11235. };
  11236. _orgParams[searchKey] = q_word[0];
  11237. if (_paramsFunc) {
  11238. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  11239. if (result && $.isPlainObject(result)) {
  11240. _params = $.extend({}, _orgParams, result);
  11241. } else {
  11242. _params = _orgParams;
  11243. }
  11244. } else {
  11245. _params = _orgParams;
  11246. }
  11247. self.prop.xhr = $.ajax({
  11248. dataType: 'json',
  11249. url: p.data,
  11250. type: 'POST',
  11251. data: _params,
  11252. success: function (returnData) {
  11253. if (!returnData || !$.isPlainObject(returnData)) {
  11254. self.hideResults(self);
  11255. self.ajaxErrorNotify(self, errorThrown);
  11256. return;
  11257. }
  11258. var data = {}, json = {};
  11259. try {
  11260. data = p.eAjaxSuccess(returnData);
  11261. json.originalResult = data.list;
  11262. json.cnt_whole = data.totalRow;
  11263. } catch (e) {
  11264. self.showMessage(self, self.message.ajax_error);
  11265. return;
  11266. }
  11267. if (self.elem.navi) {
  11268. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  11269. }
  11270. json.candidate = [];
  11271. json.keyField = [];
  11272. if (typeof json.originalResult != 'object') {
  11273. self.prop.xhr = null;
  11274. self.notFoundSearch(self);
  11275. return;
  11276. }
  11277. json.cnt_page = json.originalResult.length;
  11278. for (var i = 0; i < json.cnt_page; i++) {
  11279. for (var key in json.originalResult[i]) {
  11280. if (key == p.keyField) {
  11281. json.keyField.push(json.originalResult[i][key]);
  11282. }
  11283. if (key == p.showField) {
  11284. json.candidate.push(json.originalResult[i][key]);
  11285. }
  11286. }
  11287. }
  11288. self.prepareResults(self, json, q_word, which_page_num);
  11289. },
  11290. error: function (jqXHR, textStatus, errorThrown) {
  11291. if (textStatus != 'abort') {
  11292. self.hideResults(self);
  11293. self.ajaxErrorNotify(self, errorThrown);
  11294. }
  11295. },
  11296. complete: function () {
  11297. self.prop.xhr = null;
  11298. }
  11299. });
  11300. };
  11301. /**
  11302. * Search for json data source
  11303. * @param {Object} self
  11304. * @param {Array} q_word
  11305. * @param {number} which_page_num
  11306. */
  11307. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  11308. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  11309. //query keyword filter
  11310. do {
  11311. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  11312. //将非法字符进行转义
  11313. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  11314. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  11315. i++;
  11316. } while (i < q_word.length);
  11317. // SELECT * FROM data WHERE field LIKE q_word;
  11318. for (i = 0; i < p.data.length; i++) {
  11319. var flag = false, row = p.data[i], itemText;
  11320. for (var j = 0; j < arr_reg.length; j++) {
  11321. itemText = row[p.searchField];
  11322. if (p.formatItem && $.isFunction(p.formatItem))
  11323. itemText = p.formatItem(row);
  11324. if (itemText.match(arr_reg[j])) {
  11325. flag = true;
  11326. if (p.andOr == 'OR')
  11327. break;
  11328. } else {
  11329. flag = false;
  11330. if (p.andOr == 'AND')
  11331. break;
  11332. }
  11333. }
  11334. if (flag)
  11335. matched.push(row);
  11336. }
  11337. // (CASE WHEN ...) then く order some column
  11338. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  11339. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  11340. matched1 = [], matched2 = [], matched3 = [];
  11341. for (i = 0; i < matched.length; i++) {
  11342. var orderField = p.orderBy[0][0];
  11343. var orderValue = String(matched[i][orderField]);
  11344. if (orderValue.match(reg1)) {
  11345. matched1.push(matched[i]);
  11346. } else if (orderValue.match(reg2)) {
  11347. matched2.push(matched[i]);
  11348. } else {
  11349. matched3.push(matched[i]);
  11350. }
  11351. }
  11352. if (p.orderBy[0][1].match(/^asc$/i)) {
  11353. matched1 = self.sortAsc(self, matched1);
  11354. matched2 = self.sortAsc(self, matched2);
  11355. matched3 = self.sortAsc(self, matched3);
  11356. } else {
  11357. matched1 = self.sortDesc(self, matched1);
  11358. matched2 = self.sortDesc(self, matched2);
  11359. matched3 = self.sortDesc(self, matched3);
  11360. }
  11361. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  11362. /*
  11363. if (sorted.length === undefined || sorted.length === 0 ) {
  11364. self.notFoundSearch(self);
  11365. return;
  11366. }
  11367. */
  11368. json.cnt_whole = sorted.length;
  11369. //page_move used to distinguish between init plugin or page moving
  11370. if (!self.prop.page_move) {
  11371. //only single mode can be used page number relocation
  11372. if (!p.multiple) {
  11373. //get selected item belong page number
  11374. var currentValue = self.elem.hidden.val();
  11375. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  11376. var index = 0;
  11377. $.each(sorted, function (i, row) {
  11378. if (row[p.keyField] == currentValue) {
  11379. index = i + 1;
  11380. return false;
  11381. }
  11382. });
  11383. which_page_num = Math.ceil(index / p.pageSize);
  11384. if (which_page_num < 1)
  11385. which_page_num = 1;
  11386. self.prop.current_page = which_page_num;
  11387. }
  11388. }
  11389. } else {
  11390. //set page number to 1 when result number less then page size
  11391. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  11392. which_page_num = 1;
  11393. self.prop.current_page = 1;
  11394. }
  11395. }
  11396. //LIMIT xx OFFSET xx
  11397. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  11398. //save original data
  11399. json.originalResult = [];
  11400. //after data filter handle
  11401. for (i = start; i < end; i++) {
  11402. if (sorted[i] === undefined)
  11403. break;
  11404. json.originalResult.push(sorted[i]);
  11405. for (var key in sorted[i]) {
  11406. if (key == p.keyField) {
  11407. if (json.keyField === undefined)
  11408. json.keyField = [];
  11409. json.keyField.push(sorted[i][key]);
  11410. }
  11411. if (key == p.showField) {
  11412. if (json.candidate === undefined)
  11413. json.candidate = [];
  11414. json.candidate.push(sorted[i][key]);
  11415. }
  11416. }
  11417. }
  11418. if (json.candidate === undefined)
  11419. json.candidate = [];
  11420. json.cnt_page = json.candidate.length;
  11421. self.prepareResults(self, json, q_word, which_page_num);
  11422. };
  11423. /**
  11424. * Set order asc
  11425. * @param {Object} self
  11426. * @param {Array} arr - result array
  11427. */
  11428. SelectPage.prototype.sortAsc = function (self, arr) {
  11429. arr.sort(function (a, b) {
  11430. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  11431. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  11432. });
  11433. return arr;
  11434. };
  11435. /**
  11436. * Set order desc
  11437. * @param {Object} self
  11438. * @param {Array} arr - result array
  11439. */
  11440. SelectPage.prototype.sortDesc = function (self, arr) {
  11441. arr.sort(function (a, b) {
  11442. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  11443. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  11444. });
  11445. return arr;
  11446. };
  11447. /**
  11448. * Not result found handle
  11449. * @param {Object} self
  11450. */
  11451. SelectPage.prototype.notFoundSearch = function (self) {
  11452. self.elem.results.empty();
  11453. self.calcResultsSize(self);
  11454. self.setOpenStatus(self, true);
  11455. self.setCssFocusedInput(self);
  11456. };
  11457. /**
  11458. * Prepare data to show
  11459. * @param {Object} self
  11460. * @param {Object} json - data result
  11461. * @param {Array} q_word - query keyword
  11462. * @param {number} which_page_num - target page number
  11463. */
  11464. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  11465. if (self.option.pagination)
  11466. self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  11467. if (!json.keyField)
  11468. json.keyField = false;
  11469. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  11470. self.elem.hidden.val(json.keyField[0]);
  11471. this.setButtonAttrDefault();
  11472. }
  11473. var is_query = false;
  11474. if (q_word && q_word.length && q_word[0])
  11475. is_query = true;
  11476. self.displayResults(self, json, is_query);
  11477. };
  11478. /**
  11479. * Build page bar
  11480. * @param {Object} self
  11481. * @param {number} cnt_whole - total record count
  11482. * @param {number} cnt_page
  11483. * @param {number} page_num - current page number
  11484. */
  11485. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  11486. var msg = self.message;
  11487. /**
  11488. * build pagination bar
  11489. */
  11490. var buildPageNav = function (self, pagebar, page_num, last_page) {
  11491. var updatePageInfo = function () {
  11492. var pageInfo = msg.page_info;
  11493. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  11494. };
  11495. if (pagebar.find('li').size() === 0) {
  11496. pagebar.hide().empty();
  11497. var iconFist = 'spfont sp-first',
  11498. iconPrev = 'spfont sp-previous',
  11499. iconNext = 'spfont sp-next',
  11500. iconLast = 'spfont sp-last';
  11501. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  11502. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  11503. //pagination information
  11504. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  11505. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  11506. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  11507. pagebar.show();
  11508. } else {
  11509. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  11510. }
  11511. };
  11512. var pagebar = self.elem.navi.find('ul'),
  11513. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  11514. if (last_page === 0)
  11515. page_num = 0;
  11516. else {
  11517. if (last_page < page_num)
  11518. page_num = last_page;
  11519. else if (page_num === 0)
  11520. page_num = 1;
  11521. }
  11522. self.prop.current_page = page_num;//update current page number
  11523. self.prop.max_page = last_page;//update page count
  11524. buildPageNav(self, pagebar, page_num, last_page);
  11525. //update paging status
  11526. var dClass = 'disabled',
  11527. first = pagebar.find('li.csFirstPage'),
  11528. previous = pagebar.find('li.csPreviousPage'),
  11529. next = pagebar.find('li.csNextPage'),
  11530. last = pagebar.find('li.csLastPage');
  11531. //first and previous
  11532. if (page_num === 1 || page_num === 0) {
  11533. if (!first.hasClass(dClass))
  11534. first.addClass(dClass);
  11535. if (!previous.hasClass(dClass))
  11536. previous.addClass(dClass);
  11537. } else {
  11538. if (first.hasClass(dClass))
  11539. first.removeClass(dClass);
  11540. if (previous.hasClass(dClass))
  11541. previous.removeClass(dClass);
  11542. }
  11543. //next and last
  11544. if (page_num === last_page || last_page === 0) {
  11545. if (!next.hasClass(dClass))
  11546. next.addClass(dClass);
  11547. if (!last.hasClass(dClass))
  11548. last.addClass(dClass);
  11549. } else {
  11550. if (next.hasClass(dClass))
  11551. next.removeClass(dClass);
  11552. if (last.hasClass(dClass))
  11553. last.removeClass(dClass);
  11554. }
  11555. if (last_page > 1)
  11556. self.ePaging(); //pagination event bind
  11557. };
  11558. /**
  11559. * Render result list
  11560. * @param {Object} self
  11561. * @param {Object} json - result data
  11562. * @param {boolean} is_query - used to different from search to open and just click to open
  11563. */
  11564. SelectPage.prototype.displayResults = function (self, json, is_query) {
  11565. var p = self.option, el = self.elem;
  11566. el.results.hide().empty();
  11567. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  11568. var selectedSize = el.element_box.find('li.selected_tag').size();
  11569. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  11570. var msg = self.message.max_selected;
  11571. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  11572. return;
  11573. }
  11574. }
  11575. if (json.candidate.length) {
  11576. var arr_candidate = json.candidate,
  11577. arr_primary_key = json.keyField,
  11578. keystr = el.hidden.val(),
  11579. keyArr = keystr ? keystr.split(',') : new Array(),
  11580. itemText = '';
  11581. for (var i = 0; i < arr_candidate.length; i++) {
  11582. if (p.formatItem && $.isFunction(p.formatItem)) {
  11583. try {
  11584. itemText = p.formatItem(json.originalResult[i]);
  11585. } catch (e) {
  11586. console.error('formatItem内容格式化函数内容设置不正确!');
  11587. itemText = arr_candidate[i];
  11588. }
  11589. } else
  11590. itemText = arr_candidate[i];
  11591. var list = $('<li>').html(itemText).attr({
  11592. pkey: arr_primary_key[i]
  11593. });
  11594. if (!p.formatItem)
  11595. list.attr('title', itemText);
  11596. //Set selected item highlight
  11597. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  11598. list.addClass(self.css_class.selected);
  11599. }
  11600. //cache item data
  11601. list.data('dataObj', json.originalResult[i]);
  11602. el.results.append(list);
  11603. }
  11604. } else {
  11605. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  11606. self.message.not_found + '</li>';
  11607. el.results.append(li);
  11608. }
  11609. el.results.show();
  11610. if (p.multiple && p.multipleControlbar)
  11611. el.control.show();
  11612. if (p.pagination)
  11613. el.navi.show();
  11614. self.calcResultsSize(self);
  11615. self.setOpenStatus(self, true);
  11616. //Result item event bind
  11617. self.eResultList();
  11618. //scrolling listen
  11619. self.eScroll();
  11620. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  11621. if (is_query && json.candidate.length && p.autoSelectFirst)
  11622. self.nextLine(self);
  11623. };
  11624. /**
  11625. * Calculate result list size and position
  11626. * @param {Object} self
  11627. */
  11628. SelectPage.prototype.calcResultsSize = function (self) {
  11629. var p = self.option, el = self.elem;
  11630. var rePosition = function () {
  11631. if (el.container.css('position') === 'static') {
  11632. // position: static
  11633. var offset = el.combo_input.offset();
  11634. el.result_area.css({
  11635. top: offset.top + el.combo_input.outerHeight() + 'px',
  11636. left: offset.left + 'px'
  11637. });
  11638. } else {
  11639. if (!p.pagination) {
  11640. var itemHeight = el.results.find('li:first').outerHeight(true),
  11641. listHeight = itemHeight * p.listSize;
  11642. el.results.css({
  11643. 'max-height': listHeight,
  11644. 'overflow-y': 'auto'
  11645. });
  11646. }
  11647. //handle result list show up side(left, right, up or down)
  11648. var docWidth = $(document).width(),
  11649. docHeight = $(document).height(), //the document full height
  11650. viewHeight = $(window).height(), //browser visible area height
  11651. offset = el.container.offset(),
  11652. screenScrollTop = $(window).scrollTop(),
  11653. listWidth = el.result_area.outerWidth(),
  11654. //result list height
  11655. listHeight = el.result_area.outerHeight(),
  11656. //default left used input element left
  11657. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  11658. //input element height
  11659. inputHeight = el.container.outerHeight(),
  11660. left = (offset.left + listWidth) > docWidth ?
  11661. defaultLeft - (listWidth - el.container.outerWidth()) :
  11662. defaultLeft,
  11663. //the actual top coordinate of input element(outer div)
  11664. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  11665. top = 0, dist = 5, //set distance between input element and result list
  11666. //the actual top coordinate of result list
  11667. listBottom = screenTop + inputHeight + listHeight + dist,
  11668. hasOverflow = docHeight > viewHeight;
  11669. if ((screenTop - screenScrollTop - dist > listHeight) &&
  11670. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  11671. (!hasOverflow && listBottom > viewHeight)) {
  11672. //open up
  11673. top = offset.top - listHeight - dist;
  11674. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  11675. } else {
  11676. //open down
  11677. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  11678. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  11679. top += dist;
  11680. }
  11681. return {
  11682. top: top + 'px', left: left + 'px'
  11683. };
  11684. }
  11685. };
  11686. if (el.result_area.is(':visible')) {
  11687. el.result_area.css(rePosition());
  11688. } else {
  11689. var pss = rePosition();
  11690. el.result_area.css(pss).show(1, function () {
  11691. var repss = rePosition();
  11692. if (pss.top !== repss.top || pss.left !== repss.left)
  11693. el.result_area.css(repss);
  11694. });
  11695. }
  11696. };
  11697. /**
  11698. * hide result list
  11699. * @param {Object} self
  11700. */
  11701. SelectPage.prototype.hideResults = function (self) {
  11702. if (self.prop.key_paging) {
  11703. self.scrollWindow(self, true);
  11704. self.prop.key_paging = false;
  11705. }
  11706. self.setCssFocusedInput(self);
  11707. if (self.option.autoFillResult) {
  11708. //self.selectCurrentLine(self, true);
  11709. }
  11710. self.elem.results.empty();
  11711. self.elem.result_area.hide();
  11712. self.setOpenStatus(self, false);
  11713. //unbind window scroll listen
  11714. $(window).off('scroll.SelectPage');
  11715. self.abortAjax(self);
  11716. self.setButtonAttrDefault();
  11717. };
  11718. /**
  11719. * set plugin to disabled / enabled
  11720. * @param self
  11721. * @param disabled
  11722. */
  11723. SelectPage.prototype.disabled = function (self, disabled) {
  11724. var p = self.option, el = self.elem;
  11725. if ($.type(disabled) === 'undefined')
  11726. return el.combo_input.prop('disabled');
  11727. if ($.type(disabled) === 'boolean') {
  11728. el.combo_input.prop('disabled', disabled);
  11729. if (disabled)
  11730. el.container.addClass(self.css_class.disabled);
  11731. else
  11732. el.container.removeClass(self.css_class.disabled);
  11733. }
  11734. };
  11735. /**
  11736. * Go fist page
  11737. * @param {Object} self
  11738. */
  11739. SelectPage.prototype.firstPage = function (self) {
  11740. if (self.prop.current_page > 1) {
  11741. self.prop.current_page = 1;
  11742. self.prop.page_move = true;
  11743. self.suggest(self);
  11744. }
  11745. };
  11746. /**
  11747. * Go previous page
  11748. * @param {Object} self
  11749. */
  11750. SelectPage.prototype.prevPage = function (self) {
  11751. if (self.prop.current_page > 1) {
  11752. self.prop.current_page--;
  11753. self.prop.page_move = true;
  11754. self.suggest(self);
  11755. }
  11756. };
  11757. /**
  11758. * Go next page
  11759. * @param {Object} self
  11760. */
  11761. SelectPage.prototype.nextPage = function (self) {
  11762. if (self.prop.current_page < self.prop.max_page) {
  11763. self.prop.current_page++;
  11764. self.prop.page_move = true;
  11765. self.suggest(self);
  11766. }
  11767. };
  11768. /**
  11769. * Go last page
  11770. * @param {Object} self
  11771. */
  11772. SelectPage.prototype.lastPage = function (self) {
  11773. if (self.prop.current_page < self.prop.max_page) {
  11774. self.prop.current_page = self.prop.max_page;
  11775. self.prop.page_move = true;
  11776. self.suggest(self);
  11777. }
  11778. };
  11779. /**
  11780. * do something after select/unSelect action
  11781. * @param {Object} self
  11782. */
  11783. SelectPage.prototype.afterAction = function (self) {
  11784. self.inputResize(self);
  11785. self.elem.combo_input.change();
  11786. self.setCssFocusedInput(self);
  11787. if (self.prop.init_set)
  11788. return;
  11789. if (self.option.multiple) {
  11790. if (self.option.selectToCloseList) {
  11791. self.hideResults(self);
  11792. self.elem.combo_input.blur();
  11793. } else {
  11794. self.suggest(self);
  11795. self.elem.combo_input.focus();
  11796. }
  11797. } else {
  11798. self.hideResults(self);
  11799. self.elem.combo_input.blur();
  11800. }
  11801. };
  11802. /**
  11803. * Select current list item
  11804. * @param {Object} self
  11805. * @param {boolean} is_enter_key
  11806. */
  11807. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  11808. self.scrollWindow(self, true);
  11809. var p = self.option, current = self.getCurrentLine(self);
  11810. if (current) {
  11811. if (!p.multiple) {
  11812. self.elem.combo_input.val(current.text());
  11813. self.elem.hidden.val(current.attr('pkey'));
  11814. } else {
  11815. //build tags in multiple selection mode
  11816. self.elem.combo_input.val('');
  11817. var item = {text: current.text(), value: current.attr('pkey')};
  11818. if (!self.isAlreadySelected(self, item)) {
  11819. self.addNewTag(self, item);
  11820. self.tagValuesSet(self);
  11821. }
  11822. }
  11823. if (p.selectOnly)
  11824. self.setButtonAttrDefault();
  11825. //Select item callback
  11826. if (p.eSelect && $.isFunction(p.eSelect))
  11827. p.eSelect(current.data('dataObj'), self);
  11828. self.prop.prev_value = self.elem.combo_input.val();
  11829. self.prop.selected_text = self.elem.combo_input.val();
  11830. self.putClearButton();
  11831. }
  11832. self.afterAction(self);
  11833. };
  11834. /**
  11835. * Show clear button when item selected in single selection mode
  11836. */
  11837. SelectPage.prototype.putClearButton = function () {
  11838. if (!this.option.multiple && !this.elem.combo_input.prop('disabled'))
  11839. this.elem.container.append(this.elem.clear_btn);
  11840. };
  11841. /**
  11842. * Select all list item
  11843. * @param {Object} self
  11844. */
  11845. SelectPage.prototype.selectAllLine = function (self) {
  11846. var p = self.option, jsonarr = new Array();
  11847. self.elem.results.find('li').each(function (i, row) {
  11848. var $row = $(row);
  11849. var item = {text: $row.text(), value: $row.attr('pkey')};
  11850. if (!self.isAlreadySelected(self, item)) {
  11851. self.addNewTag(self, item);
  11852. self.tagValuesSet(self);
  11853. }
  11854. jsonarr.push($row.data('dataObj'));
  11855. //limited max selected items
  11856. if ($.type(p.maxSelectLimit) === 'number' &&
  11857. p.maxSelectLimit > 0 &&
  11858. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').size()) {
  11859. return false;
  11860. }
  11861. });
  11862. if (p.eSelect && $.isFunction(p.eSelect))
  11863. p.eSelect(jsonarr, self);
  11864. self.afterAction(self);
  11865. };
  11866. /**
  11867. * Cancel select all item in current page
  11868. * @param {Object} self
  11869. */
  11870. SelectPage.prototype.unSelectAllLine = function (self) {
  11871. var p = self.option, size = self.elem.results.find('li').size();
  11872. self.elem.results.find('li').each(function (i, row) {
  11873. var key = $(row).attr('pkey');
  11874. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  11875. self.removeTag(self, tag);
  11876. });
  11877. self.afterAction(self);
  11878. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  11879. p.eTagRemove(size, self);
  11880. };
  11881. /**
  11882. * Clear all selected items
  11883. * @param {Object} self
  11884. */
  11885. SelectPage.prototype.clearAll = function (self) {
  11886. var p = self.option, size = 0;
  11887. if (p.multiple) {
  11888. size = self.elem.element_box.find('li.selected_tag').size();
  11889. self.elem.element_box.find('li.selected_tag').remove();
  11890. }
  11891. self.reset(self);
  11892. self.afterAction(self);
  11893. if (!p.multiple)
  11894. self.elem.clear_btn.remove();
  11895. if (p.multiple) {
  11896. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  11897. p.eTagRemove(size, self);
  11898. }
  11899. };
  11900. /**
  11901. * reset
  11902. */
  11903. SelectPage.prototype.reset = function (self) {
  11904. self.elem.combo_input.val('');
  11905. self.elem.hidden.val('');
  11906. self.prop.prev_value = '';
  11907. self.prop.selected_text = '';
  11908. self.prop.current_page = 1;
  11909. };
  11910. /**
  11911. * Get current highlight item
  11912. * @param {Object} self
  11913. */
  11914. SelectPage.prototype.getCurrentLine = function (self) {
  11915. if (self.elem.result_area.is(':hidden'))
  11916. return false;
  11917. var obj = self.elem.results.find('li.' + self.css_class.select);
  11918. if (obj.size())
  11919. return obj;
  11920. else
  11921. return false;
  11922. };
  11923. /**
  11924. * Check the result item is already selected or not
  11925. * @param {Object} self
  11926. * @param {Object} item - item info
  11927. */
  11928. SelectPage.prototype.isAlreadySelected = function (self, item) {
  11929. var isExist = false;
  11930. if (item.value) {
  11931. var keys = self.elem.hidden.val();
  11932. if (keys) {
  11933. var karr = keys.split(',');
  11934. if (karr && karr.length && $.inArray(item.value, karr) != -1)
  11935. isExist = true;
  11936. }
  11937. }
  11938. return isExist;
  11939. };
  11940. /**
  11941. * Add a new tag in multiple selection mode
  11942. * @param {Object} self
  11943. * @param {Object} item
  11944. */
  11945. SelectPage.prototype.addNewTag = function (self, item) {
  11946. if (!self.option.multiple || !item)
  11947. return;
  11948. var tmp = self.template.tag.content, tag;
  11949. tmp = tmp.replace(self.template.tag.textKey, item.text);
  11950. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  11951. tag = $(tmp);
  11952. if (self.elem.combo_input.prop('disabled'))
  11953. tag.find('span.tag_close').hide();
  11954. self.elem.combo_input.closest('li').before(tag);
  11955. };
  11956. /**
  11957. * Remove a tag in multiple selection mode
  11958. * @param {Object} self
  11959. * @param {Object} item
  11960. */
  11961. SelectPage.prototype.removeTag = function (self, item) {
  11962. var key = $(item).attr('itemvalue');
  11963. var keys = self.elem.hidden.val();
  11964. if ($.type(key) != 'undefined' && keys) {
  11965. var keyarr = keys.split(','),
  11966. index = $.inArray(key.toString(), keyarr);
  11967. if (index != -1) {
  11968. keyarr.splice(index, 1);
  11969. self.elem.hidden.val(keyarr.toString());
  11970. }
  11971. }
  11972. $(item).remove();
  11973. self.afterAction(self);
  11974. };
  11975. /**
  11976. * Selected item value(keyField) put in to hidden element
  11977. * @param {Object} self
  11978. */
  11979. SelectPage.prototype.tagValuesSet = function (self) {
  11980. if (!self.option.multiple)
  11981. return;
  11982. var tags = self.elem.element_box.find('li.selected_tag');
  11983. if (tags && tags.size()) {
  11984. var result = new Array();
  11985. $.each(tags, function (i, li) {
  11986. var v = $(li).attr('itemvalue');
  11987. if ($.type(v) !== 'undefined')
  11988. result.push(v);
  11989. });
  11990. if (result.length) {
  11991. self.elem.hidden.val(result.join(','));
  11992. }
  11993. }
  11994. };
  11995. /**
  11996. * auto resize input element width in multiple select mode
  11997. * @param {Object} self
  11998. */
  11999. SelectPage.prototype.inputResize = function (self) {
  12000. if (!self.option.multiple)
  12001. return;
  12002. var width = '',
  12003. inputLi = self.elem.combo_input.closest('li');
  12004. var setDefaultSize = function (self, inputLi) {
  12005. inputLi.removeClass('full_width');
  12006. var minimumWidth = self.elem.combo_input.val().length + 1,
  12007. width = (minimumWidth * 0.75) + 'em';
  12008. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  12009. };
  12010. if (self.elem.element_box.find('li.selected_tag').size() === 0) {
  12011. if (self.elem.combo_input.attr('placeholder_bak')) {
  12012. if (!inputLi.hasClass('full_width'))
  12013. inputLi.addClass('full_width');
  12014. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  12015. } else
  12016. setDefaultSize(self, inputLi);
  12017. } else
  12018. setDefaultSize(self, inputLi);
  12019. };
  12020. /**
  12021. * Move to next line
  12022. * @param {Object} self
  12023. */
  12024. SelectPage.prototype.nextLine = function (self) {
  12025. var obj = self.getCurrentLine(self), idx;
  12026. if (!obj)
  12027. idx = -1;
  12028. else {
  12029. idx = self.elem.results.children('li').index(obj);
  12030. obj.removeClass(self.css_class.select);
  12031. }
  12032. idx++;
  12033. if (idx < self.elem.results.children('li').length) {
  12034. var next = self.elem.results.children('li').eq(idx);
  12035. next.addClass(self.css_class.select);
  12036. self.setCssFocusedResults(self);
  12037. } else
  12038. self.setCssFocusedInput(self);
  12039. self.scrollWindow(self, false);
  12040. };
  12041. /**
  12042. * Move to previous line
  12043. * @param {Object} self
  12044. */
  12045. SelectPage.prototype.prevLine = function (self) {
  12046. var obj = self.getCurrentLine(self), idx;
  12047. if (!obj)
  12048. idx = self.elem.results.children('li').length;
  12049. else {
  12050. idx = self.elem.results.children('li').index(obj);
  12051. obj.removeClass(self.css_class.select);
  12052. }
  12053. idx--;
  12054. if (idx > -1) {
  12055. var prev = self.elem.results.children('li').eq(idx);
  12056. prev.addClass(self.css_class.select);
  12057. self.setCssFocusedResults(self);
  12058. } else
  12059. self.setCssFocusedInput(self);
  12060. self.scrollWindow(self, false);
  12061. };
  12062. /**
  12063. * SelectPage plugin definition
  12064. * @global
  12065. * @param option {Object} init plugin option
  12066. */
  12067. function Plugin(option) {
  12068. return this.each(function () {
  12069. var $this = $(this),
  12070. data = $this.data(SelectPage.dataKey),
  12071. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  12072. if (!data)
  12073. $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  12074. });
  12075. }
  12076. /**
  12077. * Get plugin object
  12078. * @param {object} obj
  12079. * @returns
  12080. */
  12081. function getPlugin(obj) {
  12082. return $(obj).closest('div.sp_container').find('input.sp_input');
  12083. }
  12084. /**
  12085. * Clear all selected item
  12086. */
  12087. function ClearSelected() {
  12088. return this.each(function () {
  12089. var $this = getPlugin(this),
  12090. data = $this.data(SelectPage.dataKey);
  12091. if (data) {
  12092. data.prop.init_set = true;
  12093. data.clearAll(data);
  12094. data.prop.init_set = false;
  12095. }
  12096. });
  12097. }
  12098. /**
  12099. * Refresh result list
  12100. * use case:
  12101. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  12102. * 2.refresh selected item show content/tag text
  12103. */
  12104. function SelectedRefresh() {
  12105. return this.each(function () {
  12106. var $this = getPlugin(this),
  12107. data = $this.data(SelectPage.dataKey);
  12108. if (data && data.elem.hidden.val())
  12109. data.setInitRecord(true);
  12110. });
  12111. }
  12112. /**
  12113. * Modify plugin datasource, only work on json datasource mode
  12114. * @param {array} data - new datasource
  12115. * @example
  12116. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  12117. */
  12118. function ModifyDataSource(data) {
  12119. return this.each(function () {
  12120. if (data && $.isArray(data)) {
  12121. var $this = getPlugin(this),
  12122. plugin = $this.data(SelectPage.dataKey);
  12123. if (plugin) {
  12124. plugin.clearAll(plugin);
  12125. plugin.option.data = data;
  12126. }
  12127. }
  12128. });
  12129. }
  12130. /**
  12131. * Get plugin disabled status or Modify plugin disabled status
  12132. * @param disabled {boolean} set disabled status
  12133. */
  12134. function PluginDisabled(disabled) {
  12135. var status = false;
  12136. this.each(function () {
  12137. var $this = getPlugin(this),
  12138. plugin = $this.data(SelectPage.dataKey);
  12139. if (plugin) {
  12140. if ($.type(disabled) !== 'undefined')
  12141. plugin.disabled(plugin, disabled);
  12142. else
  12143. status = plugin.disabled(plugin);
  12144. }
  12145. });
  12146. return status;
  12147. }
  12148. /**
  12149. * Get selected item text
  12150. * @returns {string}
  12151. */
  12152. function GetInputText() {
  12153. var str = '';
  12154. this.each(function () {
  12155. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  12156. if (data) {
  12157. if (data.option.multiple) {
  12158. var tags = [];
  12159. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  12160. tags.push($(tag).text());
  12161. });
  12162. str += tags.toString();
  12163. } else {
  12164. str += data.elem.combo_input.val();
  12165. }
  12166. }
  12167. });
  12168. return str;
  12169. }
  12170. var old = $.fn.selectPage;
  12171. $.fn.selectPage = Plugin;
  12172. $.fn.selectPage.Constructor = SelectPage;
  12173. $.fn.selectPageClear = ClearSelected;
  12174. $.fn.selectPageRefresh = SelectedRefresh;
  12175. $.fn.selectPageData = ModifyDataSource;
  12176. $.fn.selectPageDisabled = PluginDisabled;
  12177. $.fn.selectPageText = GetInputText;
  12178. // SelectPage no conflict
  12179. // =================
  12180. $.fn.selectPage.noConflict = function () {
  12181. $.fn.selectPage = old;
  12182. return this;
  12183. };
  12184. })(window.jQuery);
  12185. define("selectpage", function(){});