require-backend.min.js 781 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458
  1. /*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | 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=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.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 d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.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(null)},push:f,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){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},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?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.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,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),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):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.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,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"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=ha(),z=ha(),A=ha(),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=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),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")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=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)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){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 ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(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 ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(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 pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.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.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);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 p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' 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(".#.+[+~]")}),ja(function(a){var b=g.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=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.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===g||a.ownerDocument===v&&t(v,a)?-1:b===g||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,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||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 ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.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},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.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=ga.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=ga.selectors={cacheLength:50,createPseudo:ia,match:X,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(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===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]||ga.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]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.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(ca,da).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=ga.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(Q," ")+" ").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;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(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:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(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:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).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 Z.test(a.nodeName)},input:function(a){return Y.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:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(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]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.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=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[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?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(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=[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(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(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 ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(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 wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(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=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(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=[sa(ta(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 wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.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(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.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(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(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}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(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(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==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(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir: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},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),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=u.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.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.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.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(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 n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(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&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},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().done(c.resolve).fail(c.reject).progress(c.notify):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=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;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||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=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)n.access(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};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[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=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){
  3. return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.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=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.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 L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.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=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.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 typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.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,!1)),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=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.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)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.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.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!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&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(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)>=0: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 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,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&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)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},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?Z:$):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={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&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}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(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=$),this.each(function(){n.event.remove(this,a,c,b)})},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}});var aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ia={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,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(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 ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.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])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(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 this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(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 J(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&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),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),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qa[0].contentDocument,b.write(),b.close(),c=sa(a,b),qa.detach()),ra[a]=c),c}var ua=/^margin/,va=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wa=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)};function xa(a,b,c){var d,e,f,g,h=a.style;return c=c||wa(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),va.test(g)&&ua.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 ya(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.swap=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};var za=/^(none|table(?!-c[ea]).+)/,Aa=new RegExp("^("+Q+")(.*)$","i"),Ba=new RegExp("^([+-])=("+Q+")","i"),Ca={position:"absolute",visibility:"hidden",display:"block"},Da={letterSpacing:"0",fontWeight:"400"},Ea=["Webkit","O","Moz","ms"];function Fa(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Ea.length;while(e--)if(b=Ea[e]+c,b in a)return b;return d}function Ga(a,b,c){var d=Aa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Ha(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+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ia(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wa(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xa(a,b,f),(0>e||null==e)&&(e=a.style[b]),va.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Ha(a,b,c||(g?"border":"content"),d,f)+"px"}function Ja(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",ta(d.nodeName)))):(e=S(d),"none"===c&&e||L.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=xa(a,"opacity");return""===c?"1":c}}}},cssNumber:{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]=Fa(i,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=Ba.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.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]=Fa(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xa(a,b,d)),"normal"===e&&b in Da&&(e=Da[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?za.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Ca,function(){return Ia(a,b,d)}):Ia(a,b,d):void 0},set:function(a,c,d){var e=d&&wa(a);return Ga(a,c,d?Ha(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=ya(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xa,[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+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ua.test(a)||(n.cssHooks[a+b].set=Ga)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wa(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 Ja(this,!0)},hide:function(){return Ja(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Ka(a,b,c,d,e){return new Ka.prototype.init(a,b,c,d,e)}n.Tween=Ka,Ka.prototype={constructor:Ka,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ka.propHooks[this.prop];return a&&a.get?a.get(this):Ka.propHooks._default.get(this)},run:function(a){var b,c=Ka.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):Ka.propHooks._default.set(this),this}},Ka.prototype.init.prototype=Ka.prototype,Ka.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Ka.propHooks.scrollTop=Ka.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}},n.fx=Ka.prototype.init,n.fx.step={};var La,Ma,Na=/^(?:toggle|show|hide)$/,Oa=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pa=/queueHooks$/,Qa=[Va],Ra={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Oa.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Oa.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sa(){return setTimeout(function(){La=void 0}),La=n.now()}function Ta(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ua(a,b,c){for(var d,e=(Ra[b]||[]).concat(Ra["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Va(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.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?L.get(a,"olddisplay")||ta(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],Na.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?ta(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ua(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 Wa(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 Xa(a,b,c){var d,e,f=0,g=Qa.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=La||Sa(),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:{}},c),originalProperties:b,originalOptions:c,startTime:La||Sa(),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.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wa(k,j.opts.specialEasing);g>f;f++)if(d=Qa[f].call(j,a,k,j.opts))return d;return n.map(k,Ua,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(Xa,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Ra[c]=Ra[c]||[],Ra[c].unshift(b)},prefilter:function(a,b){b?Qa.unshift(a):Qa.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(S).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=Xa(this,n.extend({},a),f);(e||L.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=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pa.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=L.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(Ta(b,!0),a,d,e)}}),n.each({slideDown:Ta("show"),slideUp:Ta("hide"),slideToggle:Ta("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(La=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),La=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(){Ma||(Ma=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Ma),Ma=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Ya,Za,$a=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(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(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Za:Ya)),
  4. void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);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)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Za={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=$a[b]||n.find.attr;$a[b]=function(a,b,d){var e,f;return d||(f=$a[b],$a[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$a[b]=f),e}});var _a=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),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){return a.hasAttribute("tabindex")||_a.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ab=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ab," ").indexOf(b)>=0)return!0;return!1}});var bb=/\r/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(bb,""):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))}},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||(k.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(d.value,f)>=0)&&(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)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),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)},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)}});var cb=n.now(),db=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var eb=/#.*$/,fb=/([?&])_=[^&]*/,gb=/^(.*?):[ \t]*([^\r\n]*)$/gm,hb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ib=/^(?:GET|HEAD)$/,jb=/^\/\//,kb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lb={},mb={},nb="*/".concat("*"),ob=a.location.href,pb=kb.exec(ob.toLowerCase())||[];function qb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];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 rb(a,b,c,d){var e={},f=a===mb;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 sb(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 tb(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 ub(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:ob,type:"GET",isLocal:hb.test(pb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},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?sb(sb(a,n.ajaxSettings),b):sb(n.ajaxSettings,a)},ajaxPrefilter:qb(lb),ajaxTransport:qb(mb),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=gb.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||ob)+"").replace(eb,"").replace(jb,pb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kb.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pb[1]&&h[2]===pb[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pb[3]||("http:"===pb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rb(lb,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ib.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(db.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=fb.test(d)?d.replace(fb,"$1_="+cb++):d+(db.test(d)?"&":"?")+"_="+cb++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+nb+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=rb(mb,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=tb(k,v,f)),u=ub(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},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({url:a,type:b,dataType:e,data:c,success:d})}}),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 this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}: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 a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vb=/%20/g,wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ab(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)Ab(c,a[c],b,e);return d.join("&").replace(vb,"+")},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")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!T.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(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bb=0,Cb={},Db={0:200,1223:204},Eb=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cb)Cb[a]()}),k.cors=!!Eb&&"withCredentials"in Eb,k.ajax=Eb=!!Eb,n.ajaxTransport(function(a){var b;return k.cors||Eb&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Cb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Db[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Cb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},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(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Fb=[],Gb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Fb.pop()||n.expando+"_"+cb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Gb.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gb.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(Gb,"$1"+e):b.jsonp!==!1&&(b.url+=(db.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(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Fb.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||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Hb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Hb)return Hb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(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,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,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};var Ib=a.document.documentElement;function Jb(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,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)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Jb(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||Ib;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ib})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Jb(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=ya(k.pixelPosition,function(a,c){return c?(c=xa(a,b),va.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 J(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.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kb=a.jQuery,Lb=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Lb),b&&a.jQuery===n&&(a.jQuery=Kb),n},typeof b===U&&(a.jQuery=a.$=n),n});
  5. //# sourceMappingURL=jquery.min.map;
  6. /*!
  7. * Bootstrap v3.3.7 (http://getbootstrap.com)
  8. * Copyright 2011-2016 Twitter, Inc.
  9. * Licensed under the MIT license
  10. */
  11. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
  12. this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
  13. define("bootstrap", ["jquery"], function(){});
  14. define('config',['module'], function (module) {
  15. return module.config();
  16. });
  17. require.config({
  18. urlArgs: "v=" + requirejs.s.contexts._.config.config.config.site.version,
  19. packages: [{
  20. name: 'moment',
  21. location: '../libs/moment',
  22. main: 'moment'
  23. }],
  24. //在打包压缩时将会把include中的模块合并到主文件中
  25. include: ['css', 'layer', 'toastr', 'backend', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs'],
  26. paths: {
  27. 'lang': "empty:",
  28. 'config': 'require-config',
  29. 'form': 'require-form',
  30. 'table': 'require-table',
  31. 'upload': 'require-upload',
  32. 'drag': 'jquery.drag.min',
  33. 'drop': 'jquery.drop.min',
  34. 'echarts': 'echarts.min',
  35. 'echarts-theme': 'echarts-theme',
  36. 'adminlte': 'adminlte',
  37. //
  38. // 以下的包从bower的libs目录加载
  39. 'jquery': '../libs/jquery/dist/jquery.min',
  40. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  41. 'bootstrap-validator': '../libs/bootstrap-validator/dist/validator.min',
  42. 'bootstrap-typeahead': '../libs/bootstrap3-typeahead/bootstrap3-typeahead.min',
  43. 'bootstrap-tagsinput': '../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput.min',
  44. 'bootstrap-dialog': '../libs/bootstrap3-dialog/dist/js/bootstrap-dialog.min',
  45. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  46. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  47. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  48. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  49. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  50. 'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch',
  51. 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  52. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  53. 'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min',
  54. 'bloodhound': '../libs/typeahead.js/dist/bloodhound.min',
  55. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  56. 'dropzone': '../libs/dropzone/dist/min/dropzone-amd-module.min',
  57. 'less': '../libs/less/dist/less.min',
  58. 'dragsort': '../libs/dragsort/jquery.dragsort',
  59. 'sortable': '../libs/Sortable/Sortable.min',
  60. 'addtabs': '../libs/jquery-addtabs/jquery.addtabs',
  61. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  62. 'crontab': '../libs/jqcron/src/jqCron.cn',
  63. 'summernote': '../libs/summernote/dist/lang/summernote-zh-CN.min',
  64. 'validator': '../libs/nice-validator/dist/jquery.validator',
  65. 'plupload': '../libs/plupload/js/plupload.min',
  66. 'toastr': '../libs/toastr/toastr',
  67. 'jstree': '../libs/jstree/dist/jstree.min',
  68. 'layer': '../libs/layer/src/layer',
  69. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  70. 'template': '../libs/art-template/dist/template-native',
  71. },
  72. // shim依赖配置
  73. shim: {
  74. 'bootstrap': ['jquery'],
  75. 'bootstrap-table': {
  76. deps: ['bootstrap', 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'],
  77. exports: '$.fn.bootstrapTable'
  78. },
  79. 'bootstrap-table-lang': {
  80. deps: ['bootstrap-table'],
  81. exports: '$.fn.bootstrapTable.defaults'
  82. },
  83. 'bootstrap-table-export': {
  84. deps: ['bootstrap-table', 'tableexport'],
  85. exports: '$.fn.bootstrapTable.defaults'
  86. },
  87. 'bootstrap-table-mobile': {
  88. deps: ['bootstrap-table'],
  89. exports: '$.fn.bootstrapTable.defaults'
  90. },
  91. 'bootstrap-table-advancedsearch': {
  92. deps: ['bootstrap-table'],
  93. exports: '$.fn.bootstrapTable.defaults'
  94. },
  95. 'bootstrap-table-commonsearch': {
  96. deps: ['bootstrap-table'],
  97. exports: '$.fn.bootstrapTable.defaults'
  98. },
  99. 'tableexport': {
  100. deps: ['jquery'],
  101. exports: '$.fn.extend'
  102. },
  103. 'slimscroll': {
  104. deps: ['jquery'],
  105. exports: '$.fn.extend'
  106. },
  107. 'adminlte': {
  108. deps: ['bootstrap', 'slimscroll'],
  109. exports: '$.AdminLTE'
  110. },
  111. 'typeahead': {
  112. deps: ['jquery'],
  113. init: function ($) {
  114. return require.s.contexts._.registry['typeahead.js'].factory($);
  115. }
  116. },
  117. 'crontab': ['../libs/jqcron/src/jqCron', 'css!../libs/jqcron/src/jqCron.css'],
  118. 'bootstrap-checkbox': ['jquery'],
  119. 'bootstrap-radio': ['jquery'],
  120. 'bootstrap-switch': ['jquery'],
  121. 'bootstrap-dialog': ['css!../libs/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css'],
  122. 'bootstrap-datetimepicker': [
  123. 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
  124. 'moment/locale/zh-cn',
  125. ],
  126. 'bootstrap-tagsinput': [
  127. 'css!../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css',
  128. 'css!../libs/bootstrap-tagsinput/dist/bootstrap-tagsinput.css',
  129. 'jquery',
  130. 'typeahead'
  131. ],
  132. 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],
  133. 'summernote': ['../libs/summernote/dist/summernote.min', 'css!../libs/summernote/dist/summernote.css'],
  134. // 'toastr': ['css!../libs/toastr/toastr.min.css'],
  135. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],
  136. 'plupload': {
  137. deps: [
  138. '../libs/plupload/js/moxie.min'
  139. ],
  140. exports: "plupload"
  141. },
  142. // 'layer': ['css!../libs/layer/build/skin/default/layer.css'],
  143. },
  144. baseUrl: requirejs.s.contexts._.config.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  145. map: {
  146. '*': {
  147. 'css': '../libs/require-css/css.min'
  148. }
  149. },
  150. charset: 'utf-8' // 文件编码
  151. });
  152. require(['jquery', 'bootstrap', 'config'], function ($, undefined, Config) {
  153. // 配置语言包的路径
  154. var paths = {};
  155. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
  156. // 避免目录冲突
  157. paths['backend/'] = 'backend/';
  158. require.config({paths: paths});
  159. // 初始化
  160. $(function () {
  161. require(['backend'], function (Module) {
  162. // 对相对地址进行处理
  163. $.ajaxSetup({
  164. beforeSend: function (xhr, setting) {
  165. setting.url = Module.api.fixurl(setting.url);
  166. }
  167. });
  168. // 绑定ESC关闭窗口事件
  169. $(window).keyup(function (e) {
  170. if (e.keyCode == 27) {
  171. if ($(".layui-layer").size() > 0) {
  172. var index = 0;
  173. $(".layui-layer").each(function () {
  174. index = Math.max(index, parseInt($(this).attr("times")));
  175. });
  176. if (index) {
  177. Module.api.layer.close(index);
  178. }
  179. }
  180. }
  181. });
  182. //加载相应模块
  183. require([Config.jsname], function (Controller) {
  184. Controller[Config.actionname] != undefined && Controller[Config.actionname]();
  185. }, function (e) {
  186. console.error(e);
  187. // 这里可捕获模块加载的错误
  188. });
  189. });
  190. });
  191. });
  192. define("require-backend", function(){});
  193. define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window)return{load:function(e,t,n){n()}};var e=document.getElementsByTagName("head")[0],t=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/)||0,n=!1,r=!0;t[1]||t[7]?n=parseInt(t[1])<6||parseInt(t[7])<=9:t[2]||t[8]?r=!1:t[4]&&(n=parseInt(t[4])<18);var o={};o.pluginBuilder="./css-builder";var a,i,s,l=function(){a=document.createElement("style"),e.appendChild(a),i=a.styleSheet||a.sheet},u=0,d=[],c=function(e){u++,32==u&&(l(),u=0),i.addImport(e),a.onload=function(){f()}},f=function(){s();var e=d.shift();return e?(s=e[1],void c(e[0])):void(s=null)},h=function(e,t){if(i&&i.addImport||l(),i&&i.addImport)s?d.push([e,t]):(c(e),s=t);else{a.textContent='@import "'+e+'";';var n=setInterval(function(){try{a.sheet.cssRules,clearInterval(n),t()}catch(e){}},10)}},p=function(t,n){var o=document.createElement("link");if(o.type="text/css",o.rel="stylesheet",r)o.onload=function(){o.onload=function(){},setTimeout(n,7)};else var a=setInterval(function(){for(var e=0;e<document.styleSheets.length;e++){var t=document.styleSheets[e];if(t.href==o.href)return clearInterval(a),n()}},10);o.href=t,e.appendChild(o)};return o.normalize=function(e,t){return".css"==e.substr(e.length-4,4)&&(e=e.substr(0,e.length-4)),t(e)},o.load=function(e,t,r){(n?h:p)(t.toUrl(e+".css"),r)},o});
  194. /**
  195. @Name:layer v3.0.1 Web弹层组件
  196. @Author:贤心
  197. @Site:http://layer.layui.com
  198. @License:LGPL
  199. */
  200. ;!function(window, undefined){
  201. "use strict";
  202. var isLayui = window.layui && layui.define, $, win, ready = {
  203. getPath: function(){
  204. var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
  205. if(script.getAttribute('merge')) return;
  206. return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
  207. }(),
  208. config: {}, end: {}, minIndex: 0, minLeft: [],
  209. btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
  210. //五种原始层模式
  211. type: ['dialog', 'page', 'iframe', 'loading', 'tips']
  212. };
  213. //默认内置方法。
  214. var layer = {
  215. v: '3.0.1',
  216. ie: function(){ //ie版本
  217. var agent = navigator.userAgent.toLowerCase();
  218. return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
  219. (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
  220. ) : false;
  221. }(),
  222. index: (window.layer && window.layer.v) ? 100000 : 0,
  223. path: ready.getPath,
  224. config: function(options, fn){
  225. options = options || {};
  226. layer.cache = ready.config = $.extend({}, ready.config, options);
  227. layer.path = ready.config.path || layer.path;
  228. typeof options.extend === 'string' && (options.extend = [options.extend]);
  229. if(ready.config.path) layer.ready();
  230. if(!options.extend) return this;
  231. isLayui
  232. ? layui.addcss('modules/layer/' + options.extend)
  233. : layer.link('skin/' + options.extend);
  234. return this;
  235. },
  236. //载入CSS配件
  237. link: function(href, fn, cssname){
  238. //未设置路径,则不主动加载css
  239. if(!layer.path) return;
  240. var head = $('head')[0], link = document.createElement('link');
  241. if(typeof fn === 'string') cssname = fn;
  242. var app = (cssname || href).replace(/\.|\//g, '');
  243. var id = 'layuicss-'+app, timeout = 0;
  244. link.rel = 'stylesheet';
  245. link.href = layer.path + href;
  246. link.id = id;
  247. if(!$('#'+ id)[0]){
  248. head.appendChild(link);
  249. }
  250. if(typeof fn !== 'function') return;
  251. //轮询css是否加载完毕
  252. (function poll() {
  253. if(++timeout > 8 * 1000 / 100){
  254. return window.console && console.error('layer.css: Invalid');
  255. };
  256. parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
  257. }());
  258. },
  259. ready: function(callback){
  260. var cssname = 'skinlayercss', ver = '1110';
  261. isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
  262. : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);
  263. return this;
  264. },
  265. //各种快捷引用
  266. alert: function(content, options, yes){
  267. var type = typeof options === 'function';
  268. if(type) yes = options;
  269. return layer.open($.extend({
  270. content: content,
  271. yes: yes
  272. }, type ? {} : options));
  273. },
  274. confirm: function(content, options, yes, cancel){
  275. var type = typeof options === 'function';
  276. if(type){
  277. cancel = yes;
  278. yes = options;
  279. }
  280. return layer.open($.extend({
  281. content: content,
  282. btn: ready.btn,
  283. yes: yes,
  284. btn2: cancel
  285. }, type ? {} : options));
  286. },
  287. msg: function(content, options, end){ //最常用提示层
  288. var type = typeof options === 'function', rskin = ready.config.skin;
  289. var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
  290. var anim = doms.anim.length - 1;
  291. if(type) end = options;
  292. return layer.open($.extend({
  293. content: content,
  294. time: 3000,
  295. shade: false,
  296. skin: skin,
  297. title: false,
  298. closeBtn: false,
  299. btn: false,
  300. resize: false,
  301. end: end
  302. }, (type && !ready.config.skin) ? {
  303. skin: skin + ' layui-layer-hui',
  304. anim: anim
  305. } : function(){
  306. options = options || {};
  307. if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
  308. options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
  309. }
  310. return options;
  311. }()));
  312. },
  313. load: function(icon, options){
  314. return layer.open($.extend({
  315. type: 3,
  316. icon: icon || 0,
  317. resize: false,
  318. shade: 0.01
  319. }, options));
  320. },
  321. tips: function(content, follow, options){
  322. return layer.open($.extend({
  323. type: 4,
  324. content: [content, follow],
  325. closeBtn: false,
  326. time: 3000,
  327. shade: false,
  328. resize: false,
  329. fixed: false,
  330. maxWidth: 210
  331. }, options));
  332. }
  333. };
  334. var Class = function(setings){
  335. var that = this;
  336. that.index = ++layer.index;
  337. that.config = $.extend({}, that.config, ready.config, setings);
  338. document.body ? that.creat() : setTimeout(function(){
  339. that.creat();
  340. }, 50);
  341. };
  342. Class.pt = Class.prototype;
  343. //缓存常用字符
  344. var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
  345. doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
  346. //默认配置
  347. Class.pt.config = {
  348. type: 0,
  349. shade: 0.3,
  350. fixed: true,
  351. move: doms[1],
  352. title: '&#x4FE1;&#x606F;',
  353. offset: 'auto',
  354. area: 'auto',
  355. closeBtn: 1,
  356. time: 0, //0表示不自动关闭
  357. zIndex: 19891014,
  358. maxWidth: 360,
  359. anim: 0,
  360. icon: -1,
  361. moveType: 1,
  362. resize: true,
  363. scrollbar: true, //是否允许浏览器滚动条
  364. tips: 2
  365. };
  366. //容器
  367. Class.pt.vessel = function(conType, callback){
  368. var that = this, times = that.index, config = that.config;
  369. var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
  370. var ismax = config.maxmin && (config.type === 1 || config.type === 2);
  371. var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
  372. + (titype ? config.title[0] : config.title)
  373. + '</div>' : '');
  374. config.zIndex = zIndex;
  375. callback([
  376. //遮罩
  377. config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
  378. //主体
  379. '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
  380. + (conType && config.type != 2 ? '' : titleHTML)
  381. + '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
  382. + (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
  383. + (config.type == 1 && conType ? '' : (config.content||''))
  384. + '</div>'
  385. + '<span class="layui-layer-setwin">'+ function(){
  386. var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
  387. config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
  388. return closebtn;
  389. }() + '</span>'
  390. + (config.btn ? function(){
  391. var button = '';
  392. typeof config.btn === 'string' && (config.btn = [config.btn]);
  393. for(var i = 0, len = config.btn.length; i < len; i++){
  394. button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
  395. }
  396. return '<div class="'+ doms[6] +' layui-layer-btn-'+ (config.btnAlign||'') +'">'+ button +'</div>'
  397. }() : '')
  398. + (config.resize ? '<span class="layui-layer-resize"></span>' : '')
  399. + '</div>'
  400. ], titleHTML, $('<div class="layui-layer-move"></div>'));
  401. return that;
  402. };
  403. //创建骨架
  404. Class.pt.creat = function(){
  405. var that = this
  406. ,config = that.config
  407. ,times = that.index, nodeIndex
  408. ,content = config.content
  409. ,conType = typeof content === 'object'
  410. ,body = $('body');
  411. if($('#'+config.id)[0]) return;
  412. if(typeof config.area === 'string'){
  413. config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
  414. }
  415. //anim兼容旧版shift
  416. if(config.shift){
  417. config.anim = config.shift;
  418. }
  419. if(layer.ie == 6){
  420. config.fixed = false;
  421. }
  422. switch(config.type){
  423. case 0:
  424. config.btn = ('btn' in config) ? config.btn : ready.btn[0];
  425. layer.closeAll('dialog');
  426. break;
  427. case 2:
  428. var content = config.content = conType ? config.content : [config.content||'http://layer.layui.com', 'auto'];
  429. config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
  430. break;
  431. case 3:
  432. delete config.title;
  433. delete config.closeBtn;
  434. config.icon === -1 && (config.icon === 0);
  435. layer.closeAll('loading');
  436. break;
  437. case 4:
  438. conType || (config.content = [config.content, 'body']);
  439. config.follow = config.content[1];
  440. config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
  441. delete config.title;
  442. config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
  443. config.tipsMore || layer.closeAll('tips');
  444. break;
  445. }
  446. //建立容器
  447. that.vessel(conType, function(html, titleHTML, moveElem){
  448. body.append(html[0]);
  449. conType ? function(){
  450. (config.type == 2 || config.type == 4) ? function(){
  451. $('body').append(html[1]);
  452. }() : function(){
  453. if(!content.parents('.'+doms[0])[0]){
  454. content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
  455. $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
  456. }
  457. }();
  458. }() : body.append(html[1]);
  459. $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
  460. that.layero = $('#'+ doms[0] + times);
  461. config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
  462. }).auto(times);
  463. config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
  464. //坐标自适应浏览器窗口尺寸
  465. config.type == 4 ? that.tips() : that.offset();
  466. if(config.fixed){
  467. win.on('resize', function(){
  468. that.offset();
  469. (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
  470. config.type == 4 && that.tips();
  471. });
  472. }
  473. config.time <= 0 || setTimeout(function(){
  474. layer.close(that.index)
  475. }, config.time);
  476. that.move().callback();
  477. //为兼容jQuery3.0的css动画影响元素尺寸计算
  478. if(doms.anim[config.anim]){
  479. that.layero.addClass(doms.anim[config.anim]).data('anim', true);
  480. };
  481. };
  482. //自适应
  483. Class.pt.auto = function(index){
  484. var that = this, config = that.config, layero = $('#'+ doms[0] + index);
  485. if(config.area[0] === '' && config.maxWidth > 0){
  486. //为了修复IE7下一个让人难以理解的bug
  487. if(layer.ie && layer.ie < 8 && config.btn){
  488. layero.width(layero.innerWidth());
  489. }
  490. layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
  491. }
  492. var area = [layero.innerWidth(), layero.innerHeight()];
  493. var titHeight = layero.find(doms[1]).outerHeight() || 0;
  494. var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  495. function setHeight(elem){
  496. elem = layero.find(elem);
  497. elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding'))|0));
  498. }
  499. switch(config.type){
  500. case 2:
  501. setHeight('iframe');
  502. break;
  503. default:
  504. if(config.area[1] === ''){
  505. if(config.fixed && area[1] >= win.height()){
  506. area[1] = win.height();
  507. setHeight('.'+doms[5]);
  508. }
  509. } else {
  510. setHeight('.'+doms[5]);
  511. }
  512. break;
  513. }
  514. return that;
  515. };
  516. //计算坐标
  517. Class.pt.offset = function(){
  518. var that = this, config = that.config, layero = that.layero;
  519. var area = [layero.outerWidth(), layero.outerHeight()];
  520. var type = typeof config.offset === 'object';
  521. that.offsetTop = (win.height() - area[1])/2;
  522. that.offsetLeft = (win.width() - area[0])/2;
  523. if(type){
  524. that.offsetTop = config.offset[0];
  525. that.offsetLeft = config.offset[1]||that.offsetLeft;
  526. } else if(config.offset !== 'auto'){
  527. if(config.offset === 't'){ //上
  528. that.offsetTop = 0;
  529. } else if(config.offset === 'r'){ //右
  530. that.offsetLeft = win.width() - area[0];
  531. } else if(config.offset === 'b'){ //下
  532. that.offsetTop = win.height() - area[1];
  533. } else if(config.offset === 'l'){ //左
  534. that.offsetLeft = 0;
  535. } else if(config.offset === 'lt'){ //左上角
  536. that.offsetTop = 0;
  537. that.offsetLeft = 0;
  538. } else if(config.offset === 'lb'){ //左下角
  539. that.offsetTop = win.height() - area[1];
  540. that.offsetLeft = 0;
  541. } else if(config.offset === 'rt'){ //右上角
  542. that.offsetTop = 0;
  543. that.offsetLeft = win.width() - area[0];
  544. } else if(config.offset === 'rb'){ //右下角
  545. that.offsetTop = win.height() - area[1];
  546. that.offsetLeft = win.width() - area[0];
  547. } else {
  548. that.offsetTop = config.offset;
  549. }
  550. }
  551. if(!config.fixed){
  552. that.offsetTop = /%$/.test(that.offsetTop) ?
  553. win.height()*parseFloat(that.offsetTop)/100
  554. : parseFloat(that.offsetTop);
  555. that.offsetLeft = /%$/.test(that.offsetLeft) ?
  556. win.width()*parseFloat(that.offsetLeft)/100
  557. : parseFloat(that.offsetLeft);
  558. that.offsetTop += win.scrollTop();
  559. that.offsetLeft += win.scrollLeft();
  560. }
  561. if(layero.attr('minLeft')){
  562. that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
  563. that.offsetLeft = layero.css('left');
  564. }
  565. layero.css({top: that.offsetTop, left: that.offsetLeft});
  566. };
  567. //Tips
  568. Class.pt.tips = function(){
  569. var that = this, config = that.config, layero = that.layero;
  570. var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);
  571. if(!follow[0]) follow = $('body');
  572. var goal = {
  573. width: follow.outerWidth(),
  574. height: follow.outerHeight(),
  575. top: follow.offset().top,
  576. left: follow.offset().left
  577. }, tipsG = layero.find('.layui-layer-TipsG');
  578. var guide = config.tips[0];
  579. config.tips[1] || tipsG.remove();
  580. goal.autoLeft = function(){
  581. if(goal.left + layArea[0] - win.width() > 0){
  582. goal.tipLeft = goal.left + goal.width - layArea[0];
  583. tipsG.css({right: 12, left: 'auto'});
  584. } else {
  585. goal.tipLeft = goal.left;
  586. };
  587. };
  588. //辨别tips的方位
  589. goal.where = [function(){ //上
  590. goal.autoLeft();
  591. goal.tipTop = goal.top - layArea[1] - 10;
  592. tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
  593. }, function(){ //右
  594. goal.tipLeft = goal.left + goal.width + 10;
  595. goal.tipTop = goal.top;
  596. tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
  597. }, function(){ //下
  598. goal.autoLeft();
  599. goal.tipTop = goal.top + goal.height + 10;
  600. tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
  601. }, function(){ //左
  602. goal.tipLeft = goal.left - layArea[0] - 10;
  603. goal.tipTop = goal.top;
  604. tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
  605. }];
  606. goal.where[guide-1]();
  607. /* 8*2为小三角形占据的空间 */
  608. if(guide === 1){
  609. goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
  610. } else if(guide === 2){
  611. win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()
  612. } else if(guide === 3){
  613. (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();
  614. } else if(guide === 4){
  615. layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()
  616. }
  617. layero.find('.'+doms[5]).css({
  618. 'background-color': config.tips[1],
  619. 'padding-right': (config.closeBtn ? '30px' : '')
  620. });
  621. layero.css({
  622. left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
  623. top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
  624. });
  625. }
  626. //拖拽层
  627. Class.pt.move = function(){
  628. var that = this
  629. ,config = that.config
  630. ,_DOC = $(document)
  631. ,layero = that.layero
  632. ,moveElem = layero.find(config.move)
  633. ,resizeElem = layero.find('.layui-layer-resize')
  634. ,dict = {};
  635. if(config.move){
  636. moveElem.css('cursor', 'move');
  637. }
  638. moveElem.on('mousedown', function(e){
  639. e.preventDefault();
  640. if(config.move){
  641. dict.moveStart = true;
  642. dict.offset = [
  643. e.clientX - parseFloat(layero.css('left'))
  644. ,e.clientY - parseFloat(layero.css('top'))
  645. ];
  646. ready.moveElem.css('cursor', 'move').show();
  647. }
  648. });
  649. resizeElem.on('mousedown', function(e){
  650. e.preventDefault();
  651. dict.resizeStart = true;
  652. dict.offset = [e.clientX, e.clientY];
  653. dict.area = [
  654. layero.outerWidth()
  655. ,layero.outerHeight()
  656. ];
  657. ready.moveElem.css('cursor', 'se-resize').show();
  658. });
  659. _DOC.on('mousemove', function(e){
  660. //拖拽移动
  661. if(dict.moveStart){
  662. var X = e.clientX - dict.offset[0]
  663. ,Y = e.clientY - dict.offset[1]
  664. ,fixed = layero.css('position') === 'fixed';
  665. e.preventDefault();
  666. dict.stX = fixed ? 0 : win.scrollLeft();
  667. dict.stY = fixed ? 0 : win.scrollTop();
  668. //控制元素不被拖出窗口外
  669. if(!config.moveOut){
  670. var setRig = win.width() - layero.outerWidth() + dict.stX
  671. ,setBot = win.height() - layero.outerHeight() + dict.stY;
  672. X < dict.stX && (X = dict.stX);
  673. X > setRig && (X = setRig);
  674. Y < dict.stY && (Y = dict.stY);
  675. Y > setBot && (Y = setBot);
  676. }
  677. layero.css({
  678. left: X
  679. ,top: Y
  680. });
  681. }
  682. //Resize
  683. if(config.resize && dict.resizeStart){
  684. var X = e.clientX - dict.offset[0]
  685. ,Y = e.clientY - dict.offset[1];
  686. e.preventDefault();
  687. layer.style(that.index, {
  688. width: dict.area[0] + X
  689. ,height: dict.area[1] + Y
  690. })
  691. dict.isResize = true;
  692. }
  693. }).on('mouseup', function(e){
  694. if(dict.moveStart){
  695. delete dict.moveStart;
  696. ready.moveElem.hide();
  697. config.moveEnd && config.moveEnd();
  698. }
  699. if(dict.resizeStart){
  700. delete dict.resizeStart;
  701. ready.moveElem.hide();
  702. }
  703. });
  704. return that;
  705. };
  706. Class.pt.callback = function(){
  707. var that = this, layero = that.layero, config = that.config;
  708. that.openLayer();
  709. if(config.success){
  710. if(config.type == 2){
  711. layero.find('iframe').on('load', function(){
  712. config.success(layero, that.index);
  713. });
  714. } else {
  715. config.success(layero, that.index);
  716. }
  717. }
  718. layer.ie == 6 && that.IE6(layero);
  719. //按钮
  720. layero.find('.'+ doms[6]).children('a').on('click', function(){
  721. var index = $(this).index();
  722. if(index === 0){
  723. if(config.yes){
  724. config.yes(that.index, layero)
  725. } else if(config['btn1']){
  726. config['btn1'](that.index, layero)
  727. } else {
  728. layer.close(that.index);
  729. }
  730. } else {
  731. var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
  732. close === false || layer.close(that.index);
  733. }
  734. });
  735. //取消
  736. function cancel(){
  737. var close = config.cancel && config.cancel(that.index, layero);
  738. close === false || layer.close(that.index);
  739. }
  740. //右上角关闭回调
  741. layero.find('.'+ doms[7]).on('click', cancel);
  742. //点遮罩关闭
  743. if(config.shadeClose){
  744. $('#layui-layer-shade'+ that.index).on('click', function(){
  745. layer.close(that.index);
  746. });
  747. }
  748. //最小化
  749. layero.find('.layui-layer-min').on('click', function(){
  750. var min = config.min && config.min(layero);
  751. min === false || layer.min(that.index, config);
  752. });
  753. //全屏/还原
  754. layero.find('.layui-layer-max').on('click', function(){
  755. if($(this).hasClass('layui-layer-maxmin')){
  756. layer.restore(that.index);
  757. config.restore && config.restore(layero);
  758. } else {
  759. layer.full(that.index, config);
  760. setTimeout(function(){
  761. config.full && config.full(layero);
  762. }, 100);
  763. }
  764. });
  765. config.end && (ready.end[that.index] = config.end);
  766. };
  767. //for ie6 恢复select
  768. ready.reselect = function(){
  769. $.each($('select'), function(index , value){
  770. var sthis = $(this);
  771. if(!sthis.parents('.'+doms[0])[0]){
  772. (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
  773. }
  774. sthis = null;
  775. });
  776. };
  777. Class.pt.IE6 = function(layero){
  778. //隐藏select
  779. $('select').each(function(index , value){
  780. var sthis = $(this);
  781. if(!sthis.parents('.'+doms[0])[0]){
  782. sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();
  783. }
  784. sthis = null;
  785. });
  786. };
  787. //需依赖原型的对外方法
  788. Class.pt.openLayer = function(){
  789. var that = this;
  790. //置顶当前窗口
  791. layer.zIndex = that.config.zIndex;
  792. layer.setTop = function(layero){
  793. var setZindex = function(){
  794. layer.zIndex++;
  795. layero.css('z-index', layer.zIndex + 1);
  796. };
  797. layer.zIndex = parseInt(layero[0].style.zIndex);
  798. layero.on('mousedown', setZindex);
  799. return layer.zIndex;
  800. };
  801. };
  802. ready.record = function(layero){
  803. var area = [
  804. layero.width(),
  805. layero.height(),
  806. layero.position().top,
  807. layero.position().left + parseFloat(layero.css('margin-left'))
  808. ];
  809. layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
  810. layero.attr({area: area});
  811. };
  812. ready.rescollbar = function(index){
  813. if(doms.html.attr('layer-full') == index){
  814. if(doms.html[0].style.removeProperty){
  815. doms.html[0].style.removeProperty('overflow');
  816. } else {
  817. doms.html[0].style.removeAttribute('overflow');
  818. }
  819. doms.html.removeAttr('layer-full');
  820. }
  821. };
  822. /** 内置成员 */
  823. window.layer = layer;
  824. //获取子iframe的DOM
  825. layer.getChildFrame = function(selector, index){
  826. index = index || $('.'+doms[4]).attr('times');
  827. return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
  828. };
  829. //得到当前iframe层的索引,子iframe时使用
  830. layer.getFrameIndex = function(name){
  831. return $('#'+ name).parents('.'+doms[4]).attr('times');
  832. };
  833. //iframe层自适应宽高
  834. layer.iframeAuto = function(index){
  835. if(!index) return;
  836. var heg = layer.getChildFrame('html', index).outerHeight();
  837. var layero = $('#'+ doms[0] + index);
  838. var titHeight = layero.find(doms[1]).outerHeight() || 0;
  839. var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  840. layero.css({height: heg + titHeight + btnHeight});
  841. layero.find('iframe').css({height: heg});
  842. };
  843. //重置iframe url
  844. layer.iframeSrc = function(index, url){
  845. $('#'+ doms[0] + index).find('iframe').attr('src', url);
  846. };
  847. //设定层的样式
  848. layer.style = function(index, options, limit){
  849. var layero = $('#'+ doms[0] + index)
  850. ,contElem = layero.find('.layui-layer-content')
  851. ,type = layero.attr('type')
  852. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  853. ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
  854. ,minLeft = layero.attr('minLeft');
  855. if(type === ready.type[3] || type === ready.type[4]){
  856. return;
  857. }
  858. if(!limit){
  859. if(parseFloat(options.width) <= 260){
  860. options.width = 260;
  861. };
  862. if(parseFloat(options.height) - titHeight - btnHeight <= 64){
  863. options.height = 64 + titHeight + btnHeight;
  864. };
  865. }
  866. layero.css(options);
  867. btnHeight = layero.find('.'+doms[6]).outerHeight();
  868. if(type === ready.type[2]){
  869. layero.find('iframe').css({
  870. height: parseFloat(options.height) - titHeight - btnHeight
  871. });
  872. } else {
  873. contElem.css({
  874. height: parseFloat(options.height) - titHeight - btnHeight
  875. - parseFloat(contElem.css('padding-top'))
  876. - parseFloat(contElem.css('padding-bottom'))
  877. })
  878. }
  879. };
  880. //最小化
  881. layer.min = function(index, options){
  882. var layero = $('#'+ doms[0] + index)
  883. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  884. ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
  885. ,position = layero.css('position');
  886. ready.record(layero);
  887. if(ready.minLeft[0]){
  888. left = ready.minLeft[0];
  889. ready.minLeft.shift();
  890. }
  891. layero.attr('position', position);
  892. layer.style(index, {
  893. width: 180
  894. ,height: titHeight
  895. ,left: left
  896. ,top: win.height() - titHeight
  897. ,position: 'fixed'
  898. ,overflow: 'hidden'
  899. }, true);
  900. layero.find('.layui-layer-min').hide();
  901. layero.attr('type') === 'page' && layero.find(doms[4]).hide();
  902. ready.rescollbar(index);
  903. if(!layero.attr('minLeft')){
  904. ready.minIndex++;
  905. }
  906. layero.attr('minLeft', left);
  907. };
  908. //还原
  909. layer.restore = function(index){
  910. var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
  911. var type = layero.attr('type');
  912. layer.style(index, {
  913. width: parseFloat(area[0]),
  914. height: parseFloat(area[1]),
  915. top: parseFloat(area[2]),
  916. left: parseFloat(area[3]),
  917. position: layero.attr('position'),
  918. overflow: 'visible'
  919. }, true);
  920. layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
  921. layero.find('.layui-layer-min').show();
  922. layero.attr('type') === 'page' && layero.find(doms[4]).show();
  923. ready.rescollbar(index);
  924. };
  925. //全屏
  926. layer.full = function(index){
  927. var layero = $('#'+ doms[0] + index), timer;
  928. ready.record(layero);
  929. if(!doms.html.attr('layer-full')){
  930. doms.html.css('overflow','hidden').attr('layer-full', index);
  931. }
  932. clearTimeout(timer);
  933. timer = setTimeout(function(){
  934. var isfix = layero.css('position') === 'fixed';
  935. layer.style(index, {
  936. top: isfix ? 0 : win.scrollTop(),
  937. left: isfix ? 0 : win.scrollLeft(),
  938. width: win.width(),
  939. height: win.height()
  940. }, true);
  941. layero.find('.layui-layer-min').hide();
  942. }, 100);
  943. };
  944. //改变title
  945. layer.title = function(name, index){
  946. var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
  947. title.html(name);
  948. };
  949. //关闭layer总方法
  950. layer.close = function(index){
  951. var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
  952. if(!layero[0]) return;
  953. var WRAP = 'layui-layer-wrap', remove = function(){
  954. if(type === ready.type[1] && layero.attr('conType') === 'object'){
  955. layero.children(':not(.'+ doms[5] +')').remove();
  956. var wrap = layero.find('.'+WRAP);
  957. for(var i = 0; i < 2; i++){
  958. wrap.unwrap();
  959. }
  960. wrap.css('display', wrap.data('display')).removeClass(WRAP);
  961. } else {
  962. //低版本IE 回收 iframe
  963. if(type === ready.type[2]){
  964. try {
  965. var iframe = $('#'+doms[4]+index)[0];
  966. iframe.contentWindow.document.write('');
  967. iframe.contentWindow.close();
  968. layero.find('.'+doms[5])[0].removeChild(iframe);
  969. } catch(e){}
  970. }
  971. layero[0].innerHTML = '';
  972. layero.remove();
  973. }
  974. };
  975. if(layero.data('anim')){
  976. layero.addClass(closeAnim);
  977. }
  978. $('#layui-layer-moves, #layui-layer-shade' + index).remove();
  979. layer.ie == 6 && ready.reselect();
  980. ready.rescollbar(index);
  981. typeof ready.end[index] === 'function' && ready.end[index]();
  982. delete ready.end[index];
  983. if(layero.attr('minLeft')){
  984. ready.minIndex--;
  985. ready.minLeft.push(layero.attr('minLeft'));
  986. }
  987. setTimeout(function(){
  988. remove();
  989. }, ((layer.ie && layer.ie < 10) || !layero.data('anim')) ? 0 : 200);
  990. };
  991. //关闭所有层
  992. layer.closeAll = function(type){
  993. $.each($('.'+doms[0]), function(){
  994. var othis = $(this);
  995. var is = type ? (othis.attr('type') === type) : 1;
  996. is && layer.close(othis.attr('times'));
  997. is = null;
  998. });
  999. };
  1000. /**
  1001. 拓展模块,layui开始合并在一起
  1002. */
  1003. var cache = layer.cache||{}, skin = function(type){
  1004. return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
  1005. };
  1006. //仿系统prompt
  1007. layer.prompt = function(options, yes){
  1008. var style = '';
  1009. options = options || {};
  1010. if(typeof options === 'function') yes = options;
  1011. if(options.area){
  1012. var area = options.area;
  1013. style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
  1014. delete options.area;
  1015. }
  1016. var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
  1017. return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
  1018. }();
  1019. return layer.open($.extend({
  1020. type: 1
  1021. ,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
  1022. ,content: content
  1023. ,skin: 'layui-layer-prompt' + skin('prompt')
  1024. ,maxWidth: win.width()
  1025. ,success: function(layero){
  1026. prompt = layero.find('.layui-layer-input');
  1027. prompt.focus();
  1028. }
  1029. ,resize: false
  1030. ,yes: function(index){
  1031. var value = prompt.val();
  1032. if(value === ''){
  1033. prompt.focus();
  1034. } else if(value.length > (options.maxlength||500)) {
  1035. layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});
  1036. } else {
  1037. yes && yes(value, index, prompt);
  1038. }
  1039. }
  1040. }, options));
  1041. };
  1042. //tab层
  1043. layer.tab = function(options){
  1044. options = options || {};
  1045. var tab = options.tab || {};
  1046. return layer.open($.extend({
  1047. type: 1,
  1048. skin: 'layui-layer-tab' + skin('tab'),
  1049. resize: false,
  1050. title: function(){
  1051. var len = tab.length, ii = 1, str = '';
  1052. if(len > 0){
  1053. str = '<span class="layui-layer-tabnow">'+ tab[0].title +'</span>';
  1054. for(; ii < len; ii++){
  1055. str += '<span>'+ tab[ii].title +'</span>';
  1056. }
  1057. }
  1058. return str;
  1059. }(),
  1060. content: '<ul class="layui-layer-tabmain">'+ function(){
  1061. var len = tab.length, ii = 1, str = '';
  1062. if(len > 0){
  1063. str = '<li class="layui-layer-tabli xubox_tab_layer">'+ (tab[0].content || 'no content') +'</li>';
  1064. for(; ii < len; ii++){
  1065. str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';
  1066. }
  1067. }
  1068. return str;
  1069. }() +'</ul>',
  1070. success: function(layero){
  1071. var btn = layero.find('.layui-layer-title').children();
  1072. var main = layero.find('.layui-layer-tabmain').children();
  1073. btn.on('mousedown', function(e){
  1074. e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
  1075. var othis = $(this), index = othis.index();
  1076. othis.addClass('layui-layer-tabnow').siblings().removeClass('layui-layer-tabnow');
  1077. main.eq(index).show().siblings().hide();
  1078. typeof options.change === 'function' && options.change(index);
  1079. });
  1080. }
  1081. }, options));
  1082. };
  1083. //相册层
  1084. layer.photos = function(options, loop, key){
  1085. var dict = {};
  1086. options = options || {};
  1087. if(!options.photos) return;
  1088. var type = options.photos.constructor === Object;
  1089. var photos = type ? options.photos : {}, data = photos.data || [];
  1090. var start = photos.start || 0;
  1091. dict.imgIndex = (start|0) + 1;
  1092. options.img = options.img || 'img';
  1093. if(!type){ //页面直接获取
  1094. var parent = $(options.photos), pushData = function(){
  1095. data = [];
  1096. parent.find(options.img).each(function(index){
  1097. var othis = $(this);
  1098. othis.attr('layer-index', index);
  1099. data.push({
  1100. alt: othis.attr('alt'),
  1101. pid: othis.attr('layer-pid'),
  1102. src: othis.attr('layer-src') || othis.attr('src'),
  1103. thumb: othis.attr('src')
  1104. });
  1105. })
  1106. };
  1107. pushData();
  1108. if (data.length === 0) return;
  1109. loop || parent.on('click', options.img, function(){
  1110. var othis = $(this), index = othis.attr('layer-index');
  1111. layer.photos($.extend(options, {
  1112. photos: {
  1113. start: index,
  1114. data: data,
  1115. tab: options.tab
  1116. },
  1117. full: options.full
  1118. }), true);
  1119. pushData();
  1120. })
  1121. //不直接弹出
  1122. if(!loop) return;
  1123. } else if (data.length === 0){
  1124. return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');
  1125. }
  1126. //上一张
  1127. dict.imgprev = function(key){
  1128. dict.imgIndex--;
  1129. if(dict.imgIndex < 1){
  1130. dict.imgIndex = data.length;
  1131. }
  1132. dict.tabimg(key);
  1133. };
  1134. //下一张
  1135. dict.imgnext = function(key,errorMsg){
  1136. dict.imgIndex++;
  1137. if(dict.imgIndex > data.length){
  1138. dict.imgIndex = 1;
  1139. if (errorMsg) {return};
  1140. }
  1141. dict.tabimg(key)
  1142. };
  1143. //方向键
  1144. dict.keyup = function(event){
  1145. if(!dict.end){
  1146. var code = event.keyCode;
  1147. event.preventDefault();
  1148. if(code === 37){
  1149. dict.imgprev(true);
  1150. } else if(code === 39) {
  1151. dict.imgnext(true);
  1152. } else if(code === 27) {
  1153. layer.close(dict.index);
  1154. }
  1155. }
  1156. }
  1157. //切换
  1158. dict.tabimg = function(key){
  1159. if(data.length <= 1) return;
  1160. photos.start = dict.imgIndex - 1;
  1161. layer.close(dict.index);
  1162. layer.photos(options, true, key);
  1163. }
  1164. //一些动作
  1165. dict.event = function(){
  1166. dict.bigimg.hover(function(){
  1167. dict.imgsee.show();
  1168. }, function(){
  1169. dict.imgsee.hide();
  1170. });
  1171. dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
  1172. event.preventDefault();
  1173. dict.imgprev();
  1174. });
  1175. dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
  1176. event.preventDefault();
  1177. dict.imgnext();
  1178. });
  1179. $(document).on('keyup', dict.keyup);
  1180. };
  1181. //图片预加载
  1182. function loadImage(url, callback, error) {
  1183. var img = new Image();
  1184. img.src = url;
  1185. if(img.complete){
  1186. return callback(img);
  1187. }
  1188. img.onload = function(){
  1189. img.onload = null;
  1190. callback(img);
  1191. };
  1192. img.onerror = function(e){
  1193. img.onerror = null;
  1194. error(e);
  1195. };
  1196. };
  1197. dict.loadi = layer.load(1, {
  1198. shade: 'shade' in options ? false : 0.9,
  1199. scrollbar: false
  1200. });
  1201. loadImage(data[start].src, function(img){
  1202. layer.close(dict.loadi);
  1203. dict.index = layer.open($.extend({
  1204. type: 1,
  1205. area: function(){
  1206. var imgarea = [img.width, img.height];
  1207. var winarea = [$(window).width() - 100, $(window).height() - 100];
  1208. //如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
  1209. if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
  1210. var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
  1211. if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
  1212. imgarea[0] = imgarea[0]/wh[0];
  1213. imgarea[1] = imgarea[1]/wh[0];
  1214. } else if(wh[0] < wh[1]){
  1215. imgarea[0] = imgarea[0]/wh[1];
  1216. imgarea[1] = imgarea[1]/wh[1];
  1217. }
  1218. }
  1219. return [imgarea[0]+'px', imgarea[1]+'px'];
  1220. }(),
  1221. title: false,
  1222. shade: 0.9,
  1223. shadeClose: true,
  1224. closeBtn: false,
  1225. move: '.layui-layer-phimg img',
  1226. moveType: 1,
  1227. scrollbar: false,
  1228. moveOut: true,
  1229. anim: Math.random()*5|0,
  1230. skin: 'layui-layer-photos' + skin('photos'),
  1231. content: '<div class="layui-layer-phimg">'
  1232. +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
  1233. +'<div class="layui-layer-imgsee">'
  1234. +(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')
  1235. +'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
  1236. +'</div>'
  1237. +'</div>',
  1238. success: function(layero, index){
  1239. dict.bigimg = layero.find('.layui-layer-phimg');
  1240. dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
  1241. dict.event(layero);
  1242. options.tab && options.tab(data[start], layero);
  1243. }, end: function(){
  1244. dict.end = true;
  1245. $(document).off('keyup', dict.keyup);
  1246. }
  1247. }, options));
  1248. }, function(){
  1249. layer.close(dict.loadi);
  1250. layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {
  1251. time: 30000,
  1252. btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],
  1253. yes: function(){
  1254. data.length > 1 && dict.imgnext(true,true);
  1255. }
  1256. });
  1257. });
  1258. };
  1259. //主入口
  1260. ready.run = function(_$){
  1261. $ = _$;
  1262. win = $(window);
  1263. doms.html = $('html');
  1264. layer.open = function(deliver){
  1265. var o = new Class(deliver);
  1266. return o.index;
  1267. };
  1268. };
  1269. //加载方式
  1270. window.layui && layui.define ? (
  1271. layer.ready()
  1272. ,layui.define('jquery', function(exports){ //layui加载
  1273. layer.path = layui.cache.dir;
  1274. ready.run(layui.jquery);
  1275. //暴露模块
  1276. window.layer = layer;
  1277. exports('layer', layer);
  1278. })
  1279. ) : (
  1280. typeof define === 'function' ? define('layer',['jquery'], function(){ //requirejs加载
  1281. ready.run(window.jQuery);
  1282. return layer;
  1283. }) : function(){ //普通script标签加载
  1284. ready.run(window.jQuery);
  1285. layer.ready();
  1286. }()
  1287. );
  1288. }(window);
  1289. /*
  1290. * Toastr
  1291. * Copyright 2012-2015
  1292. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  1293. * All Rights Reserved.
  1294. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  1295. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  1296. *
  1297. * ARIA Support: Greta Krafsig
  1298. *
  1299. * Project: https://github.com/CodeSeven/toastr
  1300. */
  1301. /* global define */
  1302. (function (define) {
  1303. define('toastr',['jquery'], function ($) {
  1304. return (function () {
  1305. var $container;
  1306. var listener;
  1307. var toastId = 0;
  1308. var toastType = {
  1309. error: 'error',
  1310. info: 'info',
  1311. success: 'success',
  1312. warning: 'warning'
  1313. };
  1314. var toastr = {
  1315. clear: clear,
  1316. remove: remove,
  1317. error: error,
  1318. getContainer: getContainer,
  1319. info: info,
  1320. options: {},
  1321. subscribe: subscribe,
  1322. success: success,
  1323. version: '2.1.3',
  1324. warning: warning
  1325. };
  1326. var previousToast;
  1327. return toastr;
  1328. ////////////////
  1329. function error(message, title, optionsOverride) {
  1330. return notify({
  1331. type: toastType.error,
  1332. iconClass: getOptions().iconClasses.error,
  1333. message: message,
  1334. optionsOverride: optionsOverride,
  1335. title: title
  1336. });
  1337. }
  1338. function getContainer(options, create) {
  1339. if (!options) { options = getOptions(); }
  1340. $container = $('#' + options.containerId);
  1341. if ($container.length) {
  1342. return $container;
  1343. }
  1344. if (create) {
  1345. $container = createContainer(options);
  1346. }
  1347. return $container;
  1348. }
  1349. function info(message, title, optionsOverride) {
  1350. return notify({
  1351. type: toastType.info,
  1352. iconClass: getOptions().iconClasses.info,
  1353. message: message,
  1354. optionsOverride: optionsOverride,
  1355. title: title
  1356. });
  1357. }
  1358. function subscribe(callback) {
  1359. listener = callback;
  1360. }
  1361. function success(message, title, optionsOverride) {
  1362. return notify({
  1363. type: toastType.success,
  1364. iconClass: getOptions().iconClasses.success,
  1365. message: message,
  1366. optionsOverride: optionsOverride,
  1367. title: title
  1368. });
  1369. }
  1370. function warning(message, title, optionsOverride) {
  1371. return notify({
  1372. type: toastType.warning,
  1373. iconClass: getOptions().iconClasses.warning,
  1374. message: message,
  1375. optionsOverride: optionsOverride,
  1376. title: title
  1377. });
  1378. }
  1379. function clear($toastElement, clearOptions) {
  1380. var options = getOptions();
  1381. if (!$container) { getContainer(options); }
  1382. if (!clearToast($toastElement, options, clearOptions)) {
  1383. clearContainer(options);
  1384. }
  1385. }
  1386. function remove($toastElement) {
  1387. var options = getOptions();
  1388. if (!$container) { getContainer(options); }
  1389. if ($toastElement && $(':focus', $toastElement).length === 0) {
  1390. removeToast($toastElement);
  1391. return;
  1392. }
  1393. if ($container.children().length) {
  1394. $container.remove();
  1395. }
  1396. }
  1397. // internal functions
  1398. function clearContainer (options) {
  1399. var toastsToClear = $container.children();
  1400. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  1401. clearToast($(toastsToClear[i]), options);
  1402. }
  1403. }
  1404. function clearToast ($toastElement, options, clearOptions) {
  1405. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  1406. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  1407. $toastElement[options.hideMethod]({
  1408. duration: options.hideDuration,
  1409. easing: options.hideEasing,
  1410. complete: function () { removeToast($toastElement); }
  1411. });
  1412. return true;
  1413. }
  1414. return false;
  1415. }
  1416. function createContainer(options) {
  1417. $container = $('<div/>')
  1418. .attr('id', options.containerId)
  1419. .addClass(options.positionClass);
  1420. $container.appendTo($(options.target));
  1421. return $container;
  1422. }
  1423. function getDefaults() {
  1424. return {
  1425. tapToDismiss: true,
  1426. toastClass: 'toast',
  1427. containerId: 'toast-container',
  1428. debug: false,
  1429. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  1430. showDuration: 300,
  1431. showEasing: 'swing', //swing and linear are built into jQuery
  1432. onShown: undefined,
  1433. hideMethod: 'fadeOut',
  1434. hideDuration: 1000,
  1435. hideEasing: 'swing',
  1436. onHidden: undefined,
  1437. closeMethod: false,
  1438. closeDuration: false,
  1439. closeEasing: false,
  1440. closeOnHover: true,
  1441. extendedTimeOut: 1000,
  1442. iconClasses: {
  1443. error: 'toast-error',
  1444. info: 'toast-info',
  1445. success: 'toast-success',
  1446. warning: 'toast-warning'
  1447. },
  1448. iconClass: 'toast-info',
  1449. positionClass: 'toast-top-right',
  1450. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  1451. titleClass: 'toast-title',
  1452. messageClass: 'toast-message',
  1453. escapeHtml: false,
  1454. target: 'body',
  1455. closeHtml: '<button type="button">&times;</button>',
  1456. closeClass: 'toast-close-button',
  1457. newestOnTop: true,
  1458. preventDuplicates: false,
  1459. progressBar: false,
  1460. progressClass: 'toast-progress',
  1461. rtl: false
  1462. };
  1463. }
  1464. function publish(args) {
  1465. if (!listener) { return; }
  1466. listener(args);
  1467. }
  1468. function notify(map) {
  1469. var options = getOptions();
  1470. var iconClass = map.iconClass || options.iconClass;
  1471. if (typeof (map.optionsOverride) !== 'undefined') {
  1472. options = $.extend(options, map.optionsOverride);
  1473. iconClass = map.optionsOverride.iconClass || iconClass;
  1474. }
  1475. if (shouldExit(options, map)) { return; }
  1476. toastId++;
  1477. $container = getContainer(options, true);
  1478. var intervalId = null;
  1479. var $toastElement = $('<div/>');
  1480. var $titleElement = $('<div/>');
  1481. var $messageElement = $('<div/>');
  1482. var $progressElement = $('<div/>');
  1483. var $closeElement = $(options.closeHtml);
  1484. var progressBar = {
  1485. intervalId: null,
  1486. hideEta: null,
  1487. maxHideTime: null
  1488. };
  1489. var response = {
  1490. toastId: toastId,
  1491. state: 'visible',
  1492. startTime: new Date(),
  1493. options: options,
  1494. map: map
  1495. };
  1496. personalizeToast();
  1497. displayToast();
  1498. handleEvents();
  1499. publish(response);
  1500. if (options.debug && console) {
  1501. console.log(response);
  1502. }
  1503. return $toastElement;
  1504. function escapeHtml(source) {
  1505. if (source == null) {
  1506. source = '';
  1507. }
  1508. return source
  1509. .replace(/&/g, '&amp;')
  1510. .replace(/"/g, '&quot;')
  1511. .replace(/'/g, '&#39;')
  1512. .replace(/</g, '&lt;')
  1513. .replace(/>/g, '&gt;');
  1514. }
  1515. function personalizeToast() {
  1516. setIcon();
  1517. setTitle();
  1518. setMessage();
  1519. setCloseButton();
  1520. setProgressBar();
  1521. setRTL();
  1522. setSequence();
  1523. setAria();
  1524. }
  1525. function setAria() {
  1526. var ariaValue = '';
  1527. switch (map.iconClass) {
  1528. case 'toast-success':
  1529. case 'toast-info':
  1530. ariaValue = 'polite';
  1531. break;
  1532. default:
  1533. ariaValue = 'assertive';
  1534. }
  1535. $toastElement.attr('aria-live', ariaValue);
  1536. }
  1537. function handleEvents() {
  1538. if (options.closeOnHover) {
  1539. $toastElement.hover(stickAround, delayedHideToast);
  1540. }
  1541. if (!options.onclick && options.tapToDismiss) {
  1542. $toastElement.click(hideToast);
  1543. }
  1544. if (options.closeButton && $closeElement) {
  1545. $closeElement.click(function (event) {
  1546. if (event.stopPropagation) {
  1547. event.stopPropagation();
  1548. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  1549. event.cancelBubble = true;
  1550. }
  1551. if (options.onCloseClick) {
  1552. options.onCloseClick(event);
  1553. }
  1554. hideToast(true);
  1555. });
  1556. }
  1557. if (options.onclick) {
  1558. $toastElement.click(function (event) {
  1559. options.onclick(event);
  1560. hideToast();
  1561. });
  1562. }
  1563. }
  1564. function displayToast() {
  1565. $toastElement.hide();
  1566. $toastElement[options.showMethod](
  1567. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  1568. );
  1569. if (options.timeOut > 0) {
  1570. intervalId = setTimeout(hideToast, options.timeOut);
  1571. progressBar.maxHideTime = parseFloat(options.timeOut);
  1572. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  1573. if (options.progressBar) {
  1574. progressBar.intervalId = setInterval(updateProgress, 10);
  1575. }
  1576. }
  1577. }
  1578. function setIcon() {
  1579. if (map.iconClass) {
  1580. $toastElement.addClass(options.toastClass).addClass(iconClass);
  1581. }
  1582. }
  1583. function setSequence() {
  1584. if (options.newestOnTop) {
  1585. $container.prepend($toastElement);
  1586. } else {
  1587. $container.append($toastElement);
  1588. }
  1589. }
  1590. function setTitle() {
  1591. if (map.title) {
  1592. var suffix = map.title;
  1593. if (options.escapeHtml) {
  1594. suffix = escapeHtml(map.title);
  1595. }
  1596. $titleElement.append(suffix).addClass(options.titleClass);
  1597. $toastElement.append($titleElement);
  1598. }
  1599. }
  1600. function setMessage() {
  1601. if (map.message) {
  1602. var suffix = map.message;
  1603. if (options.escapeHtml) {
  1604. suffix = escapeHtml(map.message);
  1605. }
  1606. $messageElement.append(suffix).addClass(options.messageClass);
  1607. $toastElement.append($messageElement);
  1608. }
  1609. }
  1610. function setCloseButton() {
  1611. if (options.closeButton) {
  1612. $closeElement.addClass(options.closeClass).attr('role', 'button');
  1613. $toastElement.prepend($closeElement);
  1614. }
  1615. }
  1616. function setProgressBar() {
  1617. if (options.progressBar) {
  1618. $progressElement.addClass(options.progressClass);
  1619. $toastElement.prepend($progressElement);
  1620. }
  1621. }
  1622. function setRTL() {
  1623. if (options.rtl) {
  1624. $toastElement.addClass('rtl');
  1625. }
  1626. }
  1627. function shouldExit(options, map) {
  1628. if (options.preventDuplicates) {
  1629. if (map.message === previousToast) {
  1630. return true;
  1631. } else {
  1632. previousToast = map.message;
  1633. }
  1634. }
  1635. return false;
  1636. }
  1637. function hideToast(override) {
  1638. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  1639. var duration = override && options.closeDuration !== false ?
  1640. options.closeDuration : options.hideDuration;
  1641. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  1642. if ($(':focus', $toastElement).length && !override) {
  1643. return;
  1644. }
  1645. clearTimeout(progressBar.intervalId);
  1646. return $toastElement[method]({
  1647. duration: duration,
  1648. easing: easing,
  1649. complete: function () {
  1650. removeToast($toastElement);
  1651. clearTimeout(intervalId);
  1652. if (options.onHidden && response.state !== 'hidden') {
  1653. options.onHidden();
  1654. }
  1655. response.state = 'hidden';
  1656. response.endTime = new Date();
  1657. publish(response);
  1658. }
  1659. });
  1660. }
  1661. function delayedHideToast() {
  1662. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  1663. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  1664. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  1665. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  1666. }
  1667. }
  1668. function stickAround() {
  1669. clearTimeout(intervalId);
  1670. progressBar.hideEta = 0;
  1671. $toastElement.stop(true, true)[options.showMethod](
  1672. {duration: options.showDuration, easing: options.showEasing}
  1673. );
  1674. }
  1675. function updateProgress() {
  1676. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  1677. $progressElement.width(percentage + '%');
  1678. }
  1679. }
  1680. function getOptions() {
  1681. return $.extend({}, getDefaults(), toastr.options);
  1682. }
  1683. function removeToast($toastElement) {
  1684. if (!$container) { $container = getContainer(); }
  1685. if ($toastElement.is(':visible')) {
  1686. return;
  1687. }
  1688. $toastElement.remove();
  1689. $toastElement = null;
  1690. if ($container.children().length === 0) {
  1691. $container.remove();
  1692. previousToast = undefined;
  1693. }
  1694. }
  1695. })();
  1696. });
  1697. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  1698. if (typeof module !== 'undefined' && module.exports) { //Node
  1699. module.exports = factory(require('jquery'));
  1700. } else {
  1701. window.toastr = factory(window.jQuery);
  1702. }
  1703. }));
  1704. define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'config'], function ($, undefined, Toastr, Layer, Lang, Config) {
  1705. var Backend = {
  1706. config: {
  1707. //toastr默认配置
  1708. toastr: {
  1709. "closeButton": true,
  1710. "debug": false,
  1711. "newestOnTop": false,
  1712. "progressBar": false,
  1713. "positionClass": "toast-top-center",
  1714. "preventDuplicates": false,
  1715. "onclick": null,
  1716. "showDuration": "300",
  1717. "hideDuration": "1000",
  1718. "timeOut": "5000",
  1719. "extendedTimeOut": "1000",
  1720. "showEasing": "swing",
  1721. "hideEasing": "linear",
  1722. "showMethod": "fadeIn",
  1723. "hideMethod": "fadeOut"
  1724. }
  1725. },
  1726. api: {
  1727. ajax: function (options, success, failure) {
  1728. var index = Backend.api.layer.load();
  1729. options = $.extend({
  1730. type: "POST",
  1731. dataType: 'json',
  1732. success: function (ret) {
  1733. Backend.api.layer.close(index);
  1734. if (ret.hasOwnProperty("code")) {
  1735. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  1736. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  1737. if (ret.code === 1) {
  1738. if (typeof success == 'function') {
  1739. var onAfterResult = success.call(undefined, data);
  1740. if (!onAfterResult) {
  1741. return false;
  1742. }
  1743. }
  1744. Toastr.success(msg ? msg : __('Operation completed'));
  1745. } else {
  1746. Toastr.error(msg ? msg : __('Operation failed'));
  1747. }
  1748. } else {
  1749. Toastr.error(__('Unknown data format'));
  1750. }
  1751. }, error: function () {
  1752. Backend.api.layer.close(index);
  1753. Toastr.error(__('Network error'));
  1754. }
  1755. }, options);
  1756. $.ajax(options);
  1757. },
  1758. //修复URL
  1759. fixurl: function (url) {
  1760. if (url.substr(0, 1) !== "/") {
  1761. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  1762. if (!r.test(url)) {
  1763. url = Config.moduleurl + "/" + url;
  1764. }
  1765. }
  1766. return url;
  1767. },
  1768. //查询Url参数
  1769. query: function (name, url) {
  1770. if (!url) {
  1771. url = window.location.href;
  1772. }
  1773. name = name.replace(/[\[\]]/g, "\\$&");
  1774. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  1775. results = regex.exec(url);
  1776. if (!results)
  1777. return null;
  1778. if (!results[2])
  1779. return '';
  1780. return decodeURIComponent(results[2].replace(/\+/g, " "));
  1781. },
  1782. //上传文件
  1783. upload: function (file, callback) {
  1784. var data = new FormData();
  1785. data.append("file", file);
  1786. $.ajax({
  1787. url: "ajax/upload",
  1788. data: data,
  1789. cache: false,
  1790. contentType: false,
  1791. processData: false,
  1792. type: 'POST',
  1793. dataType: 'json',
  1794. success: function (ret) {
  1795. if (ret.hasOwnProperty("code")) {
  1796. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  1797. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  1798. if (ret.code === 1) {
  1799. if (typeof callback == 'function') {
  1800. var onAfterResult = success.call(undefined, data);
  1801. if (!onAfterResult) {
  1802. return false;
  1803. }
  1804. }
  1805. if ($('.summernote').size() > 0 && data && typeof data.url !== 'undefined') {
  1806. $('.summernote').summernote("insertImage", data.url, 'filename');
  1807. }
  1808. Toastr.success(__('Operation completed'));
  1809. } else {
  1810. Toastr.error(msg ? msg : __('Operation failed'));
  1811. }
  1812. } else {
  1813. Toastr.error(__('Unknown data format'));
  1814. }
  1815. }, error: function () {
  1816. Toastr.error(__('Network error'));
  1817. }
  1818. });
  1819. },
  1820. open: function (url, title, options) {
  1821. title = title == undefined ? "" : title;
  1822. url = Backend.api.fixurl(url);
  1823. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  1824. var area;
  1825. if ($(window).width() < 800) {
  1826. area = ["95%", "95%"];
  1827. } else {
  1828. area = ['800px', '600px'];
  1829. }
  1830. Backend.api.layer.open($.extend({
  1831. type: 2,
  1832. title: title,
  1833. shadeClose: true,
  1834. shade: false,
  1835. maxmin: true,
  1836. moveOut: true,
  1837. area: area,
  1838. content: url,
  1839. zIndex: Backend.api.layer.zIndex,
  1840. skin: 'layui-layer-noborder',
  1841. success: function (layero, index) {
  1842. //$(layero).removeClass("layui-layer-border");
  1843. Backend.api.layer.setTop(layero);
  1844. var frame = Backend.api.layer.getChildFrame('html', index);
  1845. var layerfooter = frame.find(".layer-footer");
  1846. Backend.api.layerfooter(layero, index);
  1847. //绑定事件
  1848. if (layerfooter.size() > 0) {
  1849. // 监听窗口内的元素及属性变化
  1850. // Firefox和Chrome早期版本中带有前缀
  1851. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
  1852. // 选择目标节点
  1853. var target = layerfooter[0];
  1854. // 创建观察者对象
  1855. var observer = new MutationObserver(function (mutations) {
  1856. Backend.api.layerfooter(layero, index);
  1857. mutations.forEach(function (mutation) {
  1858. });
  1859. });
  1860. // 配置观察选项:
  1861. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  1862. // 传入目标节点和观察选项
  1863. observer.observe(target, config);
  1864. // 随后,你还可以停止观察
  1865. // observer.disconnect();
  1866. }
  1867. }
  1868. }, options ? options : {}));
  1869. return false;
  1870. },
  1871. layerfooter: function (layero, index) {
  1872. var frame = Backend.api.layer.getChildFrame('html', index);
  1873. var layerfooter = frame.find(".layer-footer");
  1874. if (layerfooter.size() > 0) {
  1875. $(".layui-layer-footer", layero).remove();
  1876. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  1877. footer.html(layerfooter.html());
  1878. if ($(".row", footer).size() === 0) {
  1879. $(">", footer).wrapAll("<div class='row'></div>");
  1880. }
  1881. footer.insertAfter(layero.find('.layui-layer-content'));
  1882. }
  1883. var heg = frame.outerHeight();
  1884. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  1885. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  1886. var oldheg = heg + titHeight + btnHeight;
  1887. var maxheg = 600;
  1888. if (frame.outerWidth() < 768) {
  1889. maxheg = $(window).height() - 28;
  1890. }
  1891. // 如果有.layer-footer或窗口小于600则重新排
  1892. if (layerfooter.size() > 0 || oldheg < maxheg) {
  1893. var footerHeight = layero.find('.layui-layer-footer').outerHeight() || 0;
  1894. footerHeight = 0;
  1895. if (oldheg >= maxheg) {
  1896. heg = Math.min(maxheg, oldheg) - titHeight - btnHeight - footerHeight;
  1897. }
  1898. layero.css({height: heg + titHeight + btnHeight + footerHeight});
  1899. layero.find("iframe").css({height: heg});
  1900. }
  1901. if (layerfooter.size() > 0) {
  1902. footer.on("click", ".btn", function () {
  1903. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  1904. //return;
  1905. }
  1906. $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click");
  1907. });
  1908. }
  1909. },
  1910. sidebar: function (params) {
  1911. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  1912. $colorNums = colorArr.length;
  1913. badgeList = {};
  1914. $.each(params, function (k, v) {
  1915. if (k.indexOf('/') > -1)
  1916. {
  1917. $url = Backend.api.fixurl(k);
  1918. } else
  1919. {
  1920. $url = k;
  1921. }
  1922. if ($.isArray(v))
  1923. {
  1924. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  1925. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  1926. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  1927. } else
  1928. {
  1929. $nums = v;
  1930. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  1931. $class = 'label';
  1932. }
  1933. //必须nums大于0才显示
  1934. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  1935. });
  1936. $.each(badgeList, function (k, v) {
  1937. var anchor = $(".treeview li a[addtabs][url='" + k + "']");
  1938. if (anchor) {
  1939. $(".pull-right-container", anchor).html(v);
  1940. $(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  1941. }
  1942. });
  1943. },
  1944. success: function (options, callback) {
  1945. var type = typeof options === 'function';
  1946. if (type) {
  1947. callback = options;
  1948. }
  1949. return Backend.api.layer.msg(__('Operation completed'), $.extend({
  1950. offset: 0, icon: 1
  1951. }, type ? {} : options), callback);
  1952. },
  1953. error: function (options, callback) {
  1954. var type = typeof options === 'function';
  1955. if (type) {
  1956. callback = options;
  1957. }
  1958. return Backend.api.layer.msg(__('Operation failed'), $.extend({
  1959. offset: 0, icon: 2
  1960. }, type ? {} : options), callback);
  1961. },
  1962. toastr: Toastr,
  1963. layer: Layer
  1964. },
  1965. lang: function () {
  1966. var args = arguments,
  1967. string = args[0],
  1968. i = 1;
  1969. string = string.toLowerCase();
  1970. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  1971. if (typeof Lang[string] != 'undefined') {
  1972. if (typeof Lang[string] == 'object')
  1973. return Lang[string];
  1974. string = Lang[string];
  1975. } else if (string.indexOf('.') !== -1) {
  1976. var arr = string.split('.');
  1977. var current = Lang[arr[0]];
  1978. for (var i = 1; i < arr.length; i++) {
  1979. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  1980. if (typeof current != 'object')
  1981. break;
  1982. }
  1983. if (typeof current == 'object')
  1984. return current;
  1985. string = current;
  1986. } else {
  1987. string = args[0];
  1988. }
  1989. return string.replace(/%((%)|s|d)/g, function (m) {
  1990. // m is the matched format, e.g. %s, %d
  1991. var val = null;
  1992. if (m[2]) {
  1993. val = m[2];
  1994. } else {
  1995. val = args[i];
  1996. // A switch statement so that the formatter can be extended. Default is %s
  1997. switch (m) {
  1998. case '%d':
  1999. val = parseFloat(val);
  2000. if (isNaN(val)) {
  2001. val = 0;
  2002. }
  2003. break;
  2004. }
  2005. i++;
  2006. }
  2007. return val;
  2008. });
  2009. },
  2010. init: function () {
  2011. //公共代码
  2012. //点击包含.btn-dialog的元素时弹出dialog
  2013. $(document).on('click', '.btn-dialog', function (e) {
  2014. Backend.api.open(Backend.api.fixurl($(this).attr('href')), $(this).attr('title'));
  2015. e.preventDefault();
  2016. });
  2017. //支持data-bind-url方式进行渲染select元素
  2018. }
  2019. };
  2020. //将Layer暴露到全局中去
  2021. window.Layer = Layer;
  2022. //将Toastr暴露到全局中去
  2023. window.Toastr = Toastr;
  2024. //将语言方法暴露到全局中去
  2025. window.__ = Backend.lang;
  2026. //将Backend渲染至全局,以便于在子框架中调用
  2027. window.Backend = Backend;
  2028. //Toastr定义
  2029. Toastr.options = Backend.config.toastr;
  2030. Backend.init();
  2031. return Backend;
  2032. });
  2033. //! moment.js
  2034. //! version : 2.15.2
  2035. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  2036. //! license : MIT
  2037. //! momentjs.com
  2038. ;(function (global, factory) {
  2039. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  2040. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  2041. global.moment = factory()
  2042. }(this, function () { 'use strict';
  2043. var hookCallback;
  2044. function utils_hooks__hooks () {
  2045. return hookCallback.apply(null, arguments);
  2046. }
  2047. // This is done to register the method called with moment()
  2048. // without creating circular dependencies.
  2049. function setHookCallback (callback) {
  2050. hookCallback = callback;
  2051. }
  2052. function isArray(input) {
  2053. return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
  2054. }
  2055. function isObject(input) {
  2056. // IE8 will treat undefined and null as object if it wasn't for
  2057. // input != null
  2058. return input != null && Object.prototype.toString.call(input) === '[object Object]';
  2059. }
  2060. function isObjectEmpty(obj) {
  2061. var k;
  2062. for (k in obj) {
  2063. // even if its not own property I'd still call it non-empty
  2064. return false;
  2065. }
  2066. return true;
  2067. }
  2068. function isDate(input) {
  2069. return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
  2070. }
  2071. function map(arr, fn) {
  2072. var res = [], i;
  2073. for (i = 0; i < arr.length; ++i) {
  2074. res.push(fn(arr[i], i));
  2075. }
  2076. return res;
  2077. }
  2078. function hasOwnProp(a, b) {
  2079. return Object.prototype.hasOwnProperty.call(a, b);
  2080. }
  2081. function extend(a, b) {
  2082. for (var i in b) {
  2083. if (hasOwnProp(b, i)) {
  2084. a[i] = b[i];
  2085. }
  2086. }
  2087. if (hasOwnProp(b, 'toString')) {
  2088. a.toString = b.toString;
  2089. }
  2090. if (hasOwnProp(b, 'valueOf')) {
  2091. a.valueOf = b.valueOf;
  2092. }
  2093. return a;
  2094. }
  2095. function create_utc__createUTC (input, format, locale, strict) {
  2096. return createLocalOrUTC(input, format, locale, strict, true).utc();
  2097. }
  2098. function defaultParsingFlags() {
  2099. // We need to deep clone this object.
  2100. return {
  2101. empty : false,
  2102. unusedTokens : [],
  2103. unusedInput : [],
  2104. overflow : -2,
  2105. charsLeftOver : 0,
  2106. nullInput : false,
  2107. invalidMonth : null,
  2108. invalidFormat : false,
  2109. userInvalidated : false,
  2110. iso : false,
  2111. parsedDateParts : [],
  2112. meridiem : null
  2113. };
  2114. }
  2115. function getParsingFlags(m) {
  2116. if (m._pf == null) {
  2117. m._pf = defaultParsingFlags();
  2118. }
  2119. return m._pf;
  2120. }
  2121. var some;
  2122. if (Array.prototype.some) {
  2123. some = Array.prototype.some;
  2124. } else {
  2125. some = function (fun) {
  2126. var t = Object(this);
  2127. var len = t.length >>> 0;
  2128. for (var i = 0; i < len; i++) {
  2129. if (i in t && fun.call(this, t[i], i, t)) {
  2130. return true;
  2131. }
  2132. }
  2133. return false;
  2134. };
  2135. }
  2136. function valid__isValid(m) {
  2137. if (m._isValid == null) {
  2138. var flags = getParsingFlags(m);
  2139. var parsedParts = some.call(flags.parsedDateParts, function (i) {
  2140. return i != null;
  2141. });
  2142. var isNowValid = !isNaN(m._d.getTime()) &&
  2143. flags.overflow < 0 &&
  2144. !flags.empty &&
  2145. !flags.invalidMonth &&
  2146. !flags.invalidWeekday &&
  2147. !flags.nullInput &&
  2148. !flags.invalidFormat &&
  2149. !flags.userInvalidated &&
  2150. (!flags.meridiem || (flags.meridiem && parsedParts));
  2151. if (m._strict) {
  2152. isNowValid = isNowValid &&
  2153. flags.charsLeftOver === 0 &&
  2154. flags.unusedTokens.length === 0 &&
  2155. flags.bigHour === undefined;
  2156. }
  2157. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  2158. m._isValid = isNowValid;
  2159. }
  2160. else {
  2161. return isNowValid;
  2162. }
  2163. }
  2164. return m._isValid;
  2165. }
  2166. function valid__createInvalid (flags) {
  2167. var m = create_utc__createUTC(NaN);
  2168. if (flags != null) {
  2169. extend(getParsingFlags(m), flags);
  2170. }
  2171. else {
  2172. getParsingFlags(m).userInvalidated = true;
  2173. }
  2174. return m;
  2175. }
  2176. function isUndefined(input) {
  2177. return input === void 0;
  2178. }
  2179. // Plugins that add properties should also add the key here (null value),
  2180. // so we can properly clone ourselves.
  2181. var momentProperties = utils_hooks__hooks.momentProperties = [];
  2182. function copyConfig(to, from) {
  2183. var i, prop, val;
  2184. if (!isUndefined(from._isAMomentObject)) {
  2185. to._isAMomentObject = from._isAMomentObject;
  2186. }
  2187. if (!isUndefined(from._i)) {
  2188. to._i = from._i;
  2189. }
  2190. if (!isUndefined(from._f)) {
  2191. to._f = from._f;
  2192. }
  2193. if (!isUndefined(from._l)) {
  2194. to._l = from._l;
  2195. }
  2196. if (!isUndefined(from._strict)) {
  2197. to._strict = from._strict;
  2198. }
  2199. if (!isUndefined(from._tzm)) {
  2200. to._tzm = from._tzm;
  2201. }
  2202. if (!isUndefined(from._isUTC)) {
  2203. to._isUTC = from._isUTC;
  2204. }
  2205. if (!isUndefined(from._offset)) {
  2206. to._offset = from._offset;
  2207. }
  2208. if (!isUndefined(from._pf)) {
  2209. to._pf = getParsingFlags(from);
  2210. }
  2211. if (!isUndefined(from._locale)) {
  2212. to._locale = from._locale;
  2213. }
  2214. if (momentProperties.length > 0) {
  2215. for (i in momentProperties) {
  2216. prop = momentProperties[i];
  2217. val = from[prop];
  2218. if (!isUndefined(val)) {
  2219. to[prop] = val;
  2220. }
  2221. }
  2222. }
  2223. return to;
  2224. }
  2225. var updateInProgress = false;
  2226. // Moment prototype object
  2227. function Moment(config) {
  2228. copyConfig(this, config);
  2229. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  2230. // Prevent infinite loop in case updateOffset creates new moment
  2231. // objects.
  2232. if (updateInProgress === false) {
  2233. updateInProgress = true;
  2234. utils_hooks__hooks.updateOffset(this);
  2235. updateInProgress = false;
  2236. }
  2237. }
  2238. function isMoment (obj) {
  2239. return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
  2240. }
  2241. function absFloor (number) {
  2242. if (number < 0) {
  2243. // -0 -> 0
  2244. return Math.ceil(number) || 0;
  2245. } else {
  2246. return Math.floor(number);
  2247. }
  2248. }
  2249. function toInt(argumentForCoercion) {
  2250. var coercedNumber = +argumentForCoercion,
  2251. value = 0;
  2252. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  2253. value = absFloor(coercedNumber);
  2254. }
  2255. return value;
  2256. }
  2257. // compare two arrays, return the number of differences
  2258. function compareArrays(array1, array2, dontConvert) {
  2259. var len = Math.min(array1.length, array2.length),
  2260. lengthDiff = Math.abs(array1.length - array2.length),
  2261. diffs = 0,
  2262. i;
  2263. for (i = 0; i < len; i++) {
  2264. if ((dontConvert && array1[i] !== array2[i]) ||
  2265. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
  2266. diffs++;
  2267. }
  2268. }
  2269. return diffs + lengthDiff;
  2270. }
  2271. function warn(msg) {
  2272. if (utils_hooks__hooks.suppressDeprecationWarnings === false &&
  2273. (typeof console !== 'undefined') && console.warn) {
  2274. console.warn('Deprecation warning: ' + msg);
  2275. }
  2276. }
  2277. function deprecate(msg, fn) {
  2278. var firstTime = true;
  2279. return extend(function () {
  2280. if (utils_hooks__hooks.deprecationHandler != null) {
  2281. utils_hooks__hooks.deprecationHandler(null, msg);
  2282. }
  2283. if (firstTime) {
  2284. var args = [];
  2285. var arg;
  2286. for (var i = 0; i < arguments.length; i++) {
  2287. arg = '';
  2288. if (typeof arguments[i] === 'object') {
  2289. arg += '\n[' + i + '] ';
  2290. for (var key in arguments[0]) {
  2291. arg += key + ': ' + arguments[0][key] + ', ';
  2292. }
  2293. arg = arg.slice(0, -2); // Remove trailing comma and space
  2294. } else {
  2295. arg = arguments[i];
  2296. }
  2297. args.push(arg);
  2298. }
  2299. warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
  2300. firstTime = false;
  2301. }
  2302. return fn.apply(this, arguments);
  2303. }, fn);
  2304. }
  2305. var deprecations = {};
  2306. function deprecateSimple(name, msg) {
  2307. if (utils_hooks__hooks.deprecationHandler != null) {
  2308. utils_hooks__hooks.deprecationHandler(name, msg);
  2309. }
  2310. if (!deprecations[name]) {
  2311. warn(msg);
  2312. deprecations[name] = true;
  2313. }
  2314. }
  2315. utils_hooks__hooks.suppressDeprecationWarnings = false;
  2316. utils_hooks__hooks.deprecationHandler = null;
  2317. function isFunction(input) {
  2318. return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
  2319. }
  2320. function locale_set__set (config) {
  2321. var prop, i;
  2322. for (i in config) {
  2323. prop = config[i];
  2324. if (isFunction(prop)) {
  2325. this[i] = prop;
  2326. } else {
  2327. this['_' + i] = prop;
  2328. }
  2329. }
  2330. this._config = config;
  2331. // Lenient ordinal parsing accepts just a number in addition to
  2332. // number + (possibly) stuff coming from _ordinalParseLenient.
  2333. this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
  2334. }
  2335. function mergeConfigs(parentConfig, childConfig) {
  2336. var res = extend({}, parentConfig), prop;
  2337. for (prop in childConfig) {
  2338. if (hasOwnProp(childConfig, prop)) {
  2339. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  2340. res[prop] = {};
  2341. extend(res[prop], parentConfig[prop]);
  2342. extend(res[prop], childConfig[prop]);
  2343. } else if (childConfig[prop] != null) {
  2344. res[prop] = childConfig[prop];
  2345. } else {
  2346. delete res[prop];
  2347. }
  2348. }
  2349. }
  2350. for (prop in parentConfig) {
  2351. if (hasOwnProp(parentConfig, prop) &&
  2352. !hasOwnProp(childConfig, prop) &&
  2353. isObject(parentConfig[prop])) {
  2354. // make sure changes to properties don't modify parent config
  2355. res[prop] = extend({}, res[prop]);
  2356. }
  2357. }
  2358. return res;
  2359. }
  2360. function Locale(config) {
  2361. if (config != null) {
  2362. this.set(config);
  2363. }
  2364. }
  2365. var keys;
  2366. if (Object.keys) {
  2367. keys = Object.keys;
  2368. } else {
  2369. keys = function (obj) {
  2370. var i, res = [];
  2371. for (i in obj) {
  2372. if (hasOwnProp(obj, i)) {
  2373. res.push(i);
  2374. }
  2375. }
  2376. return res;
  2377. };
  2378. }
  2379. var defaultCalendar = {
  2380. sameDay : '[Today at] LT',
  2381. nextDay : '[Tomorrow at] LT',
  2382. nextWeek : 'dddd [at] LT',
  2383. lastDay : '[Yesterday at] LT',
  2384. lastWeek : '[Last] dddd [at] LT',
  2385. sameElse : 'L'
  2386. };
  2387. function locale_calendar__calendar (key, mom, now) {
  2388. var output = this._calendar[key] || this._calendar['sameElse'];
  2389. return isFunction(output) ? output.call(mom, now) : output;
  2390. }
  2391. var defaultLongDateFormat = {
  2392. LTS : 'h:mm:ss A',
  2393. LT : 'h:mm A',
  2394. L : 'MM/DD/YYYY',
  2395. LL : 'MMMM D, YYYY',
  2396. LLL : 'MMMM D, YYYY h:mm A',
  2397. LLLL : 'dddd, MMMM D, YYYY h:mm A'
  2398. };
  2399. function longDateFormat (key) {
  2400. var format = this._longDateFormat[key],
  2401. formatUpper = this._longDateFormat[key.toUpperCase()];
  2402. if (format || !formatUpper) {
  2403. return format;
  2404. }
  2405. this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
  2406. return val.slice(1);
  2407. });
  2408. return this._longDateFormat[key];
  2409. }
  2410. var defaultInvalidDate = 'Invalid date';
  2411. function invalidDate () {
  2412. return this._invalidDate;
  2413. }
  2414. var defaultOrdinal = '%d';
  2415. var defaultOrdinalParse = /\d{1,2}/;
  2416. function ordinal (number) {
  2417. return this._ordinal.replace('%d', number);
  2418. }
  2419. var defaultRelativeTime = {
  2420. future : 'in %s',
  2421. past : '%s ago',
  2422. s : 'a few seconds',
  2423. m : 'a minute',
  2424. mm : '%d minutes',
  2425. h : 'an hour',
  2426. hh : '%d hours',
  2427. d : 'a day',
  2428. dd : '%d days',
  2429. M : 'a month',
  2430. MM : '%d months',
  2431. y : 'a year',
  2432. yy : '%d years'
  2433. };
  2434. function relative__relativeTime (number, withoutSuffix, string, isFuture) {
  2435. var output = this._relativeTime[string];
  2436. return (isFunction(output)) ?
  2437. output(number, withoutSuffix, string, isFuture) :
  2438. output.replace(/%d/i, number);
  2439. }
  2440. function pastFuture (diff, output) {
  2441. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  2442. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  2443. }
  2444. var aliases = {};
  2445. function addUnitAlias (unit, shorthand) {
  2446. var lowerCase = unit.toLowerCase();
  2447. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  2448. }
  2449. function normalizeUnits(units) {
  2450. return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
  2451. }
  2452. function normalizeObjectUnits(inputObject) {
  2453. var normalizedInput = {},
  2454. normalizedProp,
  2455. prop;
  2456. for (prop in inputObject) {
  2457. if (hasOwnProp(inputObject, prop)) {
  2458. normalizedProp = normalizeUnits(prop);
  2459. if (normalizedProp) {
  2460. normalizedInput[normalizedProp] = inputObject[prop];
  2461. }
  2462. }
  2463. }
  2464. return normalizedInput;
  2465. }
  2466. var priorities = {};
  2467. function addUnitPriority(unit, priority) {
  2468. priorities[unit] = priority;
  2469. }
  2470. function getPrioritizedUnits(unitsObj) {
  2471. var units = [];
  2472. for (var u in unitsObj) {
  2473. units.push({unit: u, priority: priorities[u]});
  2474. }
  2475. units.sort(function (a, b) {
  2476. return a.priority - b.priority;
  2477. });
  2478. return units;
  2479. }
  2480. function makeGetSet (unit, keepTime) {
  2481. return function (value) {
  2482. if (value != null) {
  2483. get_set__set(this, unit, value);
  2484. utils_hooks__hooks.updateOffset(this, keepTime);
  2485. return this;
  2486. } else {
  2487. return get_set__get(this, unit);
  2488. }
  2489. };
  2490. }
  2491. function get_set__get (mom, unit) {
  2492. return mom.isValid() ?
  2493. mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
  2494. }
  2495. function get_set__set (mom, unit, value) {
  2496. if (mom.isValid()) {
  2497. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  2498. }
  2499. }
  2500. // MOMENTS
  2501. function stringGet (units) {
  2502. units = normalizeUnits(units);
  2503. if (isFunction(this[units])) {
  2504. return this[units]();
  2505. }
  2506. return this;
  2507. }
  2508. function stringSet (units, value) {
  2509. if (typeof units === 'object') {
  2510. units = normalizeObjectUnits(units);
  2511. var prioritized = getPrioritizedUnits(units);
  2512. for (var i = 0; i < prioritized.length; i++) {
  2513. this[prioritized[i].unit](units[prioritized[i].unit]);
  2514. }
  2515. } else {
  2516. units = normalizeUnits(units);
  2517. if (isFunction(this[units])) {
  2518. return this[units](value);
  2519. }
  2520. }
  2521. return this;
  2522. }
  2523. function zeroFill(number, targetLength, forceSign) {
  2524. var absNumber = '' + Math.abs(number),
  2525. zerosToFill = targetLength - absNumber.length,
  2526. sign = number >= 0;
  2527. return (sign ? (forceSign ? '+' : '') : '-') +
  2528. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  2529. }
  2530. 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;
  2531. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  2532. var formatFunctions = {};
  2533. var formatTokenFunctions = {};
  2534. // token: 'M'
  2535. // padded: ['MM', 2]
  2536. // ordinal: 'Mo'
  2537. // callback: function () { this.month() + 1 }
  2538. function addFormatToken (token, padded, ordinal, callback) {
  2539. var func = callback;
  2540. if (typeof callback === 'string') {
  2541. func = function () {
  2542. return this[callback]();
  2543. };
  2544. }
  2545. if (token) {
  2546. formatTokenFunctions[token] = func;
  2547. }
  2548. if (padded) {
  2549. formatTokenFunctions[padded[0]] = function () {
  2550. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  2551. };
  2552. }
  2553. if (ordinal) {
  2554. formatTokenFunctions[ordinal] = function () {
  2555. return this.localeData().ordinal(func.apply(this, arguments), token);
  2556. };
  2557. }
  2558. }
  2559. function removeFormattingTokens(input) {
  2560. if (input.match(/\[[\s\S]/)) {
  2561. return input.replace(/^\[|\]$/g, '');
  2562. }
  2563. return input.replace(/\\/g, '');
  2564. }
  2565. function makeFormatFunction(format) {
  2566. var array = format.match(formattingTokens), i, length;
  2567. for (i = 0, length = array.length; i < length; i++) {
  2568. if (formatTokenFunctions[array[i]]) {
  2569. array[i] = formatTokenFunctions[array[i]];
  2570. } else {
  2571. array[i] = removeFormattingTokens(array[i]);
  2572. }
  2573. }
  2574. return function (mom) {
  2575. var output = '', i;
  2576. for (i = 0; i < length; i++) {
  2577. output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
  2578. }
  2579. return output;
  2580. };
  2581. }
  2582. // format date using native date object
  2583. function formatMoment(m, format) {
  2584. if (!m.isValid()) {
  2585. return m.localeData().invalidDate();
  2586. }
  2587. format = expandFormat(format, m.localeData());
  2588. formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
  2589. return formatFunctions[format](m);
  2590. }
  2591. function expandFormat(format, locale) {
  2592. var i = 5;
  2593. function replaceLongDateFormatTokens(input) {
  2594. return locale.longDateFormat(input) || input;
  2595. }
  2596. localFormattingTokens.lastIndex = 0;
  2597. while (i >= 0 && localFormattingTokens.test(format)) {
  2598. format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
  2599. localFormattingTokens.lastIndex = 0;
  2600. i -= 1;
  2601. }
  2602. return format;
  2603. }
  2604. var match1 = /\d/; // 0 - 9
  2605. var match2 = /\d\d/; // 00 - 99
  2606. var match3 = /\d{3}/; // 000 - 999
  2607. var match4 = /\d{4}/; // 0000 - 9999
  2608. var match6 = /[+-]?\d{6}/; // -999999 - 999999
  2609. var match1to2 = /\d\d?/; // 0 - 99
  2610. var match3to4 = /\d\d\d\d?/; // 999 - 9999
  2611. var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
  2612. var match1to3 = /\d{1,3}/; // 0 - 999
  2613. var match1to4 = /\d{1,4}/; // 0 - 9999
  2614. var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
  2615. var matchUnsigned = /\d+/; // 0 - inf
  2616. var matchSigned = /[+-]?\d+/; // -inf - inf
  2617. var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
  2618. var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  2619. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  2620. // any word (or two) characters or numbers including two/three word month in arabic.
  2621. // includes scottish gaelic two word and hyphenated months
  2622. var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
  2623. var regexes = {};
  2624. function addRegexToken (token, regex, strictRegex) {
  2625. regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
  2626. return (isStrict && strictRegex) ? strictRegex : regex;
  2627. };
  2628. }
  2629. function getParseRegexForToken (token, config) {
  2630. if (!hasOwnProp(regexes, token)) {
  2631. return new RegExp(unescapeFormat(token));
  2632. }
  2633. return regexes[token](config._strict, config._locale);
  2634. }
  2635. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  2636. function unescapeFormat(s) {
  2637. return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
  2638. return p1 || p2 || p3 || p4;
  2639. }));
  2640. }
  2641. function regexEscape(s) {
  2642. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  2643. }
  2644. var tokens = {};
  2645. function addParseToken (token, callback) {
  2646. var i, func = callback;
  2647. if (typeof token === 'string') {
  2648. token = [token];
  2649. }
  2650. if (typeof callback === 'number') {
  2651. func = function (input, array) {
  2652. array[callback] = toInt(input);
  2653. };
  2654. }
  2655. for (i = 0; i < token.length; i++) {
  2656. tokens[token[i]] = func;
  2657. }
  2658. }
  2659. function addWeekParseToken (token, callback) {
  2660. addParseToken(token, function (input, array, config, token) {
  2661. config._w = config._w || {};
  2662. callback(input, config._w, config, token);
  2663. });
  2664. }
  2665. function addTimeToArrayFromToken(token, input, config) {
  2666. if (input != null && hasOwnProp(tokens, token)) {
  2667. tokens[token](input, config._a, config, token);
  2668. }
  2669. }
  2670. var YEAR = 0;
  2671. var MONTH = 1;
  2672. var DATE = 2;
  2673. var HOUR = 3;
  2674. var MINUTE = 4;
  2675. var SECOND = 5;
  2676. var MILLISECOND = 6;
  2677. var WEEK = 7;
  2678. var WEEKDAY = 8;
  2679. var indexOf;
  2680. if (Array.prototype.indexOf) {
  2681. indexOf = Array.prototype.indexOf;
  2682. } else {
  2683. indexOf = function (o) {
  2684. // I know
  2685. var i;
  2686. for (i = 0; i < this.length; ++i) {
  2687. if (this[i] === o) {
  2688. return i;
  2689. }
  2690. }
  2691. return -1;
  2692. };
  2693. }
  2694. function daysInMonth(year, month) {
  2695. return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
  2696. }
  2697. // FORMATTING
  2698. addFormatToken('M', ['MM', 2], 'Mo', function () {
  2699. return this.month() + 1;
  2700. });
  2701. addFormatToken('MMM', 0, 0, function (format) {
  2702. return this.localeData().monthsShort(this, format);
  2703. });
  2704. addFormatToken('MMMM', 0, 0, function (format) {
  2705. return this.localeData().months(this, format);
  2706. });
  2707. // ALIASES
  2708. addUnitAlias('month', 'M');
  2709. // PRIORITY
  2710. addUnitPriority('month', 8);
  2711. // PARSING
  2712. addRegexToken('M', match1to2);
  2713. addRegexToken('MM', match1to2, match2);
  2714. addRegexToken('MMM', function (isStrict, locale) {
  2715. return locale.monthsShortRegex(isStrict);
  2716. });
  2717. addRegexToken('MMMM', function (isStrict, locale) {
  2718. return locale.monthsRegex(isStrict);
  2719. });
  2720. addParseToken(['M', 'MM'], function (input, array) {
  2721. array[MONTH] = toInt(input) - 1;
  2722. });
  2723. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  2724. var month = config._locale.monthsParse(input, token, config._strict);
  2725. // if we didn't find a month name, mark the date as invalid.
  2726. if (month != null) {
  2727. array[MONTH] = month;
  2728. } else {
  2729. getParsingFlags(config).invalidMonth = input;
  2730. }
  2731. });
  2732. // LOCALES
  2733. var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
  2734. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
  2735. function localeMonths (m, format) {
  2736. if (!m) {
  2737. return this._months;
  2738. }
  2739. return isArray(this._months) ? this._months[m.month()] :
  2740. this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
  2741. }
  2742. var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
  2743. function localeMonthsShort (m, format) {
  2744. if (!m) {
  2745. return this._monthsShort;
  2746. }
  2747. return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
  2748. this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
  2749. }
  2750. function units_month__handleStrictParse(monthName, format, strict) {
  2751. var i, ii, mom, llc = monthName.toLocaleLowerCase();
  2752. if (!this._monthsParse) {
  2753. // this is not used
  2754. this._monthsParse = [];
  2755. this._longMonthsParse = [];
  2756. this._shortMonthsParse = [];
  2757. for (i = 0; i < 12; ++i) {
  2758. mom = create_utc__createUTC([2000, i]);
  2759. this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
  2760. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  2761. }
  2762. }
  2763. if (strict) {
  2764. if (format === 'MMM') {
  2765. ii = indexOf.call(this._shortMonthsParse, llc);
  2766. return ii !== -1 ? ii : null;
  2767. } else {
  2768. ii = indexOf.call(this._longMonthsParse, llc);
  2769. return ii !== -1 ? ii : null;
  2770. }
  2771. } else {
  2772. if (format === 'MMM') {
  2773. ii = indexOf.call(this._shortMonthsParse, llc);
  2774. if (ii !== -1) {
  2775. return ii;
  2776. }
  2777. ii = indexOf.call(this._longMonthsParse, llc);
  2778. return ii !== -1 ? ii : null;
  2779. } else {
  2780. ii = indexOf.call(this._longMonthsParse, llc);
  2781. if (ii !== -1) {
  2782. return ii;
  2783. }
  2784. ii = indexOf.call(this._shortMonthsParse, llc);
  2785. return ii !== -1 ? ii : null;
  2786. }
  2787. }
  2788. }
  2789. function localeMonthsParse (monthName, format, strict) {
  2790. var i, mom, regex;
  2791. if (this._monthsParseExact) {
  2792. return units_month__handleStrictParse.call(this, monthName, format, strict);
  2793. }
  2794. if (!this._monthsParse) {
  2795. this._monthsParse = [];
  2796. this._longMonthsParse = [];
  2797. this._shortMonthsParse = [];
  2798. }
  2799. // TODO: add sorting
  2800. // Sorting makes sure if one month (or abbr) is a prefix of another
  2801. // see sorting in computeMonthsParse
  2802. for (i = 0; i < 12; i++) {
  2803. // make the regex if we don't have it already
  2804. mom = create_utc__createUTC([2000, i]);
  2805. if (strict && !this._longMonthsParse[i]) {
  2806. this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
  2807. this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
  2808. }
  2809. if (!strict && !this._monthsParse[i]) {
  2810. regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  2811. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2812. }
  2813. // test the regex
  2814. if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
  2815. return i;
  2816. } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
  2817. return i;
  2818. } else if (!strict && this._monthsParse[i].test(monthName)) {
  2819. return i;
  2820. }
  2821. }
  2822. }
  2823. // MOMENTS
  2824. function setMonth (mom, value) {
  2825. var dayOfMonth;
  2826. if (!mom.isValid()) {
  2827. // No op
  2828. return mom;
  2829. }
  2830. if (typeof value === 'string') {
  2831. if (/^\d+$/.test(value)) {
  2832. value = toInt(value);
  2833. } else {
  2834. value = mom.localeData().monthsParse(value);
  2835. // TODO: Another silent failure?
  2836. if (typeof value !== 'number') {
  2837. return mom;
  2838. }
  2839. }
  2840. }
  2841. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  2842. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  2843. return mom;
  2844. }
  2845. function getSetMonth (value) {
  2846. if (value != null) {
  2847. setMonth(this, value);
  2848. utils_hooks__hooks.updateOffset(this, true);
  2849. return this;
  2850. } else {
  2851. return get_set__get(this, 'Month');
  2852. }
  2853. }
  2854. function getDaysInMonth () {
  2855. return daysInMonth(this.year(), this.month());
  2856. }
  2857. var defaultMonthsShortRegex = matchWord;
  2858. function monthsShortRegex (isStrict) {
  2859. if (this._monthsParseExact) {
  2860. if (!hasOwnProp(this, '_monthsRegex')) {
  2861. computeMonthsParse.call(this);
  2862. }
  2863. if (isStrict) {
  2864. return this._monthsShortStrictRegex;
  2865. } else {
  2866. return this._monthsShortRegex;
  2867. }
  2868. } else {
  2869. if (!hasOwnProp(this, '_monthsShortRegex')) {
  2870. this._monthsShortRegex = defaultMonthsShortRegex;
  2871. }
  2872. return this._monthsShortStrictRegex && isStrict ?
  2873. this._monthsShortStrictRegex : this._monthsShortRegex;
  2874. }
  2875. }
  2876. var defaultMonthsRegex = matchWord;
  2877. function monthsRegex (isStrict) {
  2878. if (this._monthsParseExact) {
  2879. if (!hasOwnProp(this, '_monthsRegex')) {
  2880. computeMonthsParse.call(this);
  2881. }
  2882. if (isStrict) {
  2883. return this._monthsStrictRegex;
  2884. } else {
  2885. return this._monthsRegex;
  2886. }
  2887. } else {
  2888. if (!hasOwnProp(this, '_monthsRegex')) {
  2889. this._monthsRegex = defaultMonthsRegex;
  2890. }
  2891. return this._monthsStrictRegex && isStrict ?
  2892. this._monthsStrictRegex : this._monthsRegex;
  2893. }
  2894. }
  2895. function computeMonthsParse () {
  2896. function cmpLenRev(a, b) {
  2897. return b.length - a.length;
  2898. }
  2899. var shortPieces = [], longPieces = [], mixedPieces = [],
  2900. i, mom;
  2901. for (i = 0; i < 12; i++) {
  2902. // make the regex if we don't have it already
  2903. mom = create_utc__createUTC([2000, i]);
  2904. shortPieces.push(this.monthsShort(mom, ''));
  2905. longPieces.push(this.months(mom, ''));
  2906. mixedPieces.push(this.months(mom, ''));
  2907. mixedPieces.push(this.monthsShort(mom, ''));
  2908. }
  2909. // Sorting makes sure if one month (or abbr) is a prefix of another it
  2910. // will match the longer piece.
  2911. shortPieces.sort(cmpLenRev);
  2912. longPieces.sort(cmpLenRev);
  2913. mixedPieces.sort(cmpLenRev);
  2914. for (i = 0; i < 12; i++) {
  2915. shortPieces[i] = regexEscape(shortPieces[i]);
  2916. longPieces[i] = regexEscape(longPieces[i]);
  2917. }
  2918. for (i = 0; i < 24; i++) {
  2919. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2920. }
  2921. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2922. this._monthsShortRegex = this._monthsRegex;
  2923. this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  2924. this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  2925. }
  2926. // FORMATTING
  2927. addFormatToken('Y', 0, 0, function () {
  2928. var y = this.year();
  2929. return y <= 9999 ? '' + y : '+' + y;
  2930. });
  2931. addFormatToken(0, ['YY', 2], 0, function () {
  2932. return this.year() % 100;
  2933. });
  2934. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2935. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2936. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2937. // ALIASES
  2938. addUnitAlias('year', 'y');
  2939. // PRIORITIES
  2940. addUnitPriority('year', 1);
  2941. // PARSING
  2942. addRegexToken('Y', matchSigned);
  2943. addRegexToken('YY', match1to2, match2);
  2944. addRegexToken('YYYY', match1to4, match4);
  2945. addRegexToken('YYYYY', match1to6, match6);
  2946. addRegexToken('YYYYYY', match1to6, match6);
  2947. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2948. addParseToken('YYYY', function (input, array) {
  2949. array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
  2950. });
  2951. addParseToken('YY', function (input, array) {
  2952. array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
  2953. });
  2954. addParseToken('Y', function (input, array) {
  2955. array[YEAR] = parseInt(input, 10);
  2956. });
  2957. // HELPERS
  2958. function daysInYear(year) {
  2959. return isLeapYear(year) ? 366 : 365;
  2960. }
  2961. function isLeapYear(year) {
  2962. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  2963. }
  2964. // HOOKS
  2965. utils_hooks__hooks.parseTwoDigitYear = function (input) {
  2966. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2967. };
  2968. // MOMENTS
  2969. var getSetYear = makeGetSet('FullYear', true);
  2970. function getIsLeapYear () {
  2971. return isLeapYear(this.year());
  2972. }
  2973. function createDate (y, m, d, h, M, s, ms) {
  2974. //can't just apply() to create a date:
  2975. //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
  2976. var date = new Date(y, m, d, h, M, s, ms);
  2977. //the date constructor remaps years 0-99 to 1900-1999
  2978. if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
  2979. date.setFullYear(y);
  2980. }
  2981. return date;
  2982. }
  2983. function createUTCDate (y) {
  2984. var date = new Date(Date.UTC.apply(null, arguments));
  2985. //the Date.UTC function remaps years 0-99 to 1900-1999
  2986. if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
  2987. date.setUTCFullYear(y);
  2988. }
  2989. return date;
  2990. }
  2991. // start-of-first-week - start-of-year
  2992. function firstWeekOffset(year, dow, doy) {
  2993. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2994. fwd = 7 + dow - doy,
  2995. // first-week day local weekday -- which local weekday is fwd
  2996. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  2997. return -fwdlw + fwd - 1;
  2998. }
  2999. //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  3000. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  3001. var localWeekday = (7 + weekday - dow) % 7,
  3002. weekOffset = firstWeekOffset(year, dow, doy),
  3003. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  3004. resYear, resDayOfYear;
  3005. if (dayOfYear <= 0) {
  3006. resYear = year - 1;
  3007. resDayOfYear = daysInYear(resYear) + dayOfYear;
  3008. } else if (dayOfYear > daysInYear(year)) {
  3009. resYear = year + 1;
  3010. resDayOfYear = dayOfYear - daysInYear(year);
  3011. } else {
  3012. resYear = year;
  3013. resDayOfYear = dayOfYear;
  3014. }
  3015. return {
  3016. year: resYear,
  3017. dayOfYear: resDayOfYear
  3018. };
  3019. }
  3020. function weekOfYear(mom, dow, doy) {
  3021. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  3022. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  3023. resWeek, resYear;
  3024. if (week < 1) {
  3025. resYear = mom.year() - 1;
  3026. resWeek = week + weeksInYear(resYear, dow, doy);
  3027. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  3028. resWeek = week - weeksInYear(mom.year(), dow, doy);
  3029. resYear = mom.year() + 1;
  3030. } else {
  3031. resYear = mom.year();
  3032. resWeek = week;
  3033. }
  3034. return {
  3035. week: resWeek,
  3036. year: resYear
  3037. };
  3038. }
  3039. function weeksInYear(year, dow, doy) {
  3040. var weekOffset = firstWeekOffset(year, dow, doy),
  3041. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  3042. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  3043. }
  3044. // FORMATTING
  3045. addFormatToken('w', ['ww', 2], 'wo', 'week');
  3046. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  3047. // ALIASES
  3048. addUnitAlias('week', 'w');
  3049. addUnitAlias('isoWeek', 'W');
  3050. // PRIORITIES
  3051. addUnitPriority('week', 5);
  3052. addUnitPriority('isoWeek', 5);
  3053. // PARSING
  3054. addRegexToken('w', match1to2);
  3055. addRegexToken('ww', match1to2, match2);
  3056. addRegexToken('W', match1to2);
  3057. addRegexToken('WW', match1to2, match2);
  3058. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
  3059. week[token.substr(0, 1)] = toInt(input);
  3060. });
  3061. // HELPERS
  3062. // LOCALES
  3063. function localeWeek (mom) {
  3064. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  3065. }
  3066. var defaultLocaleWeek = {
  3067. dow : 0, // Sunday is the first day of the week.
  3068. doy : 6 // The week that contains Jan 1st is the first week of the year.
  3069. };
  3070. function localeFirstDayOfWeek () {
  3071. return this._week.dow;
  3072. }
  3073. function localeFirstDayOfYear () {
  3074. return this._week.doy;
  3075. }
  3076. // MOMENTS
  3077. function getSetWeek (input) {
  3078. var week = this.localeData().week(this);
  3079. return input == null ? week : this.add((input - week) * 7, 'd');
  3080. }
  3081. function getSetISOWeek (input) {
  3082. var week = weekOfYear(this, 1, 4).week;
  3083. return input == null ? week : this.add((input - week) * 7, 'd');
  3084. }
  3085. // FORMATTING
  3086. addFormatToken('d', 0, 'do', 'day');
  3087. addFormatToken('dd', 0, 0, function (format) {
  3088. return this.localeData().weekdaysMin(this, format);
  3089. });
  3090. addFormatToken('ddd', 0, 0, function (format) {
  3091. return this.localeData().weekdaysShort(this, format);
  3092. });
  3093. addFormatToken('dddd', 0, 0, function (format) {
  3094. return this.localeData().weekdays(this, format);
  3095. });
  3096. addFormatToken('e', 0, 0, 'weekday');
  3097. addFormatToken('E', 0, 0, 'isoWeekday');
  3098. // ALIASES
  3099. addUnitAlias('day', 'd');
  3100. addUnitAlias('weekday', 'e');
  3101. addUnitAlias('isoWeekday', 'E');
  3102. // PRIORITY
  3103. addUnitPriority('day', 11);
  3104. addUnitPriority('weekday', 11);
  3105. addUnitPriority('isoWeekday', 11);
  3106. // PARSING
  3107. addRegexToken('d', match1to2);
  3108. addRegexToken('e', match1to2);
  3109. addRegexToken('E', match1to2);
  3110. addRegexToken('dd', function (isStrict, locale) {
  3111. return locale.weekdaysMinRegex(isStrict);
  3112. });
  3113. addRegexToken('ddd', function (isStrict, locale) {
  3114. return locale.weekdaysShortRegex(isStrict);
  3115. });
  3116. addRegexToken('dddd', function (isStrict, locale) {
  3117. return locale.weekdaysRegex(isStrict);
  3118. });
  3119. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  3120. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  3121. // if we didn't get a weekday name, mark the date as invalid
  3122. if (weekday != null) {
  3123. week.d = weekday;
  3124. } else {
  3125. getParsingFlags(config).invalidWeekday = input;
  3126. }
  3127. });
  3128. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  3129. week[token] = toInt(input);
  3130. });
  3131. // HELPERS
  3132. function parseWeekday(input, locale) {
  3133. if (typeof input !== 'string') {
  3134. return input;
  3135. }
  3136. if (!isNaN(input)) {
  3137. return parseInt(input, 10);
  3138. }
  3139. input = locale.weekdaysParse(input);
  3140. if (typeof input === 'number') {
  3141. return input;
  3142. }
  3143. return null;
  3144. }
  3145. function parseIsoWeekday(input, locale) {
  3146. if (typeof input === 'string') {
  3147. return locale.weekdaysParse(input) % 7 || 7;
  3148. }
  3149. return isNaN(input) ? null : input;
  3150. }
  3151. // LOCALES
  3152. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
  3153. function localeWeekdays (m, format) {
  3154. if (!m) {
  3155. return this._weekdays;
  3156. }
  3157. return isArray(this._weekdays) ? this._weekdays[m.day()] :
  3158. this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
  3159. }
  3160. var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
  3161. function localeWeekdaysShort (m) {
  3162. return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
  3163. }
  3164. var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
  3165. function localeWeekdaysMin (m) {
  3166. return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
  3167. }
  3168. function day_of_week__handleStrictParse(weekdayName, format, strict) {
  3169. var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
  3170. if (!this._weekdaysParse) {
  3171. this._weekdaysParse = [];
  3172. this._shortWeekdaysParse = [];
  3173. this._minWeekdaysParse = [];
  3174. for (i = 0; i < 7; ++i) {
  3175. mom = create_utc__createUTC([2000, 1]).day(i);
  3176. this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
  3177. this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
  3178. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  3179. }
  3180. }
  3181. if (strict) {
  3182. if (format === 'dddd') {
  3183. ii = indexOf.call(this._weekdaysParse, llc);
  3184. return ii !== -1 ? ii : null;
  3185. } else if (format === 'ddd') {
  3186. ii = indexOf.call(this._shortWeekdaysParse, llc);
  3187. return ii !== -1 ? ii : null;
  3188. } else {
  3189. ii = indexOf.call(this._minWeekdaysParse, llc);
  3190. return ii !== -1 ? ii : null;
  3191. }
  3192. } else {
  3193. if (format === 'dddd') {
  3194. ii = indexOf.call(this._weekdaysParse, llc);
  3195. if (ii !== -1) {
  3196. return ii;
  3197. }
  3198. ii = indexOf.call(this._shortWeekdaysParse, llc);
  3199. if (ii !== -1) {
  3200. return ii;
  3201. }
  3202. ii = indexOf.call(this._minWeekdaysParse, llc);
  3203. return ii !== -1 ? ii : null;
  3204. } else if (format === 'ddd') {
  3205. ii = indexOf.call(this._shortWeekdaysParse, llc);
  3206. if (ii !== -1) {
  3207. return ii;
  3208. }
  3209. ii = indexOf.call(this._weekdaysParse, llc);
  3210. if (ii !== -1) {
  3211. return ii;
  3212. }
  3213. ii = indexOf.call(this._minWeekdaysParse, llc);
  3214. return ii !== -1 ? ii : null;
  3215. } else {
  3216. ii = indexOf.call(this._minWeekdaysParse, llc);
  3217. if (ii !== -1) {
  3218. return ii;
  3219. }
  3220. ii = indexOf.call(this._weekdaysParse, llc);
  3221. if (ii !== -1) {
  3222. return ii;
  3223. }
  3224. ii = indexOf.call(this._shortWeekdaysParse, llc);
  3225. return ii !== -1 ? ii : null;
  3226. }
  3227. }
  3228. }
  3229. function localeWeekdaysParse (weekdayName, format, strict) {
  3230. var i, mom, regex;
  3231. if (this._weekdaysParseExact) {
  3232. return day_of_week__handleStrictParse.call(this, weekdayName, format, strict);
  3233. }
  3234. if (!this._weekdaysParse) {
  3235. this._weekdaysParse = [];
  3236. this._minWeekdaysParse = [];
  3237. this._shortWeekdaysParse = [];
  3238. this._fullWeekdaysParse = [];
  3239. }
  3240. for (i = 0; i < 7; i++) {
  3241. // make the regex if we don't have it already
  3242. mom = create_utc__createUTC([2000, 1]).day(i);
  3243. if (strict && !this._fullWeekdaysParse[i]) {
  3244. this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
  3245. this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
  3246. this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
  3247. }
  3248. if (!this._weekdaysParse[i]) {
  3249. regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
  3250. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  3251. }
  3252. // test the regex
  3253. if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
  3254. return i;
  3255. } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
  3256. return i;
  3257. } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
  3258. return i;
  3259. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  3260. return i;
  3261. }
  3262. }
  3263. }
  3264. // MOMENTS
  3265. function getSetDayOfWeek (input) {
  3266. if (!this.isValid()) {
  3267. return input != null ? this : NaN;
  3268. }
  3269. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  3270. if (input != null) {
  3271. input = parseWeekday(input, this.localeData());
  3272. return this.add(input - day, 'd');
  3273. } else {
  3274. return day;
  3275. }
  3276. }
  3277. function getSetLocaleDayOfWeek (input) {
  3278. if (!this.isValid()) {
  3279. return input != null ? this : NaN;
  3280. }
  3281. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  3282. return input == null ? weekday : this.add(input - weekday, 'd');
  3283. }
  3284. function getSetISODayOfWeek (input) {
  3285. if (!this.isValid()) {
  3286. return input != null ? this : NaN;
  3287. }
  3288. // behaves the same as moment#day except
  3289. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  3290. // as a setter, sunday should belong to the previous week.
  3291. if (input != null) {
  3292. var weekday = parseIsoWeekday(input, this.localeData());
  3293. return this.day(this.day() % 7 ? weekday : weekday - 7);
  3294. } else {
  3295. return this.day() || 7;
  3296. }
  3297. }
  3298. var defaultWeekdaysRegex = matchWord;
  3299. function weekdaysRegex (isStrict) {
  3300. if (this._weekdaysParseExact) {
  3301. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3302. computeWeekdaysParse.call(this);
  3303. }
  3304. if (isStrict) {
  3305. return this._weekdaysStrictRegex;
  3306. } else {
  3307. return this._weekdaysRegex;
  3308. }
  3309. } else {
  3310. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3311. this._weekdaysRegex = defaultWeekdaysRegex;
  3312. }
  3313. return this._weekdaysStrictRegex && isStrict ?
  3314. this._weekdaysStrictRegex : this._weekdaysRegex;
  3315. }
  3316. }
  3317. var defaultWeekdaysShortRegex = matchWord;
  3318. function weekdaysShortRegex (isStrict) {
  3319. if (this._weekdaysParseExact) {
  3320. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3321. computeWeekdaysParse.call(this);
  3322. }
  3323. if (isStrict) {
  3324. return this._weekdaysShortStrictRegex;
  3325. } else {
  3326. return this._weekdaysShortRegex;
  3327. }
  3328. } else {
  3329. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  3330. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  3331. }
  3332. return this._weekdaysShortStrictRegex && isStrict ?
  3333. this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  3334. }
  3335. }
  3336. var defaultWeekdaysMinRegex = matchWord;
  3337. function weekdaysMinRegex (isStrict) {
  3338. if (this._weekdaysParseExact) {
  3339. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3340. computeWeekdaysParse.call(this);
  3341. }
  3342. if (isStrict) {
  3343. return this._weekdaysMinStrictRegex;
  3344. } else {
  3345. return this._weekdaysMinRegex;
  3346. }
  3347. } else {
  3348. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  3349. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  3350. }
  3351. return this._weekdaysMinStrictRegex && isStrict ?
  3352. this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  3353. }
  3354. }
  3355. function computeWeekdaysParse () {
  3356. function cmpLenRev(a, b) {
  3357. return b.length - a.length;
  3358. }
  3359. var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
  3360. i, mom, minp, shortp, longp;
  3361. for (i = 0; i < 7; i++) {
  3362. // make the regex if we don't have it already
  3363. mom = create_utc__createUTC([2000, 1]).day(i);
  3364. minp = this.weekdaysMin(mom, '');
  3365. shortp = this.weekdaysShort(mom, '');
  3366. longp = this.weekdays(mom, '');
  3367. minPieces.push(minp);
  3368. shortPieces.push(shortp);
  3369. longPieces.push(longp);
  3370. mixedPieces.push(minp);
  3371. mixedPieces.push(shortp);
  3372. mixedPieces.push(longp);
  3373. }
  3374. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  3375. // will match the longer piece.
  3376. minPieces.sort(cmpLenRev);
  3377. shortPieces.sort(cmpLenRev);
  3378. longPieces.sort(cmpLenRev);
  3379. mixedPieces.sort(cmpLenRev);
  3380. for (i = 0; i < 7; i++) {
  3381. shortPieces[i] = regexEscape(shortPieces[i]);
  3382. longPieces[i] = regexEscape(longPieces[i]);
  3383. mixedPieces[i] = regexEscape(mixedPieces[i]);
  3384. }
  3385. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  3386. this._weekdaysShortRegex = this._weekdaysRegex;
  3387. this._weekdaysMinRegex = this._weekdaysRegex;
  3388. this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  3389. this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  3390. this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
  3391. }
  3392. // FORMATTING
  3393. function hFormat() {
  3394. return this.hours() % 12 || 12;
  3395. }
  3396. function kFormat() {
  3397. return this.hours() || 24;
  3398. }
  3399. addFormatToken('H', ['HH', 2], 0, 'hour');
  3400. addFormatToken('h', ['hh', 2], 0, hFormat);
  3401. addFormatToken('k', ['kk', 2], 0, kFormat);
  3402. addFormatToken('hmm', 0, 0, function () {
  3403. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  3404. });
  3405. addFormatToken('hmmss', 0, 0, function () {
  3406. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
  3407. zeroFill(this.seconds(), 2);
  3408. });
  3409. addFormatToken('Hmm', 0, 0, function () {
  3410. return '' + this.hours() + zeroFill(this.minutes(), 2);
  3411. });
  3412. addFormatToken('Hmmss', 0, 0, function () {
  3413. return '' + this.hours() + zeroFill(this.minutes(), 2) +
  3414. zeroFill(this.seconds(), 2);
  3415. });
  3416. function meridiem (token, lowercase) {
  3417. addFormatToken(token, 0, 0, function () {
  3418. return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
  3419. });
  3420. }
  3421. meridiem('a', true);
  3422. meridiem('A', false);
  3423. // ALIASES
  3424. addUnitAlias('hour', 'h');
  3425. // PRIORITY
  3426. addUnitPriority('hour', 13);
  3427. // PARSING
  3428. function matchMeridiem (isStrict, locale) {
  3429. return locale._meridiemParse;
  3430. }
  3431. addRegexToken('a', matchMeridiem);
  3432. addRegexToken('A', matchMeridiem);
  3433. addRegexToken('H', match1to2);
  3434. addRegexToken('h', match1to2);
  3435. addRegexToken('HH', match1to2, match2);
  3436. addRegexToken('hh', match1to2, match2);
  3437. addRegexToken('hmm', match3to4);
  3438. addRegexToken('hmmss', match5to6);
  3439. addRegexToken('Hmm', match3to4);
  3440. addRegexToken('Hmmss', match5to6);
  3441. addParseToken(['H', 'HH'], HOUR);
  3442. addParseToken(['a', 'A'], function (input, array, config) {
  3443. config._isPm = config._locale.isPM(input);
  3444. config._meridiem = input;
  3445. });
  3446. addParseToken(['h', 'hh'], function (input, array, config) {
  3447. array[HOUR] = toInt(input);
  3448. getParsingFlags(config).bigHour = true;
  3449. });
  3450. addParseToken('hmm', function (input, array, config) {
  3451. var pos = input.length - 2;
  3452. array[HOUR] = toInt(input.substr(0, pos));
  3453. array[MINUTE] = toInt(input.substr(pos));
  3454. getParsingFlags(config).bigHour = true;
  3455. });
  3456. addParseToken('hmmss', function (input, array, config) {
  3457. var pos1 = input.length - 4;
  3458. var pos2 = input.length - 2;
  3459. array[HOUR] = toInt(input.substr(0, pos1));
  3460. array[MINUTE] = toInt(input.substr(pos1, 2));
  3461. array[SECOND] = toInt(input.substr(pos2));
  3462. getParsingFlags(config).bigHour = true;
  3463. });
  3464. addParseToken('Hmm', function (input, array, config) {
  3465. var pos = input.length - 2;
  3466. array[HOUR] = toInt(input.substr(0, pos));
  3467. array[MINUTE] = toInt(input.substr(pos));
  3468. });
  3469. addParseToken('Hmmss', function (input, array, config) {
  3470. var pos1 = input.length - 4;
  3471. var pos2 = input.length - 2;
  3472. array[HOUR] = toInt(input.substr(0, pos1));
  3473. array[MINUTE] = toInt(input.substr(pos1, 2));
  3474. array[SECOND] = toInt(input.substr(pos2));
  3475. });
  3476. // LOCALES
  3477. function localeIsPM (input) {
  3478. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  3479. // Using charAt should be more compatible.
  3480. return ((input + '').toLowerCase().charAt(0) === 'p');
  3481. }
  3482. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  3483. function localeMeridiem (hours, minutes, isLower) {
  3484. if (hours > 11) {
  3485. return isLower ? 'pm' : 'PM';
  3486. } else {
  3487. return isLower ? 'am' : 'AM';
  3488. }
  3489. }
  3490. // MOMENTS
  3491. // Setting the hour should keep the time, because the user explicitly
  3492. // specified which hour he wants. So trying to maintain the same hour (in
  3493. // a new timezone) makes sense. Adding/subtracting hours does not follow
  3494. // this rule.
  3495. var getSetHour = makeGetSet('Hours', true);
  3496. var baseConfig = {
  3497. calendar: defaultCalendar,
  3498. longDateFormat: defaultLongDateFormat,
  3499. invalidDate: defaultInvalidDate,
  3500. ordinal: defaultOrdinal,
  3501. ordinalParse: defaultOrdinalParse,
  3502. relativeTime: defaultRelativeTime,
  3503. months: defaultLocaleMonths,
  3504. monthsShort: defaultLocaleMonthsShort,
  3505. week: defaultLocaleWeek,
  3506. weekdays: defaultLocaleWeekdays,
  3507. weekdaysMin: defaultLocaleWeekdaysMin,
  3508. weekdaysShort: defaultLocaleWeekdaysShort,
  3509. meridiemParse: defaultLocaleMeridiemParse
  3510. };
  3511. // internal storage for locale config files
  3512. var locales = {};
  3513. var globalLocale;
  3514. function normalizeLocale(key) {
  3515. return key ? key.toLowerCase().replace('_', '-') : key;
  3516. }
  3517. // pick the locale from the array
  3518. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  3519. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  3520. function chooseLocale(names) {
  3521. var i = 0, j, next, locale, split;
  3522. while (i < names.length) {
  3523. split = normalizeLocale(names[i]).split('-');
  3524. j = split.length;
  3525. next = normalizeLocale(names[i + 1]);
  3526. next = next ? next.split('-') : null;
  3527. while (j > 0) {
  3528. locale = loadLocale(split.slice(0, j).join('-'));
  3529. if (locale) {
  3530. return locale;
  3531. }
  3532. if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
  3533. //the next array item is better than a shallower substring of this one
  3534. break;
  3535. }
  3536. j--;
  3537. }
  3538. i++;
  3539. }
  3540. return null;
  3541. }
  3542. function loadLocale(name) {
  3543. var oldLocale = null;
  3544. // TODO: Find a better way to register and load all the locales in Node
  3545. if (!locales[name] && (typeof module !== 'undefined') &&
  3546. module && module.exports) {
  3547. try {
  3548. oldLocale = globalLocale._abbr;
  3549. require('./locale/' + name);
  3550. // because defineLocale currently also sets the global locale, we
  3551. // want to undo that for lazy loaded locales
  3552. locale_locales__getSetGlobalLocale(oldLocale);
  3553. } catch (e) { }
  3554. }
  3555. return locales[name];
  3556. }
  3557. // This function will load locale and then set the global locale. If
  3558. // no arguments are passed in, it will simply return the current global
  3559. // locale key.
  3560. function locale_locales__getSetGlobalLocale (key, values) {
  3561. var data;
  3562. if (key) {
  3563. if (isUndefined(values)) {
  3564. data = locale_locales__getLocale(key);
  3565. }
  3566. else {
  3567. data = defineLocale(key, values);
  3568. }
  3569. if (data) {
  3570. // moment.duration._locale = moment._locale = data;
  3571. globalLocale = data;
  3572. }
  3573. }
  3574. return globalLocale._abbr;
  3575. }
  3576. function defineLocale (name, config) {
  3577. if (config !== null) {
  3578. var parentConfig = baseConfig;
  3579. config.abbr = name;
  3580. if (locales[name] != null) {
  3581. deprecateSimple('defineLocaleOverride',
  3582. 'use moment.updateLocale(localeName, config) to change ' +
  3583. 'an existing locale. moment.defineLocale(localeName, ' +
  3584. 'config) should only be used for creating a new locale ' +
  3585. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
  3586. parentConfig = locales[name]._config;
  3587. } else if (config.parentLocale != null) {
  3588. if (locales[config.parentLocale] != null) {
  3589. parentConfig = locales[config.parentLocale]._config;
  3590. } else {
  3591. // treat as if there is no base config
  3592. deprecateSimple('parentLocaleUndefined',
  3593. 'specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/');
  3594. }
  3595. }
  3596. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  3597. // backwards compat for now: also set the locale
  3598. locale_locales__getSetGlobalLocale(name);
  3599. return locales[name];
  3600. } else {
  3601. // useful for testing
  3602. delete locales[name];
  3603. return null;
  3604. }
  3605. }
  3606. function updateLocale(name, config) {
  3607. if (config != null) {
  3608. var locale, parentConfig = baseConfig;
  3609. // MERGE
  3610. if (locales[name] != null) {
  3611. parentConfig = locales[name]._config;
  3612. }
  3613. config = mergeConfigs(parentConfig, config);
  3614. locale = new Locale(config);
  3615. locale.parentLocale = locales[name];
  3616. locales[name] = locale;
  3617. // backwards compat for now: also set the locale
  3618. locale_locales__getSetGlobalLocale(name);
  3619. } else {
  3620. // pass null for config to unupdate, useful for tests
  3621. if (locales[name] != null) {
  3622. if (locales[name].parentLocale != null) {
  3623. locales[name] = locales[name].parentLocale;
  3624. } else if (locales[name] != null) {
  3625. delete locales[name];
  3626. }
  3627. }
  3628. }
  3629. return locales[name];
  3630. }
  3631. // returns locale data
  3632. function locale_locales__getLocale (key) {
  3633. var locale;
  3634. if (key && key._locale && key._locale._abbr) {
  3635. key = key._locale._abbr;
  3636. }
  3637. if (!key) {
  3638. return globalLocale;
  3639. }
  3640. if (!isArray(key)) {
  3641. //short-circuit everything else
  3642. locale = loadLocale(key);
  3643. if (locale) {
  3644. return locale;
  3645. }
  3646. key = [key];
  3647. }
  3648. return chooseLocale(key);
  3649. }
  3650. function locale_locales__listLocales() {
  3651. return keys(locales);
  3652. }
  3653. function checkOverflow (m) {
  3654. var overflow;
  3655. var a = m._a;
  3656. if (a && getParsingFlags(m).overflow === -2) {
  3657. overflow =
  3658. a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
  3659. a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
  3660. a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
  3661. a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
  3662. a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
  3663. a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
  3664. -1;
  3665. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  3666. overflow = DATE;
  3667. }
  3668. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  3669. overflow = WEEK;
  3670. }
  3671. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  3672. overflow = WEEKDAY;
  3673. }
  3674. getParsingFlags(m).overflow = overflow;
  3675. }
  3676. return m;
  3677. }
  3678. // iso 8601 regex
  3679. // 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)
  3680. 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)?)?/;
  3681. 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)?)?/;
  3682. var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
  3683. var isoDates = [
  3684. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  3685. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  3686. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  3687. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  3688. ['YYYY-DDD', /\d{4}-\d{3}/],
  3689. ['YYYY-MM', /\d{4}-\d\d/, false],
  3690. ['YYYYYYMMDD', /[+-]\d{10}/],
  3691. ['YYYYMMDD', /\d{8}/],
  3692. // YYYYMM is NOT allowed by the standard
  3693. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  3694. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  3695. ['YYYYDDD', /\d{7}/]
  3696. ];
  3697. // iso time formats and regexes
  3698. var isoTimes = [
  3699. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  3700. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  3701. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  3702. ['HH:mm', /\d\d:\d\d/],
  3703. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  3704. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  3705. ['HHmmss', /\d\d\d\d\d\d/],
  3706. ['HHmm', /\d\d\d\d/],
  3707. ['HH', /\d\d/]
  3708. ];
  3709. var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
  3710. // date from iso format
  3711. function configFromISO(config) {
  3712. var i, l,
  3713. string = config._i,
  3714. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3715. allowTime, dateFormat, timeFormat, tzFormat;
  3716. if (match) {
  3717. getParsingFlags(config).iso = true;
  3718. for (i = 0, l = isoDates.length; i < l; i++) {
  3719. if (isoDates[i][1].exec(match[1])) {
  3720. dateFormat = isoDates[i][0];
  3721. allowTime = isoDates[i][2] !== false;
  3722. break;
  3723. }
  3724. }
  3725. if (dateFormat == null) {
  3726. config._isValid = false;
  3727. return;
  3728. }
  3729. if (match[3]) {
  3730. for (i = 0, l = isoTimes.length; i < l; i++) {
  3731. if (isoTimes[i][1].exec(match[3])) {
  3732. // match[2] should be 'T' or space
  3733. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3734. break;
  3735. }
  3736. }
  3737. if (timeFormat == null) {
  3738. config._isValid = false;
  3739. return;
  3740. }
  3741. }
  3742. if (!allowTime && timeFormat != null) {
  3743. config._isValid = false;
  3744. return;
  3745. }
  3746. if (match[4]) {
  3747. if (tzRegex.exec(match[4])) {
  3748. tzFormat = 'Z';
  3749. } else {
  3750. config._isValid = false;
  3751. return;
  3752. }
  3753. }
  3754. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3755. configFromStringAndFormat(config);
  3756. } else {
  3757. config._isValid = false;
  3758. }
  3759. }
  3760. // date from iso format or fallback
  3761. function configFromString(config) {
  3762. var matched = aspNetJsonRegex.exec(config._i);
  3763. if (matched !== null) {
  3764. config._d = new Date(+matched[1]);
  3765. return;
  3766. }
  3767. configFromISO(config);
  3768. if (config._isValid === false) {
  3769. delete config._isValid;
  3770. utils_hooks__hooks.createFromInputFallback(config);
  3771. }
  3772. }
  3773. utils_hooks__hooks.createFromInputFallback = deprecate(
  3774. 'value provided is not in a recognized ISO format. moment construction falls back to js Date(), ' +
  3775. 'which is not reliable across all browsers and versions. Non ISO date formats are ' +
  3776. 'discouraged and will be removed in an upcoming major release. Please refer to ' +
  3777. 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3778. function (config) {
  3779. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3780. }
  3781. );
  3782. // Pick the first defined of two or three arguments.
  3783. function defaults(a, b, c) {
  3784. if (a != null) {
  3785. return a;
  3786. }
  3787. if (b != null) {
  3788. return b;
  3789. }
  3790. return c;
  3791. }
  3792. function currentDateArray(config) {
  3793. // hooks is actually the exported moment object
  3794. var nowValue = new Date(utils_hooks__hooks.now());
  3795. if (config._useUTC) {
  3796. return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
  3797. }
  3798. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3799. }
  3800. // convert an array to a date.
  3801. // the array should mirror the parameters below
  3802. // note: all values past the year are optional and will default to the lowest possible value.
  3803. // [year, month, day , hour, minute, second, millisecond]
  3804. function configFromArray (config) {
  3805. var i, date, input = [], currentDate, yearToUse;
  3806. if (config._d) {
  3807. return;
  3808. }
  3809. currentDate = currentDateArray(config);
  3810. //compute day of the year from weeks and weekdays
  3811. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3812. dayOfYearFromWeekInfo(config);
  3813. }
  3814. //if the day of the year is set, figure out what it is
  3815. if (config._dayOfYear) {
  3816. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3817. if (config._dayOfYear > daysInYear(yearToUse)) {
  3818. getParsingFlags(config)._overflowDayOfYear = true;
  3819. }
  3820. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3821. config._a[MONTH] = date.getUTCMonth();
  3822. config._a[DATE] = date.getUTCDate();
  3823. }
  3824. // Default to current date.
  3825. // * if no year, month, day of month are given, default to today
  3826. // * if day of month is given, default month and year
  3827. // * if month is given, default only year
  3828. // * if year is given, don't default anything
  3829. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3830. config._a[i] = input[i] = currentDate[i];
  3831. }
  3832. // Zero out whatever was not defaulted, including time
  3833. for (; i < 7; i++) {
  3834. config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
  3835. }
  3836. // Check for 24:00:00.000
  3837. if (config._a[HOUR] === 24 &&
  3838. config._a[MINUTE] === 0 &&
  3839. config._a[SECOND] === 0 &&
  3840. config._a[MILLISECOND] === 0) {
  3841. config._nextDay = true;
  3842. config._a[HOUR] = 0;
  3843. }
  3844. config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
  3845. // Apply timezone offset from input. The actual utcOffset can be changed
  3846. // with parseZone.
  3847. if (config._tzm != null) {
  3848. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3849. }
  3850. if (config._nextDay) {
  3851. config._a[HOUR] = 24;
  3852. }
  3853. }
  3854. function dayOfYearFromWeekInfo(config) {
  3855. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
  3856. w = config._w;
  3857. if (w.GG != null || w.W != null || w.E != null) {
  3858. dow = 1;
  3859. doy = 4;
  3860. // TODO: We need to take the current isoWeekYear, but that depends on
  3861. // how we interpret now (local, utc, fixed offset). So create
  3862. // a now version of current config (take local/utc/offset flags, and
  3863. // create now).
  3864. weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
  3865. week = defaults(w.W, 1);
  3866. weekday = defaults(w.E, 1);
  3867. if (weekday < 1 || weekday > 7) {
  3868. weekdayOverflow = true;
  3869. }
  3870. } else {
  3871. dow = config._locale._week.dow;
  3872. doy = config._locale._week.doy;
  3873. weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
  3874. week = defaults(w.w, 1);
  3875. if (w.d != null) {
  3876. // weekday -- low day numbers are considered next week
  3877. weekday = w.d;
  3878. if (weekday < 0 || weekday > 6) {
  3879. weekdayOverflow = true;
  3880. }
  3881. } else if (w.e != null) {
  3882. // local weekday -- counting starts from begining of week
  3883. weekday = w.e + dow;
  3884. if (w.e < 0 || w.e > 6) {
  3885. weekdayOverflow = true;
  3886. }
  3887. } else {
  3888. // default to begining of week
  3889. weekday = dow;
  3890. }
  3891. }
  3892. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3893. getParsingFlags(config)._overflowWeeks = true;
  3894. } else if (weekdayOverflow != null) {
  3895. getParsingFlags(config)._overflowWeekday = true;
  3896. } else {
  3897. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3898. config._a[YEAR] = temp.year;
  3899. config._dayOfYear = temp.dayOfYear;
  3900. }
  3901. }
  3902. // constant that refers to the ISO standard
  3903. utils_hooks__hooks.ISO_8601 = function () {};
  3904. // date from string and format string
  3905. function configFromStringAndFormat(config) {
  3906. // TODO: Move this to another part of the creation flow to prevent circular deps
  3907. if (config._f === utils_hooks__hooks.ISO_8601) {
  3908. configFromISO(config);
  3909. return;
  3910. }
  3911. config._a = [];
  3912. getParsingFlags(config).empty = true;
  3913. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3914. var string = '' + config._i,
  3915. i, parsedInput, tokens, token, skipped,
  3916. stringLength = string.length,
  3917. totalParsedInputLength = 0;
  3918. tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3919. for (i = 0; i < tokens.length; i++) {
  3920. token = tokens[i];
  3921. parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
  3922. // console.log('token', token, 'parsedInput', parsedInput,
  3923. // 'regex', getParseRegexForToken(token, config));
  3924. if (parsedInput) {
  3925. skipped = string.substr(0, string.indexOf(parsedInput));
  3926. if (skipped.length > 0) {
  3927. getParsingFlags(config).unusedInput.push(skipped);
  3928. }
  3929. string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
  3930. totalParsedInputLength += parsedInput.length;
  3931. }
  3932. // don't parse if it's not a known token
  3933. if (formatTokenFunctions[token]) {
  3934. if (parsedInput) {
  3935. getParsingFlags(config).empty = false;
  3936. }
  3937. else {
  3938. getParsingFlags(config).unusedTokens.push(token);
  3939. }
  3940. addTimeToArrayFromToken(token, parsedInput, config);
  3941. }
  3942. else if (config._strict && !parsedInput) {
  3943. getParsingFlags(config).unusedTokens.push(token);
  3944. }
  3945. }
  3946. // add remaining unparsed input length to the string
  3947. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  3948. if (string.length > 0) {
  3949. getParsingFlags(config).unusedInput.push(string);
  3950. }
  3951. // clear _12h flag if hour is <= 12
  3952. if (config._a[HOUR] <= 12 &&
  3953. getParsingFlags(config).bigHour === true &&
  3954. config._a[HOUR] > 0) {
  3955. getParsingFlags(config).bigHour = undefined;
  3956. }
  3957. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3958. getParsingFlags(config).meridiem = config._meridiem;
  3959. // handle meridiem
  3960. config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
  3961. configFromArray(config);
  3962. checkOverflow(config);
  3963. }
  3964. function meridiemFixWrap (locale, hour, meridiem) {
  3965. var isPm;
  3966. if (meridiem == null) {
  3967. // nothing to do
  3968. return hour;
  3969. }
  3970. if (locale.meridiemHour != null) {
  3971. return locale.meridiemHour(hour, meridiem);
  3972. } else if (locale.isPM != null) {
  3973. // Fallback
  3974. isPm = locale.isPM(meridiem);
  3975. if (isPm && hour < 12) {
  3976. hour += 12;
  3977. }
  3978. if (!isPm && hour === 12) {
  3979. hour = 0;
  3980. }
  3981. return hour;
  3982. } else {
  3983. // this is not supposed to happen
  3984. return hour;
  3985. }
  3986. }
  3987. // date from string and array of format strings
  3988. function configFromStringAndArray(config) {
  3989. var tempConfig,
  3990. bestMoment,
  3991. scoreToBeat,
  3992. i,
  3993. currentScore;
  3994. if (config._f.length === 0) {
  3995. getParsingFlags(config).invalidFormat = true;
  3996. config._d = new Date(NaN);
  3997. return;
  3998. }
  3999. for (i = 0; i < config._f.length; i++) {
  4000. currentScore = 0;
  4001. tempConfig = copyConfig({}, config);
  4002. if (config._useUTC != null) {
  4003. tempConfig._useUTC = config._useUTC;
  4004. }
  4005. tempConfig._f = config._f[i];
  4006. configFromStringAndFormat(tempConfig);
  4007. if (!valid__isValid(tempConfig)) {
  4008. continue;
  4009. }
  4010. // if there is any input that was not parsed add a penalty for that format
  4011. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  4012. //or tokens
  4013. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  4014. getParsingFlags(tempConfig).score = currentScore;
  4015. if (scoreToBeat == null || currentScore < scoreToBeat) {
  4016. scoreToBeat = currentScore;
  4017. bestMoment = tempConfig;
  4018. }
  4019. }
  4020. extend(config, bestMoment || tempConfig);
  4021. }
  4022. function configFromObject(config) {
  4023. if (config._d) {
  4024. return;
  4025. }
  4026. var i = normalizeObjectUnits(config._i);
  4027. config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
  4028. return obj && parseInt(obj, 10);
  4029. });
  4030. configFromArray(config);
  4031. }
  4032. function createFromConfig (config) {
  4033. var res = new Moment(checkOverflow(prepareConfig(config)));
  4034. if (res._nextDay) {
  4035. // Adding is smart enough around DST
  4036. res.add(1, 'd');
  4037. res._nextDay = undefined;
  4038. }
  4039. return res;
  4040. }
  4041. function prepareConfig (config) {
  4042. var input = config._i,
  4043. format = config._f;
  4044. config._locale = config._locale || locale_locales__getLocale(config._l);
  4045. if (input === null || (format === undefined && input === '')) {
  4046. return valid__createInvalid({nullInput: true});
  4047. }
  4048. if (typeof input === 'string') {
  4049. config._i = input = config._locale.preparse(input);
  4050. }
  4051. if (isMoment(input)) {
  4052. return new Moment(checkOverflow(input));
  4053. } else if (isArray(format)) {
  4054. configFromStringAndArray(config);
  4055. } else if (isDate(input)) {
  4056. config._d = input;
  4057. } else if (format) {
  4058. configFromStringAndFormat(config);
  4059. } else {
  4060. configFromInput(config);
  4061. }
  4062. if (!valid__isValid(config)) {
  4063. config._d = null;
  4064. }
  4065. return config;
  4066. }
  4067. function configFromInput(config) {
  4068. var input = config._i;
  4069. if (input === undefined) {
  4070. config._d = new Date(utils_hooks__hooks.now());
  4071. } else if (isDate(input)) {
  4072. config._d = new Date(input.valueOf());
  4073. } else if (typeof input === 'string') {
  4074. configFromString(config);
  4075. } else if (isArray(input)) {
  4076. config._a = map(input.slice(0), function (obj) {
  4077. return parseInt(obj, 10);
  4078. });
  4079. configFromArray(config);
  4080. } else if (typeof(input) === 'object') {
  4081. configFromObject(config);
  4082. } else if (typeof(input) === 'number') {
  4083. // from milliseconds
  4084. config._d = new Date(input);
  4085. } else {
  4086. utils_hooks__hooks.createFromInputFallback(config);
  4087. }
  4088. }
  4089. function createLocalOrUTC (input, format, locale, strict, isUTC) {
  4090. var c = {};
  4091. if (typeof(locale) === 'boolean') {
  4092. strict = locale;
  4093. locale = undefined;
  4094. }
  4095. if ((isObject(input) && isObjectEmpty(input)) ||
  4096. (isArray(input) && input.length === 0)) {
  4097. input = undefined;
  4098. }
  4099. // object construction must be done this way.
  4100. // https://github.com/moment/moment/issues/1423
  4101. c._isAMomentObject = true;
  4102. c._useUTC = c._isUTC = isUTC;
  4103. c._l = locale;
  4104. c._i = input;
  4105. c._f = format;
  4106. c._strict = strict;
  4107. return createFromConfig(c);
  4108. }
  4109. function local__createLocal (input, format, locale, strict) {
  4110. return createLocalOrUTC(input, format, locale, strict, false);
  4111. }
  4112. var prototypeMin = deprecate(
  4113. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  4114. function () {
  4115. var other = local__createLocal.apply(null, arguments);
  4116. if (this.isValid() && other.isValid()) {
  4117. return other < this ? this : other;
  4118. } else {
  4119. return valid__createInvalid();
  4120. }
  4121. }
  4122. );
  4123. var prototypeMax = deprecate(
  4124. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  4125. function () {
  4126. var other = local__createLocal.apply(null, arguments);
  4127. if (this.isValid() && other.isValid()) {
  4128. return other > this ? this : other;
  4129. } else {
  4130. return valid__createInvalid();
  4131. }
  4132. }
  4133. );
  4134. // Pick a moment m from moments so that m[fn](other) is true for all
  4135. // other. This relies on the function fn to be transitive.
  4136. //
  4137. // moments should either be an array of moment objects or an array, whose
  4138. // first element is an array of moment objects.
  4139. function pickBy(fn, moments) {
  4140. var res, i;
  4141. if (moments.length === 1 && isArray(moments[0])) {
  4142. moments = moments[0];
  4143. }
  4144. if (!moments.length) {
  4145. return local__createLocal();
  4146. }
  4147. res = moments[0];
  4148. for (i = 1; i < moments.length; ++i) {
  4149. if (!moments[i].isValid() || moments[i][fn](res)) {
  4150. res = moments[i];
  4151. }
  4152. }
  4153. return res;
  4154. }
  4155. // TODO: Use [].sort instead?
  4156. function min () {
  4157. var args = [].slice.call(arguments, 0);
  4158. return pickBy('isBefore', args);
  4159. }
  4160. function max () {
  4161. var args = [].slice.call(arguments, 0);
  4162. return pickBy('isAfter', args);
  4163. }
  4164. var now = function () {
  4165. return Date.now ? Date.now() : +(new Date());
  4166. };
  4167. function Duration (duration) {
  4168. var normalizedInput = normalizeObjectUnits(duration),
  4169. years = normalizedInput.year || 0,
  4170. quarters = normalizedInput.quarter || 0,
  4171. months = normalizedInput.month || 0,
  4172. weeks = normalizedInput.week || 0,
  4173. days = normalizedInput.day || 0,
  4174. hours = normalizedInput.hour || 0,
  4175. minutes = normalizedInput.minute || 0,
  4176. seconds = normalizedInput.second || 0,
  4177. milliseconds = normalizedInput.millisecond || 0;
  4178. // representation for dateAddRemove
  4179. this._milliseconds = +milliseconds +
  4180. seconds * 1e3 + // 1000
  4181. minutes * 6e4 + // 1000 * 60
  4182. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  4183. // Because of dateAddRemove treats 24 hours as different from a
  4184. // day when working around DST, we need to store them separately
  4185. this._days = +days +
  4186. weeks * 7;
  4187. // It is impossible translate months into days without knowing
  4188. // which months you are are talking about, so we have to store
  4189. // it separately.
  4190. this._months = +months +
  4191. quarters * 3 +
  4192. years * 12;
  4193. this._data = {};
  4194. this._locale = locale_locales__getLocale();
  4195. this._bubble();
  4196. }
  4197. function isDuration (obj) {
  4198. return obj instanceof Duration;
  4199. }
  4200. function absRound (number) {
  4201. if (number < 0) {
  4202. return Math.round(-1 * number) * -1;
  4203. } else {
  4204. return Math.round(number);
  4205. }
  4206. }
  4207. // FORMATTING
  4208. function offset (token, separator) {
  4209. addFormatToken(token, 0, 0, function () {
  4210. var offset = this.utcOffset();
  4211. var sign = '+';
  4212. if (offset < 0) {
  4213. offset = -offset;
  4214. sign = '-';
  4215. }
  4216. return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
  4217. });
  4218. }
  4219. offset('Z', ':');
  4220. offset('ZZ', '');
  4221. // PARSING
  4222. addRegexToken('Z', matchShortOffset);
  4223. addRegexToken('ZZ', matchShortOffset);
  4224. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  4225. config._useUTC = true;
  4226. config._tzm = offsetFromString(matchShortOffset, input);
  4227. });
  4228. // HELPERS
  4229. // timezone chunker
  4230. // '+10:00' > ['10', '00']
  4231. // '-1530' > ['-15', '30']
  4232. var chunkOffset = /([\+\-]|\d\d)/gi;
  4233. function offsetFromString(matcher, string) {
  4234. var matches = ((string || '').match(matcher) || []);
  4235. var chunk = matches[matches.length - 1] || [];
  4236. var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  4237. var minutes = +(parts[1] * 60) + toInt(parts[2]);
  4238. return parts[0] === '+' ? minutes : -minutes;
  4239. }
  4240. // Return a moment from input, that is local/utc/zone equivalent to model.
  4241. function cloneWithOffset(input, model) {
  4242. var res, diff;
  4243. if (model._isUTC) {
  4244. res = model.clone();
  4245. diff = (isMoment(input) || isDate(input) ? input.valueOf() : local__createLocal(input).valueOf()) - res.valueOf();
  4246. // Use low-level api, because this fn is low-level api.
  4247. res._d.setTime(res._d.valueOf() + diff);
  4248. utils_hooks__hooks.updateOffset(res, false);
  4249. return res;
  4250. } else {
  4251. return local__createLocal(input).local();
  4252. }
  4253. }
  4254. function getDateOffset (m) {
  4255. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  4256. // https://github.com/moment/moment/pull/1871
  4257. return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
  4258. }
  4259. // HOOKS
  4260. // This function will be called whenever a moment is mutated.
  4261. // It is intended to keep the offset in sync with the timezone.
  4262. utils_hooks__hooks.updateOffset = function () {};
  4263. // MOMENTS
  4264. // keepLocalTime = true means only change the timezone, without
  4265. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  4266. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  4267. // +0200, so we adjust the time as needed, to be valid.
  4268. //
  4269. // Keeping the time actually adds/subtracts (one hour)
  4270. // from the actual represented time. That is why we call updateOffset
  4271. // a second time. In case it wants us to change the offset again
  4272. // _changeInProgress == true case, then we have to adjust, because
  4273. // there is no such time in the given timezone.
  4274. function getSetOffset (input, keepLocalTime) {
  4275. var offset = this._offset || 0,
  4276. localAdjust;
  4277. if (!this.isValid()) {
  4278. return input != null ? this : NaN;
  4279. }
  4280. if (input != null) {
  4281. if (typeof input === 'string') {
  4282. input = offsetFromString(matchShortOffset, input);
  4283. } else if (Math.abs(input) < 16) {
  4284. input = input * 60;
  4285. }
  4286. if (!this._isUTC && keepLocalTime) {
  4287. localAdjust = getDateOffset(this);
  4288. }
  4289. this._offset = input;
  4290. this._isUTC = true;
  4291. if (localAdjust != null) {
  4292. this.add(localAdjust, 'm');
  4293. }
  4294. if (offset !== input) {
  4295. if (!keepLocalTime || this._changeInProgress) {
  4296. add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
  4297. } else if (!this._changeInProgress) {
  4298. this._changeInProgress = true;
  4299. utils_hooks__hooks.updateOffset(this, true);
  4300. this._changeInProgress = null;
  4301. }
  4302. }
  4303. return this;
  4304. } else {
  4305. return this._isUTC ? offset : getDateOffset(this);
  4306. }
  4307. }
  4308. function getSetZone (input, keepLocalTime) {
  4309. if (input != null) {
  4310. if (typeof input !== 'string') {
  4311. input = -input;
  4312. }
  4313. this.utcOffset(input, keepLocalTime);
  4314. return this;
  4315. } else {
  4316. return -this.utcOffset();
  4317. }
  4318. }
  4319. function setOffsetToUTC (keepLocalTime) {
  4320. return this.utcOffset(0, keepLocalTime);
  4321. }
  4322. function setOffsetToLocal (keepLocalTime) {
  4323. if (this._isUTC) {
  4324. this.utcOffset(0, keepLocalTime);
  4325. this._isUTC = false;
  4326. if (keepLocalTime) {
  4327. this.subtract(getDateOffset(this), 'm');
  4328. }
  4329. }
  4330. return this;
  4331. }
  4332. function setOffsetToParsedOffset () {
  4333. if (this._tzm) {
  4334. this.utcOffset(this._tzm);
  4335. } else if (typeof this._i === 'string') {
  4336. var tZone = offsetFromString(matchOffset, this._i);
  4337. if (tZone === 0) {
  4338. this.utcOffset(0, true);
  4339. } else {
  4340. this.utcOffset(offsetFromString(matchOffset, this._i));
  4341. }
  4342. }
  4343. return this;
  4344. }
  4345. function hasAlignedHourOffset (input) {
  4346. if (!this.isValid()) {
  4347. return false;
  4348. }
  4349. input = input ? local__createLocal(input).utcOffset() : 0;
  4350. return (this.utcOffset() - input) % 60 === 0;
  4351. }
  4352. function isDaylightSavingTime () {
  4353. return (
  4354. this.utcOffset() > this.clone().month(0).utcOffset() ||
  4355. this.utcOffset() > this.clone().month(5).utcOffset()
  4356. );
  4357. }
  4358. function isDaylightSavingTimeShifted () {
  4359. if (!isUndefined(this._isDSTShifted)) {
  4360. return this._isDSTShifted;
  4361. }
  4362. var c = {};
  4363. copyConfig(c, this);
  4364. c = prepareConfig(c);
  4365. if (c._a) {
  4366. var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a);
  4367. this._isDSTShifted = this.isValid() &&
  4368. compareArrays(c._a, other.toArray()) > 0;
  4369. } else {
  4370. this._isDSTShifted = false;
  4371. }
  4372. return this._isDSTShifted;
  4373. }
  4374. function isLocal () {
  4375. return this.isValid() ? !this._isUTC : false;
  4376. }
  4377. function isUtcOffset () {
  4378. return this.isValid() ? this._isUTC : false;
  4379. }
  4380. function isUtc () {
  4381. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  4382. }
  4383. // ASP.NET json date format regex
  4384. var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
  4385. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  4386. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  4387. // and further modified to allow for strings containing both week and day
  4388. 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)?)?$/;
  4389. function create__createDuration (input, key) {
  4390. var duration = input,
  4391. // matching against regexp is expensive, do it on demand
  4392. match = null,
  4393. sign,
  4394. ret,
  4395. diffRes;
  4396. if (isDuration(input)) {
  4397. duration = {
  4398. ms : input._milliseconds,
  4399. d : input._days,
  4400. M : input._months
  4401. };
  4402. } else if (typeof input === 'number') {
  4403. duration = {};
  4404. if (key) {
  4405. duration[key] = input;
  4406. } else {
  4407. duration.milliseconds = input;
  4408. }
  4409. } else if (!!(match = aspNetRegex.exec(input))) {
  4410. sign = (match[1] === '-') ? -1 : 1;
  4411. duration = {
  4412. y : 0,
  4413. d : toInt(match[DATE]) * sign,
  4414. h : toInt(match[HOUR]) * sign,
  4415. m : toInt(match[MINUTE]) * sign,
  4416. s : toInt(match[SECOND]) * sign,
  4417. ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
  4418. };
  4419. } else if (!!(match = isoRegex.exec(input))) {
  4420. sign = (match[1] === '-') ? -1 : 1;
  4421. duration = {
  4422. y : parseIso(match[2], sign),
  4423. M : parseIso(match[3], sign),
  4424. w : parseIso(match[4], sign),
  4425. d : parseIso(match[5], sign),
  4426. h : parseIso(match[6], sign),
  4427. m : parseIso(match[7], sign),
  4428. s : parseIso(match[8], sign)
  4429. };
  4430. } else if (duration == null) {// checks for null or undefined
  4431. duration = {};
  4432. } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
  4433. diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));
  4434. duration = {};
  4435. duration.ms = diffRes.milliseconds;
  4436. duration.M = diffRes.months;
  4437. }
  4438. ret = new Duration(duration);
  4439. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4440. ret._locale = input._locale;
  4441. }
  4442. return ret;
  4443. }
  4444. create__createDuration.fn = Duration.prototype;
  4445. function parseIso (inp, sign) {
  4446. // We'd normally use ~~inp for this, but unfortunately it also
  4447. // converts floats to ints.
  4448. // inp may be undefined, so careful calling replace on it.
  4449. var res = inp && parseFloat(inp.replace(',', '.'));
  4450. // apply sign while we're at it
  4451. return (isNaN(res) ? 0 : res) * sign;
  4452. }
  4453. function positiveMomentsDifference(base, other) {
  4454. var res = {milliseconds: 0, months: 0};
  4455. res.months = other.month() - base.month() +
  4456. (other.year() - base.year()) * 12;
  4457. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4458. --res.months;
  4459. }
  4460. res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
  4461. return res;
  4462. }
  4463. function momentsDifference(base, other) {
  4464. var res;
  4465. if (!(base.isValid() && other.isValid())) {
  4466. return {milliseconds: 0, months: 0};
  4467. }
  4468. other = cloneWithOffset(other, base);
  4469. if (base.isBefore(other)) {
  4470. res = positiveMomentsDifference(base, other);
  4471. } else {
  4472. res = positiveMomentsDifference(other, base);
  4473. res.milliseconds = -res.milliseconds;
  4474. res.months = -res.months;
  4475. }
  4476. return res;
  4477. }
  4478. // TODO: remove 'name' arg after deprecation is removed
  4479. function createAdder(direction, name) {
  4480. return function (val, period) {
  4481. var dur, tmp;
  4482. //invert the arguments, but complain about it
  4483. if (period !== null && !isNaN(+period)) {
  4484. deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
  4485. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
  4486. tmp = val; val = period; period = tmp;
  4487. }
  4488. val = typeof val === 'string' ? +val : val;
  4489. dur = create__createDuration(val, period);
  4490. add_subtract__addSubtract(this, dur, direction);
  4491. return this;
  4492. };
  4493. }
  4494. function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
  4495. var milliseconds = duration._milliseconds,
  4496. days = absRound(duration._days),
  4497. months = absRound(duration._months);
  4498. if (!mom.isValid()) {
  4499. // No op
  4500. return;
  4501. }
  4502. updateOffset = updateOffset == null ? true : updateOffset;
  4503. if (milliseconds) {
  4504. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4505. }
  4506. if (days) {
  4507. get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
  4508. }
  4509. if (months) {
  4510. setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
  4511. }
  4512. if (updateOffset) {
  4513. utils_hooks__hooks.updateOffset(mom, days || months);
  4514. }
  4515. }
  4516. var add_subtract__add = createAdder(1, 'add');
  4517. var add_subtract__subtract = createAdder(-1, 'subtract');
  4518. function getCalendarFormat(myMoment, now) {
  4519. var diff = myMoment.diff(now, 'days', true);
  4520. return diff < -6 ? 'sameElse' :
  4521. diff < -1 ? 'lastWeek' :
  4522. diff < 0 ? 'lastDay' :
  4523. diff < 1 ? 'sameDay' :
  4524. diff < 2 ? 'nextDay' :
  4525. diff < 7 ? 'nextWeek' : 'sameElse';
  4526. }
  4527. function moment_calendar__calendar (time, formats) {
  4528. // We want to compare the start of today, vs this.
  4529. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4530. var now = time || local__createLocal(),
  4531. sod = cloneWithOffset(now, this).startOf('day'),
  4532. format = utils_hooks__hooks.calendarFormat(this, sod) || 'sameElse';
  4533. var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
  4534. return this.format(output || this.localeData().calendar(format, this, local__createLocal(now)));
  4535. }
  4536. function clone () {
  4537. return new Moment(this);
  4538. }
  4539. function isAfter (input, units) {
  4540. var localInput = isMoment(input) ? input : local__createLocal(input);
  4541. if (!(this.isValid() && localInput.isValid())) {
  4542. return false;
  4543. }
  4544. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  4545. if (units === 'millisecond') {
  4546. return this.valueOf() > localInput.valueOf();
  4547. } else {
  4548. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4549. }
  4550. }
  4551. function isBefore (input, units) {
  4552. var localInput = isMoment(input) ? input : local__createLocal(input);
  4553. if (!(this.isValid() && localInput.isValid())) {
  4554. return false;
  4555. }
  4556. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  4557. if (units === 'millisecond') {
  4558. return this.valueOf() < localInput.valueOf();
  4559. } else {
  4560. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4561. }
  4562. }
  4563. function isBetween (from, to, units, inclusivity) {
  4564. inclusivity = inclusivity || '()';
  4565. return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
  4566. (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
  4567. }
  4568. function isSame (input, units) {
  4569. var localInput = isMoment(input) ? input : local__createLocal(input),
  4570. inputMs;
  4571. if (!(this.isValid() && localInput.isValid())) {
  4572. return false;
  4573. }
  4574. units = normalizeUnits(units || 'millisecond');
  4575. if (units === 'millisecond') {
  4576. return this.valueOf() === localInput.valueOf();
  4577. } else {
  4578. inputMs = localInput.valueOf();
  4579. return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  4580. }
  4581. }
  4582. function isSameOrAfter (input, units) {
  4583. return this.isSame(input, units) || this.isAfter(input,units);
  4584. }
  4585. function isSameOrBefore (input, units) {
  4586. return this.isSame(input, units) || this.isBefore(input,units);
  4587. }
  4588. function diff (input, units, asFloat) {
  4589. var that,
  4590. zoneDelta,
  4591. delta, output;
  4592. if (!this.isValid()) {
  4593. return NaN;
  4594. }
  4595. that = cloneWithOffset(input, this);
  4596. if (!that.isValid()) {
  4597. return NaN;
  4598. }
  4599. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4600. units = normalizeUnits(units);
  4601. if (units === 'year' || units === 'month' || units === 'quarter') {
  4602. output = monthDiff(this, that);
  4603. if (units === 'quarter') {
  4604. output = output / 3;
  4605. } else if (units === 'year') {
  4606. output = output / 12;
  4607. }
  4608. } else {
  4609. delta = this - that;
  4610. output = units === 'second' ? delta / 1e3 : // 1000
  4611. units === 'minute' ? delta / 6e4 : // 1000 * 60
  4612. units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
  4613. units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
  4614. units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
  4615. delta;
  4616. }
  4617. return asFloat ? output : absFloor(output);
  4618. }
  4619. function monthDiff (a, b) {
  4620. // difference in months
  4621. var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
  4622. // b is in (anchor - 1 month, anchor + 1 month)
  4623. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4624. anchor2, adjust;
  4625. if (b - anchor < 0) {
  4626. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4627. // linear across the month
  4628. adjust = (b - anchor) / (anchor - anchor2);
  4629. } else {
  4630. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4631. // linear across the month
  4632. adjust = (b - anchor) / (anchor2 - anchor);
  4633. }
  4634. //check for negative zero, return zero if negative zero
  4635. return -(wholeMonthDiff + adjust) || 0;
  4636. }
  4637. utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4638. utils_hooks__hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4639. function toString () {
  4640. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4641. }
  4642. function moment_format__toISOString () {
  4643. var m = this.clone().utc();
  4644. if (0 < m.year() && m.year() <= 9999) {
  4645. if (isFunction(Date.prototype.toISOString)) {
  4646. // native implementation is ~50x faster, use it when we can
  4647. return this.toDate().toISOString();
  4648. } else {
  4649. return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  4650. }
  4651. } else {
  4652. return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  4653. }
  4654. }
  4655. function format (inputString) {
  4656. if (!inputString) {
  4657. inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat;
  4658. }
  4659. var output = formatMoment(this, inputString);
  4660. return this.localeData().postformat(output);
  4661. }
  4662. function from (time, withoutSuffix) {
  4663. if (this.isValid() &&
  4664. ((isMoment(time) && time.isValid()) ||
  4665. local__createLocal(time).isValid())) {
  4666. return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
  4667. } else {
  4668. return this.localeData().invalidDate();
  4669. }
  4670. }
  4671. function fromNow (withoutSuffix) {
  4672. return this.from(local__createLocal(), withoutSuffix);
  4673. }
  4674. function to (time, withoutSuffix) {
  4675. if (this.isValid() &&
  4676. ((isMoment(time) && time.isValid()) ||
  4677. local__createLocal(time).isValid())) {
  4678. return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
  4679. } else {
  4680. return this.localeData().invalidDate();
  4681. }
  4682. }
  4683. function toNow (withoutSuffix) {
  4684. return this.to(local__createLocal(), withoutSuffix);
  4685. }
  4686. // If passed a locale key, it will set the locale for this
  4687. // instance. Otherwise, it will return the locale configuration
  4688. // variables for this instance.
  4689. function locale (key) {
  4690. var newLocaleData;
  4691. if (key === undefined) {
  4692. return this._locale._abbr;
  4693. } else {
  4694. newLocaleData = locale_locales__getLocale(key);
  4695. if (newLocaleData != null) {
  4696. this._locale = newLocaleData;
  4697. }
  4698. return this;
  4699. }
  4700. }
  4701. var lang = deprecate(
  4702. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4703. function (key) {
  4704. if (key === undefined) {
  4705. return this.localeData();
  4706. } else {
  4707. return this.locale(key);
  4708. }
  4709. }
  4710. );
  4711. function localeData () {
  4712. return this._locale;
  4713. }
  4714. function startOf (units) {
  4715. units = normalizeUnits(units);
  4716. // the following switch intentionally omits break keywords
  4717. // to utilize falling through the cases.
  4718. switch (units) {
  4719. case 'year':
  4720. this.month(0);
  4721. /* falls through */
  4722. case 'quarter':
  4723. case 'month':
  4724. this.date(1);
  4725. /* falls through */
  4726. case 'week':
  4727. case 'isoWeek':
  4728. case 'day':
  4729. case 'date':
  4730. this.hours(0);
  4731. /* falls through */
  4732. case 'hour':
  4733. this.minutes(0);
  4734. /* falls through */
  4735. case 'minute':
  4736. this.seconds(0);
  4737. /* falls through */
  4738. case 'second':
  4739. this.milliseconds(0);
  4740. }
  4741. // weeks are a special case
  4742. if (units === 'week') {
  4743. this.weekday(0);
  4744. }
  4745. if (units === 'isoWeek') {
  4746. this.isoWeekday(1);
  4747. }
  4748. // quarters are also special
  4749. if (units === 'quarter') {
  4750. this.month(Math.floor(this.month() / 3) * 3);
  4751. }
  4752. return this;
  4753. }
  4754. function endOf (units) {
  4755. units = normalizeUnits(units);
  4756. if (units === undefined || units === 'millisecond') {
  4757. return this;
  4758. }
  4759. // 'date' is an alias for 'day', so it should be considered as such.
  4760. if (units === 'date') {
  4761. units = 'day';
  4762. }
  4763. return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
  4764. }
  4765. function to_type__valueOf () {
  4766. return this._d.valueOf() - ((this._offset || 0) * 60000);
  4767. }
  4768. function unix () {
  4769. return Math.floor(this.valueOf() / 1000);
  4770. }
  4771. function toDate () {
  4772. return new Date(this.valueOf());
  4773. }
  4774. function toArray () {
  4775. var m = this;
  4776. return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
  4777. }
  4778. function toObject () {
  4779. var m = this;
  4780. return {
  4781. years: m.year(),
  4782. months: m.month(),
  4783. date: m.date(),
  4784. hours: m.hours(),
  4785. minutes: m.minutes(),
  4786. seconds: m.seconds(),
  4787. milliseconds: m.milliseconds()
  4788. };
  4789. }
  4790. function toJSON () {
  4791. // new Date(NaN).toJSON() === null
  4792. return this.isValid() ? this.toISOString() : null;
  4793. }
  4794. function moment_valid__isValid () {
  4795. return valid__isValid(this);
  4796. }
  4797. function parsingFlags () {
  4798. return extend({}, getParsingFlags(this));
  4799. }
  4800. function invalidAt () {
  4801. return getParsingFlags(this).overflow;
  4802. }
  4803. function creationData() {
  4804. return {
  4805. input: this._i,
  4806. format: this._f,
  4807. locale: this._locale,
  4808. isUTC: this._isUTC,
  4809. strict: this._strict
  4810. };
  4811. }
  4812. // FORMATTING
  4813. addFormatToken(0, ['gg', 2], 0, function () {
  4814. return this.weekYear() % 100;
  4815. });
  4816. addFormatToken(0, ['GG', 2], 0, function () {
  4817. return this.isoWeekYear() % 100;
  4818. });
  4819. function addWeekYearFormatToken (token, getter) {
  4820. addFormatToken(0, [token, token.length], 0, getter);
  4821. }
  4822. addWeekYearFormatToken('gggg', 'weekYear');
  4823. addWeekYearFormatToken('ggggg', 'weekYear');
  4824. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4825. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4826. // ALIASES
  4827. addUnitAlias('weekYear', 'gg');
  4828. addUnitAlias('isoWeekYear', 'GG');
  4829. // PRIORITY
  4830. addUnitPriority('weekYear', 1);
  4831. addUnitPriority('isoWeekYear', 1);
  4832. // PARSING
  4833. addRegexToken('G', matchSigned);
  4834. addRegexToken('g', matchSigned);
  4835. addRegexToken('GG', match1to2, match2);
  4836. addRegexToken('gg', match1to2, match2);
  4837. addRegexToken('GGGG', match1to4, match4);
  4838. addRegexToken('gggg', match1to4, match4);
  4839. addRegexToken('GGGGG', match1to6, match6);
  4840. addRegexToken('ggggg', match1to6, match6);
  4841. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
  4842. week[token.substr(0, 2)] = toInt(input);
  4843. });
  4844. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4845. week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
  4846. });
  4847. // MOMENTS
  4848. function getSetWeekYear (input) {
  4849. return getSetWeekYearHelper.call(this,
  4850. input,
  4851. this.week(),
  4852. this.weekday(),
  4853. this.localeData()._week.dow,
  4854. this.localeData()._week.doy);
  4855. }
  4856. function getSetISOWeekYear (input) {
  4857. return getSetWeekYearHelper.call(this,
  4858. input, this.isoWeek(), this.isoWeekday(), 1, 4);
  4859. }
  4860. function getISOWeeksInYear () {
  4861. return weeksInYear(this.year(), 1, 4);
  4862. }
  4863. function getWeeksInYear () {
  4864. var weekInfo = this.localeData()._week;
  4865. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  4866. }
  4867. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  4868. var weeksTarget;
  4869. if (input == null) {
  4870. return weekOfYear(this, dow, doy).year;
  4871. } else {
  4872. weeksTarget = weeksInYear(input, dow, doy);
  4873. if (week > weeksTarget) {
  4874. week = weeksTarget;
  4875. }
  4876. return setWeekAll.call(this, input, week, weekday, dow, doy);
  4877. }
  4878. }
  4879. function setWeekAll(weekYear, week, weekday, dow, doy) {
  4880. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  4881. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  4882. this.year(date.getUTCFullYear());
  4883. this.month(date.getUTCMonth());
  4884. this.date(date.getUTCDate());
  4885. return this;
  4886. }
  4887. // FORMATTING
  4888. addFormatToken('Q', 0, 'Qo', 'quarter');
  4889. // ALIASES
  4890. addUnitAlias('quarter', 'Q');
  4891. // PRIORITY
  4892. addUnitPriority('quarter', 7);
  4893. // PARSING
  4894. addRegexToken('Q', match1);
  4895. addParseToken('Q', function (input, array) {
  4896. array[MONTH] = (toInt(input) - 1) * 3;
  4897. });
  4898. // MOMENTS
  4899. function getSetQuarter (input) {
  4900. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  4901. }
  4902. // FORMATTING
  4903. addFormatToken('D', ['DD', 2], 'Do', 'date');
  4904. // ALIASES
  4905. addUnitAlias('date', 'D');
  4906. // PRIOROITY
  4907. addUnitPriority('date', 9);
  4908. // PARSING
  4909. addRegexToken('D', match1to2);
  4910. addRegexToken('DD', match1to2, match2);
  4911. addRegexToken('Do', function (isStrict, locale) {
  4912. return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
  4913. });
  4914. addParseToken(['D', 'DD'], DATE);
  4915. addParseToken('Do', function (input, array) {
  4916. array[DATE] = toInt(input.match(match1to2)[0], 10);
  4917. });
  4918. // MOMENTS
  4919. var getSetDayOfMonth = makeGetSet('Date', true);
  4920. // FORMATTING
  4921. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  4922. // ALIASES
  4923. addUnitAlias('dayOfYear', 'DDD');
  4924. // PRIORITY
  4925. addUnitPriority('dayOfYear', 4);
  4926. // PARSING
  4927. addRegexToken('DDD', match1to3);
  4928. addRegexToken('DDDD', match3);
  4929. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  4930. config._dayOfYear = toInt(input);
  4931. });
  4932. // HELPERS
  4933. // MOMENTS
  4934. function getSetDayOfYear (input) {
  4935. var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
  4936. return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
  4937. }
  4938. // FORMATTING
  4939. addFormatToken('m', ['mm', 2], 0, 'minute');
  4940. // ALIASES
  4941. addUnitAlias('minute', 'm');
  4942. // PRIORITY
  4943. addUnitPriority('minute', 14);
  4944. // PARSING
  4945. addRegexToken('m', match1to2);
  4946. addRegexToken('mm', match1to2, match2);
  4947. addParseToken(['m', 'mm'], MINUTE);
  4948. // MOMENTS
  4949. var getSetMinute = makeGetSet('Minutes', false);
  4950. // FORMATTING
  4951. addFormatToken('s', ['ss', 2], 0, 'second');
  4952. // ALIASES
  4953. addUnitAlias('second', 's');
  4954. // PRIORITY
  4955. addUnitPriority('second', 15);
  4956. // PARSING
  4957. addRegexToken('s', match1to2);
  4958. addRegexToken('ss', match1to2, match2);
  4959. addParseToken(['s', 'ss'], SECOND);
  4960. // MOMENTS
  4961. var getSetSecond = makeGetSet('Seconds', false);
  4962. // FORMATTING
  4963. addFormatToken('S', 0, 0, function () {
  4964. return ~~(this.millisecond() / 100);
  4965. });
  4966. addFormatToken(0, ['SS', 2], 0, function () {
  4967. return ~~(this.millisecond() / 10);
  4968. });
  4969. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  4970. addFormatToken(0, ['SSSS', 4], 0, function () {
  4971. return this.millisecond() * 10;
  4972. });
  4973. addFormatToken(0, ['SSSSS', 5], 0, function () {
  4974. return this.millisecond() * 100;
  4975. });
  4976. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  4977. return this.millisecond() * 1000;
  4978. });
  4979. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  4980. return this.millisecond() * 10000;
  4981. });
  4982. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  4983. return this.millisecond() * 100000;
  4984. });
  4985. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  4986. return this.millisecond() * 1000000;
  4987. });
  4988. // ALIASES
  4989. addUnitAlias('millisecond', 'ms');
  4990. // PRIORITY
  4991. addUnitPriority('millisecond', 16);
  4992. // PARSING
  4993. addRegexToken('S', match1to3, match1);
  4994. addRegexToken('SS', match1to3, match2);
  4995. addRegexToken('SSS', match1to3, match3);
  4996. var token;
  4997. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  4998. addRegexToken(token, matchUnsigned);
  4999. }
  5000. function parseMs(input, array) {
  5001. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5002. }
  5003. for (token = 'S'; token.length <= 9; token += 'S') {
  5004. addParseToken(token, parseMs);
  5005. }
  5006. // MOMENTS
  5007. var getSetMillisecond = makeGetSet('Milliseconds', false);
  5008. // FORMATTING
  5009. addFormatToken('z', 0, 0, 'zoneAbbr');
  5010. addFormatToken('zz', 0, 0, 'zoneName');
  5011. // MOMENTS
  5012. function getZoneAbbr () {
  5013. return this._isUTC ? 'UTC' : '';
  5014. }
  5015. function getZoneName () {
  5016. return this._isUTC ? 'Coordinated Universal Time' : '';
  5017. }
  5018. var momentPrototype__proto = Moment.prototype;
  5019. momentPrototype__proto.add = add_subtract__add;
  5020. momentPrototype__proto.calendar = moment_calendar__calendar;
  5021. momentPrototype__proto.clone = clone;
  5022. momentPrototype__proto.diff = diff;
  5023. momentPrototype__proto.endOf = endOf;
  5024. momentPrototype__proto.format = format;
  5025. momentPrototype__proto.from = from;
  5026. momentPrototype__proto.fromNow = fromNow;
  5027. momentPrototype__proto.to = to;
  5028. momentPrototype__proto.toNow = toNow;
  5029. momentPrototype__proto.get = stringGet;
  5030. momentPrototype__proto.invalidAt = invalidAt;
  5031. momentPrototype__proto.isAfter = isAfter;
  5032. momentPrototype__proto.isBefore = isBefore;
  5033. momentPrototype__proto.isBetween = isBetween;
  5034. momentPrototype__proto.isSame = isSame;
  5035. momentPrototype__proto.isSameOrAfter = isSameOrAfter;
  5036. momentPrototype__proto.isSameOrBefore = isSameOrBefore;
  5037. momentPrototype__proto.isValid = moment_valid__isValid;
  5038. momentPrototype__proto.lang = lang;
  5039. momentPrototype__proto.locale = locale;
  5040. momentPrototype__proto.localeData = localeData;
  5041. momentPrototype__proto.max = prototypeMax;
  5042. momentPrototype__proto.min = prototypeMin;
  5043. momentPrototype__proto.parsingFlags = parsingFlags;
  5044. momentPrototype__proto.set = stringSet;
  5045. momentPrototype__proto.startOf = startOf;
  5046. momentPrototype__proto.subtract = add_subtract__subtract;
  5047. momentPrototype__proto.toArray = toArray;
  5048. momentPrototype__proto.toObject = toObject;
  5049. momentPrototype__proto.toDate = toDate;
  5050. momentPrototype__proto.toISOString = moment_format__toISOString;
  5051. momentPrototype__proto.toJSON = toJSON;
  5052. momentPrototype__proto.toString = toString;
  5053. momentPrototype__proto.unix = unix;
  5054. momentPrototype__proto.valueOf = to_type__valueOf;
  5055. momentPrototype__proto.creationData = creationData;
  5056. // Year
  5057. momentPrototype__proto.year = getSetYear;
  5058. momentPrototype__proto.isLeapYear = getIsLeapYear;
  5059. // Week Year
  5060. momentPrototype__proto.weekYear = getSetWeekYear;
  5061. momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
  5062. // Quarter
  5063. momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
  5064. // Month
  5065. momentPrototype__proto.month = getSetMonth;
  5066. momentPrototype__proto.daysInMonth = getDaysInMonth;
  5067. // Week
  5068. momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
  5069. momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
  5070. momentPrototype__proto.weeksInYear = getWeeksInYear;
  5071. momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
  5072. // Day
  5073. momentPrototype__proto.date = getSetDayOfMonth;
  5074. momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
  5075. momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
  5076. momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
  5077. momentPrototype__proto.dayOfYear = getSetDayOfYear;
  5078. // Hour
  5079. momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
  5080. // Minute
  5081. momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
  5082. // Second
  5083. momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
  5084. // Millisecond
  5085. momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
  5086. // Offset
  5087. momentPrototype__proto.utcOffset = getSetOffset;
  5088. momentPrototype__proto.utc = setOffsetToUTC;
  5089. momentPrototype__proto.local = setOffsetToLocal;
  5090. momentPrototype__proto.parseZone = setOffsetToParsedOffset;
  5091. momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5092. momentPrototype__proto.isDST = isDaylightSavingTime;
  5093. momentPrototype__proto.isLocal = isLocal;
  5094. momentPrototype__proto.isUtcOffset = isUtcOffset;
  5095. momentPrototype__proto.isUtc = isUtc;
  5096. momentPrototype__proto.isUTC = isUtc;
  5097. // Timezone
  5098. momentPrototype__proto.zoneAbbr = getZoneAbbr;
  5099. momentPrototype__proto.zoneName = getZoneName;
  5100. // Deprecations
  5101. momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  5102. momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  5103. momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  5104. momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
  5105. momentPrototype__proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
  5106. var momentPrototype = momentPrototype__proto;
  5107. function moment__createUnix (input) {
  5108. return local__createLocal(input * 1000);
  5109. }
  5110. function moment__createInZone () {
  5111. return local__createLocal.apply(null, arguments).parseZone();
  5112. }
  5113. function preParsePostFormat (string) {
  5114. return string;
  5115. }
  5116. var prototype__proto = Locale.prototype;
  5117. prototype__proto.calendar = locale_calendar__calendar;
  5118. prototype__proto.longDateFormat = longDateFormat;
  5119. prototype__proto.invalidDate = invalidDate;
  5120. prototype__proto.ordinal = ordinal;
  5121. prototype__proto.preparse = preParsePostFormat;
  5122. prototype__proto.postformat = preParsePostFormat;
  5123. prototype__proto.relativeTime = relative__relativeTime;
  5124. prototype__proto.pastFuture = pastFuture;
  5125. prototype__proto.set = locale_set__set;
  5126. // Month
  5127. prototype__proto.months = localeMonths;
  5128. prototype__proto.monthsShort = localeMonthsShort;
  5129. prototype__proto.monthsParse = localeMonthsParse;
  5130. prototype__proto.monthsRegex = monthsRegex;
  5131. prototype__proto.monthsShortRegex = monthsShortRegex;
  5132. // Week
  5133. prototype__proto.week = localeWeek;
  5134. prototype__proto.firstDayOfYear = localeFirstDayOfYear;
  5135. prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
  5136. // Day of Week
  5137. prototype__proto.weekdays = localeWeekdays;
  5138. prototype__proto.weekdaysMin = localeWeekdaysMin;
  5139. prototype__proto.weekdaysShort = localeWeekdaysShort;
  5140. prototype__proto.weekdaysParse = localeWeekdaysParse;
  5141. prototype__proto.weekdaysRegex = weekdaysRegex;
  5142. prototype__proto.weekdaysShortRegex = weekdaysShortRegex;
  5143. prototype__proto.weekdaysMinRegex = weekdaysMinRegex;
  5144. // Hours
  5145. prototype__proto.isPM = localeIsPM;
  5146. prototype__proto.meridiem = localeMeridiem;
  5147. function lists__get (format, index, field, setter) {
  5148. var locale = locale_locales__getLocale();
  5149. var utc = create_utc__createUTC().set(setter, index);
  5150. return locale[field](utc, format);
  5151. }
  5152. function listMonthsImpl (format, index, field) {
  5153. if (typeof format === 'number') {
  5154. index = format;
  5155. format = undefined;
  5156. }
  5157. format = format || '';
  5158. if (index != null) {
  5159. return lists__get(format, index, field, 'month');
  5160. }
  5161. var i;
  5162. var out = [];
  5163. for (i = 0; i < 12; i++) {
  5164. out[i] = lists__get(format, i, field, 'month');
  5165. }
  5166. return out;
  5167. }
  5168. // ()
  5169. // (5)
  5170. // (fmt, 5)
  5171. // (fmt)
  5172. // (true)
  5173. // (true, 5)
  5174. // (true, fmt, 5)
  5175. // (true, fmt)
  5176. function listWeekdaysImpl (localeSorted, format, index, field) {
  5177. if (typeof localeSorted === 'boolean') {
  5178. if (typeof format === 'number') {
  5179. index = format;
  5180. format = undefined;
  5181. }
  5182. format = format || '';
  5183. } else {
  5184. format = localeSorted;
  5185. index = format;
  5186. localeSorted = false;
  5187. if (typeof format === 'number') {
  5188. index = format;
  5189. format = undefined;
  5190. }
  5191. format = format || '';
  5192. }
  5193. var locale = locale_locales__getLocale(),
  5194. shift = localeSorted ? locale._week.dow : 0;
  5195. if (index != null) {
  5196. return lists__get(format, (index + shift) % 7, field, 'day');
  5197. }
  5198. var i;
  5199. var out = [];
  5200. for (i = 0; i < 7; i++) {
  5201. out[i] = lists__get(format, (i + shift) % 7, field, 'day');
  5202. }
  5203. return out;
  5204. }
  5205. function lists__listMonths (format, index) {
  5206. return listMonthsImpl(format, index, 'months');
  5207. }
  5208. function lists__listMonthsShort (format, index) {
  5209. return listMonthsImpl(format, index, 'monthsShort');
  5210. }
  5211. function lists__listWeekdays (localeSorted, format, index) {
  5212. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5213. }
  5214. function lists__listWeekdaysShort (localeSorted, format, index) {
  5215. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5216. }
  5217. function lists__listWeekdaysMin (localeSorted, format, index) {
  5218. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5219. }
  5220. locale_locales__getSetGlobalLocale('en', {
  5221. ordinalParse: /\d{1,2}(th|st|nd|rd)/,
  5222. ordinal : function (number) {
  5223. var b = number % 10,
  5224. output = (toInt(number % 100 / 10) === 1) ? 'th' :
  5225. (b === 1) ? 'st' :
  5226. (b === 2) ? 'nd' :
  5227. (b === 3) ? 'rd' : 'th';
  5228. return number + output;
  5229. }
  5230. });
  5231. // Side effect imports
  5232. utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
  5233. utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
  5234. var mathAbs = Math.abs;
  5235. function duration_abs__abs () {
  5236. var data = this._data;
  5237. this._milliseconds = mathAbs(this._milliseconds);
  5238. this._days = mathAbs(this._days);
  5239. this._months = mathAbs(this._months);
  5240. data.milliseconds = mathAbs(data.milliseconds);
  5241. data.seconds = mathAbs(data.seconds);
  5242. data.minutes = mathAbs(data.minutes);
  5243. data.hours = mathAbs(data.hours);
  5244. data.months = mathAbs(data.months);
  5245. data.years = mathAbs(data.years);
  5246. return this;
  5247. }
  5248. function duration_add_subtract__addSubtract (duration, input, value, direction) {
  5249. var other = create__createDuration(input, value);
  5250. duration._milliseconds += direction * other._milliseconds;
  5251. duration._days += direction * other._days;
  5252. duration._months += direction * other._months;
  5253. return duration._bubble();
  5254. }
  5255. // supports only 2.0-style add(1, 's') or add(duration)
  5256. function duration_add_subtract__add (input, value) {
  5257. return duration_add_subtract__addSubtract(this, input, value, 1);
  5258. }
  5259. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5260. function duration_add_subtract__subtract (input, value) {
  5261. return duration_add_subtract__addSubtract(this, input, value, -1);
  5262. }
  5263. function absCeil (number) {
  5264. if (number < 0) {
  5265. return Math.floor(number);
  5266. } else {
  5267. return Math.ceil(number);
  5268. }
  5269. }
  5270. function bubble () {
  5271. var milliseconds = this._milliseconds;
  5272. var days = this._days;
  5273. var months = this._months;
  5274. var data = this._data;
  5275. var seconds, minutes, hours, years, monthsFromDays;
  5276. // if we have a mix of positive and negative values, bubble down first
  5277. // check: https://github.com/moment/moment/issues/2166
  5278. if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
  5279. (milliseconds <= 0 && days <= 0 && months <= 0))) {
  5280. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5281. days = 0;
  5282. months = 0;
  5283. }
  5284. // The following code bubbles up values, see the tests for
  5285. // examples of what that means.
  5286. data.milliseconds = milliseconds % 1000;
  5287. seconds = absFloor(milliseconds / 1000);
  5288. data.seconds = seconds % 60;
  5289. minutes = absFloor(seconds / 60);
  5290. data.minutes = minutes % 60;
  5291. hours = absFloor(minutes / 60);
  5292. data.hours = hours % 24;
  5293. days += absFloor(hours / 24);
  5294. // convert days to months
  5295. monthsFromDays = absFloor(daysToMonths(days));
  5296. months += monthsFromDays;
  5297. days -= absCeil(monthsToDays(monthsFromDays));
  5298. // 12 months -> 1 year
  5299. years = absFloor(months / 12);
  5300. months %= 12;
  5301. data.days = days;
  5302. data.months = months;
  5303. data.years = years;
  5304. return this;
  5305. }
  5306. function daysToMonths (days) {
  5307. // 400 years have 146097 days (taking into account leap year rules)
  5308. // 400 years have 12 months === 4800
  5309. return days * 4800 / 146097;
  5310. }
  5311. function monthsToDays (months) {
  5312. // the reverse of daysToMonths
  5313. return months * 146097 / 4800;
  5314. }
  5315. function as (units) {
  5316. var days;
  5317. var months;
  5318. var milliseconds = this._milliseconds;
  5319. units = normalizeUnits(units);
  5320. if (units === 'month' || units === 'year') {
  5321. days = this._days + milliseconds / 864e5;
  5322. months = this._months + daysToMonths(days);
  5323. return units === 'month' ? months : months / 12;
  5324. } else {
  5325. // handle milliseconds separately because of floating point math errors (issue #1867)
  5326. days = this._days + Math.round(monthsToDays(this._months));
  5327. switch (units) {
  5328. case 'week' : return days / 7 + milliseconds / 6048e5;
  5329. case 'day' : return days + milliseconds / 864e5;
  5330. case 'hour' : return days * 24 + milliseconds / 36e5;
  5331. case 'minute' : return days * 1440 + milliseconds / 6e4;
  5332. case 'second' : return days * 86400 + milliseconds / 1000;
  5333. // Math.floor prevents floating point math errors here
  5334. case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
  5335. default: throw new Error('Unknown unit ' + units);
  5336. }
  5337. }
  5338. }
  5339. // TODO: Use this.as('ms')?
  5340. function duration_as__valueOf () {
  5341. return (
  5342. this._milliseconds +
  5343. this._days * 864e5 +
  5344. (this._months % 12) * 2592e6 +
  5345. toInt(this._months / 12) * 31536e6
  5346. );
  5347. }
  5348. function makeAs (alias) {
  5349. return function () {
  5350. return this.as(alias);
  5351. };
  5352. }
  5353. var asMilliseconds = makeAs('ms');
  5354. var asSeconds = makeAs('s');
  5355. var asMinutes = makeAs('m');
  5356. var asHours = makeAs('h');
  5357. var asDays = makeAs('d');
  5358. var asWeeks = makeAs('w');
  5359. var asMonths = makeAs('M');
  5360. var asYears = makeAs('y');
  5361. function duration_get__get (units) {
  5362. units = normalizeUnits(units);
  5363. return this[units + 's']();
  5364. }
  5365. function makeGetter(name) {
  5366. return function () {
  5367. return this._data[name];
  5368. };
  5369. }
  5370. var milliseconds = makeGetter('milliseconds');
  5371. var seconds = makeGetter('seconds');
  5372. var minutes = makeGetter('minutes');
  5373. var hours = makeGetter('hours');
  5374. var days = makeGetter('days');
  5375. var months = makeGetter('months');
  5376. var years = makeGetter('years');
  5377. function weeks () {
  5378. return absFloor(this.days() / 7);
  5379. }
  5380. var round = Math.round;
  5381. var thresholds = {
  5382. s: 45, // seconds to minute
  5383. m: 45, // minutes to hour
  5384. h: 22, // hours to day
  5385. d: 26, // days to month
  5386. M: 11 // months to year
  5387. };
  5388. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5389. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5390. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5391. }
  5392. function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
  5393. var duration = create__createDuration(posNegDuration).abs();
  5394. var seconds = round(duration.as('s'));
  5395. var minutes = round(duration.as('m'));
  5396. var hours = round(duration.as('h'));
  5397. var days = round(duration.as('d'));
  5398. var months = round(duration.as('M'));
  5399. var years = round(duration.as('y'));
  5400. var a = seconds < thresholds.s && ['s', seconds] ||
  5401. minutes <= 1 && ['m'] ||
  5402. minutes < thresholds.m && ['mm', minutes] ||
  5403. hours <= 1 && ['h'] ||
  5404. hours < thresholds.h && ['hh', hours] ||
  5405. days <= 1 && ['d'] ||
  5406. days < thresholds.d && ['dd', days] ||
  5407. months <= 1 && ['M'] ||
  5408. months < thresholds.M && ['MM', months] ||
  5409. years <= 1 && ['y'] || ['yy', years];
  5410. a[2] = withoutSuffix;
  5411. a[3] = +posNegDuration > 0;
  5412. a[4] = locale;
  5413. return substituteTimeAgo.apply(null, a);
  5414. }
  5415. // This function allows you to set the rounding function for relative time strings
  5416. function duration_humanize__getSetRelativeTimeRounding (roundingFunction) {
  5417. if (roundingFunction === undefined) {
  5418. return round;
  5419. }
  5420. if (typeof(roundingFunction) === 'function') {
  5421. round = roundingFunction;
  5422. return true;
  5423. }
  5424. return false;
  5425. }
  5426. // This function allows you to set a threshold for relative time strings
  5427. function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
  5428. if (thresholds[threshold] === undefined) {
  5429. return false;
  5430. }
  5431. if (limit === undefined) {
  5432. return thresholds[threshold];
  5433. }
  5434. thresholds[threshold] = limit;
  5435. return true;
  5436. }
  5437. function humanize (withSuffix) {
  5438. var locale = this.localeData();
  5439. var output = duration_humanize__relativeTime(this, !withSuffix, locale);
  5440. if (withSuffix) {
  5441. output = locale.pastFuture(+this, output);
  5442. }
  5443. return locale.postformat(output);
  5444. }
  5445. var iso_string__abs = Math.abs;
  5446. function iso_string__toISOString() {
  5447. // for ISO strings we do not use the normal bubbling rules:
  5448. // * milliseconds bubble up until they become hours
  5449. // * days do not bubble at all
  5450. // * months bubble up until they become years
  5451. // This is because there is no context-free conversion between hours and days
  5452. // (think of clock changes)
  5453. // and also not between days and months (28-31 days per month)
  5454. var seconds = iso_string__abs(this._milliseconds) / 1000;
  5455. var days = iso_string__abs(this._days);
  5456. var months = iso_string__abs(this._months);
  5457. var minutes, hours, years;
  5458. // 3600 seconds -> 60 minutes -> 1 hour
  5459. minutes = absFloor(seconds / 60);
  5460. hours = absFloor(minutes / 60);
  5461. seconds %= 60;
  5462. minutes %= 60;
  5463. // 12 months -> 1 year
  5464. years = absFloor(months / 12);
  5465. months %= 12;
  5466. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5467. var Y = years;
  5468. var M = months;
  5469. var D = days;
  5470. var h = hours;
  5471. var m = minutes;
  5472. var s = seconds;
  5473. var total = this.asSeconds();
  5474. if (!total) {
  5475. // this is the same as C#'s (Noda) and python (isodate)...
  5476. // but not other JS (goog.date)
  5477. return 'P0D';
  5478. }
  5479. return (total < 0 ? '-' : '') +
  5480. 'P' +
  5481. (Y ? Y + 'Y' : '') +
  5482. (M ? M + 'M' : '') +
  5483. (D ? D + 'D' : '') +
  5484. ((h || m || s) ? 'T' : '') +
  5485. (h ? h + 'H' : '') +
  5486. (m ? m + 'M' : '') +
  5487. (s ? s + 'S' : '');
  5488. }
  5489. var duration_prototype__proto = Duration.prototype;
  5490. duration_prototype__proto.abs = duration_abs__abs;
  5491. duration_prototype__proto.add = duration_add_subtract__add;
  5492. duration_prototype__proto.subtract = duration_add_subtract__subtract;
  5493. duration_prototype__proto.as = as;
  5494. duration_prototype__proto.asMilliseconds = asMilliseconds;
  5495. duration_prototype__proto.asSeconds = asSeconds;
  5496. duration_prototype__proto.asMinutes = asMinutes;
  5497. duration_prototype__proto.asHours = asHours;
  5498. duration_prototype__proto.asDays = asDays;
  5499. duration_prototype__proto.asWeeks = asWeeks;
  5500. duration_prototype__proto.asMonths = asMonths;
  5501. duration_prototype__proto.asYears = asYears;
  5502. duration_prototype__proto.valueOf = duration_as__valueOf;
  5503. duration_prototype__proto._bubble = bubble;
  5504. duration_prototype__proto.get = duration_get__get;
  5505. duration_prototype__proto.milliseconds = milliseconds;
  5506. duration_prototype__proto.seconds = seconds;
  5507. duration_prototype__proto.minutes = minutes;
  5508. duration_prototype__proto.hours = hours;
  5509. duration_prototype__proto.days = days;
  5510. duration_prototype__proto.weeks = weeks;
  5511. duration_prototype__proto.months = months;
  5512. duration_prototype__proto.years = years;
  5513. duration_prototype__proto.humanize = humanize;
  5514. duration_prototype__proto.toISOString = iso_string__toISOString;
  5515. duration_prototype__proto.toString = iso_string__toISOString;
  5516. duration_prototype__proto.toJSON = iso_string__toISOString;
  5517. duration_prototype__proto.locale = locale;
  5518. duration_prototype__proto.localeData = localeData;
  5519. // Deprecations
  5520. duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
  5521. duration_prototype__proto.lang = lang;
  5522. // Side effect imports
  5523. // FORMATTING
  5524. addFormatToken('X', 0, 0, 'unix');
  5525. addFormatToken('x', 0, 0, 'valueOf');
  5526. // PARSING
  5527. addRegexToken('x', matchSigned);
  5528. addRegexToken('X', matchTimestamp);
  5529. addParseToken('X', function (input, array, config) {
  5530. config._d = new Date(parseFloat(input, 10) * 1000);
  5531. });
  5532. addParseToken('x', function (input, array, config) {
  5533. config._d = new Date(toInt(input));
  5534. });
  5535. // Side effect imports
  5536. utils_hooks__hooks.version = '2.15.2';
  5537. setHookCallback(local__createLocal);
  5538. utils_hooks__hooks.fn = momentPrototype;
  5539. utils_hooks__hooks.min = min;
  5540. utils_hooks__hooks.max = max;
  5541. utils_hooks__hooks.now = now;
  5542. utils_hooks__hooks.utc = create_utc__createUTC;
  5543. utils_hooks__hooks.unix = moment__createUnix;
  5544. utils_hooks__hooks.months = lists__listMonths;
  5545. utils_hooks__hooks.isDate = isDate;
  5546. utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
  5547. utils_hooks__hooks.invalid = valid__createInvalid;
  5548. utils_hooks__hooks.duration = create__createDuration;
  5549. utils_hooks__hooks.isMoment = isMoment;
  5550. utils_hooks__hooks.weekdays = lists__listWeekdays;
  5551. utils_hooks__hooks.parseZone = moment__createInZone;
  5552. utils_hooks__hooks.localeData = locale_locales__getLocale;
  5553. utils_hooks__hooks.isDuration = isDuration;
  5554. utils_hooks__hooks.monthsShort = lists__listMonthsShort;
  5555. utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
  5556. utils_hooks__hooks.defineLocale = defineLocale;
  5557. utils_hooks__hooks.updateLocale = updateLocale;
  5558. utils_hooks__hooks.locales = locale_locales__listLocales;
  5559. utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
  5560. utils_hooks__hooks.normalizeUnits = normalizeUnits;
  5561. utils_hooks__hooks.relativeTimeRounding = duration_humanize__getSetRelativeTimeRounding;
  5562. utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
  5563. utils_hooks__hooks.calendarFormat = getCalendarFormat;
  5564. utils_hooks__hooks.prototype = momentPrototype;
  5565. var _moment = utils_hooks__hooks;
  5566. return _moment;
  5567. }));
  5568. define('moment', ['moment/moment'], function (main) { return main; });
  5569. /*
  5570. * css.normalize.js
  5571. *
  5572. * CSS Normalization
  5573. *
  5574. * CSS paths are normalized based on an optional basePath and the RequireJS config
  5575. *
  5576. * Usage:
  5577. * normalize(css, fromBasePath, toBasePath);
  5578. *
  5579. * css: the stylesheet content to normalize
  5580. * fromBasePath: the absolute base path of the css relative to any root (but without ../ backtracking)
  5581. * toBasePath: the absolute new base path of the css relative to the same root
  5582. *
  5583. * Absolute dependencies are left untouched.
  5584. *
  5585. * Urls in the CSS are picked up by regular expressions.
  5586. * These will catch all statements of the form:
  5587. *
  5588. * url(*)
  5589. * url('*')
  5590. * url("*")
  5591. *
  5592. * @import '*'
  5593. * @import "*"
  5594. *
  5595. * (and so also @import url(*) variations)
  5596. *
  5597. * For urls needing normalization
  5598. *
  5599. */
  5600. define('../libs/require-css/normalize',[],function() {
  5601. // regular expression for removing double slashes
  5602. // eg http://www.example.com//my///url/here -> http://www.example.com/my/url/here
  5603. var slashes = /([^:])\/+/g
  5604. var removeDoubleSlashes = function(uri) {
  5605. return uri.replace(slashes, '$1/');
  5606. }
  5607. // given a relative URI, and two absolute base URIs, convert it from one base to another
  5608. var protocolRegEx = /[^\:\/]*:\/\/([^\/])*/;
  5609. var absUrlRegEx = /^(\/|data:)/;
  5610. function convertURIBase(uri, fromBase, toBase) {
  5611. if (uri.match(absUrlRegEx) || uri.match(protocolRegEx))
  5612. return uri;
  5613. uri = removeDoubleSlashes(uri);
  5614. // if toBase specifies a protocol path, ensure this is the same protocol as fromBase, if not
  5615. // use absolute path at fromBase
  5616. var toBaseProtocol = toBase.match(protocolRegEx);
  5617. var fromBaseProtocol = fromBase.match(protocolRegEx);
  5618. if (fromBaseProtocol && (!toBaseProtocol || toBaseProtocol[1] != fromBaseProtocol[1] || toBaseProtocol[2] != fromBaseProtocol[2]))
  5619. return absoluteURI(uri, fromBase);
  5620. else {
  5621. return relativeURI(absoluteURI(uri, fromBase), toBase);
  5622. }
  5623. };
  5624. // given a relative URI, calculate the absolute URI
  5625. function absoluteURI(uri, base) {
  5626. if (uri.substr(0, 2) == './')
  5627. uri = uri.substr(2);
  5628. // absolute urls are left in tact
  5629. if (uri.match(absUrlRegEx) || uri.match(protocolRegEx))
  5630. return uri;
  5631. var baseParts = base.split('/');
  5632. var uriParts = uri.split('/');
  5633. baseParts.pop();
  5634. while (curPart = uriParts.shift())
  5635. if (curPart == '..')
  5636. baseParts.pop();
  5637. else
  5638. baseParts.push(curPart);
  5639. return baseParts.join('/');
  5640. };
  5641. // given an absolute URI, calculate the relative URI
  5642. function relativeURI(uri, base) {
  5643. // reduce base and uri strings to just their difference string
  5644. var baseParts = base.split('/');
  5645. baseParts.pop();
  5646. base = baseParts.join('/') + '/';
  5647. i = 0;
  5648. while (base.substr(i, 1) == uri.substr(i, 1))
  5649. i++;
  5650. while (base.substr(i, 1) != '/')
  5651. i--;
  5652. base = base.substr(i + 1);
  5653. uri = uri.substr(i + 1);
  5654. // each base folder difference is thus a backtrack
  5655. baseParts = base.split('/');
  5656. var uriParts = uri.split('/');
  5657. out = '';
  5658. while (baseParts.shift())
  5659. out += '../';
  5660. // finally add uri parts
  5661. while (curPart = uriParts.shift())
  5662. out += curPart + '/';
  5663. return out.substr(0, out.length - 1);
  5664. };
  5665. var normalizeCSS = function(source, fromBase, toBase) {
  5666. fromBase = removeDoubleSlashes(fromBase);
  5667. toBase = removeDoubleSlashes(toBase);
  5668. var urlRegEx = /@import\s*("([^"]*)"|'([^']*)')|url\s*\((?!#)\s*(\s*"([^"]*)"|'([^']*)'|[^\)]*\s*)\s*\)/ig;
  5669. var result, url, source;
  5670. while (result = urlRegEx.exec(source)) {
  5671. url = result[3] || result[2] || result[5] || result[6] || result[4];
  5672. var newUrl;
  5673. newUrl = convertURIBase(url, fromBase, toBase);
  5674. var quoteLen = result[5] || result[6] ? 1 : 0;
  5675. source = source.substr(0, urlRegEx.lastIndex - url.length - quoteLen - 1) + newUrl + source.substr(urlRegEx.lastIndex - quoteLen - 1);
  5676. urlRegEx.lastIndex = urlRegEx.lastIndex + (newUrl.length - url.length);
  5677. }
  5678. return source;
  5679. };
  5680. normalizeCSS.convertURIBase = convertURIBase;
  5681. normalizeCSS.absoluteURI = absoluteURI;
  5682. normalizeCSS.relativeURI = relativeURI;
  5683. return normalizeCSS;
  5684. });
  5685. ;
  5686. define('../libs/require-css/css.min!../libs/bootstrap-table/dist/bootstrap-table.min',[],function(){});
  5687. /*
  5688. * bootstrap-table - v1.11.0 - 2016-07-02
  5689. * https://github.com/wenzhixin/bootstrap-table
  5690. * Copyright (c) 2016 zhixin wen
  5691. * Licensed MIT License
  5692. */
  5693. !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(b){var c=0;return b.children().each(function(){c<a(this).outerHeight(!0)&&(c=a(this).outerHeight(!0))}),c},l=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},m=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)d=d&&d[e[f]];return c?j(d):d},n=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},o=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}}())},p=function(b,c){this.options=c,this.$el=a(b),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};p.DEFAULTS={classes:"table table-hover",locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",sortStable:!1,striped:!1,columns:[[]],data:[],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,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}},p.LOCALES={},p.LOCALES["en-US"]=p.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(p.DEFAULTS,p.LOCALES["en-US"]),p.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},p.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"},p.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},p.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]])}},p.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")},p.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({},p.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=l(a(this).data()),a(this).find(">td").each(function(d){for(var g,h,i=a(this),j=+i.attr("colspan")||1,k=+i.attr("rowspan")||1;e[c]&&e[c][d];d++);for(g=d;d+j>g;g++)for(h=c;c+k>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"]=l(a(this).data())}),d.push(f)}),this.options.data=d,d.length&&(this.fromHtml=!0)}},p.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="",j="",k=c(' class="%s"',f["class"]),l=(b.options.sortOrder||f.order,"px"),m=f.width;if(void 0===f.width||b.options.cardView||"string"==typeof f.width&&-1!==f.width.indexOf("%")&&(l="%"),f.width&&"string"==typeof f.width&&(m=f.width.replace("%","").replace("px","")),h=c("text-align: %s; ",f.halign?f.halign:f.align),i=c("text-align: %s; ",f.align),j=c("vertical-align: %s; ",f.valign),j+=c("width: %s; ",!f.checkbox&&!f.radio||m?m?m+l:void 0:"36px"),"undefined"!=typeof f.fieldIndex){if(b.header.fields[f.fieldIndex]=f.field,b.header.styles[f.fieldIndex]=i+j,b.header.classes[f.fieldIndex]=k,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"]||""):k,c(' style="%s"',h+j),c(' rowspan="%s"',f.rowspan),c(' colspan="%s"',f.colspan),c(' data-field="%s"',f.field),"tabindex='0'",">"),e.push(c('<div class="th-inner %s">',b.options.sortable&&f.sortable?"sortable both":"")),g=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()})},p.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},p.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()},p.prototype.initSort=function(){var b=this,c=this.options.sortName,d="desc"===this.options.sortOrder?-1:1,e=a.inArray(this.options.sortName,this.header.fields);return this.options.customSort!==a.noop?void this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]):void(-1!==e&&(this.options.sortStable&&a.each(this.data,function(a,b){b.hasOwnProperty("_position")||(b._position=a)}),this.data.sort(function(f,g){b.header.sortNames[e]&&(c=b.header.sortNames[e]);var i=m(f,c,b.options.escape),j=m(g,c,b.options.escape),k=h(b.header,b.header.sorters[e],[i,j]);return void 0!==k?d*k:((void 0===i||null===i)&&(i=""),(void 0===j||null===j)&&(j=""),b.options.sortStable&&i===j&&(i=f._position,j=g._position),a.isNumeric(i)&&a.isNumeric(j)?(i=parseFloat(i),j=parseFloat(j),j>i?-1*d:d):i===j?0:("string"!=typeof i&&(i=i.toString()),-1===i.localeCompare(j)?-1*d:d))})))},p.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())},p.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" 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" 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" 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" 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><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").on("keyup drop",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))}),n()&&d.off("mouseup").on("mouseup",function(a){clearTimeout(g),g=setTimeout(function(){e.onSearch(a)},e.options.searchTimeOut)}))},p.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))},p.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])||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}},p.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%s><a href="javascript:void(0)">%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="javascript:void(0)">'+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="javascript:void(0)">',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="javascript:void(0)">...</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="javascript:void(0)">',b,"</a>","</li>");this.totalPages>=8&&this.options.pageNumber<=this.totalPages-4&&m.push('<li class="page-last-separator disabled">','<a href="javascript:void(0)">...</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="javascript:void(0)">',this.totalPages,"</a>","</li>"),m.push('<li class="page-next"><a href="javascript:void(0)">'+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"]()),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)))},p.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))},p.prototype.onPageListChange=function(b){var c=a(b.currentTarget);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)},p.prototype.onPageFirst=function(a){this.options.pageNumber=1,this.updatePagination(a)},p.prototype.onPagePre=function(a){this.options.pageNumber-1===0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(a)},p.prototype.onPageNext=function(a){this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(a)},p.prototype.onPageLast=function(a){this.options.pageNumber=this.totalPages,this.updatePagination(a)},p.prototype.onPageNumber=function(b){this.options.pageNumber!==+a(b.currentTarget).text()&&(this.options.pageNumber=+a(b.currentTarget).text(),this.updatePagination(b))},p.prototype.initBody=function(b){var f=this,g=[],i=this.getData();this.trigger("pre-body",i),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=i.length);for(var k=this.pageFrom-1;k<this.pageTo;k++){var l,n=i[k],o={},p=[],q="",r={},s=[];if(o=h(this.options,this.options.rowStyle,[n,k],o),o&&o.css)for(l in o.css)p.push(l+": "+o.css[l]);if(r=h(this.options,this.options.rowAttributes,[n,k],r))for(l in r)s.push(c('%s="%s"',l,j(r[l])));n._data&&!a.isEmptyObject(n._data)&&a.each(n._data,function(a,b){"index"!==a&&(q+=c(' data-%s="%s"',a,b))}),g.push("<tr",c(" %s",s.join(" ")),c(' id="%s"',a.isArray(n)?void 0:n._id),c(' class="%s"',o.classes||(a.isArray(n)?void 0:n._class)),c(' data-index="%s"',k),c(' data-uniqueid="%s"',n[this.options.uniqueId]),c("%s",q),">"),this.options.cardView&&g.push(c('<td colspan="%s"><div class="card-views">',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&g.push("<td>",'<a class="detail-icon" href="javascript:">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>"),a.each(this.header.fields,function(b,e){var i="",j=m(n,e,f.options.escape),l="",q={},r="",s=f.header.classes[b],t="",u="",v="",w="",x=f.columns[b];if(!(f.fromHtml&&"undefined"==typeof j||!x.visible||f.options.cardView&&!x.cardVisible)){if(o=c('style="%s"',p.concat(f.header.styles[b]).join("; ")),n["_"+e+"_id"]&&(r=c(' id="%s"',n["_"+e+"_id"])),n["_"+e+"_class"]&&(s=c(' class="%s"',n["_"+e+"_class"])),n["_"+e+"_rowspan"]&&(u=c(' rowspan="%s"',n["_"+e+"_rowspan"])),n["_"+e+"_colspan"]&&(v=c(' colspan="%s"',n["_"+e+"_colspan"])),n["_"+e+"_title"]&&(w=c(' title="%s"',n["_"+e+"_title"])),q=h(f.header,f.header.cellStyles[b],[j,n,k,e],q),q.classes&&(s=c(' class="%s"',q.classes)),q.css){var y=[];for(var z in q.css)y.push(z+": "+q.css[z]);o=c('style="%s"',y.concat(f.header.styles[b]).join("; "))}j=h(x,f.header.formatters[b],[j,n,k],j),n["_"+e+"_data"]&&!a.isEmptyObject(n["_"+e+"_data"])&&a.each(n["_"+e+"_data"],function(a,b){"index"!==a&&(t+=c(' data-%s="%s"',a,b))}),x.checkbox||x.radio?(l=x.checkbox?"checkbox":l,l=x.radio?"radio":l,i=[c(f.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',x["class"]||""),"<input"+c(' data-index="%s"',k)+c(' name="%s"',f.options.selectItemName)+c(' type="%s"',l)+c(' value="%s"',n[f.options.idField])+c(' checked="%s"',j===!0||j&&j.checked?"checked":void 0)+c(' disabled="%s"',!x.checkboxEnabled||j&&j.disabled?"disabled":void 0)+" />",f.header.formatters[b]&&"string"==typeof j?j:"",f.options.cardView?"</div>":"</td>"].join(""),n[f.header.stateField]=j===!0||j&&j.checked):(j="undefined"==typeof j||null===j?f.options.undefinedText:j,i=f.options.cardView?['<div class="card-view">',f.options.showHeader?c('<span class="title" %s>%s</span>',o,d(f.columns,"field","title",e)):"",c('<span class="value">%s</span>',j),"</div>"].join(""):[c("<td%s %s %s %s %s %s %s>",r,s,o,t,u,v,w),j,"</td>"].join(""),f.options.cardView&&f.options.smartDisplay&&""===j&&(i='<div class="card-view"></div>')),g.push(i)}}),this.options.cardView&&g.push("</div></td>"),g.push("</tr>")}g.length||g.push('<tr class="no-records-found">',c('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches()),"</tr>"),this.$body.html(g.join("")),b||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(b){var d=a(this),g=d.parent(),h=f.data[g.data("index")],i=d[0].cellIndex,j=f.getVisibleFields(),k=j[f.options.detailView&&!f.options.cardView?i-1:i],l=f.columns[e(f.columns,k)],n=m(h,k,f.options.escape);if(!d.find(".detail-icon").length&&(f.trigger("click"===b.type?"click-cell":"dbl-click-cell",k,n,h,d),f.trigger("click"===b.type?"click-row":"dbl-click-row",h,g,k),
  5694. "click"===b.type&&f.options.clickToSelect&&l.clickToSelect)){var o=g.find(c('[name="%s"]',f.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),d=b.parent().parent(),e=d.data("index"),g=i[e];if(d.next().is("tr.detail-view"))b.find("i").attr("class",c("%s %s",f.options.iconsPrefix,f.options.icons.detailOpen)),d.next().remove(),f.trigger("collapse-row",e,g);else{b.find("i").attr("class",c("%s %s",f.options.iconsPrefix,f.options.icons.detailClose)),d.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>',d.find("td").length));var j=d.next().find("td"),k=h(f.options,f.options.detailFormatter,[e,g,j],"");1===j.length&&j.append(k),f.trigger("expand-row",e,g,j)}f.resetView()}),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),d=c.prop("checked"),e=f.data[c.data("index")];f.options.maintainSelected&&a(this).is(":radio")&&a.each(f.options.data,function(a,b){b[f.header.stateField]=!1}),e[f.header.stateField]=d,f.options.singleSelect&&(f.$selectItem.not(this).each(function(){f.data[a(this).data("index")][f.header.stateField]=!1}),f.$selectItem.filter(":checked").not(this).prop("checked",!1)),f.updateSelected(),f.trigger(d?"check":"uncheck",e,c)}),a.each(this.header.events,function(b,c){if(c){"string"==typeof c&&(c=h(null,c));var d=f.header.fields[b],e=a.inArray(d,f.getVisibleFields());f.options.detailView&&!f.options.cardView&&(e+=1);for(var g in c)f.$body.find(">tr:not(.no-records-found)").each(function(){var b=a(this),h=b.find(f.options.cardView?".card-view":"td").eq(e),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"),e=f.data[c],g=e[d];l.apply(this,[a,g,e,c])})})}}),this.updateSelected(),this.resetView(),this.trigger("post-body",i)},p.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))))},p.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})}},p.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")})},p.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")})},p.prototype.updateRows=function(){var b=this;this.$selectItem.each(function(){b.data[a(this).data("index")][b.header.stateField]=a(this).prop("checked")})},p.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)})},p.prototype.trigger=function(b){var c=Array.prototype.slice.call(arguments,1);b+=".bs.table",this.options[p.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])},p.prototype.resetHeader=function(){clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(a.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)},p.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")},p.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))},p.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())}))},p.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)}},p.prototype.toggleRow=function(a,b,d){-1!==a&&this.$body.find("undefined"!=typeof a?c('tr[data-index="%s"]',a):c('tr[data-uniqueid="%s"]',b))[d?"show":"hide"]()},p.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},p.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=k(this.$toolbar),d=k(this.$pagination),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"))},p.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},p.prototype.load=function(b){var c=!1;"server"===this.options.sidePagination?(this.options.totalRows=b.total,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)},p.prototype.append=function(a){this.initData(a,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},p.prototype.prepend=function(a){this.initData(a,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},p.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);e!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},p.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},p.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},p.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))},p.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.initSort(),this.initBody(!0)},p.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))},p.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.initSort(),this.initBody(!0)},p.prototype.showRow=function(a){(a.hasOwnProperty("index")||a.hasOwnProperty("uniqueId"))&&this.toggleRow(a.index,a.uniqueId,!0)},p.prototype.hideRow=function(a){(a.hasOwnProperty("index")||a.hasOwnProperty("uniqueId"))&&this.toggleRow(a.index,a.uniqueId,!1)},p.prototype.getRowsHidden=function(b){var c=a(this.$body[0]).children().filter(":hidden"),d=0;if(b)for(;d<c.length;d++)a(c[d]).show();return c},p.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()}},p.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)))},p.prototype.getOptions=function(){return this.options},p.prototype.getSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},p.prototype.getAllSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},p.prototype.checkAll=function(){this.checkAll_(!0)},p.prototype.uncheckAll=function(){this.checkAll_(!1)},p.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)},p.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)},p.prototype.check=function(a){this.check_(!0,a)},p.prototype.uncheck=function(a){this.check_(!1,a)},p.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)},p.prototype.checkBy=function(a){this.checkBy_(!0,a)},p.prototype.uncheckBy=function(a){this.checkBy_(!1,a)},p.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)}},p.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")||"")},p.prototype.showLoading=function(){this.$tableLoading.show()},p.prototype.hideLoading=function(){this.$tableLoading.hide()},p.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()},p.prototype.refresh=function(a){a&&a.url&&(this.options.pageNumber=1),this.initServer(a&&a.silent,a&&a.query,a&&a.url),this.trigger("refresh",a)},p.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},p.prototype.showColumn=function(a){this.toggleColumn(e(this.columns,a),!0,!0)},p.prototype.hideColumn=function(a){this.toggleColumn(e(this.columns,a),!1,!0)},p.prototype.getHiddenColumns=function(){return a.grep(this.columns,function(a){return!a.visible})},p.prototype.getVisibleColumns=function(){return a.grep(this.columns,function(a){return a.visible})},p.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)}},p.prototype.showAllColumns=function(){this.toggleAllColumns(!0)},p.prototype.hideAllColumns=function(){this.toggleAllColumns(!1)},p.prototype.filterBy=function(b){this.filterColumns=a.isEmptyObject(b)?{}:b,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},p.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},p.prototype.getScrollPosition=function(){return this.scrollTo()},p.prototype.selectPage=function(a){a>0&&a<=this.options.totalPages&&(this.options.pageNumber=a,this.updatePagination())},p.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},p.prototype.nextPage=function(){this.options.pageNumber<this.options.totalPages&&(this.options.pageNumber++,this.updatePagination())},p.prototype.toggleView=function(){this.options.cardView=!this.options.cardView,this.initHeader(),this.initBody(),this.trigger("toggle",this.options.cardView)},p.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())},p.prototype.resetSearch=function(a){var b=this.$toolbar.find(".search input");b.val(a||""),this.onSearch({currentTarget:b})},p.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()},p.prototype.expandRow=function(a){this.expandRow_(!0,a)},p.prototype.collapseRow=function(a){this.expandRow_(!1,a)},p.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"))},p.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"))},p.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 q=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getRowsHidden","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({},p.DEFAULTS,e.data(),"object"==typeof b&&b);if("string"==typeof b){if(a.inArray(b,q)<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 p(this,g))}),"undefined"==typeof c?this:c},a.fn.bootstrapTable.Constructor=p,a.fn.bootstrapTable.defaults=p.DEFAULTS,a.fn.bootstrapTable.columnDefaults=p.COLUMN_DEFAULTS,a.fn.bootstrapTable.locales=p.LOCALES,a.fn.bootstrapTable.methods=q,a.fn.bootstrapTable.utils={sprintf:c,getFieldIndex:e,compareObjects:i,calculateObjectValue:h,getItemField:m,objectKeys:o,isIEBrowser:n},a(function(){a('[data-toggle="table"]').bootstrapTable()})}(jQuery);
  5695. define("bootstrap-table", ["bootstrap","css!../libs/bootstrap-table/dist/bootstrap-table.min.css"], (function (global) {
  5696. return function () {
  5697. var ret, fn;
  5698. return ret || global.$.fn.bootstrapTable;
  5699. };
  5700. }(this)));
  5701. /**
  5702. * Bootstrap Table Chinese translation
  5703. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  5704. */
  5705. (function ($) {
  5706. 'use strict';
  5707. $.fn.bootstrapTable.locales['zh-CN'] = {
  5708. formatLoadingMessage: function () {
  5709. return '正在努力地加载数据中,请稍候……';
  5710. },
  5711. formatRecordsPerPage: function (pageNumber) {
  5712. return '每页显示 ' + pageNumber + ' 条记录';
  5713. },
  5714. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  5715. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  5716. },
  5717. formatSearch: function () {
  5718. return '搜索';
  5719. },
  5720. formatNoMatches: function () {
  5721. return '没有找到匹配的记录';
  5722. },
  5723. formatPaginationSwitch: function () {
  5724. return '隐藏/显示分页';
  5725. },
  5726. formatRefresh: function () {
  5727. return '刷新';
  5728. },
  5729. formatToggle: function () {
  5730. return '切换';
  5731. },
  5732. formatColumns: function () {
  5733. return '列';
  5734. },
  5735. formatExport: function () {
  5736. return '导出数据';
  5737. },
  5738. formatClearFilters: function () {
  5739. return '清空过滤';
  5740. }
  5741. };
  5742. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  5743. })(jQuery);
  5744. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  5745. return function () {
  5746. var ret, fn;
  5747. return ret || global.$.fn.bootstrapTable.defaults;
  5748. };
  5749. }(this)));
  5750. /**
  5751. * @author: Dennis Hernández
  5752. * @webSite: http://djhvscf.github.io/Blog
  5753. * @version: v1.1.0
  5754. */
  5755. !function ($) {
  5756. 'use strict';
  5757. var showHideColumns = function (that, checked) {
  5758. if (that.options.columnsHidden.length > 0 ) {
  5759. $.each(that.columns, function (i, column) {
  5760. if (that.options.columnsHidden.indexOf(column.field) !== -1) {
  5761. if (column.visible !== checked) {
  5762. that.toggleColumn($.fn.bootstrapTable.utils.getFieldIndex(that.columns, column.field), checked, true);
  5763. }
  5764. }
  5765. });
  5766. }
  5767. };
  5768. var resetView = function (that) {
  5769. if (that.options.height || that.options.showFooter) {
  5770. setTimeout(function(){
  5771. that.resetView.call(that);
  5772. }, 1);
  5773. }
  5774. };
  5775. var changeView = function (that, width, height) {
  5776. if (that.options.minHeight) {
  5777. if ((width <= that.options.minWidth) && (height <= that.options.minHeight)) {
  5778. conditionCardView(that);
  5779. } else if ((width > that.options.minWidth) && (height > that.options.minHeight)) {
  5780. conditionFullView(that);
  5781. }
  5782. } else {
  5783. if (width <= that.options.minWidth) {
  5784. conditionCardView(that);
  5785. } else if (width > that.options.minWidth) {
  5786. conditionFullView(that);
  5787. }
  5788. }
  5789. resetView(that);
  5790. };
  5791. var conditionCardView = function (that) {
  5792. changeTableView(that, false);
  5793. showHideColumns(that, false);
  5794. };
  5795. var conditionFullView = function (that) {
  5796. changeTableView(that, true);
  5797. showHideColumns(that, true);
  5798. };
  5799. var changeTableView = function (that, cardViewState) {
  5800. that.options.cardView = cardViewState;
  5801. that.toggleView();
  5802. };
  5803. var debounce = function(func,wait) {
  5804. var timeout;
  5805. return function() {
  5806. var context = this,
  5807. args = arguments;
  5808. var later = function() {
  5809. timeout = null;
  5810. func.apply(context,args);
  5811. };
  5812. clearTimeout(timeout);
  5813. timeout = setTimeout(later, wait);
  5814. };
  5815. };
  5816. $.extend($.fn.bootstrapTable.defaults, {
  5817. mobileResponsive: false,
  5818. minWidth: 562,
  5819. minHeight: undefined,
  5820. heightThreshold: 100, // just slightly larger than mobile chrome's auto-hiding toolbar
  5821. checkOnInit: true,
  5822. columnsHidden: []
  5823. });
  5824. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  5825. _init = BootstrapTable.prototype.init;
  5826. BootstrapTable.prototype.init = function () {
  5827. _init.apply(this, Array.prototype.slice.apply(arguments));
  5828. if (!this.options.mobileResponsive) {
  5829. return;
  5830. }
  5831. if (!this.options.minWidth) {
  5832. return;
  5833. }
  5834. if (this.options.minWidth < 100 && this.options.resizable) {
  5835. console.log("The minWidth when the resizable extension is active should be greater or equal than 100");
  5836. this.options.minWidth = 100;
  5837. }
  5838. var that = this,
  5839. old = {
  5840. width: $(window).width(),
  5841. height: $(window).height()
  5842. };
  5843. $(window).on('resize orientationchange',debounce(function (evt) {
  5844. // reset view if height has only changed by at least the threshold.
  5845. var height = $(this).height(),
  5846. width = $(this).width();
  5847. if (Math.abs(old.height - height) > that.options.heightThreshold || old.width != width) {
  5848. changeView(that, width, height);
  5849. old = {
  5850. width: width,
  5851. height: height
  5852. };
  5853. }
  5854. },200));
  5855. if (this.options.checkOnInit) {
  5856. var height = $(window).height(),
  5857. width = $(window).width();
  5858. changeView(this, width, height);
  5859. old = {
  5860. width: width,
  5861. height: height
  5862. };
  5863. }
  5864. };
  5865. }(jQuery);
  5866. define("bootstrap-table-mobile", ["bootstrap-table"], (function (global) {
  5867. return function () {
  5868. var ret, fn;
  5869. return ret || global.$.fn.bootstrapTable.defaults;
  5870. };
  5871. }(this)));
  5872. /*
  5873. tableExport.jquery.plugin
  5874. Copyright (c) 2015-2017 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
  5875. Original work Copyright (c) 2014 Giri Raj, https://github.com/kayalshri/
  5876. Licensed under the MIT License, http://opensource.org/licenses/mit-license
  5877. */
  5878. (function(c){c.fn.extend({tableExport:function(u){function S(b){var a=[];c(b).find("thead").first().find("th").each(function(b,d){void 0!==c(d).attr("data-field")?a[b]=c(d).attr("data-field"):a[b]=b.toString()});return a}function z(b,h,e,d,w){if(-1==c.inArray(e,a.ignoreRow)&&-1==c.inArray(e-d,a.ignoreRow)){var q=c(b).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display")||"always"==c(this).closest("table").data("tableexport-display"))}).find(h),
  5879. l=0;q.each(function(b){if("always"==c(this).data("tableexport-display")||"none"!=c(this).css("display")&&"hidden"!=c(this).css("visibility")&&"none"!=c(this).data("tableexport-display")){var d=b,h=!1;0<a.ignoreColumn.length&&("string"==typeof a.ignoreColumn[0]?H.length>d&&"undefined"!=typeof H[d]&&-1!=c.inArray(H[d],a.ignoreColumn)&&(h=!0):"number"!=typeof a.ignoreColumn[0]||-1==c.inArray(d,a.ignoreColumn)&&-1==c.inArray(d-q.length,a.ignoreColumn)||(h=!0));if(!1===h&&"function"===typeof w){var h=
  5880. 0,r,f=0;if("undefined"!=typeof A[e]&&0<A[e].length)for(d=0;d<=b;d++)"undefined"!=typeof A[e][d]&&(w(null,e,d),delete A[e][d],b++);c(this).is("[colspan]")&&(h=parseInt(c(this).attr("colspan")),l+=0<h?h-1:0);c(this).is("[rowspan]")&&(f=parseInt(c(this).attr("rowspan")));w(this,e,b);for(d=0;d<h-1;d++)w(null,e,b+d);if(f)for(r=1;r<f;r++)for("undefined"==typeof A[e+r]&&(A[e+r]=[]),A[e+r][b+l]="",d=1;d<h;d++)A[e+r][b+l-d]=""}}});if("undefined"!=typeof A[e]&&0<A[e].length)for(b=0;b<=A[e].length;b++)"undefined"!=
  5881. typeof A[e][b]&&(w(null,e,b),delete A[e][b])}}function Z(b,h){!0===a.consoleLog&&console.log(b.output());if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return F(b.output());if("window"===a.outputMode)window.open(URL.createObjectURL(b.output("blob")));else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(d){C(a.fileName+".pdf","data:application/pdf"+(h?"":";base64")+",",h?e:b.output())}}function aa(b,a,e){var d=0;"undefined"!=typeof e&&(d=e.colspan);if(0<=d){for(var h=
  5882. b.width,c=b.textPos.x,l=a.table.columns.indexOf(a.column),r=1;r<d;r++)h+=a.table.columns[l+r].width;1<d&&("right"===b.styles.halign?c=b.textPos.x+h-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(h-b.width)/2));b.width=h;b.textPos.x=c;"undefined"!=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}
  5883. function ba(b,a,e){"undefined"!=typeof e.images&&a.each(function(){var a=c(this).children();if(c(this).is("img")){var h=ca(this.src);e.images[h]={url:this.src,src:this.src}}"undefined"!=typeof a&&0<a.length&&ba(b,a,e)})}function ka(b,a){function h(b){if(b.url){var d=new Image;c=++q;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 h=document.createElement("canvas"),
  5884. e=h.getContext("2d");h.width=d.width;h.height=d.height;e.drawImage(d,0,0);b.src=h.toDataURL("image/jpeg")}--q||a(c)};d.src=b.url}}var d,c=0,q=0;if("undefined"!=typeof b.images)for(d in b.images)b.images.hasOwnProperty(d)&&h(b.images[d]);(d=q)||(a(c),d=void 0);return d}function da(b,h,e){h.each(function(){var d=c(this).children();if(c(this).is("div")){var h=N(E(this,"background-color"),[255,255,255]),q=N(E(this,"border-top-color"),[0,0,0]),l=O(this,"border-top-width",a.jspdf.unit),r=this.getBoundingClientRect(),
  5885. f=this.offsetLeft*e.dw,g=this.offsetTop*e.dh,k=r.width*e.dw,r=r.height*e.dh;e.doc.setDrawColor.apply(void 0,q);e.doc.setFillColor.apply(void 0,h);e.doc.setLineWidth(l);e.doc.rect(b.x+f,b.y+g,k,r,l?"FD":"F")}else if(c(this).is("img")&&"undefined"!=typeof e.images&&(g=ca(this.src),h=e.images[g],"undefined"!=typeof h)){q=b.width/b.height;l=this.width/this.height;f=b.width;k=b.height;g=0;l<q?(k=Math.min(b.height,this.height),f=this.width*k/this.height):l>q&&(f=Math.min(b.width,this.width),k=this.height*
  5886. f/this.width);k<b.height&&(g=(b.height-k)/2);try{e.doc.addImage(h.src,b.textPos.x,b.y+g,f,k)}catch(oa){}b.textPos.x+=f}"undefined"!=typeof d&&0<d.length&&da(b,d,e)})}function P(b,a,e){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function ea(b){b=P(b||"0",a.numbers.html.thousandsSeparator,"");b=P(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function x(b,h,e){var d="";if(null!==b){var w=c(b),q;if(w[0].hasAttribute("data-tableexport-value"))q=
  5887. w.data("tableexport-value");else if(q=w.html(),"function"===typeof a.onCellHtmlData)q=a.onCellHtmlData(w,h,e,q);else if(""!=q){b=c.parseHTML(q);var l=0,r=0;q="";c.each(b,function(){if(c(this).is("input"))q+=w.find("input").eq(l++).val();else if(c(this).is("select"))q+=w.find("select option:selected").eq(r++).text();else if("undefined"===typeof c(this).html())q+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl"))q+=c(this).html()})}if(!0===a.htmlContent)d=
  5888. c.trim(q);else if(""!=q){var f=q.replace(/\n/g,"\u2028").replace(/<br\s*[\/]?>/gi,"\u2060");b=c("<div/>").html(f).contents();f="";c.each(b.text().split("\u2028"),function(b,a){0<b&&(f+=" ");f+=c.trim(a)});c.each(f.split("\u2060"),function(b,a){0<b&&(d+="\n");d+=c.trim(a).replace(/\u00AD/g,"")});if("json"==a.type||!1===a.numbers.output)b=ea(d),!1!==b&&(d=Number(b));else if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(b=
  5889. ea(d),!1!==b){var g=(""+b).split(".");1==g.length&&(g[1]="");var k=3<g[0].length?g[0].length%3:0,d=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?(k?g[0].substr(0,k)+a.numbers.output.thousandsSeparator:"")+g[0].substr(k).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):g[0])+(g[1].length?a.numbers.output.decimalMark+g[1]:"")}}!0===a.escape&&(d=escape(d));"function"===typeof a.onCellData&&(d=a.onCellData(w,h,e,d))}return d}function la(b,a,e){return a+"-"+e.toLowerCase()}function N(b,
  5890. a){var h=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b),d=a;h&&(d=[parseInt(h[1]),parseInt(h[2]),parseInt(h[3])]);return d}function fa(b){var a=E(b,"text-align"),e=E(b,"font-weight"),d=E(b,"font-style"),w="";"start"==a&&(a="rtl"==E(b,"direction")?"right":"left");700<=e&&(w="bold");"italic"==d&&(w+=d);""===w&&(w="normal");a={style:{align:a,bcolor:N(E(b,"background-color"),[255,255,255]),color:N(E(b,"color"),[0,0,0]),fstyle:w},colspan:parseInt(c(b).attr("colspan"))||0,rowspan:parseInt(c(b).attr("rowspan"))||
  5891. 0};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function E(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,la),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(e){}return""}function O(b,a,e){a=E(b,a).match(/\d+/);if(null!==a){a=a[0];b=b.parentElement;var d=document.createElement("div");d.style.overflow="hidden";d.style.visibility="hidden";b.appendChild(d);d.style.width=100+e;e=100/
  5892. d.offsetWidth;b.removeChild(d);return a*e}return 0}function T(){if(!(this instanceof T))return new T;this.SheetNames=[];this.Sheets={}}function ma(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),d=0;d!=a.length;++d)e[d]=a.charCodeAt(d)&255;return b}function na(a){for(var b={},e={s:{c:1E7,r:1E7},e:{c:0,r:0}},d=0;d!=a.length;++d)for(var c=0;c!=a[d].length;++c){e.s.r>d&&(e.s.r=d);e.s.c>c&&(e.s.c=c);e.e.r<d&&(e.e.r=d);e.e.c<c&&(e.e.c=c);var f={v:a[d][c]};if(null!==f.v){var l=XLSX.utils.encode_cell({c:c,
  5893. r:d});if("number"===typeof f.v)f.t="n";else if("boolean"===typeof f.v)f.t="b";else if(f.v instanceof Date){f.t="n";f.z=XLSX.SSF._table[14];var r=f,g;g=(Date.parse(f.v)-new Date(Date.UTC(1899,11,30)))/864E5;r.v=g}else f.t="s";b[l]=f}}1E7>e.s.c&&(b["!ref"]=XLSX.utils.encode_range(e));return b}function ca(a){var b=0,c,d,f;if(0===a.length)return b;c=0;for(f=a.length;c<f;c++)d=a.charCodeAt(c),b=(b<<5)-b+d,b|=0;return b}function C(a,c,e){var b=window.navigator.userAgent;if(!1!==a&&(0<b.indexOf("MSIE ")||
  5894. b.match(/Trident.*rv\:11\./)))if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([e]),a);else{if(c=document.createElement("iframe"))document.body.appendChild(c),c.setAttribute("style","display:none"),c.contentDocument.open("txt/html","replace"),c.contentDocument.write(e),c.contentDocument.close(),c.focus(),c.contentDocument.execCommand("SaveAs",!0,a),document.body.removeChild(c)}else if(b=document.createElement("a")){var h=null;b.style.display="none";!1!==a?b.download=
  5895. a:b.target="_blank";"object"==typeof e?(h=window.URL.createObjectURL(e),b.href=h):0<=c.toLowerCase().indexOf("base64,")?b.href=c+F(e):b.href=c+encodeURIComponent(e);document.body.appendChild(b);if(document.createEvent)null===Q&&(Q=document.createEvent("MouseEvents")),Q.initEvent("click",!0,!1),b.dispatchEvent(Q);else if(document.createEventObject)b.fireEvent("onclick");else if("function"==typeof b.onclick)b.onclick();h&&window.URL.revokeObjectURL(h);document.body.removeChild(b)}}function F(a){var b=
  5896. "",c,d,f,g,l,r,k=0;a=a.replace(/\x0d\x0a/g,"\n");d="";for(f=0;f<a.length;f++)g=a.charCodeAt(f),128>g?d+=String.fromCharCode(g):(127<g&&2048>g?d+=String.fromCharCode(g>>6|192):(d+=String.fromCharCode(g>>12|224),d+=String.fromCharCode(g>>6&63|128)),d+=String.fromCharCode(g&63|128));for(a=d;k<a.length;)c=a.charCodeAt(k++),d=a.charCodeAt(k++),f=a.charCodeAt(k++),g=c>>2,c=(c&3)<<4|d>>4,l=(d&15)<<2|f>>6,r=f&63,isNaN(d)?l=r=64:isNaN(f)&&(r=64),b=b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+
  5897. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r);return b}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelstyles:[],fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,
  5898. right:10,top:10,bottom:10},autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{onAfterAutotable:null,onBeforeAutotable:null,onTable:null,outputImages:!0}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,
  5899. onCellHtmlData:null,outputMode:"file",pdfmake:{enabled:!1},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"myTableName",type:"csv",worksheetName:"xlsWorksheetName"},t=this,Q=null,n=[],g=[],k=0,A=[],m="",H=[],y;c.extend(!0,a,u);H=S(t);if("csv"==a.type||"tsv"==a.type||"txt"==a.type){var D="",I=0,k=0,U=function(b,h,e){b.each(function(){m="";z(this,h,k,e+b.length,function(b,c,e){var d=m,h="";if(null!==b)if(b=x(b,c,e),c=null===b||""===b?"":b.toString(),"tsv"==a.type)b instanceof Date&&
  5900. b.toLocaleString(),h=P(c,"\t"," ");else if(b instanceof Date)h=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(h=P(c,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=h.indexOf(a.csvSeparator)||/[\r\n ]/g.test(h))h=a.csvEnclosure+h+a.csvEnclosure;m=d+(h+("tsv"==a.type?"\t":a.csvSeparator))});m=c.trim(m).substring(0,m.length-1);0<m.length&&(0<D.length&&(D+="\n"),D+=m);k++});return b.length},I=I+U(c(t).find("thead").first().find(a.theadSelector),"th,td",I);c(t).find("tbody").each(function(){I+=
  5901. U(c(this).find(a.tbodySelector),"td,th",I)});a.tfootSelector.length&&U(c(t).find("tfoot").first().find(a.tfootSelector),"td,th",I);D+="\n";!0===a.consoleLog&&console.log(D);if("string"===a.outputMode)return D;if("base64"===a.outputMode)return F(D);if("window"===a.outputMode){C(!1,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,",D);return}try{y=new Blob([D],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"}),saveAs(y,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){C(a.fileName+
  5902. "."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+("csv"==a.type&&a.csvUseBOM?"\ufeff":""),D)}}else if("sql"==a.type){var k=0,v="INSERT INTO `"+a.tableName+"` (",n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){z(this,"th,td",k,n.length,function(a,c,e){v+="'"+x(a,c,e)+"',"});k++;v=c.trim(v);v=c.trim(v).substring(0,v.length-1)});v+=") VALUES ";c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,
  5903. c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){m="";z(this,"td,th",k,n.length+g.length,function(a,c,e){m+="'"+x(a,c,e)+"',"});3<m.length&&(v+="("+m,v=c.trim(v).substring(0,v.length-1),v+="),");k++});v=c.trim(v).substring(0,v.length-1);v+=";";!0===a.consoleLog&&console.log(v);if("string"===a.outputMode)return v;if("base64"===a.outputMode)return F(v);try{y=new Blob([v],{type:"text/plain;charset=utf-8"}),saveAs(y,a.fileName+".sql")}catch(b){C(a.fileName+".sql","data:application/sql;charset=utf-8,",
  5904. v)}}else if("json"==a.type){var J=[],n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){var a=[];z(this,"th,td",k,n.length,function(b,c,d){a.push(x(b,c,d))});J.push(a)});var V=[];c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a={},h=0;z(this,"td,th",k,n.length+g.length,function(b,c,f){J.length?a[J[J.length-1][h]]=x(b,c,f):a[h]=x(b,c,f);h++});
  5905. !1===c.isEmptyObject(a)&&V.push(a);k++});u="";u="head"==a.jsonScope?JSON.stringify(J):"data"==a.jsonScope?JSON.stringify(V):JSON.stringify({header:J,data:V});!0===a.consoleLog&&console.log(u);if("string"===a.outputMode)return u;if("base64"===a.outputMode)return F(u);try{y=new Blob([u],{type:"application/json;charset=utf-8"}),saveAs(y,a.fileName+".json")}catch(b){C(a.fileName+".json","data:application/json;charset=utf-8;base64,",u)}}else if("xml"===a.type){var k=0,B='<?xml version="1.0" encoding="utf-8"?>',
  5906. B=B+"<tabledata><fields>",n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){z(this,"th,td",k,n.length,function(a,c,e){B+="<field>"+x(a,c,e)+"</field>"});k++});var B=B+"</fields><data>",ga=1;c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=1;m="";z(this,"td,th",k,n.length+g.length,function(b,c,d){m+="<column-"+a+">"+x(b,c,d)+"</column-"+a+
  5907. ">";a++});0<m.length&&"<column-1></column-1>"!=m&&(B+='<row id="'+ga+'">'+m+"</row>",ga++);k++});B+="</data></tabledata>";!0===a.consoleLog&&console.log(B);if("string"===a.outputMode)return B;if("base64"===a.outputMode)return F(B);try{y=new Blob([B],{type:"application/xml;charset=utf-8"}),saveAs(y,a.fileName+".xml")}catch(b){C(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",B)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){u="excel"==a.type||"xls"==a.type?"excel":
  5908. "word";var K="excel"==u?"xls":"doc",p='xmlns:x="urn:schemas-microsoft-com:office:'+u+'"',G="";c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=c(this);k=0;H=S(this);G+="<table><thead>";n=b.find("thead").first().find(a.theadSelector);n.each(function(){m="";z(this,"th,td",k,n.length,function(b,e,d){if(null!==b){var h="";m+="<th";for(var f in a.excelstyles)if(a.excelstyles.hasOwnProperty(f)){var l=
  5909. c(b).css(a.excelstyles[f]);""!==l&&"0px none rgb(0, 0, 0)"!=l&&"rgba(0, 0, 0, 0)"!=l&&(h+=""===h?'style="':";",h+=a.excelstyles[f]+":"+l)}""!==h&&(m+=" "+h+'"');c(b).is("[colspan]")&&(m+=' colspan="'+c(b).attr("colspan")+'"');c(b).is("[rowspan]")&&(m+=' rowspan="'+c(b).attr("rowspan")+'"');m+=">"+x(b,e,d)+"</th>"}});0<m.length&&(G+="<tr>"+m+"</tr>");k++});G+="</thead><tbody>";b.find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,b.find("tfoot").find(a.tfootSelector));
  5910. c(g).each(function(){var b=c(this);m="";z(this,"td,th",k,n.length+g.length,function(e,d,h){if(null!==e){var f="",l=c(e).data("tableexport-msonumberformat");"undefined"==typeof l&&"function"===typeof a.onMsoNumberFormat&&(l=a.onMsoNumberFormat(e,d,h));"undefined"!=typeof l&&""!==l&&(f="style=\"mso-number-format:'"+l+"'");for(var g in a.excelstyles)a.excelstyles.hasOwnProperty(g)&&(l=c(e).css(a.excelstyles[g]),""===l&&(l=b.css(a.excelstyles[g])),""!==l&&"0px none rgb(0, 0, 0)"!=l&&"rgba(0, 0, 0, 0)"!=
  5911. l&&(f+=""===f?'style="':";",f+=a.excelstyles[g]+":"+l));m+="<td";""!==f&&(m+=" "+f+'"');c(e).is("[colspan]")&&(m+=' colspan="'+c(e).attr("colspan")+'"');c(e).is("[rowspan]")&&(m+=' rowspan="'+c(e).attr("rowspan")+'"');m+=">"+x(e,d,h).replace(/\n/g,"<br>")+"</td>"}});0<m.length&&(G+="<tr>"+m+"</tr>");k++});a.displayTableName&&(G+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+x(c("<p>"+a.tableName+"</p>"))+"</td></tr>");G+="</tbody></table>";!0===a.consoleLog&&console.log(G)});p='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+
  5912. p+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+u+'; charset=UTF-8">')+"<head>";"excel"===u&&(p+="\x3c!--[if gte mso 9]>",p+="<xml>",p+="<x:ExcelWorkbook>",p+="<x:ExcelWorksheets>",p+="<x:ExcelWorksheet>",p+="<x:Name>",p+=a.worksheetName,p+="</x:Name>",p+="<x:WorksheetOptions>",p+="<x:DisplayGridlines/>",p+="</x:WorksheetOptions>",p+="</x:ExcelWorksheet>",p+="</x:ExcelWorksheets>",p+="</x:ExcelWorkbook>",p+="</xml>",p+="<![endif]--\x3e");
  5913. p+="<style>br {mso-data-placement:same-cell;}</style>";p+="</head>";p+="<body>";p+=G;p+="</body>";p+="</html>";!0===a.consoleLog&&console.log(p);if("string"===a.outputMode)return p;if("base64"===a.outputMode)return F(p);try{y=new Blob([p],{type:"application/vnd.ms-"+a.type}),saveAs(y,a.fileName+"."+K)}catch(b){C(a.fileName+"."+K,"data:application/vnd.ms-"+u+";base64,",p)}}else if("xlsx"==a.type){var ha=[],W=[],k=0,g=c(t).find("thead").first().find(a.theadSelector);c(t).find("tbody").each(function(){g.push.apply(g,
  5914. c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];z(this,"th,td",k,g.length,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=parseInt(b.getAttribute("colspan")),f=parseInt(b.getAttribute("rowspan"));b=x(b,c,d);""!==b&&b==+b&&(b=+b);W.forEach(function(b){if(k>=b.s.r&&k<=b.e.r&&a.length>=b.s.c&&a.length<=b.e.c)for(var c=0;c<=b.e.c-b.s.c;++c)a.push(null)});if(f||e)e=e||1,W.push({s:{r:k,c:a.length},
  5915. e:{r:k+(f||1)-1,c:a.length+e-1}});a.push(""!==b?b:null);if(e)for(f=0;f<e-1;++f)a.push(null)}});ha.push(a);k++});u=new T;K=na(ha);K["!merges"]=W;u.SheetNames.push(a.worksheetName);u.Sheets[a.worksheetName]=K;u=XLSX.write(u,{bookType:a.type,bookSST:!1,type:"binary"});try{y=new Blob([ma(u)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),saveAs(y,a.fileName+"."+a.type)}catch(b){C(a.fileName+"."+a.type,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,",
  5916. y)}}else if("png"==a.type)html2canvas(c(t)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length),d=new Uint8Array(e),f=0;f<c.length;f++)d[f]=c.charCodeAt(f);!0===a.consoleLog&&console.log(c);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return F(b);if("window"===a.outputMode)window.open(b);else try{y=new Blob([e],{type:"image/png"}),saveAs(y,a.fileName+".png")}catch(q){C(a.fileName+".png","data:image/png,",y)}});else if("pdf"==a.type)if(!0===
  5917. a.pdfmake.enabled){var X=[],Y=[],k=0,n=c(this).find("thead").first().find(a.theadSelector);n.each(function(){var a=[];z(this,"th,td",k,n.length,function(b,c,f){a.push(x(b,c,f))});a.length&&Y.push(a);for(var c=X.length;c<a.length;c++)X.push("*");k++});c(this).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];z(this,"td,th",k,n.length+g.length,function(b,c,d){a.push(x(b,
  5918. c,d))});a.length&&Y.push(a);k++});pdfMake.createPdf({pageOrientation:"landscape",content:[{table:{headerRows:n.length,widths:X,body:Y}}]}).getBuffer(function(b){try{var c=new Blob([b],{type:"application/pdf"});saveAs(c,a.fileName+".pdf")}catch(e){C(a.fileName+".pdf","data:application/pdf;base64,",b)}})}else if(!1===a.jspdf.autotable){u={dim:{w:O(c(t).first().get(0),"width","mm"),h:O(c(t).first().get(0),"height","mm")},pagesplit:!1};var ia=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);
  5919. ia.addHTML(c(t).first(),a.jspdf.margins.left,a.jspdf.margins.top,u,function(){Z(ia,!1)})}else{var f=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var L={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]},R="",M="",ja=0;c(t).filter(":visible").each(function(){if("none"!=c(this).css("display")){var a=O(c(this).get(0),"width","pt");if(a>ja){a>L.a0[0]&&(R="a0",M="l");for(var f in L)L.hasOwnProperty(f)&&
  5920. L[f][1]>a&&(R=f,M="l",L[f][0]>a&&(M="p"));ja=a}}});a.jspdf.format=""===R?"a4":R;a.jspdf.orientation=""===M?"w":M}f.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);!0===f.outputImages&&(f.images={});"undefined"!=typeof f.images&&(c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=0;n=c(this).find("thead").find(a.theadSelector);c(this).find("tbody").each(function(){g.push.apply(g,
  5921. c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){z(this,"td,th",n.length+b,n.length+g.length,function(a,b,d){"undefined"!==typeof a&&null!==a&&(b=c(a).children(),"undefined"!=typeof b&&0<b.length&&ba(a,b,f))});b++})}),n=[],g=[]);ka(f,function(b){c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b,
  5922. e=0;H=S(this);f.columns=[];f.rows=[];f.rowoptions={};if("function"===typeof f.onTable&&!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){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+=
  5923. (2-1.15)/2*b.styles.fontSize)})});"function"!==typeof d.createdHeaderCell&&(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){var g;a.contentWidth=e.rect.width;if("undefined"==typeof f.heightRatio||0===f.heightRatio)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,
  5924. f.heightRatio=a.styles.rowHeight/g;g=b.row.raw[b.column.dataKey].rect.height*f.heightRatio;g>a.styles.rowHeight&&(a.styles.rowHeight=g)}"undefined"!=typeof e.style&&!0!==e.style.hidden&&(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))}});"function"!==typeof d.createdCell&&(d.createdCell=function(a,b){var c=f.rowoptions[b.row.index+
  5925. ":"+b.column.dataKey];"undefined"!=typeof c&&"undefined"!=typeof c.style&&!0!==c.style.hidden&&(a.styles.halign=c.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=c.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=c.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=c.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)&&
  5926. 0<=c.rowIndex?aa(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var c=f.rowoptions[b.row.index+":"+b.column.dataKey];if(aa(a,b,c)){f.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle);if("undefined"!=typeof c&&"undefined"!=typeof c.kids&&0<c.kids.length){var d=a.height/c.rect.height;if(d>f.dh||"undefined"==typeof f.dh)f.dh=d;f.dw=a.width/c.rect.width;da(a,c.kids,f)}f.doc.autoTableText(a.text,a.textPos.x,a.textPos.y,{halign:a.styles.halign,valign:a.styles.valign})}return!1});
  5927. f.headerrows=[];n=c(this).find("thead").find(a.theadSelector);n.each(function(){b=0;f.headerrows[e]=[];z(this,"th,td",e,n.length,function(a,c,d){var g=fa(a);g.title=x(a,c,d);g.key=b++;g.rowIndex=e;f.headerrows[e].push(g)});e++});if(0<e)for(var k=e-1;0<=k;)c.each(f.headerrows[k],function(){var a=this;0<k&&null===this.rect&&(a=f.headerrows[k-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&f.columns.push(a)}),k=0<f.columns.length?-1:k-1;var m=0;g=
  5928. [];c(this).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];b=0;z(this,"td,th",e,n.length+g.length,function(d,e,g){if("undefined"===typeof f.columns[b]){var h={title:"",key:b,style:{hidden:!0}};f.columns.push(h)}"undefined"!==typeof d&&null!==d?(h=fa(d),h.kids=c(d).children()):(h=c.extend(!0,{},f.rowoptions[m+":"+(b-1)]),h.colspan=-1);f.rowoptions[m+":"+b++]=
  5929. h;a.push(x(d,e,g))});a.length&&(f.rows.push(a),m++);e++});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),d);a.jspdf.autotable.startY=f.doc.autoTableEndPosY()+d.margin.top});Z(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=
  5930. 0);"undefined"!=typeof f.rows&&(f.rows.length=0);delete f.doc;f.doc=null})}return this}})})(jQuery);
  5931. define("tableexport", ["jquery"], (function (global) {
  5932. return function () {
  5933. var ret, fn;
  5934. return ret || global.$.fn.extend;
  5935. };
  5936. }(this)));
  5937. /*
  5938. * bootstrap-table - v1.11.0 - 2016-07-02
  5939. * https://github.com/wenzhixin/bootstrap-table
  5940. * Copyright (c) 2016 zhixin wen
  5941. * Licensed MIT License
  5942. */
  5943. !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",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" 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 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();d.load(f),c(),d.load(e)}else c()})}}}}(jQuery);
  5944. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  5945. return function () {
  5946. var ret, fn;
  5947. return ret || global.$.fn.bootstrapTable.defaults;
  5948. };
  5949. }(this)));
  5950. /**
  5951. * @author: aperez <aperez@datadec.es>
  5952. * @version: v2.0.0
  5953. *
  5954. * @update Dennis Hernández <http://djhvscf.github.io/Blog>
  5955. */
  5956. !function ($) {
  5957. 'use strict';
  5958. var firstLoad = false;
  5959. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  5960. var showAvdSearch = function (pColumns, that) {
  5961. var searchTitle = that.options.formatAdvancedSearch();
  5962. if (!$("#avdSearchModal" + "_" + that.options.idTable).hasClass("modal")) {
  5963. var vModal = sprintf("<div id=\"avdSearchModal%s\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"mySmallModalLabel\" aria-hidden=\"true\">", "_" + that.options.idTable);
  5964. vModal += "<div class=\"modal-dialog modal-xs\">";
  5965. vModal += " <div class=\"modal-content\">";
  5966. vModal += " <div class=\"modal-header\">";
  5967. vModal += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" >&times;</button>";
  5968. vModal += sprintf(" <h4 class=\"modal-title\">%s</h4>", searchTitle);
  5969. vModal += " </div>";
  5970. vModal += " <div class=\"modal-body modal-body-custom\">";
  5971. vModal += sprintf(" <div class=\"container-fluid\" id=\"avdSearchModalContent%s\" style=\"padding-right: 0px;padding-left: 0px;\" >", "_" + that.options.idTable);
  5972. vModal += " </div>";
  5973. vModal += " </div>";
  5974. vModal += " <div class=\"modal-footer\">";
  5975. vModal += createFormBtn(that).join('');
  5976. vModal += " </div>";
  5977. vModal += " </div>";
  5978. vModal += " </div>";
  5979. vModal += "</div>";
  5980. $("body").append($(vModal));
  5981. var vFormAvd = createFormAvd(pColumns, that),
  5982. timeoutId = 0;
  5983. ;
  5984. $('#avdSearchModalContent' + "_" + that.options.idTable).append(vFormAvd.join(''));
  5985. if (that.options.sidePagination != 'server' || !that.options.url) {
  5986. $('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) {
  5987. clearTimeout(timeoutId);
  5988. timeoutId = setTimeout(function () {
  5989. that.onColumnAdvancedSearch(event);
  5990. }, that.options.searchTimeOut);
  5991. });
  5992. } else {
  5993. }
  5994. // 提交搜索
  5995. $("#btnSubmitAvd" + "_" + that.options.idTable).click(function (event) {
  5996. that.onColumnAdvancedSearch();
  5997. });
  5998. // 重置搜索
  5999. $("#btnResetAvd" + "_" + that.options.idTable).click(function () {
  6000. $("#avdSearchModal" + "_" + that.options.idTable + " form")[0].reset();
  6001. that.onColumnAdvancedSearch();
  6002. });
  6003. $("#avdSearchModal" + "_" + that.options.idTable).modal();
  6004. } else {
  6005. $("#avdSearchModal" + "_" + that.options.idTable).modal();
  6006. }
  6007. };
  6008. var createFormAvd = function (pColumns, that) {
  6009. var htmlForm = [];
  6010. var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'];
  6011. var selectList = [];
  6012. for (var i = 0; i < opList.length; i++) {
  6013. selectList.push("<option value='" + opList[i] + "'>" + opList[i] + "</option>");
  6014. }
  6015. var selectHtml = selectList.join('');
  6016. htmlForm.push(sprintf('<form class="form-horizontal" id="%s" action="%s" >', that.options.idForm, that.options.actionForm));
  6017. for (var i in pColumns) {
  6018. var vObjCol = pColumns[i];
  6019. if (!vObjCol.checkbox && vObjCol.field != 'operate' && vObjCol.visible && vObjCol.searchable) {
  6020. htmlForm.push('<div class="form-group">');
  6021. htmlForm.push(sprintf('<label class="col-sm-3 control-label">%s</label>', vObjCol.title));
  6022. if (that.options.sidePagination == 'server' && that.options.url) {
  6023. htmlForm.push('<div class="col-sm-2">');
  6024. htmlForm.push(sprintf('<select class="form-control" name="field-%s" data-name="%s">%s</select>', vObjCol.field, vObjCol.field, selectHtml));
  6025. htmlForm.push('</div>');
  6026. }
  6027. htmlForm.push('<div class="col-sm-6">');
  6028. if (vObjCol.searchList) {
  6029. if (typeof vObjCol.searchList == 'function') {
  6030. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  6031. } else {
  6032. var isArray = vObjCol.searchList.constructor === Array;
  6033. var searchList = [];
  6034. searchList.push(sprintf('<option value="">%s</option>', $.fn.bootstrapTable.locales.formatAdvancedChoose()));
  6035. $.each(vObjCol.searchList, function (key, value) {
  6036. searchList.push("<option value='" + (isArray ? value : key) + "'>" + value + "</option>");
  6037. });
  6038. htmlForm.push(sprintf('<select class="form-control" name="%s">%s</select>', vObjCol.field, searchList.join('')));
  6039. }
  6040. } else {
  6041. htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field));
  6042. }
  6043. htmlForm.push('</div>');
  6044. htmlForm.push('</div>');
  6045. }
  6046. }
  6047. htmlForm.push('</form>');
  6048. return htmlForm;
  6049. };
  6050. var createFormBtn = function (that) {
  6051. var htmlBtn = [];
  6052. var searchSubmit = that.options.formatAdvancedSubmitButton();
  6053. var searchReset = that.options.formatAdvancedResetButton();
  6054. var searchClose = that.options.formatAdvancedCloseButton();
  6055. htmlBtn.push('<div class="form-group">');
  6056. htmlBtn.push('<div class="col-sm-12 text-center">');
  6057. if (that.options.sidePagination == 'server' && that.options.url) {
  6058. htmlBtn.push(sprintf('<button type="button" id="btnSubmitAvd%s" class="btn btn-success" >%s</button> ', "_" + that.options.idTable, searchSubmit));
  6059. htmlBtn.push(sprintf('<button type="button" id="btnResetAvd%s" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchReset));
  6060. } else {
  6061. htmlBtn.push(sprintf('<button type="button" id="btnCloseAvd%s" data-dismiss="modal" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchClose));
  6062. }
  6063. htmlBtn.push('</div>');
  6064. htmlBtn.push('</div>');
  6065. return htmlBtn;
  6066. };
  6067. $.extend($.fn.bootstrapTable.defaults, {
  6068. advancedSearch: false,
  6069. idForm: 'advancedSearch',
  6070. actionForm: '',
  6071. idTable: undefined,
  6072. onColumnAdvancedSearch: function (field, text) {
  6073. return false;
  6074. }
  6075. });
  6076. $.extend($.fn.bootstrapTable.defaults.icons, {
  6077. advancedSearchIcon: 'glyphicon-search'
  6078. });
  6079. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  6080. 'column-advanced-search.bs.table': 'onColumnAdvancedSearch'
  6081. });
  6082. $.extend($.fn.bootstrapTable.locales, {
  6083. formatAdvancedSearch: function () {
  6084. return 'Advanced search';
  6085. },
  6086. formatAdvancedSubmitButton: function () {
  6087. return "Submit";
  6088. },
  6089. formatAdvancedResetButton: function () {
  6090. return "Reset";
  6091. },
  6092. formatAdvancedCloseButton: function () {
  6093. return "Close";
  6094. },
  6095. formatAdvancedChoose: function () {
  6096. return "Choose";
  6097. }
  6098. });
  6099. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  6100. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6101. _initToolbar = BootstrapTable.prototype.initToolbar,
  6102. _load = BootstrapTable.prototype.load,
  6103. _initSearch = BootstrapTable.prototype.initSearch;
  6104. BootstrapTable.prototype.initToolbar = function () {
  6105. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  6106. if (!this.options.search) {
  6107. return;
  6108. }
  6109. if (!this.options.advancedSearch) {
  6110. return;
  6111. }
  6112. if (!this.options.idTable) {
  6113. return;
  6114. }
  6115. var that = this,
  6116. html = [];
  6117. html.push(sprintf('<div class="columns columns-%s btn-group pull-%s" role="group">', this.options.buttonsAlign, this.options.buttonsAlign));
  6118. html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch()));
  6119. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.advancedSearchIcon))
  6120. html.push('</button></div>');
  6121. that.$toolbar.prepend(html.join(''));
  6122. that.$toolbar.find('button[name="advancedSearch"]')
  6123. .off('click').on('click', function () {
  6124. showAvdSearch(that.columns, that);
  6125. });
  6126. };
  6127. BootstrapTable.prototype.load = function (data) {
  6128. _load.apply(this, Array.prototype.slice.apply(arguments));
  6129. if (!this.options.advancedSearch) {
  6130. return;
  6131. }
  6132. if (typeof this.options.idTable === 'undefined') {
  6133. return;
  6134. } else {
  6135. if (!firstLoad) {
  6136. var height = parseInt($(".bootstrap-table").height());
  6137. height += 10;
  6138. $("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
  6139. firstLoad = true;
  6140. }
  6141. }
  6142. };
  6143. BootstrapTable.prototype.initSearch = function () {
  6144. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  6145. if (!this.options.advancedSearch) {
  6146. return;
  6147. }
  6148. var that = this;
  6149. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  6150. this.data = fp ? $.grep(this.data, function (item, i) {
  6151. for (var key in fp) {
  6152. var fval = fp[key].toLowerCase();
  6153. var value = item[key];
  6154. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  6155. that.header.formatters[$.inArray(key, that.header.fields)],
  6156. [value, item, i], value);
  6157. if (!($.inArray(key, that.header.fields) !== -1 &&
  6158. (typeof value === 'string' || typeof value === 'number') &&
  6159. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  6160. return false;
  6161. }
  6162. }
  6163. return true;
  6164. }) : this.data;
  6165. };
  6166. BootstrapTable.prototype.onColumnAdvancedSearch = function (event) {
  6167. if (typeof event == 'undefined') {
  6168. var op = {};
  6169. var filter = {};
  6170. $("#avdSearchModalContent_" + this.options.idTable + " select").each(function () {
  6171. var name = $(this).data("name");
  6172. var sym = $(this).val();
  6173. var obj = $("[name='" + name + "']");
  6174. if (obj.size() == 0)
  6175. return true;
  6176. var value = obj.size() > 1 ? $("[name='" + name + "']:checked").val() : obj.val();
  6177. if (value == '' && sym.indexOf("NULL") == -1) {
  6178. return true;
  6179. }
  6180. op[name] = sym;
  6181. filter[name] = value;
  6182. });
  6183. // 追加查询关键字
  6184. this.options.pageNumber = 1;
  6185. this.options.queryParams = function (params) {
  6186. return {
  6187. search: params.search,
  6188. sort: params.sort,
  6189. order: params.order,
  6190. filter: JSON.stringify(filter),
  6191. op: JSON.stringify(op),
  6192. offset: params.offset,
  6193. limit: params.limit,
  6194. };
  6195. };
  6196. this.refresh({query: {filter: JSON.stringify(filter), op: JSON.stringify(op)}});
  6197. } else {
  6198. var text = $.trim($(event.currentTarget).val());
  6199. var $field = $(event.currentTarget)[0].id;
  6200. if ($.isEmptyObject(this.filterColumnsPartial)) {
  6201. this.filterColumnsPartial = {};
  6202. }
  6203. if (text) {
  6204. this.filterColumnsPartial[$field] = text;
  6205. } else {
  6206. delete this.filterColumnsPartial[$field];
  6207. }
  6208. this.options.pageNumber = 1;
  6209. this.onSearch(event);
  6210. // this.updatePagination();
  6211. this.trigger('column-advanced-search', $field, text);
  6212. }
  6213. };
  6214. }(jQuery);
  6215. define("bootstrap-table-advancedsearch", ["bootstrap-table"], (function (global) {
  6216. return function () {
  6217. var ret, fn;
  6218. return ret || global.$.fn.bootstrapTable.defaults;
  6219. };
  6220. }(this)));
  6221. define('../libs/require-css/css.min!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min',[],function(){});
  6222. //! moment.js locale configuration
  6223. //! locale : Chinese (China) [zh-cn]
  6224. //! author : suupic : https://github.com/suupic
  6225. //! author : Zeno Zeng : https://github.com/zenozeng
  6226. ;(function (global, factory) {
  6227. typeof exports === 'object' && typeof module !== 'undefined'
  6228. && typeof require === 'function' ? factory(require('../moment')) :
  6229. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  6230. factory(global.moment)
  6231. }(this, function (moment) { 'use strict';
  6232. var zh_cn = moment.defineLocale('zh-cn', {
  6233. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  6234. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  6235. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  6236. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  6237. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  6238. longDateFormat : {
  6239. LT : 'Ah点mm分',
  6240. LTS : 'Ah点m分s秒',
  6241. L : 'YYYY-MM-DD',
  6242. LL : 'YYYY年MMMD日',
  6243. LLL : 'YYYY年MMMD日Ah点mm分',
  6244. LLLL : 'YYYY年MMMD日ddddAh点mm分',
  6245. l : 'YYYY-MM-DD',
  6246. ll : 'YYYY年MMMD日',
  6247. lll : 'YYYY年MMMD日Ah点mm分',
  6248. llll : 'YYYY年MMMD日ddddAh点mm分'
  6249. },
  6250. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  6251. meridiemHour: function (hour, meridiem) {
  6252. if (hour === 12) {
  6253. hour = 0;
  6254. }
  6255. if (meridiem === '凌晨' || meridiem === '早上' ||
  6256. meridiem === '上午') {
  6257. return hour;
  6258. } else if (meridiem === '下午' || meridiem === '晚上') {
  6259. return hour + 12;
  6260. } else {
  6261. // '中午'
  6262. return hour >= 11 ? hour : hour + 12;
  6263. }
  6264. },
  6265. meridiem : function (hour, minute, isLower) {
  6266. var hm = hour * 100 + minute;
  6267. if (hm < 600) {
  6268. return '凌晨';
  6269. } else if (hm < 900) {
  6270. return '早上';
  6271. } else if (hm < 1130) {
  6272. return '上午';
  6273. } else if (hm < 1230) {
  6274. return '中午';
  6275. } else if (hm < 1800) {
  6276. return '下午';
  6277. } else {
  6278. return '晚上';
  6279. }
  6280. },
  6281. calendar : {
  6282. sameDay : function () {
  6283. return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
  6284. },
  6285. nextDay : function () {
  6286. return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
  6287. },
  6288. lastDay : function () {
  6289. return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
  6290. },
  6291. nextWeek : function () {
  6292. var startOfWeek, prefix;
  6293. startOfWeek = moment().startOf('week');
  6294. prefix = this.diff(startOfWeek, 'days') >= 7 ? '[下]' : '[本]';
  6295. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  6296. },
  6297. lastWeek : function () {
  6298. var startOfWeek, prefix;
  6299. startOfWeek = moment().startOf('week');
  6300. prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
  6301. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  6302. },
  6303. sameElse : 'LL'
  6304. },
  6305. ordinalParse: /\d{1,2}(日|月|周)/,
  6306. ordinal : function (number, period) {
  6307. switch (period) {
  6308. case 'd':
  6309. case 'D':
  6310. case 'DDD':
  6311. return number + '日';
  6312. case 'M':
  6313. return number + '月';
  6314. case 'w':
  6315. case 'W':
  6316. return number + '周';
  6317. default:
  6318. return number;
  6319. }
  6320. },
  6321. relativeTime : {
  6322. future : '%s内',
  6323. past : '%s前',
  6324. s : '几秒',
  6325. m : '1 分钟',
  6326. mm : '%d 分钟',
  6327. h : '1 小时',
  6328. hh : '%d 小时',
  6329. d : '1 天',
  6330. dd : '%d 天',
  6331. M : '1 个月',
  6332. MM : '%d 个月',
  6333. y : '1 年',
  6334. yy : '%d 年'
  6335. },
  6336. week : {
  6337. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6338. dow : 1, // Monday is the first day of the week.
  6339. doy : 4 // The week that contains Jan 4th is the first week of the year.
  6340. }
  6341. });
  6342. return zh_cn;
  6343. }));
  6344. /*! version : 4.17.42
  6345. =========================================================
  6346. bootstrap-datetimejs
  6347. https://github.com/Eonasdan/bootstrap-datetimepicker
  6348. Copyright (c) 2015 Jonathan Peterson
  6349. =========================================================
  6350. */
  6351. /*
  6352. The MIT License (MIT)
  6353. Copyright (c) 2015 Jonathan Peterson
  6354. Permission is hereby granted, free of charge, to any person obtaining a copy
  6355. of this software and associated documentation files (the "Software"), to deal
  6356. in the Software without restriction, including without limitation the rights
  6357. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6358. copies of the Software, and to permit persons to whom the Software is
  6359. furnished to do so, subject to the following conditions:
  6360. The above copyright notice and this permission notice shall be included in
  6361. all copies or substantial portions of the Software.
  6362. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6363. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6364. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6365. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6366. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6367. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6368. THE SOFTWARE.
  6369. */
  6370. /*global define:false */
  6371. /*global exports:false */
  6372. /*global require:false */
  6373. /*global jQuery:false */
  6374. /*global moment:false */
  6375. !function(a){"use strict";if("function"==typeof define&&define.amd)
  6376. // AMD is used - Register as an anonymous module.
  6377. define('bootstrap-datetimepicker',["jquery","moment"],a);else if("object"==typeof exports)a(require("jquery"),require("moment"));else{
  6378. // Neither AMD nor CommonJS used. Use global variables.
  6379. if("undefined"==typeof jQuery)throw"bootstrap-datetimepicker requires jQuery to be loaded first";if("undefined"==typeof moment)throw"bootstrap-datetimepicker requires Moment.js to be loaded first";a(jQuery,moment)}}(function(a,b){"use strict";if(!b)throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");var c=function(c,d){var e,f,g,h,i,j,k,l={},m=!0,n=!1,o=!1,p=0,q=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10},{clsName:"decades",navFnc:"y",navStep:100}],r=["days","months","years","decades"],s=["top","bottom","auto"],t=["left","right","auto"],u=["default","top","bottom"],v={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t","delete":46,46:"delete"},w={},/********************************************************************************
  6380. *
  6381. * Private functions
  6382. *
  6383. ********************************************************************************/
  6384. x=function(){return void 0!==b.tz&&void 0!==d.timeZone&&null!==d.timeZone&&""!==d.timeZone},y=function(a){var c;return c=void 0===a||null===a?b():x()?b.tz(a,j,d.useStrict,d.timeZone):b(a,j,d.useStrict),x()&&c.tz(d.timeZone),c},z=function(a){if("string"!=typeof a||a.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(a){case"y":return-1!==i.indexOf("Y");case"M":return-1!==i.indexOf("M");case"d":return-1!==i.toLowerCase().indexOf("d");case"h":case"H":return-1!==i.toLowerCase().indexOf("h");case"m":return-1!==i.indexOf("m");case"s":return-1!==i.indexOf("s");default:return!1}},A=function(){return z("h")||z("m")||z("s")},B=function(){return z("y")||z("M")||z("d")},C=function(){var b=a("<thead>").append(a("<tr>").append(a("<th>").addClass("prev").attr("data-action","previous").append(a("<span>").addClass(d.icons.previous))).append(a("<th>").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",d.calendarWeeks?"6":"5")).append(a("<th>").addClass("next").attr("data-action","next").append(a("<span>").addClass(d.icons.next)))),c=a("<tbody>").append(a("<tr>").append(a("<td>").attr("colspan",d.calendarWeeks?"8":"7")));return[a("<div>").addClass("datepicker-days").append(a("<table>").addClass("table-condensed").append(b).append(a("<tbody>"))),a("<div>").addClass("datepicker-months").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())),a("<div>").addClass("datepicker-years").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())),a("<div>").addClass("datepicker-decades").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone()))]},D=function(){var b=a("<tr>"),c=a("<tr>"),e=a("<tr>");return z("h")&&(b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementHour}).addClass("btn").attr("data-action","incrementHours").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-hour").attr({"data-time-component":"hours",title:d.tooltips.pickHour}).attr("data-action","showHours"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementHour}).addClass("btn").attr("data-action","decrementHours").append(a("<span>").addClass(d.icons.down))))),z("m")&&(z("h")&&(b.append(a("<td>").addClass("separator")),c.append(a("<td>").addClass("separator").html(":")),e.append(a("<td>").addClass("separator"))),b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementMinute}).addClass("btn").attr("data-action","incrementMinutes").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-minute").attr({"data-time-component":"minutes",title:d.tooltips.pickMinute}).attr("data-action","showMinutes"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementMinute}).addClass("btn").attr("data-action","decrementMinutes").append(a("<span>").addClass(d.icons.down))))),z("s")&&(z("m")&&(b.append(a("<td>").addClass("separator")),c.append(a("<td>").addClass("separator").html(":")),e.append(a("<td>").addClass("separator"))),b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementSecond}).addClass("btn").attr("data-action","incrementSeconds").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-second").attr({"data-time-component":"seconds",title:d.tooltips.pickSecond}).attr("data-action","showSeconds"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementSecond}).addClass("btn").attr("data-action","decrementSeconds").append(a("<span>").addClass(d.icons.down))))),h||(b.append(a("<td>").addClass("separator")),c.append(a("<td>").append(a("<button>").addClass("btn btn-primary").attr({"data-action":"togglePeriod",tabindex:"-1",title:d.tooltips.togglePeriod}))),e.append(a("<td>").addClass("separator"))),a("<div>").addClass("timepicker-picker").append(a("<table>").addClass("table-condensed").append([b,c,e]))},E=function(){var b=a("<div>").addClass("timepicker-hours").append(a("<table>").addClass("table-condensed")),c=a("<div>").addClass("timepicker-minutes").append(a("<table>").addClass("table-condensed")),d=a("<div>").addClass("timepicker-seconds").append(a("<table>").addClass("table-condensed")),e=[D()];return z("h")&&e.push(b),z("m")&&e.push(c),z("s")&&e.push(d),e},F=function(){var b=[];return d.showTodayButton&&b.push(a("<td>").append(a("<a>").attr({"data-action":"today",title:d.tooltips.today}).append(a("<span>").addClass(d.icons.today)))),!d.sideBySide&&B()&&A()&&b.push(a("<td>").append(a("<a>").attr({"data-action":"togglePicker",title:d.tooltips.selectTime}).append(a("<span>").addClass(d.icons.time)))),d.showClear&&b.push(a("<td>").append(a("<a>").attr({"data-action":"clear",title:d.tooltips.clear}).append(a("<span>").addClass(d.icons.clear)))),d.showClose&&b.push(a("<td>").append(a("<a>").attr({"data-action":"close",title:d.tooltips.close}).append(a("<span>").addClass(d.icons.close)))),a("<table>").addClass("table-condensed").append(a("<tbody>").append(a("<tr>").append(b)))},G=function(){var b=a("<div>").addClass("bootstrap-datetimepicker-widget dropdown-menu"),c=a("<div>").addClass("datepicker").append(C()),e=a("<div>").addClass("timepicker").append(E()),f=a("<ul>").addClass("list-unstyled"),g=a("<li>").addClass("picker-switch"+(d.collapse?" accordion-toggle":"")).append(F());return d.inline&&b.removeClass("dropdown-menu"),h&&b.addClass("usetwentyfour"),z("s")&&!h&&b.addClass("wider"),d.sideBySide&&B()&&A()?(b.addClass("timepicker-sbs"),"top"===d.toolbarPlacement&&b.append(g),b.append(a("<div>").addClass("row").append(c.addClass("col-md-6")).append(e.addClass("col-md-6"))),"bottom"===d.toolbarPlacement&&b.append(g),b):("top"===d.toolbarPlacement&&f.append(g),B()&&f.append(a("<li>").addClass(d.collapse&&A()?"collapse in":"").append(c)),"default"===d.toolbarPlacement&&f.append(g),A()&&f.append(a("<li>").addClass(d.collapse&&B()?"collapse":"").append(e)),"bottom"===d.toolbarPlacement&&f.append(g),b.append(f))},H=function(){var b,e={};return b=c.is("input")||d.inline?c.data():c.find("input").data(),b.dateOptions&&b.dateOptions instanceof Object&&(e=a.extend(!0,e,b.dateOptions)),a.each(d,function(a){var c="date"+a.charAt(0).toUpperCase()+a.slice(1);void 0!==b[c]&&(e[a]=b[c])}),e},I=function(){var b,e=(n||c).position(),f=(n||c).offset(),g=d.widgetPositioning.vertical,h=d.widgetPositioning.horizontal;if(d.widgetParent)b=d.widgetParent.append(o);else if(c.is("input"))b=c.after(o).parent();else{if(d.inline)return void(b=c.append(o));b=c,c.children().first().after(o)}if(
  6385. // Top and bottom logic
  6386. "auto"===g&&(g=f.top+1.5*o.height()>=a(window).height()+a(window).scrollTop()&&o.height()+c.outerHeight()<f.top?"top":"bottom"),
  6387. // Left and right logic
  6388. "auto"===h&&(h=b.width()<f.left+o.outerWidth()/2&&f.left+o.outerWidth()>a(window).width()?"right":"left"),"top"===g?o.addClass("top").removeClass("bottom"):o.addClass("bottom").removeClass("top"),"right"===h?o.addClass("pull-right"):o.removeClass("pull-right"),
  6389. // find the first parent element that has a relative css positioning
  6390. "relative"!==b.css("position")&&(b=b.parents().filter(function(){return"relative"===a(this).css("position")}).first()),0===b.length)throw new Error("datetimepicker component should be placed within a relative positioned container");o.css({top:"top"===g?"auto":e.top+c.outerHeight(),bottom:"top"===g?b.outerHeight()-(b===c?0:e.top):"auto",left:"left"===h?b===c?0:e.left:"auto",right:"left"===h?"auto":b.outerWidth()-c.outerWidth()-(b===c?0:e.left)})},J=function(a){"dp.change"===a.type&&(a.date&&a.date.isSame(a.oldDate)||!a.date&&!a.oldDate)||c.trigger(a)},K=function(a){"y"===a&&(a="YYYY"),J({type:"dp.update",change:a,viewDate:f.clone()})},L=function(a){o&&(a&&(k=Math.max(p,Math.min(3,k+a))),o.find(".datepicker > div").hide().filter(".datepicker-"+q[k].clsName).show())},M=function(){var b=a("<tr>"),c=f.clone().startOf("w").startOf("d");for(d.calendarWeeks===!0&&b.append(a("<th>").addClass("cw").text("#"));c.isBefore(f.clone().endOf("w"));)b.append(a("<th>").addClass("dow").text(c.format("dd"))),c.add(1,"d");o.find(".datepicker-days thead").append(b)},N=function(a){return d.disabledDates[a.format("YYYY-MM-DD")]===!0},O=function(a){return d.enabledDates[a.format("YYYY-MM-DD")]===!0},P=function(a){return d.disabledHours[a.format("H")]===!0},Q=function(a){return d.enabledHours[a.format("H")]===!0},R=function(b,c){if(!b.isValid())return!1;if(d.disabledDates&&"d"===c&&N(b))return!1;if(d.enabledDates&&"d"===c&&!O(b))return!1;if(d.minDate&&b.isBefore(d.minDate,c))return!1;if(d.maxDate&&b.isAfter(d.maxDate,c))return!1;if(d.daysOfWeekDisabled&&"d"===c&&-1!==d.daysOfWeekDisabled.indexOf(b.day()))return!1;if(d.disabledHours&&("h"===c||"m"===c||"s"===c)&&P(b))return!1;if(d.enabledHours&&("h"===c||"m"===c||"s"===c)&&!Q(b))return!1;if(d.disabledTimeIntervals&&("h"===c||"m"===c||"s"===c)){var e=!1;if(a.each(d.disabledTimeIntervals,function(){return b.isBetween(this[0],this[1])?(e=!0,!1):void 0}),e)return!1}return!0},S=function(){for(var b=[],c=f.clone().startOf("y").startOf("d");c.isSame(f,"y");)b.push(a("<span>").attr("data-action","selectMonth").addClass("month").text(c.format("MMM"))),c.add(1,"M");o.find(".datepicker-months td").empty().append(b)},T=function(){var b=o.find(".datepicker-months"),c=b.find("th"),g=b.find("tbody").find("span");c.eq(0).find("span").attr("title",d.tooltips.prevYear),c.eq(1).attr("title",d.tooltips.selectYear),c.eq(2).find("span").attr("title",d.tooltips.nextYear),b.find(".disabled").removeClass("disabled"),R(f.clone().subtract(1,"y"),"y")||c.eq(0).addClass("disabled"),c.eq(1).text(f.year()),R(f.clone().add(1,"y"),"y")||c.eq(2).addClass("disabled"),g.removeClass("active"),e.isSame(f,"y")&&!m&&g.eq(e.month()).addClass("active"),g.each(function(b){R(f.clone().month(b),"M")||a(this).addClass("disabled")})},U=function(){var a=o.find(".datepicker-years"),b=a.find("th"),c=f.clone().subtract(5,"y"),g=f.clone().add(6,"y"),h="";for(b.eq(0).find("span").attr("title",d.tooltips.prevDecade),b.eq(1).attr("title",d.tooltips.selectDecade),b.eq(2).find("span").attr("title",d.tooltips.nextDecade),a.find(".disabled").removeClass("disabled"),d.minDate&&d.minDate.isAfter(c,"y")&&b.eq(0).addClass("disabled"),b.eq(1).text(c.year()+"-"+g.year()),d.maxDate&&d.maxDate.isBefore(g,"y")&&b.eq(2).addClass("disabled");!c.isAfter(g,"y");)h+='<span data-action="selectYear" class="year'+(c.isSame(e,"y")&&!m?" active":"")+(R(c,"y")?"":" disabled")+'">'+c.year()+"</span>",c.add(1,"y");a.find("td").html(h)},V=function(){var a,c=o.find(".datepicker-decades"),g=c.find("th"),h=b({y:f.year()-f.year()%100-1}),i=h.clone().add(100,"y"),j=h.clone(),k=!1,l=!1,m="";for(g.eq(0).find("span").attr("title",d.tooltips.prevCentury),g.eq(2).find("span").attr("title",d.tooltips.nextCentury),c.find(".disabled").removeClass("disabled"),(h.isSame(b({y:1900}))||d.minDate&&d.minDate.isAfter(h,"y"))&&g.eq(0).addClass("disabled"),g.eq(1).text(h.year()+"-"+i.year()),(h.isSame(b({y:2e3}))||d.maxDate&&d.maxDate.isBefore(i,"y"))&&g.eq(2).addClass("disabled");!h.isAfter(i,"y");)a=h.year()+12,k=d.minDate&&d.minDate.isAfter(h,"y")&&d.minDate.year()<=a,l=d.maxDate&&d.maxDate.isAfter(h,"y")&&d.maxDate.year()<=a,m+='<span data-action="selectDecade" class="decade'+(e.isAfter(h)&&e.year()<=a?" active":"")+(R(h,"y")||k||l?"":" disabled")+'" data-selection="'+(h.year()+6)+'">'+(h.year()+1)+" - "+(h.year()+12)+"</span>",h.add(12,"y");m+="<span></span><span></span><span></span>",c.find("td").html(m),g.eq(1).text(j.year()+1+"-"+h.year())},W=function(){var b,c,g,h,i=o.find(".datepicker-days"),j=i.find("th"),k=[];if(B()){for(j.eq(0).find("span").attr("title",d.tooltips.prevMonth),j.eq(1).attr("title",d.tooltips.selectMonth),j.eq(2).find("span").attr("title",d.tooltips.nextMonth),i.find(".disabled").removeClass("disabled"),j.eq(1).text(f.format(d.dayViewHeaderFormat)),R(f.clone().subtract(1,"M"),"M")||j.eq(0).addClass("disabled"),R(f.clone().add(1,"M"),"M")||j.eq(2).addClass("disabled"),b=f.clone().startOf("M").startOf("w").startOf("d"),h=0;42>h;h++)//always display 42 days (should show 6 weeks)
  6391. 0===b.weekday()&&(c=a("<tr>"),d.calendarWeeks&&c.append('<td class="cw">'+b.week()+"</td>"),k.push(c)),g="",b.isBefore(f,"M")&&(g+=" old"),b.isAfter(f,"M")&&(g+=" new"),b.isSame(e,"d")&&!m&&(g+=" active"),R(b,"d")||(g+=" disabled"),b.isSame(y(),"d")&&(g+=" today"),0!==b.day()&&6!==b.day()||(g+=" weekend"),c.append('<td data-action="selectDay" data-day="'+b.format("L")+'" class="day'+g+'">'+b.date()+"</td>"),b.add(1,"d");i.find("tbody").empty().append(k),T(),U(),V()}},X=function(){var b=o.find(".timepicker-hours table"),c=f.clone().startOf("d"),d=[],e=a("<tr>");for(f.hour()>11&&!h&&c.hour(12);c.isSame(f,"d")&&(h||f.hour()<12&&c.hour()<12||f.hour()>11);)c.hour()%4===0&&(e=a("<tr>"),d.push(e)),e.append('<td data-action="selectHour" class="hour'+(R(c,"h")?"":" disabled")+'">'+c.format(h?"HH":"hh")+"</td>"),c.add(1,"h");b.empty().append(d)},Y=function(){for(var b=o.find(".timepicker-minutes table"),c=f.clone().startOf("h"),e=[],g=a("<tr>"),h=1===d.stepping?5:d.stepping;f.isSame(c,"h");)c.minute()%(4*h)===0&&(g=a("<tr>"),e.push(g)),g.append('<td data-action="selectMinute" class="minute'+(R(c,"m")?"":" disabled")+'">'+c.format("mm")+"</td>"),c.add(h,"m");b.empty().append(e)},Z=function(){for(var b=o.find(".timepicker-seconds table"),c=f.clone().startOf("m"),d=[],e=a("<tr>");f.isSame(c,"m");)c.second()%20===0&&(e=a("<tr>"),d.push(e)),e.append('<td data-action="selectSecond" class="second'+(R(c,"s")?"":" disabled")+'">'+c.format("ss")+"</td>"),c.add(5,"s");b.empty().append(d)},$=function(){var a,b,c=o.find(".timepicker span[data-time-component]");h||(a=o.find(".timepicker [data-action=togglePeriod]"),b=e.clone().add(e.hours()>=12?-12:12,"h"),a.text(e.format("A")),R(b,"h")?a.removeClass("disabled"):a.addClass("disabled")),c.filter("[data-time-component=hours]").text(e.format(h?"HH":"hh")),c.filter("[data-time-component=minutes]").text(e.format("mm")),c.filter("[data-time-component=seconds]").text(e.format("ss")),X(),Y(),Z()},_=function(){o&&(W(),$())},aa=function(a){var b=m?null:e;
  6392. // case of calling setValue(null or false)
  6393. // case of calling setValue(null or false)
  6394. //viewDate = date.clone(); // TODO this doesn't work right on first use
  6395. return a?(a=a.clone().locale(d.locale),x()&&a.tz(d.timeZone),1!==d.stepping&&a.minutes(Math.round(a.minutes()/d.stepping)*d.stepping).seconds(0),void(R(a)?(e=a,g.val(e.format(i)),c.data("date",e.format(i)),m=!1,_(),J({type:"dp.change",date:e.clone(),oldDate:b})):(d.keepInvalid?J({type:"dp.change",date:a,oldDate:b}):g.val(m?"":e.format(i)),J({type:"dp.error",date:a,oldDate:b})))):(m=!0,g.val(""),c.data("date",""),J({type:"dp.change",date:!1,oldDate:b}),void _())},/**
  6396. * Hides the widget. Possibly will emit dp.hide
  6397. */
  6398. ba=function(){var b=!1;
  6399. // Ignore event if in the middle of a picker transition
  6400. return o?(o.find(".collapse").each(function(){var c=a(this).data("collapse");return c&&c.transitioning?(b=!0,!1):!0}),b?l:(n&&n.hasClass("btn")&&n.toggleClass("active"),o.hide(),a(window).off("resize",I),o.off("click","[data-action]"),o.off("mousedown",!1),o.remove(),o=!1,J({type:"dp.hide",date:e.clone()}),g.blur(),k=0,f=e.clone(),l)):l},ca=function(){aa(null)},da=function(a){
  6401. //inputDate.locale(options.locale);
  6402. return void 0===d.parseInputDate?b.isMoment(a)||(a=y(a)):a=d.parseInputDate(a),a},/********************************************************************************
  6403. *
  6404. * Widget UI interaction functions
  6405. *
  6406. ********************************************************************************/
  6407. ea={next:function(){var a=q[k].navFnc;f.add(q[k].navStep,a),W(),K(a)},previous:function(){var a=q[k].navFnc;f.subtract(q[k].navStep,a),W(),K(a)},pickerSwitch:function(){L(1)},selectMonth:function(b){var c=a(b.target).closest("tbody").find("span").index(a(b.target));f.month(c),k===p?(aa(e.clone().year(f.year()).month(f.month())),d.inline||ba()):(L(-1),W()),K("M")},selectYear:function(b){var c=parseInt(a(b.target).text(),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDecade:function(b){var c=parseInt(a(b.target).data("selection"),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDay:function(b){var c=f.clone();a(b.target).is(".old")&&c.subtract(1,"M"),a(b.target).is(".new")&&c.add(1,"M"),aa(c.date(parseInt(a(b.target).text(),10))),A()||d.keepOpen||d.inline||ba()},incrementHours:function(){var a=e.clone().add(1,"h");R(a,"h")&&aa(a)},incrementMinutes:function(){var a=e.clone().add(d.stepping,"m");R(a,"m")&&aa(a)},incrementSeconds:function(){var a=e.clone().add(1,"s");R(a,"s")&&aa(a)},decrementHours:function(){var a=e.clone().subtract(1,"h");R(a,"h")&&aa(a)},decrementMinutes:function(){var a=e.clone().subtract(d.stepping,"m");R(a,"m")&&aa(a)},decrementSeconds:function(){var a=e.clone().subtract(1,"s");R(a,"s")&&aa(a)},togglePeriod:function(){aa(e.clone().add(e.hours()>=12?-12:12,"h"))},togglePicker:function(b){var c,e=a(b.target),f=e.closest("ul"),g=f.find(".in"),h=f.find(".collapse:not(.in)");if(g&&g.length){if(c=g.data("collapse"),c&&c.transitioning)return;g.collapse?(// if collapse plugin is available through bootstrap.js then use it
  6408. g.collapse("hide"),h.collapse("show")):(// otherwise just toggle in class on the two views
  6409. g.removeClass("in"),h.addClass("in")),e.is("span")?e.toggleClass(d.icons.time+" "+d.icons.date):e.find("span").toggleClass(d.icons.time+" "+d.icons.date)}},showPicker:function(){o.find(".timepicker > div:not(.timepicker-picker)").hide(),o.find(".timepicker .timepicker-picker").show()},showHours:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-hours").show()},showMinutes:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-seconds").show()},selectHour:function(b){var c=parseInt(a(b.target).text(),10);h||(e.hours()>=12?12!==c&&(c+=12):12===c&&(c=0)),aa(e.clone().hours(c)),ea.showPicker.call(l)},selectMinute:function(b){aa(e.clone().minutes(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},selectSecond:function(b){aa(e.clone().seconds(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},clear:ca,today:function(){var a=y();R(a,"d")&&aa(a)},close:ba},fa=function(b){return a(b.currentTarget).is(".disabled")?!1:(ea[a(b.currentTarget).data("action")].apply(l,arguments),!1)},/**
  6410. * Shows the widget. Possibly will emit dp.show and dp.change
  6411. */
  6412. ga=function(){var b,c={year:function(a){return a.month(0).date(1).hours(0).seconds(0).minutes(0)},month:function(a){return a.date(1).hours(0).seconds(0).minutes(0)},day:function(a){return a.hours(0).seconds(0).minutes(0)},hour:function(a){return a.seconds(0).minutes(0)},minute:function(a){return a.seconds(0)}};// this handles clicks on the widget
  6413. return g.prop("disabled")||!d.ignoreReadonly&&g.prop("readonly")||o?l:(void 0!==g.val()&&0!==g.val().trim().length?aa(da(g.val().trim())):m&&d.useCurrent&&(d.inline||g.is("input")&&0===g.val().trim().length)&&(b=y(),"string"==typeof d.useCurrent&&(b=c[d.useCurrent](b)),aa(b)),o=G(),M(),S(),o.find(".timepicker-hours").hide(),o.find(".timepicker-minutes").hide(),o.find(".timepicker-seconds").hide(),_(),L(),a(window).on("resize",I),o.on("click","[data-action]",fa),o.on("mousedown",!1),n&&n.hasClass("btn")&&n.toggleClass("active"),I(),o.show(),d.focusOnShow&&!g.is(":focus")&&g.focus(),J({type:"dp.show"}),l)},/**
  6414. * Shows or hides the widget
  6415. */
  6416. ha=function(){return o?ba():ga()},ia=function(a){var b,c,e,f,g=null,h=[],i={},j=a.which,k="p";w[j]=k;for(b in w)w.hasOwnProperty(b)&&w[b]===k&&(h.push(b),parseInt(b,10)!==j&&(i[b]=!0));for(b in d.keyBinds)if(d.keyBinds.hasOwnProperty(b)&&"function"==typeof d.keyBinds[b]&&(e=b.split(" "),e.length===h.length&&v[j]===e[e.length-1])){for(f=!0,c=e.length-2;c>=0;c--)if(!(v[e[c]]in i)){f=!1;break}if(f){g=d.keyBinds[b];break}}g&&(g.call(l,o),a.stopPropagation(),a.preventDefault())},ja=function(a){w[a.which]="r",a.stopPropagation(),a.preventDefault()},ka=function(b){var c=a(b.target).val().trim(),d=c?da(c):null;return aa(d),b.stopImmediatePropagation(),!1},la=function(){g.on({change:ka,blur:d.debug?"":ba,keydown:ia,keyup:ja,focus:d.allowInputToggle?ga:""}),c.is("input")?g.on({focus:ga}):n&&(n.on("click",ha),n.on("mousedown",!1))},ma=function(){g.off({change:ka,blur:blur,keydown:ia,keyup:ja,focus:d.allowInputToggle?ba:""}),c.is("input")?g.off({focus:ga}):n&&(n.off("click",ha),n.off("mousedown",!1))},na=function(b){
  6417. // Store given enabledDates and disabledDates as keys.
  6418. // This way we can check their existence in O(1) time instead of looping through whole array.
  6419. // (for example: options.enabledDates['2014-02-27'] === true)
  6420. var c={};return a.each(b,function(){var a=da(this);a.isValid()&&(c[a.format("YYYY-MM-DD")]=!0)}),Object.keys(c).length?c:!1},oa=function(b){
  6421. // Store given enabledHours and disabledHours as keys.
  6422. // This way we can check their existence in O(1) time instead of looping through whole array.
  6423. // (for example: options.enabledHours['2014-02-27'] === true)
  6424. var c={};return a.each(b,function(){c[this]=!0}),Object.keys(c).length?c:!1},pa=function(){var a=d.format||"L LT";i=a.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){var b=e.localeData().longDateFormat(a)||a;return b.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){//temp fix for #740
  6425. return e.localeData().longDateFormat(a)||a})}),j=d.extraFormats?d.extraFormats.slice():[],j.indexOf(a)<0&&j.indexOf(i)<0&&j.push(i),h=i.toLowerCase().indexOf("a")<1&&i.replace(/\[.*?\]/g,"").indexOf("h")<1,z("y")&&(p=2),z("M")&&(p=1),z("d")&&(p=0),k=Math.max(p,k),m||aa(e)};
  6426. // initializing element and component attributes
  6427. if(/********************************************************************************
  6428. *
  6429. * Public API functions
  6430. * =====================
  6431. *
  6432. * Important: Do not expose direct references to private objects or the options
  6433. * object to the outer world. Always return a clone when returning values or make
  6434. * a clone when setting a private variable.
  6435. *
  6436. ********************************************************************************/
  6437. l.destroy=function(){
  6438. ///<summary>Destroys the widget and removes all attached event listeners</summary>
  6439. ba(),ma(),c.removeData("DateTimePicker"),c.removeData("date")},l.toggle=ha,l.show=ga,l.hide=ba,l.disable=function(){
  6440. ///<summary>Disables the input element, the component is attached to, by adding a disabled="true" attribute to it.
  6441. ///If the widget was visible before that call it is hidden. Possibly emits dp.hide</summary>
  6442. return ba(),n&&n.hasClass("btn")&&n.addClass("disabled"),g.prop("disabled",!0),l},l.enable=function(){
  6443. ///<summary>Enables the input element, the component is attached to, by removing disabled attribute from it.</summary>
  6444. return n&&n.hasClass("btn")&&n.removeClass("disabled"),g.prop("disabled",!1),l},l.ignoreReadonly=function(a){if(0===arguments.length)return d.ignoreReadonly;if("boolean"!=typeof a)throw new TypeError("ignoreReadonly () expects a boolean parameter");return d.ignoreReadonly=a,l},l.options=function(b){if(0===arguments.length)return a.extend(!0,{},d);if(!(b instanceof Object))throw new TypeError("options() options parameter should be an object");return a.extend(!0,d,b),a.each(d,function(a,b){if(void 0===l[a])throw new TypeError("option "+a+" is not recognized!");l[a](b)}),l},l.date=function(a){
  6445. ///<signature helpKeyword="$.fn.datetimepicker.date">
  6446. ///<summary>Returns the component's model current date, a moment object or null if not set.</summary>
  6447. ///<returns type="Moment">date.clone()</returns>
  6448. ///</signature>
  6449. ///<signature>
  6450. ///<summary>Sets the components model current moment to it. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.</summary>
  6451. ///<param name="newDate" locid="$.fn.datetimepicker.date_p:newDate">Takes string, Date, moment, null parameter.</param>
  6452. ///</signature>
  6453. if(0===arguments.length)return m?null:e.clone();if(!(null===a||"string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("date() parameter must be one of [null, string, moment or Date]");return aa(null===a?null:da(a)),l},l.format=function(a){
  6454. ///<summary>test su</summary>
  6455. ///<param name="newFormat">info about para</param>
  6456. ///<returns type="string|boolean">returns foo</returns>
  6457. if(0===arguments.length)return d.format;if("string"!=typeof a&&("boolean"!=typeof a||a!==!1))throw new TypeError("format() expects a string or boolean:false parameter "+a);return d.format=a,i&&pa(),l},l.timeZone=function(a){if(0===arguments.length)return d.timeZone;if("string"!=typeof a)throw new TypeError("newZone() expects a string parameter");return d.timeZone=a,l},l.dayViewHeaderFormat=function(a){if(0===arguments.length)return d.dayViewHeaderFormat;if("string"!=typeof a)throw new TypeError("dayViewHeaderFormat() expects a string parameter");return d.dayViewHeaderFormat=a,l},l.extraFormats=function(a){if(0===arguments.length)return d.extraFormats;if(a!==!1&&!(a instanceof Array))throw new TypeError("extraFormats() expects an array or false parameter");return d.extraFormats=a,j&&pa(),l},l.disabledDates=function(b){
  6458. ///<signature helpKeyword="$.fn.datetimepicker.disabledDates">
  6459. ///<summary>Returns an array with the currently set disabled dates on the component.</summary>
  6460. ///<returns type="array">options.disabledDates</returns>
  6461. ///</signature>
  6462. ///<signature>
  6463. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
  6464. ///options.enabledDates if such exist.</summary>
  6465. ///<param name="dates" locid="$.fn.datetimepicker.disabledDates_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
  6466. ///</signature>
  6467. if(0===arguments.length)return d.disabledDates?a.extend({},d.disabledDates):d.disabledDates;if(!b)return d.disabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledDates() expects an array parameter");return d.disabledDates=na(b),d.enabledDates=!1,_(),l},l.enabledDates=function(b){
  6468. ///<signature helpKeyword="$.fn.datetimepicker.enabledDates">
  6469. ///<summary>Returns an array with the currently set enabled dates on the component.</summary>
  6470. ///<returns type="array">options.enabledDates</returns>
  6471. ///</signature>
  6472. ///<signature>
  6473. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledDates if such exist.</summary>
  6474. ///<param name="dates" locid="$.fn.datetimepicker.enabledDates_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
  6475. ///</signature>
  6476. if(0===arguments.length)return d.enabledDates?a.extend({},d.enabledDates):d.enabledDates;if(!b)return d.enabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledDates() expects an array parameter");return d.enabledDates=na(b),d.disabledDates=!1,_(),l},l.daysOfWeekDisabled=function(a){if(0===arguments.length)return d.daysOfWeekDisabled.splice(0);if("boolean"==typeof a&&!a)return d.daysOfWeekDisabled=!1,_(),l;if(!(a instanceof Array))throw new TypeError("daysOfWeekDisabled() expects an array parameter");if(d.daysOfWeekDisabled=a.reduce(function(a,b){return b=parseInt(b,10),b>6||0>b||isNaN(b)?a:(-1===a.indexOf(b)&&a.push(b),a)},[]).sort(),d.useCurrent&&!d.keepInvalid){for(var b=0;!R(e,"d");){if(e.add(1,"d"),7===b)throw"Tried 7 times to find a valid date";b++}aa(e)}return _(),l},l.maxDate=function(a){if(0===arguments.length)return d.maxDate?d.maxDate.clone():d.maxDate;if("boolean"==typeof a&&a===!1)return d.maxDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("maxDate() Could not parse date parameter: "+a);if(d.minDate&&b.isBefore(d.minDate))throw new TypeError("maxDate() date parameter is before options.minDate: "+b.format(i));return d.maxDate=b,d.useCurrent&&!d.keepInvalid&&e.isAfter(a)&&aa(d.maxDate),f.isAfter(b)&&(f=b.clone().subtract(d.stepping,"m")),_(),l},l.minDate=function(a){if(0===arguments.length)return d.minDate?d.minDate.clone():d.minDate;if("boolean"==typeof a&&a===!1)return d.minDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("minDate() Could not parse date parameter: "+a);if(d.maxDate&&b.isAfter(d.maxDate))throw new TypeError("minDate() date parameter is after options.maxDate: "+b.format(i));return d.minDate=b,d.useCurrent&&!d.keepInvalid&&e.isBefore(a)&&aa(d.minDate),f.isBefore(b)&&(f=b.clone().add(d.stepping,"m")),_(),l},l.defaultDate=function(a){
  6477. ///<signature helpKeyword="$.fn.datetimepicker.defaultDate">
  6478. ///<summary>Returns a moment with the options.defaultDate option configuration or false if not set</summary>
  6479. ///<returns type="Moment">date.clone()</returns>
  6480. ///</signature>
  6481. ///<signature>
  6482. ///<summary>Will set the picker's inital date. If a boolean:false value is passed the options.defaultDate parameter is cleared.</summary>
  6483. ///<param name="defaultDate" locid="$.fn.datetimepicker.defaultDate_p:defaultDate">Takes a string, Date, moment, boolean:false</param>
  6484. ///</signature>
  6485. if(0===arguments.length)return d.defaultDate?d.defaultDate.clone():d.defaultDate;if(!a)return d.defaultDate=!1,l;"string"==typeof a&&(a="now"===a||"moment"===a?y():y(a));var b=da(a);if(!b.isValid())throw new TypeError("defaultDate() Could not parse date parameter: "+a);if(!R(b))throw new TypeError("defaultDate() date passed is invalid according to component setup validations");return d.defaultDate=b,(d.defaultDate&&d.inline||""===g.val().trim())&&aa(d.defaultDate),l},l.locale=function(a){if(0===arguments.length)return d.locale;if(!b.localeData(a))throw new TypeError("locale() locale "+a+" is not loaded from moment locales!");return d.locale=a,e.locale(d.locale),f.locale(d.locale),i&&pa(),o&&(ba(),ga()),l},l.stepping=function(a){return 0===arguments.length?d.stepping:(a=parseInt(a,10),(isNaN(a)||1>a)&&(a=1),d.stepping=a,l)},l.useCurrent=function(a){var b=["year","month","day","hour","minute"];if(0===arguments.length)return d.useCurrent;if("boolean"!=typeof a&&"string"!=typeof a)throw new TypeError("useCurrent() expects a boolean or string parameter");if("string"==typeof a&&-1===b.indexOf(a.toLowerCase()))throw new TypeError("useCurrent() expects a string parameter of "+b.join(", "));return d.useCurrent=a,l},l.collapse=function(a){if(0===arguments.length)return d.collapse;if("boolean"!=typeof a)throw new TypeError("collapse() expects a boolean parameter");return d.collapse===a?l:(d.collapse=a,o&&(ba(),ga()),l)},l.icons=function(b){if(0===arguments.length)return a.extend({},d.icons);if(!(b instanceof Object))throw new TypeError("icons() expects parameter to be an Object");return a.extend(d.icons,b),o&&(ba(),ga()),l},l.tooltips=function(b){if(0===arguments.length)return a.extend({},d.tooltips);if(!(b instanceof Object))throw new TypeError("tooltips() expects parameter to be an Object");return a.extend(d.tooltips,b),o&&(ba(),ga()),l},l.useStrict=function(a){if(0===arguments.length)return d.useStrict;if("boolean"!=typeof a)throw new TypeError("useStrict() expects a boolean parameter");return d.useStrict=a,l},l.sideBySide=function(a){if(0===arguments.length)return d.sideBySide;if("boolean"!=typeof a)throw new TypeError("sideBySide() expects a boolean parameter");return d.sideBySide=a,o&&(ba(),ga()),l},l.viewMode=function(a){if(0===arguments.length)return d.viewMode;if("string"!=typeof a)throw new TypeError("viewMode() expects a string parameter");if(-1===r.indexOf(a))throw new TypeError("viewMode() parameter must be one of ("+r.join(", ")+") value");return d.viewMode=a,k=Math.max(r.indexOf(a),p),L(),l},l.toolbarPlacement=function(a){if(0===arguments.length)return d.toolbarPlacement;if("string"!=typeof a)throw new TypeError("toolbarPlacement() expects a string parameter");if(-1===u.indexOf(a))throw new TypeError("toolbarPlacement() parameter must be one of ("+u.join(", ")+") value");return d.toolbarPlacement=a,o&&(ba(),ga()),l},l.widgetPositioning=function(b){if(0===arguments.length)return a.extend({},d.widgetPositioning);if("[object Object]"!=={}.toString.call(b))throw new TypeError("widgetPositioning() expects an object variable");if(b.horizontal){if("string"!=typeof b.horizontal)throw new TypeError("widgetPositioning() horizontal variable must be a string");if(b.horizontal=b.horizontal.toLowerCase(),-1===t.indexOf(b.horizontal))throw new TypeError("widgetPositioning() expects horizontal parameter to be one of ("+t.join(", ")+")");d.widgetPositioning.horizontal=b.horizontal}if(b.vertical){if("string"!=typeof b.vertical)throw new TypeError("widgetPositioning() vertical variable must be a string");if(b.vertical=b.vertical.toLowerCase(),-1===s.indexOf(b.vertical))throw new TypeError("widgetPositioning() expects vertical parameter to be one of ("+s.join(", ")+")");d.widgetPositioning.vertical=b.vertical}return _(),l},l.calendarWeeks=function(a){if(0===arguments.length)return d.calendarWeeks;if("boolean"!=typeof a)throw new TypeError("calendarWeeks() expects parameter to be a boolean value");return d.calendarWeeks=a,_(),l},l.showTodayButton=function(a){if(0===arguments.length)return d.showTodayButton;if("boolean"!=typeof a)throw new TypeError("showTodayButton() expects a boolean parameter");return d.showTodayButton=a,o&&(ba(),ga()),l},l.showClear=function(a){if(0===arguments.length)return d.showClear;if("boolean"!=typeof a)throw new TypeError("showClear() expects a boolean parameter");return d.showClear=a,o&&(ba(),ga()),l},l.widgetParent=function(b){if(0===arguments.length)return d.widgetParent;if("string"==typeof b&&(b=a(b)),null!==b&&"string"!=typeof b&&!(b instanceof a))throw new TypeError("widgetParent() expects a string or a jQuery object parameter");return d.widgetParent=b,o&&(ba(),ga()),l},l.keepOpen=function(a){if(0===arguments.length)return d.keepOpen;if("boolean"!=typeof a)throw new TypeError("keepOpen() expects a boolean parameter");return d.keepOpen=a,l},l.focusOnShow=function(a){if(0===arguments.length)return d.focusOnShow;if("boolean"!=typeof a)throw new TypeError("focusOnShow() expects a boolean parameter");return d.focusOnShow=a,l},l.inline=function(a){if(0===arguments.length)return d.inline;if("boolean"!=typeof a)throw new TypeError("inline() expects a boolean parameter");return d.inline=a,l},l.clear=function(){return ca(),l},l.keyBinds=function(a){return 0===arguments.length?d.keyBinds:(d.keyBinds=a,l)},l.getMoment=function(a){return y(a)},l.debug=function(a){if("boolean"!=typeof a)throw new TypeError("debug() expects a boolean parameter");return d.debug=a,l},l.allowInputToggle=function(a){if(0===arguments.length)return d.allowInputToggle;if("boolean"!=typeof a)throw new TypeError("allowInputToggle() expects a boolean parameter");return d.allowInputToggle=a,l},l.showClose=function(a){if(0===arguments.length)return d.showClose;if("boolean"!=typeof a)throw new TypeError("showClose() expects a boolean parameter");return d.showClose=a,l},l.keepInvalid=function(a){if(0===arguments.length)return d.keepInvalid;if("boolean"!=typeof a)throw new TypeError("keepInvalid() expects a boolean parameter");return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)return d.datepickerInput;if("string"!=typeof a)throw new TypeError("datepickerInput() expects a string parameter");return d.datepickerInput=a,l},l.parseInputDate=function(a){if(0===arguments.length)return d.parseInputDate;if("function"!=typeof a)throw new TypeError("parseInputDate() sholud be as function");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){
  6486. ///<signature helpKeyword="$.fn.datetimepicker.disabledTimeIntervals">
  6487. ///<summary>Returns an array with the currently set disabled dates on the component.</summary>
  6488. ///<returns type="array">options.disabledTimeIntervals</returns>
  6489. ///</signature>
  6490. ///<signature>
  6491. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
  6492. ///options.enabledDates if such exist.</summary>
  6493. ///<param name="dates" locid="$.fn.datetimepicker.disabledTimeIntervals_p:dates">Takes an [ string or Date or moment ] of values and allows the user to select only from those days.</param>
  6494. ///</signature>
  6495. if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledTimeIntervals() expects an array parameter");return d.disabledTimeIntervals=b,_(),l},l.disabledHours=function(b){
  6496. ///<signature helpKeyword="$.fn.datetimepicker.disabledHours">
  6497. ///<summary>Returns an array with the currently set disabled hours on the component.</summary>
  6498. ///<returns type="array">options.disabledHours</returns>
  6499. ///</signature>
  6500. ///<signature>
  6501. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of
  6502. ///options.enabledHours if such exist.</summary>
  6503. ///<param name="hours" locid="$.fn.datetimepicker.disabledHours_p:hours">Takes an [ int ] of values and disallows the user to select only from those hours.</param>
  6504. ///</signature>
  6505. if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledHours() expects an array parameter");if(d.disabledHours=oa(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.enabledHours=function(b){
  6506. ///<signature helpKeyword="$.fn.datetimepicker.enabledHours">
  6507. ///<summary>Returns an array with the currently set enabled hours on the component.</summary>
  6508. ///<returns type="array">options.enabledHours</returns>
  6509. ///</signature>
  6510. ///<signature>
  6511. ///<summary>Setting this takes precedence over options.minDate, options.maxDate configuration. Also calling this function removes the configuration of options.disabledHours if such exist.</summary>
  6512. ///<param name="hours" locid="$.fn.datetimepicker.enabledHours_p:hours">Takes an [ int ] of values and allows the user to select only from those hours.</param>
  6513. ///</signature>
  6514. if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledHours() expects an array parameter");if(d.enabledHours=oa(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},/**
  6515. * Returns the component's model current viewDate, a moment object or null if not set. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.
  6516. * @param {Takes string, viewDate, moment, null parameter.} newDate
  6517. * @returns {viewDate.clone()}
  6518. */
  6519. l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!("string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");return f=da(a),K(),l},c.is("input"))g=c;else if(g=c.find(d.datepickerInput),0===g.length)g=c.find("input");else if(!g.is("input"))throw new Error('CSS class "'+d.datepickerInput+'" cannot be applied to non input element');if(c.hasClass("input-group")&&(
  6520. // in case there is more then one 'input-group-addon' Issue #48
  6521. n=0===c.find(".datepickerbutton").length?c.find(".input-group-addon"):c.find(".datepickerbutton")),!d.inline&&!g.is("input"))throw new Error("Could not initialize DateTimePicker without an input element");
  6522. // Set defaults for date here now instead of in var declaration
  6523. return e=y(),f=e.clone(),a.extend(!0,d,H()),l.options(d),pa(),la(),g.prop("disabled")&&l.disable(),g.is("input")&&0!==g.val().trim().length?aa(da(g.val().trim())):d.defaultDate&&void 0===g.attr("placeholder")&&aa(d.defaultDate),d.inline&&ga(),l};/********************************************************************************
  6524. *
  6525. * jQuery plugin constructor and defaults object
  6526. *
  6527. ********************************************************************************/
  6528. /**
  6529. * See (http://jquery.com/).
  6530. * @name jQuery
  6531. * @class
  6532. * See the jQuery Library (http://jquery.com/) for full details. This just
  6533. * documents the function and classes that are added to jQuery by this plug-in.
  6534. */
  6535. /**
  6536. * See (http://jquery.com/)
  6537. * @name fn
  6538. * @class
  6539. * See the jQuery Library (http://jquery.com/) for full details. This just
  6540. * documents the function and classes that are added to jQuery by this plug-in.
  6541. * @memberOf jQuery
  6542. */
  6543. /**
  6544. * Show comments
  6545. * @class datetimepicker
  6546. * @memberOf jQuery.fn
  6547. */
  6548. a.fn.datetimepicker=function(b){b=b||{};var d,e=Array.prototype.slice.call(arguments,1),f=!0,g=["destroy","hide","show","toggle"];if("object"==typeof b)return this.each(function(){var d=a(this);d.data("DateTimePicker")||(b=a.extend(!0,{},a.fn.datetimepicker.defaults,b),d.data("DateTimePicker",c(d,b)))});if("string"==typeof b)return this.each(function(){var c=a(this),g=c.data("DateTimePicker");if(!g)throw new Error('bootstrap-datetimepicker("'+b+'") method was called on an element that is not using DateTimePicker');d=g[b].apply(g,e),f=d===g}),f||a.inArray(b,g)>-1?this:d;throw new TypeError("Invalid arguments for DateTimePicker: "+b)},a.fn.datetimepicker.defaults={timeZone:"",format:!1,dayViewHeaderFormat:"MMMM YYYY",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down",previous:"glyphicon glyphicon-chevron-left",next:"glyphicon glyphicon-chevron-right",today:"glyphicon glyphicon-screenshot",clear:"glyphicon glyphicon-trash",close:"glyphicon glyphicon-remove"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:"days",toolbarPlacement:"default",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:".datepickerinput",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(7,"d")):this.date(b.clone().add(this.stepping(),"m"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(7,"d")):this.date(b.clone().subtract(this.stepping(),"m"))},"control up":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(1,"y")):this.date(b.clone().add(1,"h"))}},"control down":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(1,"y")):this.date(b.clone().subtract(1,"h"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"d"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"d"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"M"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"M"))}},enter:function(){this.hide()},escape:function(){this.hide()},
  6549. //tab: function (widget) { //this break the flow of the form. disabling for now
  6550. // var toggle = widget.find('.picker-switch a[data-action="togglePicker"]');
  6551. // if(toggle.length > 0) toggle.click();
  6552. //},
  6553. "control space":function(a){a.find(".timepicker").is(":visible")&&a.find('.btn[data-action="togglePeriod"]').click()},t:function(){this.date(this.getMoment())},"delete":function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1},"undefined"!=typeof module&&(module.exports=a.fn.datetimepicker)});
  6554. /**
  6555. * @author: pppscn <35696959@qq.com>
  6556. * @version: v0.0.1
  6557. *
  6558. * @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
  6559. */
  6560. !function ($) {
  6561. 'use strict';
  6562. var firstLoad = false, ColumnsForSearch = [];
  6563. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  6564. var showCommonSearch = function (pColumns, that) {
  6565. var vFormCommon = createFormCommon(pColumns, that), timeoutId = 0;
  6566. var vModal = sprintf("<div id=\"commonSearchModalContent_%s\" class=\"common-search-table\">", that.options.idTable);
  6567. vModal += vFormCommon.join('');
  6568. vModal += "</div>";
  6569. $("#myTabContent").before($(vModal));
  6570. if (that.options.sidePagination != 'server' || !that.options.url) {
  6571. $('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) {
  6572. clearTimeout(timeoutId);
  6573. timeoutId = setTimeout(function () {
  6574. that.onColumnCommonSearch(event);
  6575. }, that.options.searchTimeOut);
  6576. });
  6577. }
  6578. //绑定日期时间元素事件
  6579. var form = $("#" + that.options.idForm);
  6580. if ($(".datetimepicker", form).size() > 0) {
  6581. require(['bootstrap-datetimepicker'], function () {
  6582. $('.datetimepicker', form).parent().css('position', 'relative');
  6583. $('.datetimepicker', form).datetimepicker({
  6584. //format: 'YYYY-MM-DD',
  6585. icons: {
  6586. time: 'fa fa-clock-o',
  6587. date: 'fa fa-calendar',
  6588. up: 'fa fa-chevron-up',
  6589. down: 'fa fa-chevron-down',
  6590. previous: 'fa fa-chevron-left',
  6591. next: 'fa fa-chevron-right',
  6592. today: 'fa fa-history',
  6593. clear: 'fa fa-trash',
  6594. close: 'fa fa-remove'
  6595. },
  6596. showTodayButton: true,
  6597. showClose: true
  6598. });
  6599. });
  6600. }
  6601. // 提交搜索
  6602. $("#btnSubmitCommon" + "_" + that.options.idTable).click(function (event) {
  6603. that.onColumnCommonSearch();
  6604. });
  6605. // 重置搜索
  6606. $("#btnResetCommon" + "_" + that.options.idTable).click(function () {
  6607. $("#commonSearchModalContent" + "_" + that.options.idTable + " form")[0].reset();
  6608. that.onColumnCommonSearch();
  6609. });
  6610. };
  6611. var createFormCommon = function (pColumns, that) {
  6612. var htmlForm = [];
  6613. var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'];
  6614. //var selectList = [];
  6615. //for (var i = 0; i < opList.length; i++) {
  6616. // selectList.push("<option value='" + opList[i] + "'>" + opList[i] + "</option>");
  6617. //}
  6618. //var selectHtml = selectList.join('');
  6619. htmlForm.push(sprintf('<form class="form-inline" id="%s" action="%s" >', that.options.idForm, that.options.actionForm));
  6620. htmlForm.push('<fieldset>');
  6621. if (that.options.titleForm.length > 0)
  6622. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  6623. for (var i in pColumns) {
  6624. var vObjCol = pColumns[i];
  6625. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  6626. ColumnsForSearch.push(vObjCol);
  6627. htmlForm.push('<div class="form-group" style="margin:5px">');
  6628. htmlForm.push(sprintf('<label for="%s" class="control-label" style="padding:0 10px">%s</label>', vObjCol.field, vObjCol.title));
  6629. if (that.options.sidePagination == 'server' && that.options.url) {
  6630. //htmlForm.push('<div class="col-sm-2">');
  6631. //htmlForm.push(sprintf('<select class="form-control" name="field-%s" data-name="%s">%s</select>', vObjCol.field, vObjCol.field, selectHtml));
  6632. vObjCol.operate = (typeof vObjCol.operate === 'undefined' || $.inArray(vObjCol.operate, opList) === -1) ? '=' : vObjCol.operate;
  6633. htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="field-%s" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
  6634. //htmlForm.push('</div>');
  6635. }
  6636. //htmlForm.push('<div class="col-sm-8">');
  6637. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  6638. if (vObjCol.searchList) {
  6639. if (typeof vObjCol.searchList == 'function') {
  6640. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  6641. } else {
  6642. var isArray = vObjCol.searchList.constructor === Array;
  6643. var searchList = [];
  6644. searchList.push(sprintf('<option value="">%s</option>', $.fn.bootstrapTable.locales.formatCommonChoose()));
  6645. $.each(vObjCol.searchList, function (key, value) {
  6646. searchList.push("<option value='" + (isArray ? value : key) + "'>" + value + "</option>");
  6647. });
  6648. htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, searchList.join('')));
  6649. }
  6650. } else {
  6651. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  6652. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  6653. var addclass = typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass;
  6654. var data = typeof vObjCol.data === 'undefined' ? '' : vObjCol.data;
  6655. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, placeholder, vObjCol.field, style, data));
  6656. var reg = /BETWEEN$/;
  6657. if (reg.test(vObjCol.operate)) {
  6658. htmlForm.push(sprintf('&nbsp;-&nbsp;<input type="%s" class="%s" name="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, placeholder, vObjCol.field, style, data));
  6659. }
  6660. }
  6661. //htmlForm.push('</div>');
  6662. htmlForm.push('</div>');
  6663. }
  6664. }
  6665. htmlForm.push(createFormBtn(that).join(''));
  6666. htmlForm.push('</fieldset>');
  6667. htmlForm.push('</form>');
  6668. return htmlForm;
  6669. };
  6670. var createFormBtn = function (that) {
  6671. var htmlBtn = [];
  6672. var searchSubmit = that.options.formatCommonSubmitButton();
  6673. var searchReset = that.options.formatCommonResetButton();
  6674. var searchClose = that.options.formatCommonCloseButton();
  6675. htmlBtn.push('<div class="form-group" style="margin:5px">');
  6676. htmlBtn.push('<div class="col-sm-12 text-center">');
  6677. if (that.options.sidePagination == 'server' && that.options.url) {
  6678. htmlBtn.push(sprintf('<button type="button" id="btnSubmitCommon%s" class="btn btn-success" >%s</button> ', "_" + that.options.idTable, searchSubmit));
  6679. htmlBtn.push(sprintf('<button type="button" id="btnResetCommon%s" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchReset));
  6680. } else {
  6681. htmlBtn.push(sprintf('<button type="button" id="btnCloseCommon%s" data-dismiss="modal" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchClose));
  6682. }
  6683. htmlBtn.push('</div>');
  6684. htmlBtn.push('</div>');
  6685. return htmlBtn;
  6686. };
  6687. $.extend($.fn.bootstrapTable.defaults, {
  6688. commonSearch: false,
  6689. idForm: 'commonSearch',
  6690. titleForm: "Common search",
  6691. actionForm: '',
  6692. idTable: undefined,
  6693. onColumnCommonSearch: function (field, text) {
  6694. return false;
  6695. }
  6696. });
  6697. $.extend($.fn.bootstrapTable.defaults.icons, {
  6698. commonSearchIcon: 'glyphicon-search'
  6699. });
  6700. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  6701. 'column-common-search.bs.table': 'onColumnCommonSearch'
  6702. });
  6703. $.extend($.fn.bootstrapTable.locales, {
  6704. formatCommonSearch: function () {
  6705. return "Common search";
  6706. },
  6707. formatCommonSubmitButton: function () {
  6708. return "Submit";
  6709. },
  6710. formatCommonResetButton: function () {
  6711. return "Reset";
  6712. },
  6713. formatCommonCloseButton: function () {
  6714. return "Close";
  6715. },
  6716. formatCommonChoose: function () {
  6717. return "Choose";
  6718. }
  6719. });
  6720. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  6721. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6722. _initToolbar = BootstrapTable.prototype.initToolbar,
  6723. _load = BootstrapTable.prototype.load,
  6724. _initSearch = BootstrapTable.prototype.initSearch;
  6725. BootstrapTable.prototype.initToolbar = function () {
  6726. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  6727. if (!this.options.search) {
  6728. return;
  6729. }
  6730. if (!this.options.commonSearch) {
  6731. return;
  6732. }
  6733. if (!this.options.idTable) {
  6734. return;
  6735. }
  6736. var that = this;
  6737. showCommonSearch(that.columns, that);
  6738. };
  6739. BootstrapTable.prototype.load = function (data) {
  6740. _load.apply(this, Array.prototype.slice.apply(arguments));
  6741. if (!this.options.commonSearch) {
  6742. return;
  6743. }
  6744. if (typeof this.options.idTable === 'undefined') {
  6745. return;
  6746. } else {
  6747. if (!firstLoad) {
  6748. var height = parseInt($(".bootstrap-table").height());
  6749. height += 10;
  6750. $("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
  6751. firstLoad = true;
  6752. }
  6753. }
  6754. };
  6755. BootstrapTable.prototype.initSearch = function () {
  6756. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  6757. if (!this.options.commonSearch) {
  6758. return;
  6759. }
  6760. var that = this;
  6761. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  6762. this.data = fp ? $.grep(this.data, function (item, i) {
  6763. for (var key in fp) {
  6764. var fval = fp[key].toLowerCase();
  6765. var value = item[key];
  6766. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  6767. that.header.formatters[$.inArray(key, that.header.fields)],
  6768. [value, item, i], value);
  6769. if (!($.inArray(key, that.header.fields) !== -1 &&
  6770. (typeof value === 'string' || typeof value === 'number') &&
  6771. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  6772. return false;
  6773. }
  6774. }
  6775. return true;
  6776. }) : this.data;
  6777. };
  6778. BootstrapTable.prototype.onColumnCommonSearch = function (event) {
  6779. if (typeof event === 'undefined') {
  6780. var op = {};
  6781. var filter = {};
  6782. $("#commonSearchModalContent_" + this.options.idTable + " input.operate").each(function (i) {
  6783. var name = $(this).data("name");
  6784. var sym = $(this).val();
  6785. var obj = $("[name='" + name + "']");
  6786. if (obj.size() == 0)
  6787. return true;
  6788. var vObjCol = ColumnsForSearch[i];
  6789. if (obj.size() > 1) {
  6790. if (/BETWEEN$/.test(sym)) {
  6791. var value_begin = $.trim($("[name='" + name + "']:first").val()), value_end = $.trim($("[name='" + name + "']:last").val());
  6792. if (!value_begin.length || !value_end.length) {
  6793. return true;
  6794. }
  6795. if (typeof vObjCol.process === 'function') {
  6796. value_begin = vObjCol.process(value_begin, 'begin');
  6797. value_end = vObjCol.process(value_end, 'end');
  6798. } else if ($("[name='" + name + "']:first").attr('type') === 'datetime') { //datetime类型字段转换成时间戳
  6799. value_begin = strtotime(value_begin);
  6800. value_end = strtotime(value_end);
  6801. if (value_begin === value_end && '00:00:00' === date('H:i:s', value_begin)) {
  6802. value_end += 86399;
  6803. }
  6804. }
  6805. var value = value_begin + ',' + value_end;
  6806. } else {
  6807. var value = $("[name='" + name + "']:checked").val();
  6808. }
  6809. } else {
  6810. var value = (typeof vObjCol.process === 'function') ? vObjCol.process(obj.val()) : obj.val();
  6811. }
  6812. if (value == '' && sym.indexOf("NULL") == -1) {
  6813. return true;
  6814. }
  6815. op[name] = sym;
  6816. filter[name] = value;
  6817. });
  6818. // 追加查询关键字
  6819. this.options.pageNumber = 1;
  6820. this.options.queryParams = function (params) {
  6821. return {
  6822. search: params.search,
  6823. sort: params.sort,
  6824. order: params.order,
  6825. filter: JSON.stringify(filter),
  6826. op: JSON.stringify(op),
  6827. offset: params.offset,
  6828. limit: params.limit,
  6829. };
  6830. };
  6831. this.refresh({query: {filter: JSON.stringify(filter), op: JSON.stringify(op)}});
  6832. } else {
  6833. var text = $.trim($(event.currentTarget).val());
  6834. var $field = $(event.currentTarget)[0].id;
  6835. if ($.isEmptyObject(this.filterColumnsPartial)) {
  6836. this.filterColumnsPartial = {};
  6837. }
  6838. if (text) {
  6839. this.filterColumnsPartial[$field] = text;
  6840. } else {
  6841. delete this.filterColumnsPartial[$field];
  6842. }
  6843. this.options.pageNumber = 1;
  6844. this.onSearch(event);
  6845. // this.updatePagination();
  6846. this.trigger('column-common-search', $field, text);
  6847. }
  6848. };
  6849. /**
  6850. * 模仿PHP的strtotime()函数
  6851. * strtotime('2017-05-20 13:14:00') OR strtotime('2017-05-20')
  6852. * @return 时间戳
  6853. */
  6854. var strtotime = function (str) {
  6855. var _arr = str.split(' ');
  6856. var _day = _arr[0].split('-');
  6857. _arr[1] = (_arr[1] == null) ? '0:0:0' : _arr[1];
  6858. var _time = _arr[1].split(':');
  6859. for (var i = _day.length - 1; i >= 0; i--) {
  6860. _day[i] = isNaN(parseInt(_day[i])) ? 0 : parseInt(_day[i]);
  6861. }
  6862. for (var i = _time.length - 1; i >= 0; i--) {
  6863. _time[i] = isNaN(parseInt(_time[i])) ? 0 : parseInt(_time[i]);
  6864. }
  6865. var _temp = new Date(_day[0], _day[1] - 1, _day[2], _time[0], _time[1], _time[2]);
  6866. return _temp.getTime() / 1000;
  6867. };
  6868. /**
  6869. * 模仿PHP的date()函数
  6870. * strtotime('Y-m-d H:i:s');
  6871. * @param format 只支持 'Y-m-d H:i:s','Y-m-d','H:i:s' 三种调用方式
  6872. * @param time 为空时,取当前时间
  6873. * @return 日期格式化的字符串
  6874. */
  6875. var date = function (format, time) {
  6876. var _temp = (time != null) ? new Date(time * 1000) : new Date();
  6877. var _return = '';
  6878. if (/Y-m-d/.test(format)) {
  6879. var _day = [_temp.getFullYear(), addzero(1 + _temp.getMonth()), addzero(_temp.getDate())];
  6880. _return = _day.join('-');
  6881. }
  6882. if (/H:i:s/.test(format)) {
  6883. var _time = [addzero(_temp.getHours()), addzero(_temp.getMinutes()), addzero(_temp.getSeconds())];
  6884. _return += ' ' + _time.join(':');
  6885. }
  6886. return _return.replace(/^\s+|\s+$/gm, '');
  6887. function addzero(i) {
  6888. if (i <= 9) {
  6889. return '0' + i;
  6890. } else {
  6891. return i;
  6892. }
  6893. }
  6894. };
  6895. }(jQuery);
  6896. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  6897. return function () {
  6898. var ret, fn;
  6899. return ret || global.$.fn.bootstrapTable.defaults;
  6900. };
  6901. }(this)));
  6902. define('table',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-advancedsearch', 'bootstrap-table-commonsearch'], function ($, undefined, Backend, Config, Toastr, Moment) {
  6903. var Table = {
  6904. list: {},
  6905. // Bootstrap-table 基础配置
  6906. defaults: {
  6907. url: '',
  6908. sidePagination: 'server',
  6909. method: 'get',
  6910. toolbar: "#toolbar",
  6911. search: true,
  6912. cache: false,
  6913. advancedSearch: true,
  6914. commonSearch: false,
  6915. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  6916. idTable: 'advancedTable',
  6917. showExport: true,
  6918. exportDataType: "all",
  6919. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  6920. pageSize: 10,
  6921. pageList: [10, 25, 50, 'All'],
  6922. pagination: true,
  6923. clickToSelect: true,
  6924. showRefresh: false,
  6925. locale: 'zh-CN',
  6926. showToggle: true,
  6927. showColumns: true,
  6928. sortName: 'id',
  6929. sortOrder: 'desc',
  6930. paginationFirstText: __("First"),
  6931. paginationPreText: __("Previous"),
  6932. paginationNextText: __("Next"),
  6933. paginationLastText: __("Last"),
  6934. mobileResponsive: true,
  6935. cardView: true,
  6936. checkOnInit: true,
  6937. extend: {
  6938. index_url: '',
  6939. add_url: '',
  6940. edit_url: '',
  6941. del_url: '',
  6942. multi_url: '',
  6943. dragsort_url: 'ajax/weigh',
  6944. }
  6945. },
  6946. // Bootstrap-table 列配置
  6947. columnDefaults: {
  6948. align: 'center',
  6949. valign: 'middle',
  6950. },
  6951. config: {
  6952. firsttd: 'tbody tr td:first-child:not(:has(div.card-views))',
  6953. toolbar: '.toolbar',
  6954. refreshbtn: '.btn-refresh',
  6955. addbtn: '.btn-add',
  6956. editbtn: '.btn-edit',
  6957. delbtn: '.btn-del',
  6958. multibtn: '.btn-multi',
  6959. disabledbtn: '.btn-disabled',
  6960. editonebtn: '.btn-editone',
  6961. dragsortfield: 'weigh',
  6962. },
  6963. api: {
  6964. init: function (defaults, columnDefaults, locales) {
  6965. defaults = defaults ? defaults : {};
  6966. columnDefaults = columnDefaults ? columnDefaults : {};
  6967. locales = locales ? locales : {};
  6968. // 写入bootstrap-table默认配置
  6969. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  6970. // 写入bootstrap-table column配置
  6971. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  6972. // 写入bootstrap-table locale配置
  6973. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  6974. formatAdvancedSearch: function () {
  6975. return __('Advanced search');
  6976. },
  6977. formatAdvancedSubmitButton: function () {
  6978. return __("Submit");
  6979. },
  6980. formatAdvancedResetButton: function () {
  6981. return __("Reset");
  6982. },
  6983. formatAdvancedCloseButton: function () {
  6984. return __("Close");
  6985. }
  6986. }, locales);
  6987. },
  6988. // 绑定事件
  6989. bindevent: function (table) {
  6990. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  6991. var parenttable = table.closest('.bootstrap-table');
  6992. //Bootstrap-table配置
  6993. var options = table.bootstrapTable('getOptions');
  6994. //Bootstrap操作区
  6995. var toolbar = $(options.toolbar, parenttable);
  6996. //当刷新表格时
  6997. table.on('load-error.bs.table', function (status, res) {
  6998. Toastr.error(__('Unknown data format'));
  6999. });
  7000. //当刷新表格时
  7001. table.on('refresh.bs.table', function (e, settings, data) {
  7002. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  7003. });
  7004. //当双击单元格时
  7005. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  7006. $(Table.config.editonebtn, element).trigger("click");
  7007. });
  7008. //当内容渲染完成后
  7009. table.on('post-body.bs.table', function (e, settings, json, xhr) {
  7010. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  7011. // 挺拽选择,需要重新绑定事件
  7012. require(['drag', 'drop'], function () {
  7013. $(Table.config.firsttd, table).drag("start", function (ev, dd) {
  7014. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  7015. }).drag(function (ev, dd) {
  7016. $(dd.proxy).css({
  7017. top: Math.min(ev.pageY, dd.startY),
  7018. left: Math.min(ev.pageX, dd.startX),
  7019. height: Math.abs(ev.pageY - dd.startY),
  7020. width: Math.abs(ev.pageX - dd.startX)
  7021. });
  7022. }).drag("end", function (ev, dd) {
  7023. $(dd.proxy).remove();
  7024. });
  7025. $(Table.config.firsttd, table).drop("start", function () {
  7026. Table.api.toggleattr(this);
  7027. }).drop(function () {
  7028. Table.api.toggleattr(this);
  7029. }).drop("end", function () {
  7030. Table.api.toggleattr(this);
  7031. });
  7032. $.drop({
  7033. multi: true
  7034. });
  7035. });
  7036. });
  7037. // 处理选中筛选框后按钮的状态统一变更
  7038. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
  7039. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !table.bootstrapTable('getSelections').length);
  7040. });
  7041. // 刷新按钮事件
  7042. $(toolbar).on('click', Table.config.refreshbtn, function () {
  7043. table.bootstrapTable('refresh');
  7044. });
  7045. // 添加按钮事件
  7046. $(toolbar).on('click', Table.config.addbtn, function () {
  7047. var ids = Table.api.selectedids(table);
  7048. Backend.api.open(options.extend.add_url + "/ids/" + ids.join(","), __('Add'));
  7049. });
  7050. // 编辑按钮事件
  7051. $(toolbar).on('click', Table.config.editbtn, function () {
  7052. var ids = Table.api.selectedids(table);
  7053. //循环弹出多个编辑框
  7054. $.each(ids, function (i, j) {
  7055. Backend.api.open(options.extend.edit_url + "/ids/" + j, __('Edit'));
  7056. });
  7057. });
  7058. // 批量操作按钮事件
  7059. $(toolbar).on('click', Table.config.multibtn, function () {
  7060. var ids = Table.api.selectedids(table);
  7061. Table.api.multi($(this).data("action"), ids, table, this);
  7062. });
  7063. // 批量删除按钮事件
  7064. $(toolbar).on('click', Table.config.delbtn, function () {
  7065. var that = this;
  7066. var ids = Table.api.selectedids(table);
  7067. var index = Backend.api.layer.confirm(
  7068. __('Are you sure you want to delete the %s selected item?', ids.length),
  7069. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
  7070. function () {
  7071. Table.api.multi("del", ids, table, that);
  7072. Backend.api.layer.close(index);
  7073. }
  7074. );
  7075. });
  7076. // 拖拽排序
  7077. require(['dragsort'], function () {
  7078. //绑定拖动排序
  7079. $("tbody", table).dragsort({
  7080. itemSelector: 'tr',
  7081. dragSelector: "a.btn-dragsort",
  7082. dragEnd: function () {
  7083. var data = table.bootstrapTable('getData');
  7084. var current = data[parseInt($(this).data("index"))];
  7085. //改变的值和改变的ID集合
  7086. var ids = $.map($("tbody tr:visible", table), function (tr) {
  7087. return data[parseInt($(tr).data("index"))].id;
  7088. });
  7089. var changeid = current.id;
  7090. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  7091. var options = {
  7092. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  7093. data: {
  7094. ids: ids.join(','),
  7095. changeid: changeid,
  7096. pid: pid,
  7097. field: Table.config.dragsortfield,
  7098. orderway: table.bootstrapTable('getOptions').sortOrder,
  7099. table: table.bootstrapTable('getOptions').extend.table
  7100. }
  7101. };
  7102. Backend.api.ajax(options, function (data) {
  7103. Toastr.success(__('Operation completed'));
  7104. table.bootstrapTable('refresh');
  7105. });
  7106. },
  7107. placeHolderTemplate: ""
  7108. });
  7109. });
  7110. var id = table.attr("id");
  7111. Table.list[id] = table;
  7112. return table;
  7113. },
  7114. // 批量操作请求
  7115. multi: function (action, ids, table, element) {
  7116. var options = table.bootstrapTable('getOptions');
  7117. var url = action == "del" ? options.extend.del_url : options.extend.multi_url;
  7118. url = url + "/ids/" + ($.isArray(ids) ? ids.join(",") : ids);
  7119. var options = {url: url, data: {action: action, ids: ids, params: element ? $(element).data("params") : ''}};
  7120. Backend.api.ajax(options, function (data) {
  7121. Toastr.success(__('Operation completed'));
  7122. table.bootstrapTable('refresh');
  7123. });
  7124. },
  7125. // 单元格元素事件
  7126. events: {
  7127. operate: {
  7128. 'click .btn-editone': function (e, value, row, index) {
  7129. var options = $(this).closest('table').bootstrapTable('getOptions');
  7130. Backend.api.open(options.extend.edit_url + "/ids/" + row.id, __('Edit'));
  7131. },
  7132. 'click .btn-delone': function (e, value, row, index) {
  7133. var that = this;
  7134. var top = $(that).offset().top - $(window).scrollTop();
  7135. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  7136. if (top + 154 > $(window).height()) {
  7137. top = top - 154;
  7138. }
  7139. if ($(window).width() < 480) {
  7140. top = left = undefined;
  7141. }
  7142. var index = Backend.api.layer.confirm(
  7143. __('Are you sure you want to delete this item?'),
  7144. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
  7145. function () {
  7146. var table = $(that).closest('table');
  7147. Table.api.multi("del", row.id, table, that);
  7148. Backend.api.layer.close(index);
  7149. }
  7150. );
  7151. }
  7152. }
  7153. },
  7154. // 单元格数据格式化
  7155. formatter: {
  7156. icon: function (value, row, index) {
  7157. if (!value)
  7158. return '';
  7159. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  7160. //渲染fontawesome图标
  7161. return '<i class="' + value + '"></i> ' + value;
  7162. },
  7163. image: function (value, row, index) {
  7164. return '<img class="img-rounded img-sm" src="' + (value.indexOf("http") === 0 ? '' : Config.upload.cdnurl) + value + '" />';
  7165. },
  7166. status: function (value, row, index, custom) {
  7167. //颜色状态数组,可使用red/yellow/aqua/blue/navy/teal/olive/lime/fuchsia/purple/maroon
  7168. var colorArr = {normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info'};
  7169. //如果有自定义状态,可以按需传入
  7170. if (typeof custom !== 'undefined') {
  7171. colorArr = $.extend(colorArr, custom);
  7172. }
  7173. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  7174. value = value[0].toUpperCase() + value.substr(1);
  7175. //渲染状态
  7176. var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(value) + '</span>';
  7177. return html;
  7178. },
  7179. url: function (value, row, index) {
  7180. return '<a href="' + value + '" target="_blank" class="label bg-green">' + value + '</a>';
  7181. },
  7182. flag: function (value, row, index) {
  7183. var flagstext = __('Flags');
  7184. var flagscolor = {t: 'red', i: 'blue', r: 'green', h: 'yellow'};
  7185. if (!value)
  7186. return value;
  7187. //渲染Flag
  7188. var html = [];
  7189. var arr = value.split(',');
  7190. arr.forEach(function (value) {
  7191. html.push('<span class="label bg-' + (typeof flagscolor[value] != 'undefined' ? flagscolor[value] : 'primary') + '">' + (typeof flagstext[value] !== 'undefined' ? flagstext[value] : '') + '</span>');
  7192. });
  7193. return html.join(' ');
  7194. },
  7195. datetime: function (value, row, index) {
  7196. return value ? Moment(parseInt(value) * 1000).format("YYYY-MM-DD HH:mm:ss") : __('None');
  7197. },
  7198. operate: function (value, row, index, table) {
  7199. var showweigh = true;
  7200. var showedit = true;
  7201. var showdel = true;
  7202. if (typeof table != 'undefined') {
  7203. var options = table.bootstrapTable('getOptions');
  7204. if (options.extend.del_url == '')
  7205. showdel = false;
  7206. if (options.extend.edit_url == '')
  7207. showedit = false;
  7208. }
  7209. showweigh = typeof row[Table.config.dragsortfield] != 'undefined' ? true : false;
  7210. //行操作
  7211. var html = [];
  7212. if (showweigh)
  7213. html.push('<a href="javascript:;" class="btn btn-primary btn-dragsort btn-xs"><i class="fa fa-arrows"></i></a>');
  7214. if (showedit)
  7215. html.push('<a href="javascript:;" class="btn btn-success btn-editone btn-xs"><i class="fa fa-pencil"></i></a>');
  7216. if (showdel)
  7217. html.push('<a href="javascript:;" class="btn btn-danger btn-delone btn-xs"><i class="fa fa-trash"></i></a>');
  7218. return html.join(' ');
  7219. }
  7220. },
  7221. // 获取选中的条目ID集合
  7222. selectedids: function (table) {
  7223. return $.map(table.bootstrapTable('getSelections'), function (row) {
  7224. return row.id
  7225. });
  7226. },
  7227. // 切换复选框状态
  7228. toggleattr: function (table) {
  7229. $("input[type='checkbox']", table).trigger('click');
  7230. }
  7231. },
  7232. };
  7233. return Table;
  7234. });
  7235. /**
  7236. * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
  7237. * v1.5.1
  7238. *
  7239. * Copyright 2013, Moxiecode Systems AB
  7240. * Released under GPL License.
  7241. *
  7242. * License: http://www.plupload.com/license
  7243. * Contributing: http://www.plupload.com/contributing
  7244. *
  7245. * Date: 2016-11-14
  7246. */
  7247. !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 n(!1,arguments)}function i(){return n(!0,arguments)}function n(t,i){var r,a=i[0];return o(i,function(i,s){s>0&&o(i,function(i,o){return i===r||t&&a[o]===r?!0:(e(a[o])===e(i)&&-1!==c(e(i),["array","object"])?n(t,[a[o],i]):a[o]=i,void 0)})}),a}function r(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 o(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 a(t){var i;if(!t||"object"!==e(t))return!0;for(i in t)return!1;return!0}function s(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 u(e,t){var i=0,n=e.length,r=new Array(n);o(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 c(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 l(t,i){var n=[];"array"!==e(t)&&(t=[t]),"array"!==e(i)&&(i=[i]);for(var r in t)-1===c(t[r],i)&&n.push(t[r]);return n.length?n:!1}function d(e,t){var i=[];return o(e,function(e){-1!==c(e,t)&&i.push(e)}),i.length?i:null}function m(e){var t,i=[];for(t=0;t<e.length;t++)i[t]=e[t];return i}function h(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e}function f(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 p(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e(t)?t:""})}function g(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var x=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:x,typeOf:e,extend:t,extendIf:i,inherit:r,each:o,isEmptyObj:a,inSeries:s,inParallel:u,inArray:c,arrayDiff:l,arrayIntersect:d,toArray:m,trim:h,sprintf:p,parseSizeStr:f,delay:g}}),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=e?r[this.uid]&&r[this.uid][e]:r[this.uid];return 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;if(!(n instanceof r))return this.trigger("error",new i.DOMException(i.DOMException.NOT_FOUND_ERR)),this.trigger("loadend"),void 0;
  7248. 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)},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){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)}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(){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();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;
  7249. 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,n){t.inArray(n,[5,6,7,8])>-1&&(v.width=i,v.height=e);var r=v.getContext("2d");switch(n){case 2:r.translate(e,0),r.scale(-1,1);break;case 3:r.translate(e,i),r.rotate(Math.PI);break;case 4:r.translate(0,i),r.scale(1,-1);break;case 5:r.rotate(.5*Math.PI),r.scale(1,-1);break;case 6:r.rotate(.5*Math.PI),r.translate(0,-i);break;case 7:r.rotate(.5*Math.PI),r.translate(e,-i),r.scale(-1,1);break;case 8:r.rotate(-.5*Math.PI),r.translate(-e,0)}}function p(){x&&(x.purge(),x=null),g&&(g.src=""),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;f(v.width,v.height,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)}),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)
  7250. }),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)});
  7251. define("../libs/plupload/js/moxie.min", function(){});
  7252. /**
  7253. * Plupload - multi-runtime File Uploader
  7254. * v2.2.0
  7255. *
  7256. * Copyright 2013, Moxiecode Systems AB
  7257. * Released under GPL License.
  7258. *
  7259. * License: http://www.plupload.com/license
  7260. * Contributing: http://www.plupload.com/contributing
  7261. *
  7262. * Date: 2016-11-14
  7263. */
  7264. !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.0",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),D.setRequestHeader("Content-Type","application/octet-stream"),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),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)});
  7265. define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], function ($, undefined, Backend, Config, Plupload) {
  7266. var Upload = {
  7267. list: {},
  7268. config: {
  7269. container: document.body,
  7270. classname: '.plupload',
  7271. },
  7272. api: {
  7273. //Plupload上传
  7274. plupload: function (element, onAfterUpload) {
  7275. element = typeof element == 'undefined' ? Upload.config.classname : element;
  7276. $(element, Upload.config.container).each(function () {
  7277. var that = this;
  7278. var id = $(this).prop("id");
  7279. var url = $(this).data("url");
  7280. var maxsize = $(this).data("maxsize");
  7281. var mimetype = $(this).data("mimetype");
  7282. var multipart = $(this).data("multipart");
  7283. var multiple = $(this).data("multiple");
  7284. //上传URL
  7285. url = url ? url : Config.upload.uploadurl;
  7286. url = Backend.api.fixurl(url);
  7287. //最大可上传
  7288. maxsize = maxsize ? maxsize : Config.upload.maxsize;
  7289. //文件类型
  7290. mimetype = mimetype ? mimetype : Config.upload.mimetype;
  7291. //请求的表单参数
  7292. multipart = multipart ? multipart : Config.upload.multipart;
  7293. //是否支持批量上传
  7294. multiple = multiple ? multiple : Config.upload.multiple;
  7295. //生成Plupload实例
  7296. Upload.list[id] = new Plupload.Uploader({
  7297. runtimes: 'html5,flash,silverlight,html4',
  7298. multi_selection: multiple, //是否允许多选批量上传
  7299. browse_button: id, // 浏览按钮的ID
  7300. container: $(this).parent().get(0), //取按钮的上级元素
  7301. flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
  7302. silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
  7303. filters: {
  7304. max_file_size: maxsize,
  7305. mime_types: mimetype
  7306. },
  7307. url: url,
  7308. multipart_params: multipart,
  7309. init: {
  7310. PostInit: function () {
  7311. },
  7312. FilesAdded: function (up, files) {
  7313. Plupload.each(files, function (file) {
  7314. //这里可以改成其它的表现形式
  7315. //document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
  7316. });
  7317. $(that).data("bakup-html", $(that).html());
  7318. //添加后立即上传
  7319. setTimeout(function () {
  7320. Upload.list[id].start();
  7321. }, 1);
  7322. },
  7323. UploadProgress: function (up, file) {
  7324. //这里可以改成其它的表现形式
  7325. //document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
  7326. $(that).prop("disabled", true).html("<i class='fa fa-upload'></i> 上传" + file.percent + "%");
  7327. },
  7328. FileUploaded: function (up, file, info) {
  7329. //还原按钮文字及状态
  7330. $(that).prop("disabled", false).html($(that).data("bakup-html"));
  7331. //这里可以改成其它的表现形式
  7332. //document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML += (' [Url]: ' + '<a href="' + url + '" target="_blank">' + url + '</a>');
  7333. //这里建议不修改
  7334. try {
  7335. var ret = JSON.parse(info.response);
  7336. if (ret.hasOwnProperty('code')) {
  7337. ret.data = ret.code == 200 ? ret : ret.data;
  7338. ret.code = ret.code == 200 ? 1 : ret.code;
  7339. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  7340. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  7341. if (ret.code === 1) {
  7342. //$("input[data-plupload-id='" + id + "-text']").val(data.url);
  7343. if ($(that).data("input-id")) {
  7344. $("input#" + $(that).data("input-id")).val(data.url);
  7345. }
  7346. var afterUpload = $("#" + id).data("after-upload");
  7347. if (afterUpload && typeof Upload.api.custom[afterUpload] == 'function') {
  7348. Upload.api.custom[afterUpload].call(that, data);
  7349. }
  7350. if (typeof onAfterUpload == 'function') {
  7351. onAfterUpload.call(that, data);
  7352. }
  7353. } else {
  7354. Toastr.error(msg ? msg : __('Operation failed'));
  7355. }
  7356. } else {
  7357. Toastr.error(e.message + "(code:-2)");
  7358. }
  7359. } catch (e) {
  7360. Toastr.error(e.message + "(code:-1)");
  7361. }
  7362. },
  7363. Error: function (up, err) {
  7364. Toastr.error(err.message + "(code:" + err.code + ")");
  7365. }
  7366. }
  7367. });
  7368. Upload.list[id].init();
  7369. });
  7370. },
  7371. // AJAX异步上传,主要用于Summernote上传回调
  7372. send: function (file, callback) {
  7373. var data = new FormData();
  7374. data.append("file", file);
  7375. $.each(Config.upload.multipart, function (k, v) {
  7376. data.append(k, v);
  7377. });
  7378. $.ajax({
  7379. url: Config.upload.uploadurl,
  7380. data: data,
  7381. cache: false,
  7382. contentType: false,
  7383. processData: false,
  7384. type: 'POST',
  7385. dataType: 'json',
  7386. success: function (ret) {
  7387. if (ret.hasOwnProperty("code")) {
  7388. ret.data = ret.code == 200 ? ret : ret.data;
  7389. ret.code = ret.code == 200 ? 1 : ret.code;
  7390. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  7391. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  7392. if (ret.code === 1) {
  7393. // 如果回调存在,则直接调用回调
  7394. if (typeof callback == 'function') {
  7395. callback.call(this, data);
  7396. } else {
  7397. Toastr.success(msg ? msg : __('Operation completed'));
  7398. }
  7399. } else {
  7400. Toastr.error(msg ? msg : __('Operation failed'));
  7401. }
  7402. } else {
  7403. Toastr.error(__('Unknown data format'));
  7404. }
  7405. }, error: function () {
  7406. Toastr.error(__('Network error'));
  7407. }
  7408. });
  7409. },
  7410. custom: {
  7411. //自定义上传完成回调
  7412. afteruploadcallback: function (response) {
  7413. console.log(this, response);
  7414. alert("Custom Callback,Response URL:" + response.url);
  7415. },
  7416. },
  7417. }
  7418. };
  7419. return Upload;
  7420. });
  7421. /*! nice-validator 1.0.10
  7422. * (c) 2012-2017 Jony Zhang <niceue@live.com>, MIT Licensed
  7423. * https://github.com/niceue/nice-validator
  7424. */
  7425. ;(function(factory) {
  7426. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  7427. typeof define === 'function' && define.amd ? define('validator',['jquery'], factory) :
  7428. factory(jQuery);
  7429. }(function($, undefined) {
  7430. "use strict";
  7431. var NS = 'validator',
  7432. CLS_NS = '.' + NS,
  7433. CLS_NS_RULE = '.rule',
  7434. CLS_NS_FIELD = '.field',
  7435. CLS_NS_FORM = '.form',
  7436. CLS_WRAPPER = 'nice-' + NS,
  7437. CLS_MSG_BOX = 'msg-box',
  7438. ARIA_REQUIRED = 'aria-required',
  7439. ARIA_INVALID = 'aria-invalid',
  7440. DATA_RULE = 'data-rule',
  7441. DATA_MSG = 'data-msg',
  7442. DATA_TIP = 'data-tip',
  7443. DATA_OK = 'data-ok',
  7444. DATA_TIMELY = 'data-timely',
  7445. DATA_TARGET = 'data-target',
  7446. DATA_DISPLAY = 'data-display',
  7447. DATA_MUST = 'data-must',
  7448. NOVALIDATE = 'novalidate',
  7449. INPUT_SELECTOR = ':verifiable',
  7450. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  7451. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  7452. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  7453. rDoubleBytes = /[^\x00-\xff]/g,
  7454. rPos = /top|right|bottom|left/,
  7455. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  7456. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  7457. noop = $.noop,
  7458. proxy = $.proxy,
  7459. trim = $.trim,
  7460. isFunction = $.isFunction,
  7461. isString = function(s) {
  7462. return typeof s === 'string';
  7463. },
  7464. isObject = function(o) {
  7465. return o && Object.prototype.toString.call(o) === '[object Object]';
  7466. },
  7467. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  7468. attr = function(el, key, value) {
  7469. if (!el || !el.tagName) return null;
  7470. if (value !== undefined) {
  7471. if (value === null) el.removeAttribute(key);
  7472. else el.setAttribute(key, '' + value);
  7473. } else {
  7474. return el.getAttribute(key);
  7475. }
  7476. },
  7477. novalidateonce,
  7478. preinitialized = {},
  7479. defaults = {
  7480. debug: 0,
  7481. theme: 'default',
  7482. ignore: '',
  7483. focusInvalid: true,
  7484. focusCleanup: false,
  7485. stopOnError: false,
  7486. beforeSubmit: null,
  7487. valid: null,
  7488. invalid: null,
  7489. validation: null,
  7490. formClass: 'n-default',
  7491. validClass: 'n-valid',
  7492. invalidClass: 'n-invalid',
  7493. bindClassTo: null
  7494. },
  7495. fieldDefaults = {
  7496. timely: 1,
  7497. display: null,
  7498. target: null,
  7499. ignoreBlank: false,
  7500. showOk: true,
  7501. // Translate ajax response to validation result
  7502. dataFilter: function (data) {
  7503. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  7504. return data;
  7505. }
  7506. },
  7507. msgMaker: function(opt) {
  7508. var html;
  7509. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  7510. if (opt.result) {
  7511. $.each(opt.result, function(i, obj){
  7512. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  7513. });
  7514. } else {
  7515. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  7516. }
  7517. html += '</span>';
  7518. return html;
  7519. },
  7520. msgWrapper: 'span',
  7521. msgArrow: '',
  7522. msgIcon: '<span class="n-icon"></span>',
  7523. msgClass: 'n-right',
  7524. msgStyle: '',
  7525. msgShow: null,
  7526. msgHide: null
  7527. },
  7528. themes = {};
  7529. /** jQuery Plugin
  7530. * @param {Object} options
  7531. debug {Boolean} 0 Whether to enable debug mode
  7532. timely {Number} 1 Whether to enable timely validation
  7533. theme {String} 'default' Theme name
  7534. stopOnError {Boolean} false Whether to stop validate when found an error input
  7535. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  7536. focusInvalid {Boolean} true Whether to focus the field that is invalid
  7537. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  7538. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  7539. beforeSubmit {Function} Do something before submit form
  7540. dataFilter {Function} Convert ajax results
  7541. valid {Function} Triggered when the form is valid
  7542. invalid {Function} Triggered when the form is invalid
  7543. validClass {String} 'n-valid' Add this class name to a valid field
  7544. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  7545. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  7546. display {Function} Callback function to get dynamic display
  7547. target {Function} Callback function to get dynamic target
  7548. msgShow {Function} Trigger this callback when show message
  7549. msgHide {Function} Trigger this callback when hide message
  7550. msgWrapper {String} 'span' Message wrapper tag name
  7551. msgMaker {Function} Callback function to make message HTML
  7552. msgArrow {String} Message arrow template
  7553. msgIcon {String} Message icon template
  7554. msgStyle {String} Custom message css style
  7555. msgClass {String} Additional added to the message class names
  7556. formClass {String} Additional added to the form class names
  7557. messages {Object} Custom messages for the current instance
  7558. rules {Object} Custom rules for the current instance
  7559. fields {Object} Field validation configuration
  7560. {String} key name|#id
  7561. {String|Object} value Rule string or an object which can pass more arguments
  7562. fields[key][rule] {String} Rule string
  7563. fields[key][display] {String|Function}
  7564. fields[key][tip] {String} Custom tip message
  7565. fields[key][ok] {String} Custom success message
  7566. fields[key][msg] {Object} Custom error message
  7567. fields[key][msgStyle] {String} Custom message style
  7568. fields[key][msgClass] {String} A className which added to message placeholder element
  7569. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  7570. fields[key][msgMaker] {Function} A function to custom message HTML
  7571. fields[key][dataFilter] {Function} A function to convert ajax results
  7572. fields[key][valid] {Function} A function triggered when field is valid
  7573. fields[key][invalid] {Function} A function triggered when field is invalid
  7574. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  7575. fields[key][timely] {Boolean} Whether to enable timely validation
  7576. fields[key][target] {jqSelector} Define placement of a message
  7577. */
  7578. $.fn.validator = function(options) {
  7579. var that = this,
  7580. args = arguments;
  7581. if (that.is(INPUT_SELECTOR)) return that;
  7582. if (!that.is('form')) that = this.find('form');
  7583. if (!that.length) that = this;
  7584. that.each(function() {
  7585. var instance = $(this).data(NS);
  7586. if (instance) {
  7587. if ( isString(options) ) {
  7588. if ( options.charAt(0) === '_' ) return;
  7589. instance[options].apply(instance, [].slice.call(args, 1));
  7590. }
  7591. else if (options) {
  7592. instance._reset(true);
  7593. instance._init(this, options);
  7594. }
  7595. } else {
  7596. new Validator(this, options);
  7597. }
  7598. });
  7599. return this;
  7600. };
  7601. // Validate a field, or an area
  7602. $.fn.isValid = function(callback, hideMsg) {
  7603. var me = _getInstance(this[0]),
  7604. hasCallback = isFunction(callback),
  7605. ret, opt;
  7606. if (!me) return true;
  7607. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  7608. me.checkOnly = !!hideMsg;
  7609. opt = me.options;
  7610. ret = me._multiValidate(
  7611. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  7612. function(isValid){
  7613. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  7614. // navigate to the error element
  7615. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7616. }
  7617. if (hasCallback) {
  7618. if (callback.length) {
  7619. callback(isValid);
  7620. } else if (isValid) {
  7621. callback();
  7622. }
  7623. }
  7624. me.checkOnly = false;
  7625. }
  7626. );
  7627. // If you pass a callback, we maintain the jQuery object chain
  7628. return hasCallback ? this : ret;
  7629. };
  7630. $.extend($.expr.pseudos || $.expr[':'], {
  7631. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  7632. verifiable: function(elem) {
  7633. var name = elem.nodeName.toLowerCase();
  7634. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  7635. name === 'select' ||
  7636. name === 'textarea' ||
  7637. elem.contentEditable === 'true'
  7638. ) && !elem.disabled;
  7639. },
  7640. // any value, but not only whitespace
  7641. filled: function(elem) {
  7642. return !!trim($(elem).val());
  7643. }
  7644. });
  7645. /**
  7646. * Creates a new Validator
  7647. *
  7648. * @class
  7649. * @param {Element} element - form element
  7650. * @param {Object} options - options for validator
  7651. */
  7652. function Validator(element, options) {
  7653. var me = this;
  7654. if ( !(me instanceof Validator) ) {
  7655. return new Validator(element, options);
  7656. }
  7657. if (Validator.pending) {
  7658. $(window).on('validatorready', init);
  7659. } else {
  7660. init();
  7661. }
  7662. function init() {
  7663. me.$el = $(element);
  7664. if (me.$el.length) {
  7665. me._init(me.$el[0], options);
  7666. }
  7667. else if (isString(element)) {
  7668. preinitialized[element] = options;
  7669. }
  7670. }
  7671. }
  7672. Validator.prototype = {
  7673. _init: function(element, options) {
  7674. var me = this,
  7675. opt, themeOpt, dataOpt;
  7676. // Initialization options
  7677. if ( isFunction(options) ) {
  7678. options = {
  7679. valid: options
  7680. };
  7681. }
  7682. options = me._opt = options || {};
  7683. dataOpt = attr(element, 'data-'+ NS +'-option');
  7684. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function("return " + dataOpt))() : {};
  7685. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  7686. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  7687. me.rules = new Rules(opt.rules, true);
  7688. me.messages = new Messages(opt.messages, true);
  7689. me.Field = _createFieldFactory(me);
  7690. me.elements = me.elements || {};
  7691. me.deferred = {};
  7692. me.errors = {};
  7693. me.fields = {};
  7694. // Initialization fields
  7695. me._initFields(opt.fields);
  7696. // Initialization events and make a cache
  7697. if ( !me.$el.data(NS) ) {
  7698. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  7699. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  7700. me.vetoed = veto.veto = !me.isValid;
  7701. me.ajaxFormOptions = opts;
  7702. })
  7703. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  7704. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  7705. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  7706. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  7707. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  7708. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  7709. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  7710. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  7711. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  7712. // cache the novalidate attribute value
  7713. me._NOVALIDATE = attr(element, NOVALIDATE);
  7714. // Initialization is complete, stop off default HTML5 form validation
  7715. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  7716. attr(element, NOVALIDATE, NOVALIDATE);
  7717. }
  7718. // Display all messages in target container
  7719. if ( isString(opt.target) ) {
  7720. me.$el.find(opt.target).addClass('msg-container');
  7721. }
  7722. },
  7723. // Guess whether the form use ajax submit
  7724. _guessAjax: function(form) {
  7725. var me = this;
  7726. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7727. // if there is a "valid.form" event
  7728. var events = ($._data || $.data)(form, "events");
  7729. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7730. }
  7731. function issetEvent(events, name, namespace) {
  7732. if ( events && events[name] &&
  7733. $.map(events[name], function(e){
  7734. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7735. }).length
  7736. ) {
  7737. return true;
  7738. }
  7739. return false;
  7740. }
  7741. },
  7742. _initFields: function(fields) {
  7743. var me = this, k, arr, i,
  7744. clear = fields === null;
  7745. // Processing field information
  7746. if (clear) fields = me.fields;
  7747. if ( isObject(fields) ) {
  7748. for (k in fields) {
  7749. if (~k.indexOf(',')) {
  7750. arr = k.split(',');
  7751. i = arr.length;
  7752. while (i--) {
  7753. initField(trim(arr[i]), fields[k]);
  7754. }
  7755. } else {
  7756. initField(k, fields[k]);
  7757. }
  7758. }
  7759. }
  7760. // Parsing DOM rules
  7761. me.$el.find(INPUT_SELECTOR).each(function() {
  7762. me._parse(this);
  7763. });
  7764. function initField(k, v) {
  7765. // delete a field from settings
  7766. if ( v === null || clear ) {
  7767. var el = me.elements[k];
  7768. if (el) me._resetElement(el, true);
  7769. delete me.fields[k];
  7770. } else {
  7771. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7772. }
  7773. }
  7774. },
  7775. // Parsing a field
  7776. _parse: function(el) {
  7777. var me = this,
  7778. field,
  7779. key = el.name,
  7780. display,
  7781. timely,
  7782. dataRule = attr(el, DATA_RULE);
  7783. dataRule && attr(el, DATA_RULE, null);
  7784. // If the field has passed the key as id mode, or it doesn't has a name
  7785. if ( el.id && (
  7786. ('#' + el.id in me.fields) ||
  7787. !key ||
  7788. // If dataRule and element are diffrent from old's, we use ID mode.
  7789. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7790. )
  7791. ) {
  7792. key = '#' + el.id;
  7793. }
  7794. // doesn't verify a field that has neither id nor name
  7795. if (!key) return;
  7796. field = me.getField(key, true);
  7797. // The priority of passing parameter by DOM is higher than by JS.
  7798. field.rule = dataRule || field.rule;
  7799. if (display = attr(el, DATA_DISPLAY)) {
  7800. field.display = display;
  7801. }
  7802. if (field.rule) {
  7803. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7804. field.must = true;
  7805. }
  7806. if ( /\brequired\b/.test(field.rule) ) {
  7807. field.required = true;
  7808. attr(el, ARIA_REQUIRED, true);
  7809. }
  7810. if (timely = attr(el, DATA_TIMELY)) {
  7811. field.timely = +timely;
  7812. } else if (field.timely > 3) {
  7813. attr(el, DATA_TIMELY, field.timely);
  7814. }
  7815. me._parseRule(field);
  7816. field.old = {};
  7817. }
  7818. if ( isString(field.target) ) {
  7819. attr(el, DATA_TARGET, field.target);
  7820. }
  7821. if ( isString(field.tip) ) {
  7822. attr(el, DATA_TIP, field.tip);
  7823. }
  7824. return me.fields[key] = field;
  7825. },
  7826. // Parsing field rules
  7827. _parseRule: function(field) {
  7828. var arr = rDisplay.exec(field.rule);
  7829. if (!arr) return;
  7830. // current rule index
  7831. field._i = 0;
  7832. if (arr[1]) {
  7833. field.display = arr[1];
  7834. }
  7835. if (arr[2]) {
  7836. field._rules = [];
  7837. arr[2].replace(rRules, function(){
  7838. var args = arguments;
  7839. args[4] = args[4] || args[5];
  7840. field._rules.push({
  7841. and: args[1] === "&",
  7842. not: args[2] === "!",
  7843. or: args[6] === "|",
  7844. method: args[3],
  7845. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7846. });
  7847. });
  7848. }
  7849. },
  7850. // Verify a zone
  7851. _multiValidate: function($inputs, doneCallback){
  7852. var me = this,
  7853. opt = me.options;
  7854. me.hasError = false;
  7855. if (opt.ignore) {
  7856. $inputs = $inputs.not(opt.ignore);
  7857. }
  7858. $inputs.each(function() {
  7859. me._validate(this);
  7860. if (me.hasError && opt.stopOnError) {
  7861. // stop the validation
  7862. return false;
  7863. }
  7864. });
  7865. // Need to wait for all fields validation complete, especially asynchronous validation
  7866. if (doneCallback) {
  7867. me.validating = true;
  7868. $.when.apply(
  7869. null,
  7870. $.map(me.deferred, function(v){return v;})
  7871. ).done(function(){
  7872. doneCallback.call(me, !me.hasError);
  7873. me.validating = false;
  7874. });
  7875. }
  7876. // If the form does not contain asynchronous validation, the return value is correct.
  7877. // Otherwise, you should detect form validation result through "doneCallback".
  7878. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7879. },
  7880. // Validate the whole form
  7881. _submit: function(e) {
  7882. var me = this,
  7883. opt = me.options,
  7884. form = e.target,
  7885. canSubmit = e.type === 'submit' && !e.isDefaultPrevented();
  7886. e.preventDefault();
  7887. if (
  7888. novalidateonce && ~(novalidateonce = false) ||
  7889. // Prevent duplicate submission
  7890. me.submiting ||
  7891. // Receive the "validate" event only from the form.
  7892. e.type === 'validate' && me.$el[0] !== form ||
  7893. // trigger the beforeSubmit callback.
  7894. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7895. ) {
  7896. return;
  7897. }
  7898. if (me.isAjaxSubmit === undefined) {
  7899. me._guessAjax(form);
  7900. }
  7901. me._debug('log', '\n<<< event: ' + e.type);
  7902. me._reset();
  7903. me.submiting = true;
  7904. me._multiValidate(
  7905. me.$el.find(INPUT_SELECTOR),
  7906. function(isValid){
  7907. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7908. errors;
  7909. if (!isValid) {
  7910. if (opt.focusInvalid) {
  7911. // navigate to the error element
  7912. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7913. }
  7914. errors = $.map(me.errors, function(err){return err;});
  7915. }
  7916. // releasing submit
  7917. me.submiting = false;
  7918. me.isValid = isValid;
  7919. // trigger callback and event
  7920. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7921. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7922. me._debug('log', '>>> ' + ret);
  7923. if (!isValid) return;
  7924. // For jquery.form plugin
  7925. if (me.vetoed) {
  7926. $(form).ajaxSubmit(me.ajaxFormOptions);
  7927. }
  7928. else if (canSubmit && !me.isAjaxSubmit) {
  7929. document.createElement('form').submit.call(form);
  7930. }
  7931. }
  7932. );
  7933. },
  7934. _reset: function(e) {
  7935. var me = this;
  7936. me.errors = {};
  7937. if (e) {
  7938. me.reseting = true;
  7939. me.$el.find(INPUT_SELECTOR).each( function(){
  7940. me._resetElement(this);
  7941. });
  7942. delete me.reseting;
  7943. }
  7944. },
  7945. _resetElement: function(el, all) {
  7946. this._setClass(el, null);
  7947. this.hideMsg(el);
  7948. if (all) {
  7949. attr(el, ARIA_REQUIRED, null);
  7950. }
  7951. },
  7952. // Handle events: "focusin/click"
  7953. _focusin: function(e) {
  7954. var me = this,
  7955. opt = me.options,
  7956. el = e.target,
  7957. timely,
  7958. msg;
  7959. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7960. return;
  7961. }
  7962. if (opt.focusCleanup) {
  7963. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7964. me._setClass(el, null);
  7965. me.hideMsg(el);
  7966. }
  7967. }
  7968. msg = attr(el, DATA_TIP);
  7969. if (msg) {
  7970. me.showMsg(el, {
  7971. type: 'tip',
  7972. msg: msg
  7973. });
  7974. } else {
  7975. if (attr(el, DATA_RULE)) {
  7976. me._parse(el);
  7977. }
  7978. if (timely = attr(el, DATA_TIMELY)) {
  7979. if ( timely === 8 || timely === 9 ) {
  7980. me._focusout(e);
  7981. }
  7982. }
  7983. }
  7984. },
  7985. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7986. _focusout: function(e) {
  7987. var me = this,
  7988. opt = me.options,
  7989. el = e.target,
  7990. etype = e.type,
  7991. etype0,
  7992. focusin = etype === 'focusin',
  7993. special = etype === 'validate',
  7994. elem,
  7995. field,
  7996. old,
  7997. value,
  7998. timestamp,
  7999. key, specialKey,
  8000. timely,
  8001. timer = 0;
  8002. if (etype === 'compositionstart') {
  8003. me.pauseValidate = true;
  8004. }
  8005. if (etype === 'compositionend') {
  8006. me.pauseValidate = false;
  8007. }
  8008. if (me.pauseValidate) {
  8009. return;
  8010. }
  8011. // For checkbox and radio
  8012. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  8013. // Get field
  8014. if (!(field = me.getField(elem)) || !field.rule) {
  8015. return;
  8016. }
  8017. // Cache event type
  8018. etype0 = field._e;
  8019. field._e = etype;
  8020. timely = field.timely;
  8021. if (!special) {
  8022. if (!timely || (_checkable(el) && etype !== 'click')) {
  8023. return;
  8024. }
  8025. value = field.getValue();
  8026. // not validate field unless fill a value
  8027. if ( field.ignoreBlank && !value && !focusin ) {
  8028. me.hideMsg(el);
  8029. return;
  8030. }
  8031. if ( etype === 'focusout' ) {
  8032. if (etype0 === 'change') {
  8033. return;
  8034. }
  8035. if ( timely === 2 || timely === 8 ) {
  8036. old = field.old;
  8037. if (value && old) {
  8038. if (field.isValid && !old.showOk) {
  8039. me.hideMsg(el);
  8040. } else {
  8041. me._makeMsg(el, field, old);
  8042. }
  8043. } else {
  8044. return;
  8045. }
  8046. }
  8047. }
  8048. else {
  8049. if ( timely < 2 && !e.data ) {
  8050. return;
  8051. }
  8052. // mark timestamp to reduce the frequency of the received event
  8053. timestamp = +new Date();
  8054. if ( timestamp - (el._ts || 0) < 100 ) {
  8055. return;
  8056. }
  8057. el._ts = timestamp;
  8058. // handle keyup
  8059. if ( etype === 'keyup' ) {
  8060. if (etype0 === 'input') {
  8061. return;
  8062. }
  8063. key = e.keyCode;
  8064. specialKey = {
  8065. 8: 1, // Backspace
  8066. 9: 1, // Tab
  8067. 16: 1, // Shift
  8068. 32: 1, // Space
  8069. 46: 1 // Delete
  8070. };
  8071. // only gets focus, no validation
  8072. if ( key === 9 && !value ) {
  8073. return;
  8074. }
  8075. // do not validate, if triggered by these keys
  8076. if ( key < 48 && !specialKey[key] ) {
  8077. return;
  8078. }
  8079. }
  8080. if ( !focusin ) {
  8081. // keyboard events, reducing the frequency of validation
  8082. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  8083. }
  8084. }
  8085. }
  8086. // if the current field is ignored
  8087. if ( opt.ignore && $(el).is(opt.ignore) ) {
  8088. return;
  8089. }
  8090. clearTimeout(field._t);
  8091. if (timer) {
  8092. field._t = setTimeout(function() {
  8093. me._validate(el, field);
  8094. }, timer);
  8095. } else {
  8096. if (special) field.old = {};
  8097. me._validate(el, field);
  8098. }
  8099. },
  8100. _setClass: function(el, isValid) {
  8101. var $el = $(el), opt = this.options;
  8102. if (opt.bindClassTo) {
  8103. $el = $el.closest(opt.bindClassTo);
  8104. }
  8105. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  8106. if (isValid !== null) {
  8107. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  8108. }
  8109. },
  8110. _showmsg: function(e, type, msg) {
  8111. var me = this,
  8112. el = e.target;
  8113. if ( me.$el.is(el) ) {
  8114. if (isObject(type)) {
  8115. me.showMsg(type)
  8116. }
  8117. else if ( type === 'tip' ) {
  8118. me.$el.find(INPUT_SELECTOR +"["+ DATA_TIP +"]", el).each(function(){
  8119. me.showMsg(this, {type: type, msg: msg});
  8120. });
  8121. }
  8122. }
  8123. else {
  8124. me.showMsg(el, {type: type, msg: msg});
  8125. }
  8126. },
  8127. _hidemsg: function(e) {
  8128. var $el = $(e.target);
  8129. if ( $el.is(INPUT_SELECTOR) ) {
  8130. this.hideMsg($el);
  8131. }
  8132. },
  8133. // Validated a field
  8134. _validatedField: function(el, field, ret) {
  8135. var me = this,
  8136. opt = me.options,
  8137. isValid = field.isValid = ret.isValid = !!ret.isValid,
  8138. callback = isValid ? 'valid' : 'invalid';
  8139. ret.key = field.key;
  8140. ret.ruleName = field._r;
  8141. ret.id = el.id;
  8142. ret.value = field.value;
  8143. me.elements[field.key] = ret.element = el;
  8144. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  8145. if (isValid) {
  8146. ret.type = 'ok';
  8147. } else {
  8148. if (me.submiting) {
  8149. me.errors[field.key] = ret.msg;
  8150. }
  8151. me.hasError = true;
  8152. }
  8153. // cache result
  8154. field.old = ret;
  8155. // trigger callback
  8156. isFunction(field[callback]) && field[callback].call(me, el, ret);
  8157. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  8158. // trigger event
  8159. $(el).attr( ARIA_INVALID, isValid ? null : true )
  8160. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  8161. me.$el.triggerHandler('validation', [ret, me]);
  8162. if (me.checkOnly) return;
  8163. // set className
  8164. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  8165. me._makeMsg.apply(me, arguments);
  8166. },
  8167. _makeMsg: function(el, field, ret) {
  8168. // show or hide the message
  8169. if (field.msgMaker) {
  8170. ret = $.extend({}, ret);
  8171. if (field._e === 'focusin') {
  8172. ret.type = 'tip';
  8173. }
  8174. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  8175. }
  8176. },
  8177. // Validated a rule
  8178. _validatedRule: function(el, field, ret, msgOpt) {
  8179. field = field || me.getField(el);
  8180. msgOpt = msgOpt || {};
  8181. var me = this,
  8182. msg,
  8183. rule,
  8184. method = field._r,
  8185. timely = field.timely,
  8186. special = timely === 9 || timely === 8,
  8187. transfer,
  8188. temp,
  8189. isValid = false;
  8190. // use null to break validation from a field
  8191. if (ret === null) {
  8192. me._validatedField(el, field, {isValid: true, skip: true});
  8193. field._i = 0;
  8194. return;
  8195. }
  8196. else if (ret === undefined) {
  8197. transfer = true;
  8198. }
  8199. else if (ret === true || ret === '') {
  8200. isValid = true;
  8201. }
  8202. else if (isString(ret)) {
  8203. msg = ret;
  8204. }
  8205. else if (isObject(ret)) {
  8206. if (ret.error) {
  8207. msg = ret.error;
  8208. } else {
  8209. msg = ret.ok;
  8210. isValid = true;
  8211. }
  8212. }
  8213. rule = field._rules[field._i];
  8214. if (rule.not) {
  8215. msg = undefined;
  8216. isValid = method === "required" || !isValid;
  8217. }
  8218. if (rule.or) {
  8219. if (isValid) {
  8220. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  8221. field._i++;
  8222. }
  8223. } else {
  8224. transfer = true;
  8225. }
  8226. }
  8227. else if (rule.and) {
  8228. if (!field.isValid) transfer = true;
  8229. }
  8230. if (transfer) {
  8231. isValid = true;
  8232. }
  8233. // message analysis, and throw rule level event
  8234. else {
  8235. if (isValid) {
  8236. if (field.showOk !== false) {
  8237. temp = attr(el, DATA_OK);
  8238. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  8239. if (!isString(msg) && isString(field.showOk)) {
  8240. msg = field.showOk;
  8241. }
  8242. if (isString(msg)) {
  8243. msgOpt.showOk = isValid;
  8244. }
  8245. }
  8246. }
  8247. if (!isValid || special) {
  8248. /* rule message priority:
  8249. 1. custom DOM message
  8250. 2. custom field message;
  8251. 3. global defined message;
  8252. 4. rule returned message;
  8253. 5. default message;
  8254. */
  8255. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  8256. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  8257. });
  8258. }
  8259. if (!isValid) field.isValid = isValid;
  8260. msgOpt.msg = msg;
  8261. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  8262. }
  8263. if (special && (!transfer || rule.and)) {
  8264. if (!isValid && !field._m) field._m = msg;
  8265. field._v = field._v || [];
  8266. field._v.push({
  8267. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  8268. msg: msg || rule.msg
  8269. });
  8270. }
  8271. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  8272. // the current rule has passed, continue to validate
  8273. if ( (isValid || special) && field._i < field._rules.length - 1) {
  8274. field._i++;
  8275. me._checkRule(el, field);
  8276. }
  8277. // field was invalid, or all fields was valid
  8278. else {
  8279. field._i = 0;
  8280. if (special) {
  8281. msgOpt.isValid = field.isValid;
  8282. msgOpt.result = field._v;
  8283. msgOpt.msg = field._m || '';
  8284. if (!field.value && (field._e === 'focusin')) {
  8285. msgOpt.type = 'tip';
  8286. }
  8287. } else {
  8288. msgOpt.isValid = isValid;
  8289. }
  8290. me._validatedField(el, field, msgOpt);
  8291. delete field._m;
  8292. delete field._v;
  8293. }
  8294. },
  8295. // Verify a rule form a field
  8296. _checkRule: function(el, field) {
  8297. var me = this,
  8298. ret,
  8299. fn,
  8300. old,
  8301. key = field.key,
  8302. rule = field._rules[field._i],
  8303. method = rule.method,
  8304. params = rule.params;
  8305. // request has been sent, wait it
  8306. if (me.submiting && me.deferred[key]) {
  8307. return;
  8308. }
  8309. old = field.old;
  8310. field._r = method;
  8311. if (old && !field.must && !rule.must && rule.result !== undefined &&
  8312. old.ruleName === method && old.id === el.id &&
  8313. field.value && old.value === field.value )
  8314. {
  8315. // get result from cache
  8316. ret = rule.result;
  8317. }
  8318. else {
  8319. // get result from current rule
  8320. fn = _getDataRule(el, method) || me.rules[method] || noop;
  8321. ret = fn.call(field, el, params, field);
  8322. if (fn.msg) rule.msg = fn.msg;
  8323. }
  8324. // asynchronous validation
  8325. if (isObject(ret) && isFunction(ret.then)) {
  8326. me.deferred[key] = ret;
  8327. // whether the field valid is unknown
  8328. field.isValid = undefined;
  8329. // show loading message
  8330. !me.checkOnly && me.showMsg(el, {
  8331. type: 'loading',
  8332. msg: me.messages.loading
  8333. }, field);
  8334. // waiting to parse the response data
  8335. ret.then(
  8336. function(d, textStatus, jqXHR) {
  8337. var data = trim(jqXHR.responseText),
  8338. result,
  8339. dataFilter = field.dataFilter;
  8340. // detect if data is json or jsonp format
  8341. if (/jsonp?/.test(this.dataType)) {
  8342. data = d;
  8343. } else if (data.charAt(0) === '{') {
  8344. data = $.parseJSON(data);
  8345. }
  8346. // filter data
  8347. result = dataFilter.call(this, data, field);
  8348. if (result === undefined) result = dataFilter.call(this, data.data, field);
  8349. rule.data = this.data;
  8350. rule.result = field.old ? result : undefined;
  8351. me._validatedRule(el, field, result);
  8352. },
  8353. function(jqXHR, textStatus){
  8354. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  8355. }
  8356. ).always(function(){
  8357. delete me.deferred[key];
  8358. });
  8359. }
  8360. // other result
  8361. else {
  8362. me._validatedRule(el, field, ret);
  8363. }
  8364. },
  8365. // Processing the validation
  8366. _validate: function(el, field) {
  8367. var me = this;
  8368. // doesn't validate the element that has "disabled" or "novalidate" attribute
  8369. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  8370. return;
  8371. }
  8372. field = field || me.getField(el);
  8373. if (!field) return;
  8374. if (!field._rules) me._parse(el);
  8375. if (!field._rules) return;
  8376. me._debug('info', field.key);
  8377. field.isValid = true;
  8378. field.element = el;
  8379. // Cache the value
  8380. field.value = field.getValue();
  8381. // if the field is not required, and that has a blank value
  8382. if (!field.required && !field.must && !field.value) {
  8383. if (!_checkable(el)) {
  8384. me._validatedField(el, field, {isValid: true});
  8385. return true;
  8386. }
  8387. }
  8388. me._checkRule(el, field);
  8389. return field.isValid;
  8390. },
  8391. _debug: function(type, messages) {
  8392. if (window.console && this.options.debug) {
  8393. console[type](messages);
  8394. }
  8395. },
  8396. /**
  8397. * Detecting whether the value of an element that matches a rule
  8398. *
  8399. * @method test
  8400. * @param {Element} el - input element
  8401. * @param {String} rule - rule name
  8402. */
  8403. test: function(el, rule) {
  8404. var me = this,
  8405. ret,
  8406. parts = rRule.exec(rule),
  8407. field,
  8408. method,
  8409. params;
  8410. if (parts) {
  8411. method = parts[1];
  8412. if (method in me.rules) {
  8413. params = parts[2] || parts[3];
  8414. params = params ? params.split(', ') : undefined;
  8415. field = me.getField(el, true);
  8416. field._r = method;
  8417. field.value = field.getValue();
  8418. ret = me.rules[method].call(field, el, params);
  8419. }
  8420. }
  8421. return ret === true || ret === undefined || ret === null;
  8422. },
  8423. _getDisplay: function(el, str) {
  8424. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  8425. },
  8426. _getMsgOpt: function(obj, field) {
  8427. var opt = field ? field : this.options;
  8428. return $.extend({
  8429. type: 'error',
  8430. pos: _getPos(opt.msgClass),
  8431. target: opt.target,
  8432. wrapper: opt.msgWrapper,
  8433. style: opt.msgStyle,
  8434. cls: opt.msgClass,
  8435. arrow: opt.msgArrow,
  8436. icon: opt.msgIcon
  8437. }, isString(obj) ? {msg: obj} : obj);
  8438. },
  8439. _getMsgDOM: function(el, msgOpt) {
  8440. var $el = $(el), $msgbox, datafor, tgt, container;
  8441. if ( $el.is(INPUT_SELECTOR) ) {
  8442. tgt = msgOpt.target || attr(el, DATA_TARGET);
  8443. if (tgt) {
  8444. tgt = isFunction(tgt) ? tgt.call(this, el) : this.$el.find(tgt);
  8445. if (tgt.length) {
  8446. if ( tgt.is(INPUT_SELECTOR) ) {
  8447. $el = tgt
  8448. el = tgt.get(0);
  8449. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  8450. $msgbox = tgt;
  8451. } else {
  8452. container = tgt;
  8453. }
  8454. }
  8455. }
  8456. if (!$msgbox) {
  8457. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  8458. $msgbox = this.$el.find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  8459. }
  8460. } else {
  8461. $msgbox = $el;
  8462. }
  8463. // Create new message box
  8464. if (!msgOpt.hide && !$msgbox.length) {
  8465. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  8466. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  8467. 'style': msgOpt.style || undefined,
  8468. 'for': datafor
  8469. });
  8470. if ( _checkable(el) ) {
  8471. var $parent = $el.parent();
  8472. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  8473. } else {
  8474. if (container) {
  8475. $msgbox.appendTo(container);
  8476. } else {
  8477. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  8478. }
  8479. }
  8480. }
  8481. return $msgbox;
  8482. },
  8483. /**
  8484. * Show validation message
  8485. *
  8486. * @method showMsg
  8487. * @param {Element} el - input element
  8488. * @param {Object} msgOpt
  8489. */
  8490. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  8491. if (!el) return;
  8492. var me = this,
  8493. opt = me.options,
  8494. msgShow,
  8495. msgMaker,
  8496. temp,
  8497. $msgbox;
  8498. if (isObject(el) && !el.jquery && !msgOpt) {
  8499. $.each(el, function(key, msg) {
  8500. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  8501. me.showMsg(el, msg);
  8502. });
  8503. return;
  8504. }
  8505. if ($(el).is(INPUT_SELECTOR)) {
  8506. field = field || me.getField(el);
  8507. }
  8508. if (!(msgMaker = (field || opt).msgMaker)) {
  8509. return;
  8510. }
  8511. msgOpt = me._getMsgOpt(msgOpt, field);
  8512. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  8513. // ok or tip
  8514. if (!msgOpt.msg && msgOpt.type !== 'error') {
  8515. temp = attr(el, 'data-' + msgOpt.type);
  8516. if (temp !== null) msgOpt.msg = temp;
  8517. }
  8518. if ( !isString(msgOpt.msg) ) {
  8519. return;
  8520. }
  8521. $msgbox = me._getMsgDOM(el, msgOpt);
  8522. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  8523. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  8524. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  8525. }
  8526. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  8527. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  8528. msgShow.call(me, $msgbox, msgOpt.type);
  8529. }
  8530. },
  8531. /**
  8532. * Hide validation message
  8533. *
  8534. * @method hideMsg
  8535. * @param {Element} el - input element
  8536. * @param {Object} msgOpt optional
  8537. */
  8538. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  8539. var me = this,
  8540. opt = me.options,
  8541. msgHide,
  8542. $msgbox;
  8543. el = $(el).get(0);
  8544. if ($(el).is(INPUT_SELECTOR)) {
  8545. field = field || me.getField(el);
  8546. if (field) {
  8547. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  8548. }
  8549. }
  8550. msgOpt = me._getMsgOpt(msgOpt, field);
  8551. msgOpt.hide = true;
  8552. $msgbox = me._getMsgDOM(el, msgOpt);
  8553. if (!$msgbox.length) return;
  8554. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  8555. msgHide.call(me, $msgbox, msgOpt.type);
  8556. } else {
  8557. $msgbox[0].style.display = 'none';
  8558. $msgbox[0].innerHTML = null;
  8559. }
  8560. },
  8561. /**
  8562. * Get field information
  8563. *
  8564. * @method getField
  8565. * @param {Element} - input element
  8566. * @return {Object} field
  8567. */
  8568. getField: function(el, must) {
  8569. var me = this,
  8570. key,
  8571. field;
  8572. if (isString(el)) {
  8573. key = el;
  8574. el = undefined;
  8575. } else {
  8576. if (attr(el, DATA_RULE)) {
  8577. return me._parse(el);
  8578. }
  8579. if (el.id && '#' + el.id in me.fields || !el.name) {
  8580. key = '#' + el.id;
  8581. } else {
  8582. key = el.name;
  8583. }
  8584. }
  8585. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  8586. field.element = el;
  8587. }
  8588. return field;
  8589. },
  8590. /**
  8591. * Config a field
  8592. *
  8593. * @method: setField
  8594. * @param {String} key
  8595. * @param {Object} obj
  8596. */
  8597. setField: function(key, obj) {
  8598. var fields = {};
  8599. if (!key) return;
  8600. // update this field
  8601. if (isString(key)) {
  8602. fields[key] = obj;
  8603. }
  8604. // update fields
  8605. else {
  8606. fields = key;
  8607. }
  8608. this._initFields(fields);
  8609. },
  8610. /**
  8611. * Detecting whether the form is valid
  8612. *
  8613. * @method isFormValid
  8614. * @return {Boolean}
  8615. */
  8616. isFormValid: function() {
  8617. var fields = this.fields, k, field;
  8618. for (k in fields) {
  8619. field = fields[k];
  8620. if (!field._rules || !field.required && !field.must && !field.value) continue;
  8621. if (!field.isValid) return false;
  8622. }
  8623. return true;
  8624. },
  8625. /**
  8626. * Prevent submission form
  8627. *
  8628. * @method holdSubmit
  8629. * @param {Boolean} hold - If set to false, will release the hold
  8630. */
  8631. holdSubmit: function(hold) {
  8632. this.submiting = hold === undefined || hold;
  8633. },
  8634. /**
  8635. * Clean validation messages
  8636. *
  8637. * @method cleanUp
  8638. */
  8639. cleanUp: function() {
  8640. this._reset(1);
  8641. },
  8642. /**
  8643. * Destroy the validation
  8644. *
  8645. * @method destroy
  8646. */
  8647. destroy: function() {
  8648. this._reset(1);
  8649. this.$el.off(CLS_NS).removeData(NS);
  8650. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  8651. }
  8652. };
  8653. /**
  8654. * Create Field Factory
  8655. *
  8656. * @class
  8657. * @param {Object} context
  8658. * @return {Function} Factory
  8659. */
  8660. function _createFieldFactory(context) {
  8661. function FieldFactory() {
  8662. var options = this.options;
  8663. for (var i in options) {
  8664. if (i in fieldDefaults) this[i] = options[i];
  8665. }
  8666. $.extend(this, {
  8667. _valHook: function() {
  8668. return this.element.contentEditable === 'true' ? 'text' : 'val';
  8669. },
  8670. getValue: function() {
  8671. var elem = this.element;
  8672. if (elem.type === "number" && elem.validity && elem.validity.badInput) {
  8673. return 'NaN';
  8674. }
  8675. return $(elem)[this._valHook()]();
  8676. },
  8677. setValue: function(value) {
  8678. $(this.element)[this._valHook()](this.value = value);
  8679. },
  8680. // Get a range of validation messages
  8681. getRangeMsg: function(value, params, suffix) {
  8682. if (!params) return;
  8683. var me = this,
  8684. msg = me.messages[me._r] || '',
  8685. result,
  8686. p = params[0].split('~'),
  8687. e = params[1] === 'false',
  8688. a = p[0],
  8689. b = p[1],
  8690. c = 'rg',
  8691. args = [''],
  8692. isNumber = trim(value) && +value === +value;
  8693. function compare(large, small) {
  8694. return !e ? large >= small : large > small;
  8695. }
  8696. if (p.length === 2) {
  8697. if (a && b) {
  8698. if (isNumber && compare(value, +a) && compare(+b, value)) {
  8699. result = true;
  8700. }
  8701. args = args.concat(p);
  8702. c = e ? 'gtlt' : 'rg';
  8703. }
  8704. else if (a && !b) {
  8705. if (isNumber && compare(value, +a)) {
  8706. result = true;
  8707. }
  8708. args.push(a);
  8709. c = e ? 'gt' : 'gte';
  8710. }
  8711. else if (!a && b) {
  8712. if (isNumber && compare(+b, value)) {
  8713. result = true;
  8714. }
  8715. args.push(b);
  8716. c = e ? 'lt' : 'lte';
  8717. }
  8718. }
  8719. else {
  8720. if (value === +a) {
  8721. result = true;
  8722. }
  8723. args.push(a);
  8724. c = 'eq';
  8725. }
  8726. if (msg) {
  8727. if (suffix && msg[c + suffix]) {
  8728. c += suffix;
  8729. }
  8730. args[0] = msg[c];
  8731. }
  8732. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8733. },
  8734. // Render message template
  8735. renderMsg: function() {
  8736. var args = arguments,
  8737. tpl = args[0],
  8738. i = args.length;
  8739. if (!tpl) return;
  8740. while (--i) {
  8741. tpl = tpl.replace('{' + i + '}', args[i]);
  8742. }
  8743. return tpl;
  8744. }
  8745. });
  8746. }
  8747. function Field(key, obj, oldField) {
  8748. this.key = key;
  8749. this.validator = context;
  8750. $.extend(this, oldField, obj);
  8751. }
  8752. FieldFactory.prototype = context;
  8753. Field.prototype = new FieldFactory();
  8754. return Field;
  8755. }
  8756. /**
  8757. * Create Rules
  8758. *
  8759. * @class
  8760. * @param {Object} obj rules
  8761. * @param {Object} context context
  8762. */
  8763. function Rules(obj, context) {
  8764. if (!isObject(obj)) return;
  8765. var k, that = context ? context === true ? this : context : Rules.prototype;
  8766. for (k in obj) {
  8767. if (_checkRuleName(k))
  8768. that[k] = _getRule(obj[k]);
  8769. }
  8770. }
  8771. /**
  8772. * Create Messages
  8773. *
  8774. * @class
  8775. * @param {Object} obj rules
  8776. * @param {Object} context context
  8777. */
  8778. function Messages(obj, context) {
  8779. if (!isObject(obj)) return;
  8780. var k, that = context ? context === true ? this : context : Messages.prototype;
  8781. for (k in obj) {
  8782. that[k] = obj[k];
  8783. }
  8784. }
  8785. // Rule converted factory
  8786. function _getRule(fn) {
  8787. switch ($.type(fn)) {
  8788. case 'function':
  8789. return fn;
  8790. case 'array':
  8791. var f = function() {
  8792. return fn[0].test(this.value) || fn[1] || false;
  8793. };
  8794. f.msg = fn[1];
  8795. return f;
  8796. case 'regexp':
  8797. return function() {
  8798. return fn.test(this.value);
  8799. };
  8800. }
  8801. }
  8802. // Get instance by an element
  8803. function _getInstance(el) {
  8804. var wrap, k, options;
  8805. if (!el || !el.tagName) return;
  8806. switch (el.tagName) {
  8807. case 'INPUT':
  8808. case 'SELECT':
  8809. case 'TEXTAREA':
  8810. case 'BUTTON':
  8811. case 'FIELDSET':
  8812. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8813. break;
  8814. case 'FORM':
  8815. wrap = el;
  8816. break;
  8817. default:
  8818. wrap = $(el).closest('.' + CLS_WRAPPER);
  8819. }
  8820. for (k in preinitialized) {
  8821. if ($(wrap).is(k)) {
  8822. options = preinitialized[k];
  8823. break;
  8824. }
  8825. }
  8826. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8827. }
  8828. // Get custom rules on the node
  8829. function _getDataRule(el, method) {
  8830. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8831. if ( fn && (fn = new Function("return " + fn)()) ) {
  8832. return _getRule(fn);
  8833. }
  8834. }
  8835. // Get custom messages on the node
  8836. function _getDataMsg(el, field, m) {
  8837. var msg = field.msg,
  8838. item = field._r;
  8839. if ( isObject(msg) ) msg = msg[item];
  8840. if ( !isString(msg) ) {
  8841. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8842. }
  8843. return msg;
  8844. }
  8845. // Get message position
  8846. function _getPos(str) {
  8847. var pos;
  8848. if (str) pos = rPos.exec(str);
  8849. return pos && pos[0];
  8850. }
  8851. // Check whether the element is checkbox or radio
  8852. function _checkable(el) {
  8853. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8854. }
  8855. // Parse date string to timestamp
  8856. function _parseDate(str) {
  8857. return Date.parse(str.replace(/\.|\-/g, '/'));
  8858. }
  8859. // Rule name only allows alphanumeric characters and underscores
  8860. function _checkRuleName(name) {
  8861. return /^\w+$/.test(name);
  8862. }
  8863. // Translate field key to jQuery selector.
  8864. function _key2selector(key) {
  8865. var isID = key.charAt(0) === "#";
  8866. key = key.replace(/([:.{(|)}/\[\]])/g, "\\$1");
  8867. return isID ? key : '[name="'+ key +'"]:first';
  8868. }
  8869. // Fixed a issue cause by refresh page in IE.
  8870. $(window).on('beforeunload', function(){
  8871. this.focus();
  8872. });
  8873. $(document)
  8874. .on('click', ':submit', function(){
  8875. var input = this, attrNode;
  8876. if (!input.form) return;
  8877. // Shim for "formnovalidate"
  8878. attrNode = input.getAttributeNode('formnovalidate');
  8879. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8880. novalidateonce = true;
  8881. }
  8882. })
  8883. // Automatic initializing form validation
  8884. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8885. if ( attr(this, NOVALIDATE) !== null ) return;
  8886. var $form = $(this), me;
  8887. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8888. if ( !$.isEmptyObject(me.fields) ) {
  8889. // Execute event handler
  8890. if (e.type === 'focusin') {
  8891. me._focusin(e);
  8892. } else {
  8893. me._submit(e);
  8894. }
  8895. } else {
  8896. attr(this, NOVALIDATE, NOVALIDATE);
  8897. $form.off(CLS_NS).removeData(NS);
  8898. }
  8899. }
  8900. });
  8901. new Messages({
  8902. fallback: "This field is not valid.",
  8903. loading: 'Validating...'
  8904. });
  8905. // Built-in rules (global)
  8906. new Rules({
  8907. /**
  8908. * required
  8909. *
  8910. * @example:
  8911. required
  8912. required(anotherRule)
  8913. required(not, -1)
  8914. required(from, .contact)
  8915. */
  8916. required: function(element, params) {
  8917. var me = this,
  8918. val = trim(me.value),
  8919. isValid = true;
  8920. if (params) {
  8921. if ( params.length === 1 ) {
  8922. if ( !_checkRuleName(params[0]) ) {
  8923. if (!val && !$(params[0], me.$el).length ) {
  8924. return null;
  8925. }
  8926. }
  8927. else if ( me.rules[params[0]] ) {
  8928. if ( !val && !me.test(element, params[0]) ) {
  8929. attr(element, ARIA_REQUIRED, null);
  8930. return null;
  8931. } else {
  8932. attr(element, ARIA_REQUIRED, true);
  8933. }
  8934. }
  8935. }
  8936. else if ( params[0] === 'not' ) {
  8937. $.each(params.slice(1), function() {
  8938. return (isValid = val !== trim(this));
  8939. });
  8940. }
  8941. else if ( params[0] === 'from' ) {
  8942. var $elements = me.$el.find(params[1]),
  8943. VALIDATED = '_validated_',
  8944. ret;
  8945. isValid = $elements.filter(function(){
  8946. var field = me.getField(this);
  8947. return field && !!trim(field.getValue());
  8948. }).length >= (params[2] || 1);
  8949. if (isValid) {
  8950. if (!val) ret = null;
  8951. } else {
  8952. ret = _getDataMsg($elements[0], me) || false;
  8953. }
  8954. if ( !$(element).data(VALIDATED) ) {
  8955. $elements.data(VALIDATED, 1).each(function(){
  8956. if (element !== this) {
  8957. me._validate(this);
  8958. }
  8959. }).removeData(VALIDATED);
  8960. }
  8961. return ret;
  8962. }
  8963. }
  8964. return isValid && !!val;
  8965. },
  8966. /**
  8967. * integer
  8968. *
  8969. * @example:
  8970. integer
  8971. integer[+]
  8972. integer[+0]
  8973. integer[-]
  8974. integer[-0]
  8975. */
  8976. integer: function(element, params) {
  8977. var re, z = '0|',
  8978. p = '[1-9]\\d*',
  8979. key = params ? params[0] : '*';
  8980. switch (key) {
  8981. case '+':
  8982. re = p;
  8983. break;
  8984. case '-':
  8985. re = '-' + p;
  8986. break;
  8987. case '+0':
  8988. re = z + p;
  8989. break;
  8990. case '-0':
  8991. re = z + '-' + p;
  8992. break;
  8993. default:
  8994. re = z + '-?' + p;
  8995. }
  8996. re = '^(?:' + re + ')$';
  8997. return new RegExp(re).test(this.value) || this.messages.integer[key];
  8998. },
  8999. /**
  9000. * match another field
  9001. *
  9002. * @example:
  9003. match[password] Match the password field (two values ​​must be the same)
  9004. match[eq, password] Ditto
  9005. match[neq, count] The value must be not equal to the value of the count field
  9006. match[lt, count] The value must be less than the value of the count field
  9007. match[lte, count] The value must be less than or equal to the value of the count field
  9008. match[gt, count] The value must be greater than the value of the count field
  9009. match[gte, count] The value must be greater than or equal to the value of the count field
  9010. match[gte, startDate, date]
  9011. match[gte, startTime, time]
  9012. **/
  9013. match: function(element, params) {
  9014. if (!params) return;
  9015. var me = this,
  9016. a, b,
  9017. key, msg, type = 'eq', parser,
  9018. selector2, elem2, field2;
  9019. if (params.length === 1) {
  9020. key = params[0];
  9021. } else {
  9022. type = params[0];
  9023. key = params[1];
  9024. }
  9025. selector2 = _key2selector(key);
  9026. elem2 = me.$el.find(selector2)[0];
  9027. // If the compared field is not exist
  9028. if (!elem2) return;
  9029. field2 = me.getField(elem2);
  9030. a = me.value;
  9031. b = field2.getValue();
  9032. if (!me._match) {
  9033. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  9034. $(element).trigger('validate');
  9035. });
  9036. me._match = field2._match = 1;
  9037. }
  9038. // If both fields are blank
  9039. if (!me.required && a === "" && b === "") {
  9040. return null;
  9041. }
  9042. parser = params[2];
  9043. if (parser) {
  9044. if (/^date(time)?$/i.test(parser)) {
  9045. a = _parseDate(a);
  9046. b = _parseDate(b);
  9047. } else if (parser === 'time') {
  9048. a = +a.replace(/:/g, '');
  9049. b = +b.replace(/:/g, '');
  9050. }
  9051. }
  9052. // If the compared field is incorrect, we only ensure that this field is correct.
  9053. if (type !== "eq" && !isNaN(+a) && isNaN(+b)) {
  9054. return true;
  9055. }
  9056. msg = me.messages.match[type].replace( '{1}', me._getDisplay( element, field2.display || key ) );
  9057. switch (type) {
  9058. case 'lt':
  9059. return (+a < +b) || msg;
  9060. case 'lte':
  9061. return (+a <= +b) || msg;
  9062. case 'gte':
  9063. return (+a >= +b) || msg;
  9064. case 'gt':
  9065. return (+a > +b) || msg;
  9066. case 'neq':
  9067. return (a !== b) || msg;
  9068. default:
  9069. return (a === b) || msg;
  9070. }
  9071. },
  9072. /**
  9073. * range numbers
  9074. *
  9075. * @example:
  9076. range[0~99] Number 0-99
  9077. range[0~] Number greater than or equal to 0
  9078. range[~100] Number less than or equal to 100
  9079. **/
  9080. range: function(element, params) {
  9081. return this.getRangeMsg(this.value, params);
  9082. },
  9083. /**
  9084. * how many checkbox or radio inputs that checked
  9085. *
  9086. * @example:
  9087. checked; no empty, same to required
  9088. checked[1~3] 1-3 items
  9089. checked[1~] greater than 1 item
  9090. checked[~3] less than 3 items
  9091. checked[3] 3 items
  9092. **/
  9093. checked: function(element, params) {
  9094. if ( !_checkable(element) ) return;
  9095. var me = this,
  9096. elem, count;
  9097. if (element.name) {
  9098. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  9099. var el = this;
  9100. if (!elem && _checkable(el)) elem = el;
  9101. return !el.disabled && el.checked;
  9102. }).length;
  9103. } else {
  9104. elem = element;
  9105. count = elem.checked;
  9106. }
  9107. if (params) {
  9108. return me.getRangeMsg(count, params);
  9109. } else {
  9110. return !!count || _getDataMsg(elem, me, '') || me.messages.required;
  9111. }
  9112. },
  9113. /**
  9114. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  9115. *
  9116. * @example:
  9117. length[6~16] 6-16 characters
  9118. length[6~] Greater than 6 characters
  9119. length[~16] Less than 16 characters
  9120. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  9121. **/
  9122. length: function(element, params) {
  9123. var value = this.value,
  9124. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  9125. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  9126. },
  9127. /**
  9128. * remote validation
  9129. *
  9130. * @description
  9131. * remote([get:]url [, name1, [name2 ...]]);
  9132. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  9133. 1. text:
  9134. '' 'Error Message'
  9135. 2. json:
  9136. {"ok": ""} {"error": "Error Message"}
  9137. 3. json wrapper:
  9138. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  9139. * @example
  9140. The simplest: remote(path/to/server);
  9141. With parameters: remote(path/to/server, name1, name2, ...);
  9142. By GET: remote(get:path/to/server, name1, name2, ...);
  9143. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  9144. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  9145. */
  9146. remote: function(element, params) {
  9147. if (!params) return;
  9148. var me = this,
  9149. arr = rAjaxType.exec(params[0]),
  9150. rule = me._rules[me._i],
  9151. data = {},
  9152. queryString = '',
  9153. url = arr[3],
  9154. type = arr[2] || 'POST', // GET / POST
  9155. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  9156. dataType;
  9157. rule.must = true;
  9158. data[element.name] = me.value;
  9159. // There are extra fields
  9160. if (params[1]) {
  9161. $.map(params.slice(1), function(name) {
  9162. var arr, key;
  9163. if (~name.indexOf('=')) {
  9164. queryString += '&' + name;
  9165. } else {
  9166. arr = name.split(':');
  9167. name = trim(arr[0]);
  9168. key = trim(arr[1]) || name;
  9169. data[ name ] = me.$el.find( _key2selector(key) ).val();
  9170. }
  9171. });
  9172. }
  9173. data = $.param(data) + queryString;
  9174. if (!me.must && rule.data && rule.data === data) {
  9175. return rule.result;
  9176. }
  9177. // Cross-domain request, force jsonp dataType
  9178. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  9179. dataType = 'jsonp';
  9180. }
  9181. // Asynchronous validation need return jqXHR objects
  9182. return $.ajax({
  9183. url: url,
  9184. type: type,
  9185. data: data,
  9186. dataType: dataType
  9187. });
  9188. },
  9189. /**
  9190. * filter characters, direct filtration without prompting error (support custom regular expressions)
  9191. *
  9192. * @example
  9193. * filter filtering unsafe characters
  9194. * filter(regexp) filtering the "regexp" matched characters
  9195. */
  9196. filter: function(element, params) {
  9197. var value = this.value,
  9198. temp = value.replace( params ? (new RegExp("[" + params[0] + "]", "gm")) : rUnsafe, '' );
  9199. if (temp !== value) this.setValue(temp);
  9200. }
  9201. });
  9202. /**
  9203. * Config global options
  9204. *
  9205. * @static config
  9206. * @param {Object} options
  9207. */
  9208. Validator.config = function(key, value) {
  9209. if (isObject(key)) {
  9210. $.each(key, _config);
  9211. }
  9212. else if (isString(key)) {
  9213. _config(key, value);
  9214. }
  9215. function _config(k, o) {
  9216. if (k === 'rules') {
  9217. new Rules(o);
  9218. }
  9219. else if (k === 'messages') {
  9220. new Messages(o);
  9221. }
  9222. else if (k in fieldDefaults) {
  9223. fieldDefaults[k] = o;
  9224. }
  9225. else {
  9226. defaults[k] = o;
  9227. }
  9228. }
  9229. };
  9230. /**
  9231. * Config themes
  9232. *
  9233. * @static setTheme
  9234. * @param {String|Object} name
  9235. * @param {Object} obj
  9236. * @example
  9237. .setTheme( themeName, themeOptions )
  9238. .setTheme( multiThemes )
  9239. */
  9240. Validator.setTheme = function(name, obj) {
  9241. if ( isObject(name) ) {
  9242. $.extend(true, themes, name);
  9243. }
  9244. else if ( isString(name) && isObject(obj) ) {
  9245. themes[name] = $.extend(themes[name], obj);
  9246. }
  9247. };
  9248. /**
  9249. * Resource loader
  9250. *
  9251. * @static load
  9252. * @param {String} str
  9253. * @example
  9254. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  9255. .load('local=zh-CN&css=') // load: local/zh-CN.js
  9256. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  9257. .load('local') // dito
  9258. */
  9259. Validator.load = function(str) {
  9260. if (!str) return;
  9261. var doc = document,
  9262. params = {},
  9263. node = doc.scripts[0],
  9264. dir, el, ONLOAD;
  9265. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  9266. params[key] = value;
  9267. });
  9268. dir = params.dir || Validator.dir;
  9269. if (!Validator.css && params.css !== '') {
  9270. el = doc.createElement('link');
  9271. el.rel = 'stylesheet';
  9272. el.href = Validator.css = dir + 'jquery.validator.css';
  9273. node.parentNode.insertBefore(el, node);
  9274. }
  9275. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  9276. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  9277. Validator.pending = 1;
  9278. el = doc.createElement('script');
  9279. el.src = dir + 'local/' + Validator.local + '.js';
  9280. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  9281. el[ONLOAD] = function() {
  9282. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  9283. el = el[ONLOAD] = null;
  9284. delete Validator.pending;
  9285. $(window).triggerHandler('validatorready');
  9286. }
  9287. };
  9288. node.parentNode.insertBefore(el, node);
  9289. }
  9290. };
  9291. // Auto loading resources
  9292. (function(){
  9293. var scripts = document.scripts,
  9294. i = scripts.length, node, arr,
  9295. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  9296. while (i-- && !arr) {
  9297. node = scripts[i];
  9298. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  9299. }
  9300. if (!arr) return;
  9301. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  9302. Validator.load(arr[2]);
  9303. })();
  9304. return $[NS] = Validator;
  9305. }));
  9306. define('form',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'upload', 'validator'], function ($, undefined, Backend, Config, Toastr, Upload, Validator) {
  9307. var Form = {
  9308. config: {
  9309. },
  9310. api: {
  9311. submit: function (form, onBeforeSubmit, onAfterSubmit) {
  9312. if (form.size() == 0)
  9313. return Toastr.error("表单未初始化完成,无法提交");
  9314. //提交前事件
  9315. var beforeSubmit = form.data("before-submit");
  9316. //元素绑定函数
  9317. if (beforeSubmit && typeof Form.api.custom[beforeSubmit] == 'function') {
  9318. if (!Form.api.custom[beforeSubmit].call(form)) {
  9319. return false;
  9320. }
  9321. }
  9322. //自定义函数
  9323. if (typeof onBeforeSubmit == 'function') {
  9324. if (!onBeforeSubmit.call(form)) {
  9325. return false;
  9326. }
  9327. }
  9328. var type = form.attr("method");
  9329. type = type && (type == 'GET' || type == 'POST') ? type : 'GET';
  9330. url = form.attr("action");
  9331. url = url ? url : location.href;
  9332. $.ajax({
  9333. type: type,
  9334. url: url,
  9335. data: form.serialize(),
  9336. dataType: 'json',
  9337. success: function (ret) {
  9338. if (ret.hasOwnProperty("code")) {
  9339. var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
  9340. var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
  9341. if (ret.code === 1) {
  9342. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9343. //成功提交后事件
  9344. var afterSubmit = form.data("after-submit");
  9345. //元素绑定函数
  9346. if (afterSubmit && typeof Form.api.custom[afterSubmit] == 'function') {
  9347. if (!Form.api.custom[afterSubmit].call(form, data)) {
  9348. return false;
  9349. }
  9350. }
  9351. //自定义函数
  9352. if (typeof onAfterSubmit == 'function') {
  9353. if (!onAfterSubmit.call(form, data)) {
  9354. return false;
  9355. }
  9356. }
  9357. Toastr.success(msg ? msg : __('Operation completed'));
  9358. } else {
  9359. Toastr.error(msg ? msg : __('Operation failed'));
  9360. }
  9361. } else {
  9362. Toastr.error(__('Unknown data format'));
  9363. }
  9364. }, error: function () {
  9365. Toastr.error(__('Network error'));
  9366. }, complete: function (e) {
  9367. }
  9368. });
  9369. return false;
  9370. },
  9371. bindevent: function (form, onBeforeSubmit, onAfterSubmit) {
  9372. form.validator({
  9373. validClass: 'has-success',
  9374. invalidClass: 'has-error',
  9375. bindClassTo: '.form-group',
  9376. formClass: 'n-default n-bootstrap',
  9377. msgClass: 'n-right',
  9378. stopOnError: true,
  9379. valid: function (ret) {
  9380. //验证通过提交表单
  9381. Form.api.submit(form, onBeforeSubmit, function (data) {
  9382. if (typeof onAfterSubmit == 'function') {
  9383. if (!onAfterSubmit.call(form, data)) {
  9384. return false;
  9385. }
  9386. }
  9387. //提示及关闭当前窗口
  9388. parent.Toastr.success(__('Operation completed'));
  9389. parent.$(".btn-refresh").trigger("click");
  9390. var index = parent.Layer.getFrameIndex(window.name);
  9391. parent.Layer.close(index);
  9392. });
  9393. return false;
  9394. }
  9395. });
  9396. //绑定select元素事件
  9397. if ($(".selectpicker", form).size() > 0) {
  9398. require(['bootstrap-select'], function () {
  9399. $('.selectpicker', form).selectpicker();
  9400. });
  9401. }
  9402. if ($(".typeahead").size() > 0 || $(".tagsinput").size() > 0) {
  9403. require(['bloodhound'], function () {
  9404. var remotesource = function (input) {
  9405. return new Bloodhound({
  9406. datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
  9407. queryTokenizer: Bloodhound.tokenizers.whitespace,
  9408. remote: {
  9409. url: '/ajax/typeahead?search=%QUERY&field=' + $(input).attr("name"),
  9410. wildcard: '%QUERY',
  9411. transform: function (ret) {
  9412. return ret.data.searchlist;
  9413. }
  9414. }
  9415. });
  9416. };
  9417. //绑定typeahead事件
  9418. if ($(".typeahead", form).size() > 0) {
  9419. require(['typeahead'], function () {
  9420. $(".typeahead", form).each(function () {
  9421. $(this).typeahead({
  9422. hint: true,
  9423. highlight: true,
  9424. minLength: 0
  9425. }, {
  9426. name: 'typeahead',
  9427. limit: 20,
  9428. displayKey: 'id',
  9429. source: remotesource(this),
  9430. templates: {
  9431. empty: '<li class="notfound">' + __('No matches found') + '</li>',
  9432. suggestion: function (item) {
  9433. return '<li>' + item.name + '</li>';
  9434. }
  9435. }
  9436. });
  9437. });
  9438. });
  9439. }
  9440. //绑定tagsinput事件
  9441. if ($(".tagsinput", form).size() > 0) {
  9442. require(['bootstrap-tagsinput'], function () {
  9443. $('.tagsinput', form).each(function () {
  9444. $(this).tagsinput({
  9445. freeInput: false,
  9446. typeaheadjs: {
  9447. name: 'tagsinput',
  9448. limit: 20,
  9449. displayKey: 'name',
  9450. valueKey: 'id',
  9451. source: remotesource(this),
  9452. templates: {
  9453. empty: '<li class="notfound">' + __('No matches found') + '</li>',
  9454. suggestion: function (item) {
  9455. return '<li>' + item.name + '</li>';
  9456. }
  9457. }
  9458. }
  9459. });
  9460. });
  9461. $('.bootstrap-tagsinput .twitter-typeahead').css('display', 'inline');
  9462. });
  9463. }
  9464. });
  9465. }
  9466. //绑定日期时间元素事件
  9467. if ($(".datetimepicker", form).size() > 0) {
  9468. require(['bootstrap-datetimepicker'], function () {
  9469. $('.datetimepicker', form).parent().css('position', 'relative');
  9470. $('.datetimepicker', form)
  9471. .datetimepicker({
  9472. format: 'YYYY-MM-DD HH:mm:ss',
  9473. icons: {
  9474. time: 'fa fa-clock-o',
  9475. date: 'fa fa-calendar',
  9476. up: 'fa fa-chevron-up',
  9477. down: 'fa fa-chevron-down',
  9478. previous: 'fa fa-chevron-left',
  9479. next: 'fa fa-chevron-right',
  9480. today: 'fa fa-history',
  9481. clear: 'fa fa-trash',
  9482. close: 'fa fa-remove'
  9483. },
  9484. showTodayButton: true,
  9485. showClose: true
  9486. });
  9487. });
  9488. }
  9489. //绑定summernote事件
  9490. if ($(".summernote", form).size() > 0) {
  9491. require(['summernote'], function () {
  9492. $(".summernote", form).summernote({
  9493. height: 250,
  9494. lang: 'zh-CN',
  9495. dialogsInBody: true,
  9496. callbacks: {
  9497. onChange: function (contents) {
  9498. $(this).val(contents);
  9499. $(this).trigger('change');
  9500. },
  9501. onInit: function () {
  9502. },
  9503. onImageUpload: function (files) {
  9504. var that = this;
  9505. //依次上传图片
  9506. for (var i = 0; i < files.length; i++) {
  9507. Upload.api.send(files[i], function (data) {
  9508. var url = Config.upload.cdnurl + data.url;
  9509. $(that).summernote("insertImage", url, 'filename');
  9510. });
  9511. }
  9512. }
  9513. }
  9514. });
  9515. });
  9516. }
  9517. //绑定plupload上传元素事件
  9518. if ($(".plupload", form).size() > 0) {
  9519. Upload.api.plupload();
  9520. }
  9521. },
  9522. custom: {}
  9523. },
  9524. };
  9525. return Form;
  9526. });
  9527. // jQuery List DragSort v0.5.2
  9528. // Website: http://dragsort.codeplex.com/
  9529. // License: http://dragsort.codeplex.com/license
  9530. (function($) {
  9531. $.fn.dragsort = function(options) {
  9532. if (options == "destroy") {
  9533. $(this.selector).trigger("dragsort-uninit");
  9534. return;
  9535. }
  9536. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  9537. var lists = [];
  9538. var list = null, lastPos = null;
  9539. this.each(function(i, cont) {
  9540. //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
  9541. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  9542. cont = $(cont).children().get(0);
  9543. var newList = {
  9544. draggedItem: null,
  9545. placeHolderItem: null,
  9546. pos: null,
  9547. offset: null,
  9548. offsetLimit: null,
  9549. scroll: null,
  9550. container: cont,
  9551. init: function() {
  9552. //set options to default values if not set
  9553. opts.tagName = $(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase();
  9554. if (opts.itemSelector == "")
  9555. opts.itemSelector = opts.tagName;
  9556. if (opts.dragSelector == "")
  9557. opts.dragSelector = opts.tagName;
  9558. if (opts.placeHolderTemplate == "")
  9559. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  9560. //listidx allows reference back to correct list variable instance
  9561. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  9562. this.styleDragHandlers(true);
  9563. },
  9564. uninit: function() {
  9565. var list = lists[$(this).attr("data-listidx")];
  9566. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  9567. list.styleDragHandlers(false);
  9568. },
  9569. getItems: function() {
  9570. return $(this.container).children(opts.itemSelector);
  9571. },
  9572. styleDragHandlers: function(cursor) {
  9573. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  9574. },
  9575. grabItem: function(e) {
  9576. var list = lists[$(this).attr("data-listidx")];
  9577. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  9578. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  9579. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  9580. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  9581. return;
  9582. //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,
  9583. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  9584. //e.preventDefault();
  9585. //change cursor to move while dragging
  9586. var dragHandle = e.target;
  9587. while (!$(dragHandle).is(opts.dragSelector)) {
  9588. if (dragHandle == this) return;
  9589. dragHandle = dragHandle.parentNode;
  9590. }
  9591. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  9592. $(dragHandle).css("cursor", "move");
  9593. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  9594. var listElem = this;
  9595. var trigger = function() {
  9596. list.dragStart.call(listElem, e);
  9597. $(list.container).unbind("mousemove", trigger);
  9598. };
  9599. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  9600. },
  9601. dragStart: function(e) {
  9602. if (list != null && list.draggedItem != null)
  9603. list.dropItem();
  9604. list = lists[$(this).attr("data-listidx")];
  9605. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  9606. //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
  9607. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  9608. //calculate mouse offset relative to draggedItem
  9609. var mt = parseInt(list.draggedItem.css("marginTop"));
  9610. var ml = parseInt(list.draggedItem.css("marginLeft"));
  9611. list.offset = list.draggedItem.offset();
  9612. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  9613. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  9614. //calculate box the dragged item can't be dragged outside of
  9615. if (!opts.dragBetween) {
  9616. 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();
  9617. list.offsetLimit = $(list.container).offset();
  9618. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  9619. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  9620. }
  9621. //create placeholder item
  9622. var h = list.draggedItem.height();
  9623. var w = list.draggedItem.width();
  9624. if (opts.tagName == "tr") {
  9625. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  9626. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  9627. list.draggedItem.after(list.placeHolderItem);
  9628. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  9629. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  9630. } else {
  9631. list.draggedItem.after(opts.placeHolderTemplate);
  9632. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  9633. }
  9634. if (opts.tagName == "td") {
  9635. var listTable = list.draggedItem.closest("table").get(0);
  9636. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  9637. }
  9638. //style draggedItem while dragging
  9639. var orig = list.draggedItem.attr("style");
  9640. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  9641. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  9642. //auto-scroll setup
  9643. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  9644. list.scroll.scrollY = window.setInterval(function() {
  9645. if (opts.scrollContainer != window) {
  9646. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  9647. return;
  9648. }
  9649. var t = $(opts.scrollContainer).scrollTop();
  9650. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  9651. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  9652. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  9653. }
  9654. }, 10);
  9655. list.scroll.scrollX = window.setInterval(function() {
  9656. if (opts.scrollContainer != window) {
  9657. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  9658. return;
  9659. }
  9660. var l = $(opts.scrollContainer).scrollLeft();
  9661. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  9662. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  9663. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  9664. }
  9665. }, 10);
  9666. //misc
  9667. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9668. list.setPos(e.pageX, e.pageY);
  9669. $(document).bind("mousemove", list.swapItems);
  9670. $(document).bind("mouseup", list.dropItem);
  9671. if (opts.scrollContainer != window)
  9672. $(window).bind("wheel", list.wheel);
  9673. },
  9674. //set position of draggedItem
  9675. setPos: function(x, y) {
  9676. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  9677. var top = y - this.offset.top;
  9678. var left = x - this.offset.left;
  9679. //limit top, left to within box draggedItem can't be dragged outside of
  9680. if (!opts.dragBetween) {
  9681. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  9682. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  9683. }
  9684. //adjust top & left calculations to parent offset
  9685. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  9686. if (parent != null) {
  9687. top -= parent.top;
  9688. left -= parent.left;
  9689. }
  9690. //set x or y auto-scroll amount
  9691. if (opts.scrollContainer == window) {
  9692. y -= $(window).scrollTop();
  9693. x -= $(window).scrollLeft();
  9694. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  9695. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  9696. } else {
  9697. var cont = $(opts.scrollContainer);
  9698. var offset = cont.offset();
  9699. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  9700. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  9701. }
  9702. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  9703. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  9704. //move draggedItem to new mouse cursor location
  9705. this.draggedItem.css({ top: top, left: left });
  9706. },
  9707. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  9708. wheel: function(e) {
  9709. if (list && opts.scrollContainer != window) {
  9710. var cont = $(opts.scrollContainer);
  9711. var offset = cont.offset();
  9712. e = e.originalEvent;
  9713. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  9714. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  9715. cont.scrollTop(cont.scrollTop() + deltaY);
  9716. e.preventDefault();
  9717. }
  9718. }
  9719. },
  9720. //build a table recording all the positions of the moveable list items
  9721. buildPositionTable: function() {
  9722. var pos = [];
  9723. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  9724. var loc = $(this).offset();
  9725. loc.right = loc.left + $(this).outerWidth();
  9726. loc.bottom = loc.top + $(this).outerHeight();
  9727. loc.elm = this;
  9728. pos[i] = loc;
  9729. });
  9730. this.pos = pos;
  9731. },
  9732. dropItem: function() {
  9733. if (list.draggedItem == null)
  9734. return;
  9735. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  9736. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  9737. var orig = list.draggedItem.attr("data-origstyle");
  9738. list.draggedItem.attr("style", orig);
  9739. if (orig == "")
  9740. list.draggedItem.removeAttr("style");
  9741. list.draggedItem.removeAttr("data-origstyle");
  9742. list.styleDragHandlers(true);
  9743. list.placeHolderItem.before(list.draggedItem);
  9744. list.placeHolderItem.remove();
  9745. $("[data-droptarget], .dragSortItem").remove();
  9746. window.clearInterval(list.scroll.scrollY);
  9747. window.clearInterval(list.scroll.scrollX);
  9748. //if position changed call dragEnd
  9749. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  9750. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  9751. var pos = list.draggedItem.attr("data-origpos").split('-');
  9752. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  9753. if (nextItem.size() > 0)
  9754. nextItem.before(list.draggedItem);
  9755. else if (pos[1] == 0) //was the only item in list
  9756. $(lists[pos[0]].container).prepend(list.draggedItem);
  9757. else //was the last item in list
  9758. $(lists[pos[0]].container).append(list.draggedItem);
  9759. }
  9760. list.draggedItem.removeAttr("data-origpos");
  9761. list.draggedItem = null;
  9762. $(document).unbind("mousemove", list.swapItems);
  9763. $(document).unbind("mouseup", list.dropItem);
  9764. if (opts.scrollContainer != window)
  9765. $(window).unbind("wheel", list.wheel);
  9766. return false;
  9767. },
  9768. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  9769. swapItems: function(e) {
  9770. if (list.draggedItem == null)
  9771. return false;
  9772. //move draggedItem to mouse location
  9773. list.setPos(e.pageX, e.pageY);
  9774. //retrieve list and item position mouse cursor is over
  9775. var ei = list.findPos(e.pageX, e.pageY);
  9776. var nlist = list;
  9777. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  9778. ei = lists[i].findPos(e.pageX, e.pageY);
  9779. nlist = lists[i];
  9780. }
  9781. //if not over another moveable list item return
  9782. if (ei == -1)
  9783. return false;
  9784. //save fixed items locations
  9785. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  9786. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  9787. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  9788. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  9789. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  9790. else
  9791. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  9792. //restore fixed items location
  9793. fixed.each(function() {
  9794. var elm = children().eq(this.idx).get(0);
  9795. if (this != elm && children().index(this) < this.idx)
  9796. $(this).insertAfter(elm);
  9797. else if (this != elm)
  9798. $(this).insertBefore(elm);
  9799. });
  9800. //misc
  9801. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9802. lastPos = list.draggedItem.offset();
  9803. return false;
  9804. },
  9805. //returns the index of the list item the mouse is over
  9806. findPos: function(x, y) {
  9807. for (var i = 0; i < this.pos.length; i++) {
  9808. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  9809. return i;
  9810. }
  9811. return -1;
  9812. },
  9813. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  9814. createDropTargets: function() {
  9815. if (!opts.dragBetween)
  9816. return;
  9817. $(lists).each(function() {
  9818. var ph = $(this.container).find("[data-placeholder]");
  9819. var dt = $(this.container).find("[data-droptarget]");
  9820. if (ph.size() > 0 && dt.size() > 0)
  9821. dt.remove();
  9822. else if (ph.size() == 0 && dt.size() == 0) {
  9823. if (opts.tagName == "td")
  9824. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  9825. else
  9826. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  9827. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  9828. list.placeHolderItem.attr("data-placeholder", true);
  9829. }
  9830. });
  9831. }
  9832. };
  9833. newList.init();
  9834. lists.push(newList);
  9835. });
  9836. return this;
  9837. };
  9838. $.fn.dragsort.defaults = {
  9839. itemSelector: "",
  9840. dragSelector: "",
  9841. dragSelectorExclude: "input, textarea",
  9842. dragEnd: function() { },
  9843. dragBetween: false,
  9844. placeHolderTemplate: "",
  9845. scrollContainer: window,
  9846. scrollSpeed: 5
  9847. };
  9848. })(jQuery);
  9849. define("dragsort", function(){});
  9850. /*!
  9851. * jquery.event.drag - v 2.2
  9852. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9853. * Open Source MIT License - http://threedubmedia.com/code/license
  9854. */
  9855. ;(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);
  9856. define("drag", function(){});
  9857. /*!
  9858. * jquery.event.drop - v 2.2
  9859. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9860. * Open Source MIT License - http://threedubmedia.com/code/license
  9861. */
  9862. ;(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);
  9863. define("drop", function(){});
  9864. /**
  9865. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  9866. * Created by joe on 2015-12-19.
  9867. * @param {type} options {
  9868. * content string||html 直接指定内容
  9869. * close bool 是否可以关闭
  9870. * monitor 监视的区域
  9871. * }
  9872. *
  9873. * @returns
  9874. */
  9875. $.fn.addtabs = function (options) {
  9876. var obj = $(this);
  9877. options = $.extend({
  9878. content: '', //直接指定所有页面TABS内容
  9879. close: true, //是否可以关闭
  9880. monitor: 'body', //监视的区域
  9881. nav: '.nav-addtabs',
  9882. tab: '.tab-addtabs',
  9883. iframeUse: true, //使用iframe还是ajax
  9884. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  9885. callback: function () {
  9886. //关闭后回调函数
  9887. }
  9888. }, options || {});
  9889. var navobj = $(options.nav);
  9890. var tabobj = $(options.tab);
  9891. if (history.pushState) {
  9892. //浏览器前进后退事件
  9893. $(window).on("popstate", function (e) {
  9894. var state = e.originalEvent.state;
  9895. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  9896. });
  9897. }
  9898. $(options.monitor).on('click', '[addtabs]', function (e) {
  9899. if ($(this).attr('url').indexOf("javascript") !== 0) {
  9900. if ($(this).is("a")) {
  9901. e.preventDefault();
  9902. }
  9903. var id = $(this).attr('addtabs');
  9904. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  9905. var url = $(this).attr('url');
  9906. var content = options.content ? options.content : $(this).attr('content');
  9907. var ajax = $(this).attr('ajax') ? true : false;
  9908. var state = ({
  9909. url: url, title: title, id: id, content: content, ajax: ajax
  9910. });
  9911. document.title = title;
  9912. if (history.pushState && !$(this).data("pushstate")) {
  9913. window.history.pushState(state, title, url);
  9914. }
  9915. $(this).data("pushstate", null);
  9916. _add({
  9917. id: id,
  9918. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  9919. content: content,
  9920. url: url,
  9921. ajax: ajax
  9922. });
  9923. }
  9924. });
  9925. navobj.on('click', '.close-tab', function (e) {
  9926. id = $(this).prev("a").attr("aria-controls");
  9927. _close(id);
  9928. return false;
  9929. });
  9930. navobj.on('dblclick', 'li[role=presentation]', function (e) {
  9931. $(this).find(".close-tab").trigger("click");
  9932. });
  9933. navobj.on('click', 'li[role=presentation]', function (e) {
  9934. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  9935. });
  9936. $(window).resize(function () {
  9937. $("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  9938. _drop();
  9939. });
  9940. _add = function (opts) {
  9941. id = 'tab_' + opts.id;
  9942. url = opts.url;
  9943. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  9944. navobj.find("[role='presentation']").removeClass('active');
  9945. tabobj.find("[role='tabpanel']").removeClass('active');
  9946. //如果TAB不存在,创建一个新的TAB
  9947. if ($("#" + id).size() == 0) {
  9948. //创建新TAB的title
  9949. title = $('<li role="presentation" id="tab_' + id + '"><a href="#' + id + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
  9950. //是否允许关闭
  9951. if (options.close) {
  9952. title.append(' <i class="close-tab fa fa-remove"></i>');
  9953. }
  9954. //创建新TAB的内容
  9955. content = $('<div role="tabpanel" class="tab-pane" id="' + id + '"></div>');
  9956. //是否指定TAB内容
  9957. if (opts.content) {
  9958. content.append(opts.content);
  9959. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  9960. var height = options.iframeHeight;
  9961. content.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
  9962. } else {
  9963. $.get(url, function (data) {
  9964. content.append(data);
  9965. });
  9966. }
  9967. //加入TABS
  9968. if ($('.tabdrop li').size() > 0) {
  9969. $('.tabdrop ul').append(title);
  9970. } else {
  9971. navobj.append(title);
  9972. }
  9973. tabobj.append(content);
  9974. }
  9975. //激活TAB
  9976. $("#tab_" + id).addClass('active');
  9977. $("#" + id).addClass("active");
  9978. _drop();
  9979. };
  9980. _close = function (id) {
  9981. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  9982. if (obj.find("li.active").attr('id') == "tab_" + id) {
  9983. if ($("#tab_" + id).prev().not(".tabdrop").size() > 0) {
  9984. $("#tab_" + id).prev().not(".tabdrop").find("a").trigger("click");
  9985. } else if ($("#tab_" + id).next().size() > 0) {
  9986. $("#tab_" + id).next().trigger("click");
  9987. }
  9988. }
  9989. //关闭TAB
  9990. $("#tab_" + id).remove();
  9991. $("#" + id).remove();
  9992. _drop();
  9993. options.callback();
  9994. };
  9995. _drop = function () {
  9996. //创建下拉标签
  9997. var 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. //检测是否已增加
  10001. if (!$('.tabdrop').html()) {
  10002. dropdown.prependTo(navobj);
  10003. } else {
  10004. dropdown = navobj.find('.tabdrop');
  10005. }
  10006. //检测是否有下拉样式
  10007. if (navobj.parent().is('.tabs-below')) {
  10008. dropdown.addClass('dropup');
  10009. }
  10010. var collection = 0;
  10011. var maxwidth = navobj.width() - 60;
  10012. var liwidth = 0;
  10013. //检查超过一行的标签页
  10014. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  10015. var lisize = litabs.size();
  10016. litabs.each(function (i, j) {
  10017. liwidth += $(this).width();
  10018. if (collection == 0 && i == lisize - 1 && liwidth <= navobj.width()) {
  10019. return true;
  10020. }
  10021. if (liwidth > maxwidth) {
  10022. dropdown.find('ul').append($(this));
  10023. collection++;
  10024. }
  10025. });
  10026. //如果有超出的,显示下拉标签
  10027. if (collection > 0) {
  10028. dropdown.removeClass('hide');
  10029. if (dropdown.find('.active').length == 1) {
  10030. dropdown.addClass('active');
  10031. } else {
  10032. dropdown.removeClass('active');
  10033. }
  10034. } else {
  10035. dropdown.addClass('hide');
  10036. }
  10037. };
  10038. };
  10039. define("addtabs", function(){});
  10040. (function(c){var d=document,a='appendChild',i='styleSheet',s=d.createElement('style');s.type='text/css';d.getElementsByTagName('head')[0][a](s);s[i]?s[i].cssText=c:s[a](d.createTextNode(c));})
  10041. ('.fixed-table-container .bs-checkbox,.fixed-table-container .no-records-found{text-align:center}.fixed-table-body thead th .th-inner,.table td,.table th{box-sizing:border-box}.bootstrap-table .table{margin-bottom:0!important;border-bottom:1px solid #ddd;border-collapse:collapse!important;border-radius:1px}.bootstrap-table .table:not(.table-condensed),.bootstrap-table .table:not(.table-condensed)>tbody>tr>td,.bootstrap-table .table:not(.table-condensed)>tbody>tr>th,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>td,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>th,.bootstrap-table .table:not(.table-condensed)>thead>tr>td{padding:8px}.bootstrap-table .table.table-no-bordered>tbody>tr>td,.bootstrap-table .table.table-no-bordered>thead>tr>th{border-right:2px solid transparent}.bootstrap-table .table.table-no-bordered>tbody>tr>td:last-child{border-right:none}.fixed-table-container{position:relative;clear:both;border:1px solid #ddd;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px}.fixed-table-container.table-no-bordered{border:1px solid transparent}.fixed-table-footer,.fixed-table-header{overflow:hidden}.fixed-table-footer{border-top:1px solid #ddd}.fixed-table-body{overflow-x:auto;overflow-y:auto;height:100%}.fixed-table-container table{width:100%}.fixed-table-container thead th{height:0;padding:0;margin:0;border-left:1px solid #ddd}.fixed-table-container thead th:focus{outline:transparent solid 0}.fixed-table-container thead th:first-child{border-left:none;border-top-left-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px}.fixed-table-container tbody td .th-inner,.fixed-table-container thead th .th-inner{padding:8px;line-height:24px;vertical-align:top;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fixed-table-container thead th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px}.fixed-table-container thead th .both{background-image:url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC\')}.fixed-table-container thead th .asc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==)}.fixed-table-container thead th .desc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII=)}.fixed-table-container th.detail{width:30px}.fixed-table-container tbody td{border-left:1px solid #ddd}.fixed-table-container tbody tr:first-child td{border-top:none}.fixed-table-container tbody td:first-child{border-left:none}.fixed-table-container tbody .selected td{background-color:#f5f5f5}.fixed-table-container .bs-checkbox .th-inner{padding:8px 0}.fixed-table-container input[type=radio],.fixed-table-container input[type=checkbox]{margin:0 auto!important}.fixed-table-pagination .pagination-detail,.fixed-table-pagination div.pagination{margin-top:10px;margin-bottom:10px}.fixed-table-pagination div.pagination .pagination{margin:0}.fixed-table-pagination .pagination a{padding:6px 12px;line-height:1.428571429}.fixed-table-pagination .pagination-info{line-height:34px;margin-right:5px}.fixed-table-pagination .btn-group{position:relative;display:inline-block;vertical-align:middle}.fixed-table-pagination .dropup .dropdown-menu{margin-bottom:0}.fixed-table-pagination .page-list{display:inline-block}.fixed-table-toolbar .columns-left{margin-right:5px}.fixed-table-toolbar .columns-right{margin-left:5px}.fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429}.fixed-table-toolbar .bs-bars,.fixed-table-toolbar .columns,.fixed-table-toolbar .search{position:relative;margin-top:10px;margin-bottom:10px;line-height:34px}.fixed-table-pagination li.disabled a{pointer-events:none;cursor:default}.fixed-table-loading{display:none;position:absolute;top:42px;right:0;bottom:0;left:0;z-index:99;background-color:#fff;text-align:center}.fixed-table-body .card-view .title{font-weight:700;display:inline-block;min-width:30%;text-align:left!important}.table td,.table th{vertical-align:middle}.fixed-table-toolbar .dropdown-menu{text-align:left;max-height:300px;overflow:auto}.fixed-table-toolbar .btn-group>.btn-group{display:inline-block;margin-left:-1px!important}.fixed-table-toolbar .btn-group>.btn-group>.btn{border-radius:0}.fixed-table-toolbar .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.fixed-table-toolbar .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .table>thead>tr>th{vertical-align:bottom;border-bottom:1px solid #ddd}.bootstrap-table .table thead>tr>th{padding:0;margin:0}.bootstrap-table .fixed-table-footer tbody>tr>td{padding:0!important}.bootstrap-table .fixed-table-footer .table{border-bottom:none;border-radius:0;padding:0!important}.pull-right .dropdown-menu{right:0;left:auto}p.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden}/*!\n * Datetimepicker for Bootstrap 3\n * version : 4.17.42\n * https://github.com/Eonasdan/bootstrap-datetimepicker/\n */.bootstrap-datetimepicker-widget{list-style:none}.bootstrap-datetimepicker-widget.dropdown-menu{margin:2px 0;padding:4px;width:19em}@media (min-width:768px){.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs{width:38em}}@media (min-width:992px){.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs{width:38em}}@media (min-width:1200px){.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs{width:38em}}.bootstrap-datetimepicker-widget.dropdown-menu:before,.bootstrap-datetimepicker-widget.dropdown-menu:after{content:\'\';display:inline-block;position:absolute}.bootstrap-datetimepicker-widget.dropdown-menu.bottom:before{border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,0.2);top:-7px;left:7px}.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after{border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid white;top:-6px;left:8px}.bootstrap-datetimepicker-widget.dropdown-menu.top:before{border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ccc;border-top-color:rgba(0,0,0,0.2);bottom:-7px;left:6px}.bootstrap-datetimepicker-widget.dropdown-menu.top:after{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;bottom:-6px;left:7px}.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:before{left:auto;right:6px}.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:after{left:auto;right:7px}.bootstrap-datetimepicker-widget .list-unstyled{margin:0}.bootstrap-datetimepicker-widget a[data-action]{padding:6px 0}.bootstrap-datetimepicker-widget a[data-action]:active{box-shadow:none}.bootstrap-datetimepicker-widget .timepicker-hour,.bootstrap-datetimepicker-widget .timepicker-minute,.bootstrap-datetimepicker-widget .timepicker-second{width:54px;font-weight:bold;font-size:1.2em;margin:0}.bootstrap-datetimepicker-widget button[data-action]{padding:6px}.bootstrap-datetimepicker-widget .btn[data-action=\"incrementHours\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Increment Hours\"}.bootstrap-datetimepicker-widget .btn[data-action=\"incrementMinutes\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Increment Minutes\"}.bootstrap-datetimepicker-widget .btn[data-action=\"decrementHours\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Decrement Hours\"}.bootstrap-datetimepicker-widget .btn[data-action=\"decrementMinutes\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Decrement Minutes\"}.bootstrap-datetimepicker-widget .btn[data-action=\"showHours\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Show Hours\"}.bootstrap-datetimepicker-widget .btn[data-action=\"showMinutes\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Show Minutes\"}.bootstrap-datetimepicker-widget .btn[data-action=\"togglePeriod\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Toggle AM/PM\"}.bootstrap-datetimepicker-widget .btn[data-action=\"clear\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Clear the picker\"}.bootstrap-datetimepicker-widget .btn[data-action=\"today\"]::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Set the date to today\"}.bootstrap-datetimepicker-widget .picker-switch{text-align:center}.bootstrap-datetimepicker-widget .picker-switch::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Toggle Date and Time Screens\"}.bootstrap-datetimepicker-widget .picker-switch td{padding:0;margin:0;height:auto;width:auto;line-height:inherit}.bootstrap-datetimepicker-widget .picker-switch td span{line-height:2.5;height:2.5em;width:100%}.bootstrap-datetimepicker-widget table{width:100%;margin:0}.bootstrap-datetimepicker-widget table td,.bootstrap-datetimepicker-widget table th{text-align:center;border-radius:4px}.bootstrap-datetimepicker-widget table th{height:20px;line-height:20px;width:20px}.bootstrap-datetimepicker-widget table th.picker-switch{width:145px}.bootstrap-datetimepicker-widget table th.disabled,.bootstrap-datetimepicker-widget table th.disabled:hover{background:none;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget table th.prev::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Previous Month\"}.bootstrap-datetimepicker-widget table th.next::after{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;content:\"Next Month\"}.bootstrap-datetimepicker-widget table thead tr:first-child th{cursor:pointer}.bootstrap-datetimepicker-widget table thead tr:first-child th:hover{background:#eee}.bootstrap-datetimepicker-widget table td{height:54px;line-height:54px;width:54px}.bootstrap-datetimepicker-widget table td.cw{font-size:.8em;height:20px;line-height:20px;color:#777}.bootstrap-datetimepicker-widget table td.day{height:20px;line-height:20px;width:20px}.bootstrap-datetimepicker-widget table td.day:hover,.bootstrap-datetimepicker-widget table td.hour:hover,.bootstrap-datetimepicker-widget table td.minute:hover,.bootstrap-datetimepicker-widget table td.second:hover{background:#eee;cursor:pointer}.bootstrap-datetimepicker-widget table td.old,.bootstrap-datetimepicker-widget table td.new{color:#777}.bootstrap-datetimepicker-widget table td.today{position:relative}.bootstrap-datetimepicker-widget table td.today:before{content:\'\';display:inline-block;border:solid transparent;border-width:0 0 7px 7px;border-bottom-color:#337ab7;border-top-color:rgba(0,0,0,0.2);position:absolute;bottom:4px;right:4px}.bootstrap-datetimepicker-widget table td.active,.bootstrap-datetimepicker-widget table td.active:hover{background-color:#337ab7;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.bootstrap-datetimepicker-widget table td.active.today:before{border-bottom-color:#fff}.bootstrap-datetimepicker-widget table td.disabled,.bootstrap-datetimepicker-widget table td.disabled:hover{background:none;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget table td span{display:inline-block;width:54px;height:54px;line-height:54px;margin:2px 1.5px;cursor:pointer;border-radius:4px}.bootstrap-datetimepicker-widget table td span:hover{background:#eee}.bootstrap-datetimepicker-widget table td span.active{background-color:#337ab7;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.bootstrap-datetimepicker-widget table td span.old{color:#777}.bootstrap-datetimepicker-widget table td span.disabled,.bootstrap-datetimepicker-widget table td span.disabled:hover{background:none;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget.usetwentyfour td.hour{height:27px;line-height:27px}.bootstrap-datetimepicker-widget.wider{width:21em}.bootstrap-datetimepicker-widget .datepicker-decades .decade{line-height:1.8em !important}.input-group.date .input-group-addon{cursor:pointer}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}');