require-frontend.min.js 895 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161
  1. /*! jQuery v2.2.4 | (c) jQuery Foundation | jquery.org/license */
  2. !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c;
  3. }catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=N.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=/^(?:checkbox|radio)$/i,Y=/<([\w:-]+)/,Z=/^$|\/(?:java|ecma)script/i,$={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||d,e=c.documentElement,f=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ea.test(f)?this.mouseHooks:da.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=d),3===a.target.nodeType&&(a.target=a.target.parentNode),h.filter?h.filter(a,g):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==ia()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===ia()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ga:ha):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:ha,isPropagationStopped:ha,isImmediatePropagationStopped:ha,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ga,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ga,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ga,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),n.fn.extend({on:function(a,b,c,d){return ja(this,a,b,c,d)},one:function(a,b,c,d){return ja(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=ha),this.each(function(){n.event.remove(this,a,c,b)})}});var ka=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,la=/<script|<style|<link/i,ma=/checked\s*(?:[^=]|=\s*.checked.)/i,na=/^true\/(.*)/,oa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=wa[0].contentDocument,b.write(),b.close(),c=ya(a,b),wa.detach()),xa[a]=c),c}var Aa=/^margin/,Ba=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ca=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Ea=d.documentElement;!function(){var b,c,e,f,g=d.createElement("div"),h=d.createElement("div");if(h.style){h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",g.appendChild(h);function i(){h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",h.innerHTML="",Ea.appendChild(g);var d=a.getComputedStyle(h);b="1%"!==d.top,f="2px"===d.marginLeft,c="4px"===d.width,h.style.marginRight="50%",e="4px"===d.marginRight,Ea.removeChild(g)}n.extend(l,{pixelPosition:function(){return i(),b},boxSizingReliable:function(){return null==c&&i(),c},pixelMarginRight:function(){return null==c&&i(),e},reliableMarginLeft:function(){return null==c&&i(),f},reliableMarginRight:function(){var b,c=h.appendChild(d.createElement("div"));return c.style.cssText=h.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",h.style.width="1px",Ea.appendChild(g),b=!parseFloat(a.getComputedStyle(c).marginRight),Ea.removeChild(g),h.removeChild(c),b}})}}();function Fa(a,b,c){var d,e,f,g,h=a.style;return c=c||Ca(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Ba.test(g)&&Aa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0!==g?g+"":g}function Ga(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Ha=/^(none|table(?!-c[ea]).+)/,Ia={position:"absolute",visibility:"hidden",display:"block"},Ja={letterSpacing:"0",fontWeight:"400"},Ka=["Webkit","O","Moz","ms"],La=d.createElement("div").style;function Ma(a){if(a in La)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ka.length;while(c--)if(a=Ka[c]+b,a in La)return a}function Na(a,b,c){var d=T.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Oa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Pa(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ca(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Fa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ba.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Oa(a,b,c||(g?"border":"content"),d,f)+"px"}function Qa(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=N.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=N.access(d,"olddisplay",za(d.nodeName)))):(e=V(d),"none"===c&&e||N.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Fa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=T.exec(c))&&e[1]&&(c=W(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Fa(a,b,d)),"normal"===e&&b in Ja&&(e=Ja[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Ha.test(n.css(a,"display"))&&0===a.offsetWidth?Da(a,Ia,function(){return Pa(a,b,d)}):Pa(a,b,d):void 0},set:function(a,c,d){var e,f=d&&Ca(a),g=d&&Oa(a,b,d,"border-box"===n.css(a,"boxSizing",!1,f),f);return g&&(e=T.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=n.css(a,b)),Na(a,c,g)}}}),n.cssHooks.marginLeft=Ga(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Fa(a,"marginLeft"))||a.getBoundingClientRect().left-Da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),n.cssHooks.marginRight=Ga(l.reliableMarginRight,function(a,b){return b?Da(a,{display:"inline-block"},Fa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Aa.test(a)||(n.cssHooks[a+b].set=Na)}),n.fn.extend({css:function(a,b){return K(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ca(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Qa(this,!0)},hide:function(){return Qa(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function Ra(a,b,c,d,e){return new Ra.prototype.init(a,b,c,d,e)}n.Tween=Ra,Ra.prototype={constructor:Ra,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ra.propHooks[this.prop];return a&&a.get?a.get(this):Ra.propHooks._default.get(this)},run:function(a){var b,c=Ra.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ra.propHooks._default.set(this),this}},Ra.prototype.init.prototype=Ra.prototype,Ra.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},Ra.propHooks.scrollTop=Ra.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=Ra.prototype.init,n.fx.step={};var Sa,Ta,Ua=/^(?:toggle|show|hide)$/,Va=/queueHooks$/;function Wa(){return a.setTimeout(function(){Sa=void 0}),Sa=n.now()}function Xa(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=U[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ya(a,b,c){for(var d,e=(_a.tweeners[b]||[]).concat(_a.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Za(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&V(a),q=N.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?N.get(a,"olddisplay")||za(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Ua.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?za(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=N.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;N.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ya(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function $a(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function _a(a,b,c){var d,e,f=0,g=_a.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Sa||Wa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:Sa||Wa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for($a(k,j.opts.specialEasing);g>f;f++)if(d=_a.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,Ya,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(_a,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return W(c.elem,a,T.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],_a.tweeners[c]=_a.tweeners[c]||[],_a.tweeners[c].unshift(b)},prefilters:[Za],prefilter:function(a,b){b?_a.prefilters.unshift(a):_a.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=_a(this,n.extend({},a),f);(e||N.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=N.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Va.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=N.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Xa(b,!0),a,d,e)}}),n.each({slideDown:Xa("show"),slideUp:Xa("hide"),slideToggle:Xa("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Sa=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Sa=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ta||(Ta=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(Ta),Ta=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var ab,bb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return K(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ab:void 0)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}),ab={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=bb[b]||n.find.attr;bb[b]=function(a,b,d){var e,f;return d||(f=bb[b],bb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,bb[b]=f),e}});var cb=/^(?:input|select|textarea|button)$/i,db=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return K(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),
  4. void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):cb.test(a.nodeName)||db.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var eb=/[\t\r\n\f]/g;function fb(a){return a.getAttribute&&a.getAttribute("class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,fb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,fb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,fb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=fb(this),b&&N.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":N.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+fb(c)+" ").replace(eb," ").indexOf(b)>-1)return!0;return!1}});var gb=/\r/g,hb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(gb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(hb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var ib=/^(?:focusinfocus|focusoutblur)$/;n.extend(n.event,{trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!ib.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),l=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},f||!o.trigger||o.trigger.apply(e,c)!==!1)){if(!f&&!o.noBubble&&!n.isWindow(e)){for(j=o.delegateType||q,ib.test(j+q)||(h=h.parentNode);h;h=h.parentNode)p.push(h),i=h;i===(e.ownerDocument||d)&&p.push(i.defaultView||i.parentWindow||a)}g=0;while((h=p[g++])&&!b.isPropagationStopped())b.type=g>1?j:o.bindType||q,m=(N.get(h,"events")||{})[b.type]&&N.get(h,"handle"),m&&m.apply(h,c),m=l&&h[l],m&&m.apply&&L(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=q,f||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!L(e)||l&&n.isFunction(e[q])&&!n.isWindow(e)&&(i=e[l],i&&(e[l]=null),n.event.triggered=q,e[q](),n.event.triggered=void 0,i&&(e[l]=i)),b.result}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b)}}),n.fn.extend({trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),l.focusin="onfocusin"in a,l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=N.access(d,b);e||d.addEventListener(a,c,!0),N.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=N.access(d,b)-1;e?N.access(d,b,e):(d.removeEventListener(a,c,!0),N.remove(d,b))}}});var jb=a.location,kb=n.now(),lb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var mb=/#.*$/,nb=/([?&])_=[^&]*/,ob=/^(.*?):[ \t]*([^\r\n]*)$/gm,pb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,qb=/^(?:GET|HEAD)$/,rb=/^\/\//,sb={},tb={},ub="*/".concat("*"),vb=d.createElement("a");vb.href=jb.href;function wb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function xb(a,b,c,d){var e={},f=a===tb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function yb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function zb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Ab(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:jb.href,type:"GET",isLocal:pb.test(jb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ub,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?yb(yb(a,n.ajaxSettings),b):yb(n.ajaxSettings,a)},ajaxPrefilter:wb(sb),ajaxTransport:wb(tb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m=n.ajaxSetup({},c),o=m.context||m,p=m.context&&(o.nodeType||o.jquery)?n(o):n.event,q=n.Deferred(),r=n.Callbacks("once memory"),s=m.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,getResponseHeader:function(a){var b;if(2===v){if(!h){h={};while(b=ob.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===v?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return v||(a=u[c]=u[c]||a,t[a]=b),this},overrideMimeType:function(a){return v||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>v)for(b in a)s[b]=[s[b],a[b]];else x.always(a[x.status]);return this},abort:function(a){var b=a||w;return e&&e.abort(b),z(0,b),this}};if(q.promise(x).complete=r.add,x.success=x.done,x.error=x.fail,m.url=((b||m.url||jb.href)+"").replace(mb,"").replace(rb,jb.protocol+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=n.trim(m.dataType||"*").toLowerCase().match(G)||[""],null==m.crossDomain){j=d.createElement("a");try{j.href=m.url,j.href=j.href,m.crossDomain=vb.protocol+"//"+vb.host!=j.protocol+"//"+j.host}catch(y){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=n.param(m.data,m.traditional)),xb(sb,m,c,x),2===v)return x;k=n.event&&m.global,k&&0===n.active++&&n.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!qb.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(lb.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=nb.test(f)?f.replace(nb,"$1_="+kb++):f+(lb.test(f)?"&":"?")+"_="+kb++)),m.ifModified&&(n.lastModified[f]&&x.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&x.setRequestHeader("If-None-Match",n.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",m.contentType),x.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+ub+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)x.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(o,x,m)===!1||2===v))return x.abort();w="abort";for(l in{success:1,error:1,complete:1})x[l](m[l]);if(e=xb(tb,m,c,x)){if(x.readyState=1,k&&p.trigger("ajaxSend",[x,m]),2===v)return x;m.async&&m.timeout>0&&(i=a.setTimeout(function(){x.abort("timeout")},m.timeout));try{v=1,e.send(t,z)}catch(y){if(!(2>v))throw y;z(-1,y)}}else z(-1,"No Transport");function z(b,c,d,h){var j,l,t,u,w,y=c;2!==v&&(v=2,i&&a.clearTimeout(i),e=void 0,g=h||"",x.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(u=zb(m,x,d)),u=Ab(m,u,x,j),j?(m.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(n.lastModified[f]=w),w=x.getResponseHeader("etag"),w&&(n.etag[f]=w)),204===b||"HEAD"===m.type?y="nocontent":304===b?y="notmodified":(y=u.state,l=u.data,t=u.error,j=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),x.status=b,x.statusText=(c||y)+"",j?q.resolveWith(o,[l,y,x]):q.rejectWith(o,[x,y,t]),x.statusCode(s),s=void 0,k&&p.trigger(j?"ajaxSuccess":"ajaxError",[x,m,j?l:t]),r.fireWith(o,[x,y]),k&&(p.trigger("ajaxComplete",[x,m]),--n.active||n.event.trigger("ajaxStop")))}return x},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return!n.expr.filters.visible(a)},n.expr.filters.visible=function(a){return a.offsetWidth>0||a.offsetHeight>0||a.getClientRects().length>0};var Bb=/%20/g,Cb=/\[\]$/,Db=/\r?\n/g,Eb=/^(?:submit|button|image|reset|file)$/i,Fb=/^(?:input|select|textarea|keygen)/i;function Gb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Cb.test(a)?d(a,e):Gb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Gb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Gb(c,a[c],b,e);return d.join("&").replace(Bb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Fb.test(this.nodeName)&&!Eb.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Db,"\r\n")}}):{name:b.name,value:c.replace(Db,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Hb={0:200,1223:204},Ib=n.ajaxSettings.xhr();l.cors=!!Ib&&"withCredentials"in Ib,l.ajax=Ib=!!Ib,n.ajaxTransport(function(b){var c,d;return l.cors||Ib&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Hb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Jb=[],Kb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Jb.pop()||n.expando+"_"+kb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Kb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Kb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Kb,"$1"+e):b.jsonp!==!1&&(b.url+=(lb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Jb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ca([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var Lb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Lb)return Lb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function Mb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(e=d.getBoundingClientRect(),c=Mb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ea})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;n.fn[a]=function(d){return K(this,function(a,d,e){var f=Mb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ga(l.pixelPosition,function(a,c){return c?(c=Fa(a,b),Ba.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return K(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function(){return this.length}}),n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Nb=a.jQuery,Ob=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Ob),b&&a.jQuery===n&&(a.jQuery=Nb),n},b||(a.jQuery=a.$=n),n});
  5. /*!
  6. * Bootstrap v3.4.1 (https://getbootstrap.com/)
  7. * Copyright 2011-2019 Twitter, Inc.
  8. * Licensed under the MIT license
  9. */
  10. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",p.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",p.proxy(this.pause,this)).on("mouseleave.bs.carousel",p.proxy(this.cycle,this))};function r(n){return this.each(function(){var t=p(this),e=t.data("bs.carousel"),i=p.extend({},c.DEFAULTS,t.data(),"object"==typeof n&&n),o="string"==typeof n?n:i.slide;e||t.data("bs.carousel",e=new c(this,i)),"number"==typeof n?e.to(n):o?e[o]():i.interval&&e.pause().cycle()})}c.VERSION="3.4.1",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},c.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(p.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},c.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var o=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(o)},c.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i<t?"next":"prev",this.$items.eq(t))},c.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&p.support.transition&&(this.$element.trigger(p.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(t,e){var i=this.$element.find(".item.active"),o=e||this.getItemForDirection(t,i),n=this.interval,s="next"==t?"left":"right",a=this;if(o.hasClass("active"))return this.sliding=!1;var r=o[0],l=p.Event("slide.bs.carousel",{relatedTarget:r,direction:s});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,n&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=p(this.$indicators.children()[this.getItemIndex(o)]);h&&h.addClass("active")}var d=p.Event("slid.bs.carousel",{relatedTarget:r,direction:s});return p.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),"object"==typeof o&&o.length&&o[0].offsetWidth,i.addClass(s),o.addClass(s),i.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),i.removeClass(["active",s].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(d)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(i.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),n&&this.cycle(),this}};var t=p.fn.carousel;p.fn.carousel=r,p.fn.carousel.Constructor=c,p.fn.carousel.noConflict=function(){return p.fn.carousel=t,this};var e=function(t){var e=p(this),i=e.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var o=e.attr("data-target")||i,n=p(document).find(o);if(n.hasClass("carousel")){var s=p.extend({},n.data(),e.data()),a=e.attr("data-slide-to");a&&(s.interval=!1),r.call(n,s),a&&n.data("bs.carousel").to(a),t.preventDefault()}};p(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),p(window).on("load",function(){p('[data-ride="carousel"]').each(function(){var t=p(this);r.call(t,t.data())})})}(jQuery),function(a){"use strict";var r=function(t,e){this.$element=a(t),this.options=a.extend({},r.DEFAULTS,e),this.$trigger=a('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function n(t){var e,i=t.attr("data-target")||(e=t.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"");return a(document).find(i)}function l(o){return this.each(function(){var t=a(this),e=t.data("bs.collapse"),i=a.extend({},r.DEFAULTS,t.data(),"object"==typeof o&&o);!e&&i.toggle&&/show|hide/.test(o)&&(i.toggle=!1),e||t.data("bs.collapse",e=new r(this,i)),"string"==typeof o&&e[o]()})}r.VERSION="3.4.1",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0},r.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(t=e.data("bs.collapse"))&&t.transitioning)){var i=a.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){e&&e.length&&(l.call(e,"hide"),t||e.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var n=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return n.call(this);var s=a.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",a.proxy(n,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][s])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=a.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!a.support.transition)return i.call(this);this.$element[e](0).one("bsTransitionEnd",a.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return a(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(t,e){var i=a(e);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var t=a.fn.collapse;a.fn.collapse=l,a.fn.collapse.Constructor=r,a.fn.collapse.noConflict=function(){return a.fn.collapse=t,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var e=a(this);e.attr("data-target")||t.preventDefault();var i=n(e),o=i.data("bs.collapse")?"toggle":e.data();l.call(i,o)})}(jQuery),function(a){"use strict";var r='[data-toggle="dropdown"]',o=function(t){a(t).on("click.bs.dropdown",this.toggle)};function l(t){var e=t.attr("data-target");e||(e=(e=t.attr("href"))&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==e?a(document).find(e):null;return i&&i.length?i:t.parent()}function s(o){o&&3===o.which||(a(".dropdown-backdrop").remove(),a(r).each(function(){var t=a(this),e=l(t),i={relatedTarget:this};e.hasClass("open")&&(o&&"click"==o.type&&/input|textarea/i.test(o.target.tagName)&&a.contains(e[0],o.target)||(e.trigger(o=a.Event("hide.bs.dropdown",i)),o.isDefaultPrevented()||(t.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",i)))))}))}o.VERSION="3.4.1",o.prototype.toggle=function(t){var e=a(this);if(!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(s(),!o){"ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",s);var n={relatedTarget:this};if(i.trigger(t=a.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),i.toggleClass("open").trigger(a.Event("shown.bs.dropdown",n))}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=a(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(r).trigger("focus"),e.trigger("click");var n=i.find(".dropdown-menu li:not(.disabled):visible a");if(n.length){var s=n.index(t.target);38==t.which&&0<s&&s--,40==t.which&&s<n.length-1&&s++,~s||(s=0),n.eq(s).trigger("focus")}}}};var t=a.fn.dropdown;a.fn.dropdown=function e(i){return this.each(function(){var t=a(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new o(this)),"string"==typeof i&&e[i].call(t)})},a.fn.dropdown.Constructor=o,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=t,this},a(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(a){"use strict";var s=function(t,e){this.options=e,this.$body=a(document.body),this.$element=a(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function r(o,n){return this.each(function(){var t=a(this),e=t.data("bs.modal"),i=a.extend({},s.DEFAULTS,t.data(),"object"==typeof o&&o);e||t.data("bs.modal",e=new s(this,i)),"string"==typeof o?e[o](n):i.show&&e.show(n)})}s.VERSION="3.4.1",s.TRANSITION_DURATION=300,s.BACKDROP_TRANSITION_DURATION=150,s.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},s.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},s.prototype.show=function(i){var o=this,t=a.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(t),this.isShown||t.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){o.$element.one("mouseup.dismiss.bs.modal",function(t){a(t.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var t=a.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),t&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:i});t?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(s.TRANSITION_DURATION):o.$element.trigger("focus").trigger(e)}))},s.prototype.hide=function(t){t&&t.preventDefault(),t=a.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(s.TRANSITION_DURATION):this.hideModal())},s.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},s.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},s.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},s.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},s.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},s.prototype.backdrop=function(t){var e=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=a.support.transition&&i;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var n=function(){e.removeBackdrop(),t&&t()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):n()}else t&&t()},s.prototype.handleUpdate=function(){this.adjustDialog()},s.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},s.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",t+n),a(this.fixedContent).each(function(t,e){var i=e.style.paddingRight,o=a(e).css("padding-right");a(e).data("padding-right",i).css("padding-right",parseFloat(o)+n+"px")}))},s.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),a(this.fixedContent).each(function(t,e){var i=a(e).data("padding-right");a(e).removeData("padding-right"),e.style.paddingRight=i||""})},s.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var t=a.fn.modal;a.fn.modal=r,a.fn.modal.Constructor=s,a.fn.modal.noConflict=function(){return a.fn.modal=t,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=a(this),i=e.attr("href"),o=e.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),n=a(document).find(o),s=n.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(i)&&i},n.data(),e.data());e.is("a")&&t.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){e.is(":visible")&&e.trigger("focus")})}),r.call(n,s,this)})}(jQuery),function(g){"use strict";var o=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],t={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function u(t,e){var i=t.nodeName.toLowerCase();if(-1!==g.inArray(i,e))return-1===g.inArray(i,a)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(l));for(var o=g(e).filter(function(t,e){return e instanceof RegExp}),n=0,s=o.length;n<s;n++)if(i.match(o[n]))return!0;return!1}function n(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=t;for(var n=g.map(e,function(t,e){return e}),s=g(o.body).find("*"),a=0,r=s.length;a<r;a++){var l=s[a],h=l.nodeName.toLowerCase();if(-1!==g.inArray(h,n))for(var d=g.map(l.attributes,function(t){return t}),p=[].concat(e["*"]||[],e[h]||[]),c=0,f=d.length;c<f;c++)u(d[c],p)||l.removeAttribute(d[c].nodeName);else l.parentNode.removeChild(l)}return o.body.innerHTML}var m=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};m.VERSION="3.4.1",m.TRANSITION_DURATION=150,m.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-d<c.top?"bottom":"right"==s&&l.right+h>c.width?"left":"left"==s&&l.left-h<c.left?"right":s,o.removeClass(p).addClass(s)}var f=this.getCalculatedOffset(s,l,h,d);this.applyPlacement(f,s);var u=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};g.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",u).emulateTransitionEnd(m.TRANSITION_DURATION):u()}},m.prototype.applyPlacement=function(t,e){var i=this.tip(),o=i[0].offsetWidth,n=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),t.top+=s,t.left+=a,g.offset.setOffset(i[0],g.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},t),0),i.addClass("in");var r=i[0].offsetWidth,l=i[0].offsetHeight;"top"==e&&l!=n&&(t.top=t.top+n-l);var h=this.getViewportAdjustedDelta(e,t,r,l);h.left?t.left+=h.left:t.top+=h.top;var d=/top|bottom/.test(e),p=d?2*h.left-o+r:2*h.top-n+l,c=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(p,i[0][c],d)},m.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},m.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},m.prototype.hide=function(t){var e=this,i=g(this.$tip),o=g.Event("hide.bs."+this.type);function n(){"in"!=e.hoverState&&i.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),t&&t()}if(this.$element.trigger(o),!o.isDefaultPrevented())return i.removeClass("in"),g.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",n).emulateTransitionEnd(m.TRANSITION_DURATION):n(),this.hoverState=null,this},m.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},m.prototype.hasContent=function(){return this.getTitle()},m.prototype.getPosition=function(t){var e=(t=t||this.$element)[0],i="BODY"==e.tagName,o=e.getBoundingClientRect();null==o.width&&(o=g.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var n=window.SVGElement&&e instanceof window.SVGElement,s=i?{top:0,left:0}:n?null:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},r=i?{width:g(window).width(),height:g(window).height()}:null;return g.extend({},o,a,r,s)},m.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},m.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(n[t+1]===undefined||e<n[t+1])&&this.activate(s[t])},n.prototype.activate=function(t){this.activeTarget=t,this.clear();var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=s(e).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},n.prototype.clear=function(){s(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=s.fn.scrollspy;s.fn.scrollspy=e,s.fn.scrollspy.Constructor=n,s.fn.scrollspy.noConflict=function(){return s.fn.scrollspy=t,this},s(window).on("load.bs.scrollspy.data-api",function(){s('[data-spy="scroll"]').each(function(){var t=s(this);e.call(t,t.data())})})}(jQuery),function(r){"use strict";var a=function(t){this.element=r(t)};function e(i){return this.each(function(){var t=r(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof i&&e[i]()})}a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var o=e.find(".active:last a"),n=r.Event("hide.bs.tab",{relatedTarget:t[0]}),s=r.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(n),t.trigger(s),!s.isDefaultPrevented()&&!n.isDefaultPrevented()){var a=r(document).find(i);this.activate(t.closest("li"),e),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},a.prototype.activate=function(t,e,i){var o=e.find("> .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n<i&&"top";if("bottom"==this.affixed)return null!=i?!(n+this.unpin<=s.top)&&"bottom":!(n+a<=t-o)&&"bottom";var r=null==this.affixed,l=r?n:s.top;return null!=i&&n<=i?"top":null!=o&&t-o<=l+(r?a:e)&&"bottom"},h.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(h.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},h.prototype.checkPositionWithEventLoop=function(){setTimeout(l.proxy(this.checkPosition,this),1)},h.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),e=this.options.offset,i=e.top,o=e.bottom,n=Math.max(l(document).height(),l(document.body).height());"object"!=typeof e&&(o=i=e),"function"==typeof i&&(i=e.top(this.$element)),"function"==typeof o&&(o=e.bottom(this.$element));var s=this.getState(n,t,i,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var a="affix"+(s?"-"+s:""),r=l.Event(a+".bs.affix");if(this.$element.trigger(r),r.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(h.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:n-t-o})}};var t=l.fn.affix;l.fn.affix=i,l.fn.affix.Constructor=h,l.fn.affix.noConflict=function(){return l.fn.affix=t,this},l(window).on("load",function(){l('[data-spy="affix"]').each(function(){var t=l(this),e=t.data();e.offset=e.offset||{},null!=e.offsetBottom&&(e.offset.bottom=e.offsetBottom),null!=e.offsetTop&&(e.offset.top=e.offsetTop),i.call(t,e)})})}(jQuery);
  11. define("bootstrap", ["jquery"], function(){});
  12. require.config({
  13. urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
  14. packages: [{
  15. name: 'moment',
  16. location: '../libs/moment',
  17. main: 'moment'
  18. }],
  19. //在打包压缩时将会把include中的模块合并到主文件中
  20. include: ['css', 'layer', 'toastr', 'fast', 'frontend', 'frontend-init', 'table', 'form', 'dragsort', 'drag', 'drop', 'selectpage'],
  21. paths: {
  22. 'lang': "empty:",
  23. 'form': 'require-form',
  24. 'table': 'require-table',
  25. 'upload': 'require-upload',
  26. 'drag': 'jquery.drag.min',
  27. 'drop': 'jquery.drop.min',
  28. 'dropzone': 'dropzone.min',
  29. 'echarts': 'echarts.min',
  30. 'echarts-theme': 'echarts-theme',
  31. 'adminlte': 'adminlte',
  32. 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  33. 'bootstrap-table-template': 'bootstrap-table-template',
  34. //
  35. // 以下的包从bower的libs目录加载
  36. 'jquery': '../libs/jquery/dist/jquery.min',
  37. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  38. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  39. 'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
  40. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  41. 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
  42. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  43. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  44. 'bootstrap-table-fixed-columns': '../libs/bootstrap-table/dist/extensions/fixed-columns/bootstrap-table-fixed-columns',
  45. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  46. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  47. 'bootstrap-table-jumpto': '../libs/bootstrap-table/dist/extensions/page-jumpto/bootstrap-table-jumpto',
  48. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  49. 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
  50. 'sortable': '../libs/Sortable/Sortable.min',
  51. 'addtabs': '../libs/fastadmin-addtabs/jquery.addtabs',
  52. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  53. 'validator': '../libs/nice-validator/dist/jquery.validator',
  54. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  55. 'toastr': '../libs/toastr/toastr',
  56. 'jstree': '../libs/jstree/dist/jstree.min',
  57. 'layer': '../libs/fastadmin-layer/dist/layer',
  58. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  59. 'cxselect': '../libs/fastadmin-cxselect/js/jquery.cxselect',
  60. 'template': '../libs/art-template/dist/template-native',
  61. 'selectpage': '../libs/fastadmin-selectpage/selectpage',
  62. 'citypicker': '../libs/fastadmin-citypicker/dist/js/city-picker.min',
  63. 'citypicker-data': '../libs/fastadmin-citypicker/dist/js/city-picker.data'
  64. },
  65. // shim依赖配置
  66. shim: {
  67. 'addons': ['frontend'],
  68. 'bootstrap': ['jquery'],
  69. 'bootstrap-table': {
  70. deps: ['bootstrap'],
  71. exports: '$.fn.bootstrapTable'
  72. },
  73. 'bootstrap-table-lang': {
  74. deps: ['bootstrap-table'],
  75. exports: '$.fn.bootstrapTable.defaults'
  76. },
  77. 'bootstrap-table-export': {
  78. deps: ['bootstrap-table', 'tableexport'],
  79. exports: '$.fn.bootstrapTable.defaults'
  80. },
  81. 'bootstrap-table-fixed-columns': {
  82. deps: ['bootstrap-table'],
  83. exports: '$.fn.bootstrapTable.defaults'
  84. },
  85. 'bootstrap-table-mobile': {
  86. deps: ['bootstrap-table'],
  87. exports: '$.fn.bootstrapTable.defaults'
  88. },
  89. 'bootstrap-table-advancedsearch': {
  90. deps: ['bootstrap-table'],
  91. exports: '$.fn.bootstrapTable.defaults'
  92. },
  93. 'bootstrap-table-commonsearch': {
  94. deps: ['bootstrap-table'],
  95. exports: '$.fn.bootstrapTable.defaults'
  96. },
  97. 'bootstrap-table-template': {
  98. deps: ['bootstrap-table', 'template'],
  99. exports: '$.fn.bootstrapTable.defaults'
  100. },
  101. 'bootstrap-table-jumpto': {
  102. deps: ['bootstrap-table'],
  103. exports: '$.fn.bootstrapTable.defaults'
  104. },
  105. 'tableexport': {
  106. deps: ['jquery'],
  107. exports: '$.fn.extend'
  108. },
  109. 'slimscroll': {
  110. deps: ['jquery'],
  111. exports: '$.fn.extend'
  112. },
  113. 'adminlte': {
  114. deps: ['bootstrap', 'slimscroll'],
  115. exports: '$.AdminLTE'
  116. },
  117. 'bootstrap-daterangepicker': [
  118. 'moment/locale/zh-cn'
  119. ],
  120. 'bootstrap-datetimepicker': [
  121. 'moment/locale/zh-cn',
  122. ],
  123. 'bootstrap-select-lang': ['bootstrap-select'],
  124. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css'],
  125. 'validator-lang': ['validator'],
  126. 'citypicker': ['citypicker-data', 'css!../libs/fastadmin-citypicker/dist/css/city-picker.css']
  127. },
  128. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  129. map: {
  130. '*': {
  131. 'css': '../libs/require-css/css.min'
  132. }
  133. },
  134. waitSeconds: 60,
  135. charset: 'utf-8' // 文件编码
  136. });
  137. require(['jquery', 'bootstrap'], function ($, undefined) {
  138. //初始配置
  139. var Config = requirejs.s.contexts._.config.config;
  140. //将Config渲染到全局
  141. window.Config = Config;
  142. // 配置语言包的路径
  143. var paths = {};
  144. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername + '&lang=' + Config.language + '&v=' + Config.site.version;
  145. // 避免目录冲突
  146. paths['frontend/'] = 'frontend/';
  147. require.config({paths: paths});
  148. // 初始化
  149. $(function () {
  150. require(['fast'], function (Fast) {
  151. require(['frontend', 'frontend-init', 'addons'], function (Frontend, Addons) {
  152. //加载相应模块
  153. if (Config.jsname) {
  154. require([Config.jsname], function (Controller) {
  155. Controller[Config.actionname] != undefined && Controller[Config.actionname]();
  156. }, function (e) {
  157. console.error(e);
  158. // 这里可捕获模块加载的错误
  159. });
  160. }
  161. });
  162. });
  163. });
  164. });
  165. define("require-frontend", function(){});
  166. define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window)return{load:function(a,b,c){c()}};var a=document.getElementsByTagName("head")[0],b=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/)||0,c=!1,d=!0;b[1]||b[7]?c=parseInt(b[1])<6||parseInt(b[7])<=9:b[2]||b[8]?d=!1:b[4]&&(c=parseInt(b[4])<18);var e={};e.pluginBuilder="./css-builder";var f,g,h,i=function(){f=document.createElement("style"),a.appendChild(f),g=f.styleSheet||f.sheet},j=0,k=[],l=function(a){g.addImport(a),f.onload=function(){m()},j++,31==j&&(i(),j=0)},m=function(){h();var a=k.shift();return a?(h=a[1],void l(a[0])):void(h=null)},n=function(a,b){if(g&&g.addImport||i(),g&&g.addImport)h?k.push([a,b]):(l(a),h=b);else{f.textContent='@import "'+a+'";';var c=setInterval(function(){try{f.sheet.cssRules,clearInterval(c),b()}catch(a){}},10)}},o=function(b,c){var e=document.createElement("link");if(e.type="text/css",e.rel="stylesheet",d)e.onload=function(){e.onload=function(){},setTimeout(c,7)};else var f=setInterval(function(){for(var a=0;a<document.styleSheets.length;a++){var b=document.styleSheets[a];if(b.href==e.href)return clearInterval(f),c()}},10);e.href=b,a.appendChild(e)};return e.normalize=function(a,b){return".css"==a.substr(a.length-4,4)&&(a=a.substr(0,a.length-4)),b(a)},e.load=function(a,b,d,e){(c?n:o)(b.toUrl(a+".css"),d)},e});
  167. /*! layer-v3.5.2 Web 通用弹出层组件 MIT License http://layer.layui.com/ By 贤心 */
  168. ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var t=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}(),i=e.LAYUI_GLOBAL||{};return i.layer_dir||t.substring(0,t.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c="creating",u=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function d(t){var n=100,a=document.getElementById(f);return++u>1e4/n?e.console&&console.error(l+".css: Invalid"):void(1989===parseInt(o.getStyle(a,"width"))?(t===c&&a.removeAttribute("lay-status"),a.getAttribute("lay-status")===c?setTimeout(d,n):i()):(a.setAttribute("lay-status",c),setTimeout(function(){d(c)},n)))}()}}},r={v:"3.5.2",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},f=r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},n.icon!==-1&&n.icon!==t||(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:260},n))}},s=function(e){var t=this,n=function(){t.creat()};t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?n():setTimeout(function(){n()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],l.SHADE="layui-layer-shade",l.MOVE="layui-layer-move",s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,minStack:!0,focusBtn:0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="'+l.SHADE+'" id="'+l.SHADE+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+";position:"+(r.fixed?"fixed;":"absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'" href="javascript:">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="'+l.MOVE+'" id="'+l.MOVE+'"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i("#"+l.MOVE)[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),e.shadeo=i("#"+l.SHADE+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),e.shadeo.css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():function(){e.offset(),parseInt(o.getStyle(document.getElementById(l.MOVE),"z-index"))||function(){e.layero.css("visibility","hidden"),r.ready(function(){e.offset(),e.layero.css("visibility","visible")})}()}(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;if(t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),"number"==typeof a.focusBtn){n.find("."+l[6]).children("a").each(function(){var e=i(this),t=i("<button type='button' />").addClass("layui-layer-confirm");e.css("position","relative").attr("tabindex",-1).append(t),t.click(function(){return e.trigger("click"),!1})});var s=n.find("."+l[6]).find("button.layui-layer-confirm").eq(a.focusBtn);s.length>0&&s.focus()}n.find("."+l[7]).on("click",e),a.shadeClose&&t.shadeo.on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n,t.index);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n,t.index)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n,t.index)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");if(s!==o.type[3]&&s!==o.type[4])if(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2])a.find("iframe").css({height:parseFloat(t.height)-f-c});else{var u="border-box"==r.css("box-sizing");r.css({height:parseFloat(t.height)-f-c-parseFloat(u?0:r.css("padding-top"))-parseFloat(u?0:r.css("padding-bottom"))})}},r.min=function(e,t){t=t||{};var a=i("#"+l[0]+e),s=i("#"+l.SHADE+e),f=a.find(l[1]).outerHeight()||0,c=a.attr("minLeft")||181*o.minIndex+"px",u=a.css("position"),d={width:180,height:f,position:"fixed",overflow:"hidden"};o.record(a),o.minLeft[0]&&(c=o.minLeft[0],o.minLeft.shift()),t.minStack&&(d.left=c,d.top=n.height()-f,a.attr("minLeft")||o.minIndex++,a.attr("minLeft",c)),a.attr("position",u),r.style(e,d,!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),s.hide()},r.restore=function(e){var t=i("#"+l[0]+e),n=i("#"+l.SHADE+e),a=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(a[0]),height:parseFloat(a[1]),top:parseFloat(a[2]),left:parseFloat(a[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e),n.show()},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e,t){var n=i("#"+l[0]+e),a=n.attr("type"),s="layer-anim-close";if(n[0]){var f="layui-layer-wrap",c=function(){if(a===o.type[1]&&"object"===n.attr("conType")){n.children(":not(."+l[5]+")").remove();for(var r=n.find("."+f),s=0;s<2;s++)r.unwrap();r.css("display",r.data("display")).removeClass(f)}else{if(a===o.type[2])try{var c=i("#"+l[4]+e)[0];c.contentWindow.document.write(""),c.contentWindow.close(),n.find("."+l[5])[0].removeChild(c)}catch(u){}n[0].innerHTML="",n.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e],"function"==typeof t&&t()};n.data("isOutAnim")&&n.addClass("layer-anim "+s),i("#layui-layer-moves, #"+l.SHADE+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),n.attr("minLeft")&&(o.minIndex--,o.minLeft.push(n.attr("minLeft"))),r.ie&&r.ie<10||!n.data("isOutAnim")?c():setTimeout(function(){c()},200)}},r.closeAll=function(e,t){"function"==typeof e&&(t=e,e=null);var n=i("."+l[0]);i.each(n,function(a){var o=i(this),s=e?o.attr("type")===e:1;s&&r.close(o.attr("times"),a===n.length-1?t:null),s=null}),0===n.length&&"function"==typeof t&&t()};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+"></textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(e.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=!("string"==typeof t.photos||t.photos instanceof i),f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){h();var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0)}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),a&&(t.anim=-1),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,anim:5,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'">'+function(){return u.length>1?'<div class="layui-layer-imgsee"><span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span><div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+" / "+u.length+"</em></span></div></div>":""}()+"</div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["&#x4E0B;&#x4E00;&#x5F20;","&#x4E0D;&#x770B;&#x4E86;"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define('layer',["jquery"],function(){return o.run(e.jQuery),r}):function(){r.ready(),o.run(e.jQuery)}()}(window);
  169. /*
  170. * Toastr
  171. * Copyright 2012-2015
  172. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  173. * All Rights Reserved.
  174. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  175. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  176. *
  177. * ARIA Support: Greta Krafsig
  178. *
  179. * Project: https://github.com/CodeSeven/toastr
  180. */
  181. /* global define */
  182. (function (define) {
  183. define('toastr',['jquery'], function ($) {
  184. return (function () {
  185. var $container;
  186. var listener;
  187. var toastId = 0;
  188. var toastType = {
  189. error: 'error',
  190. info: 'info',
  191. success: 'success',
  192. warning: 'warning'
  193. };
  194. var toastr = {
  195. clear: clear,
  196. remove: remove,
  197. error: error,
  198. getContainer: getContainer,
  199. info: info,
  200. options: {},
  201. subscribe: subscribe,
  202. success: success,
  203. version: '2.1.3',
  204. warning: warning
  205. };
  206. var previousToast;
  207. return toastr;
  208. ////////////////
  209. function error(message, title, optionsOverride) {
  210. return notify({
  211. type: toastType.error,
  212. iconClass: getOptions().iconClasses.error,
  213. message: message,
  214. optionsOverride: optionsOverride,
  215. title: title
  216. });
  217. }
  218. function getContainer(options, create) {
  219. if (!options) { options = getOptions(); }
  220. $container = $('#' + options.containerId);
  221. if ($container.length) {
  222. return $container;
  223. }
  224. if (create) {
  225. $container = createContainer(options);
  226. }
  227. return $container;
  228. }
  229. function info(message, title, optionsOverride) {
  230. return notify({
  231. type: toastType.info,
  232. iconClass: getOptions().iconClasses.info,
  233. message: message,
  234. optionsOverride: optionsOverride,
  235. title: title
  236. });
  237. }
  238. function subscribe(callback) {
  239. listener = callback;
  240. }
  241. function success(message, title, optionsOverride) {
  242. return notify({
  243. type: toastType.success,
  244. iconClass: getOptions().iconClasses.success,
  245. message: message,
  246. optionsOverride: optionsOverride,
  247. title: title
  248. });
  249. }
  250. function warning(message, title, optionsOverride) {
  251. return notify({
  252. type: toastType.warning,
  253. iconClass: getOptions().iconClasses.warning,
  254. message: message,
  255. optionsOverride: optionsOverride,
  256. title: title
  257. });
  258. }
  259. function clear($toastElement, clearOptions) {
  260. var options = getOptions();
  261. if (!$container) { getContainer(options); }
  262. if (!clearToast($toastElement, options, clearOptions)) {
  263. clearContainer(options);
  264. }
  265. }
  266. function remove($toastElement) {
  267. var options = getOptions();
  268. if (!$container) { getContainer(options); }
  269. if ($toastElement && $(':focus', $toastElement).length === 0) {
  270. removeToast($toastElement);
  271. return;
  272. }
  273. if ($container.children().length) {
  274. $container.remove();
  275. }
  276. }
  277. // internal functions
  278. function clearContainer (options) {
  279. var toastsToClear = $container.children();
  280. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  281. clearToast($(toastsToClear[i]), options);
  282. }
  283. }
  284. function clearToast ($toastElement, options, clearOptions) {
  285. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  286. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  287. $toastElement[options.hideMethod]({
  288. duration: options.hideDuration,
  289. easing: options.hideEasing,
  290. complete: function () { removeToast($toastElement); }
  291. });
  292. return true;
  293. }
  294. return false;
  295. }
  296. function createContainer(options) {
  297. $container = $('<div/>')
  298. .attr('id', options.containerId)
  299. .addClass(options.positionClass);
  300. $container.appendTo($(options.target));
  301. return $container;
  302. }
  303. function getDefaults() {
  304. return {
  305. tapToDismiss: true,
  306. toastClass: 'toast',
  307. containerId: 'toast-container',
  308. debug: false,
  309. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  310. showDuration: 300,
  311. showEasing: 'swing', //swing and linear are built into jQuery
  312. onShown: undefined,
  313. hideMethod: 'fadeOut',
  314. hideDuration: 1000,
  315. hideEasing: 'swing',
  316. onHidden: undefined,
  317. closeMethod: false,
  318. closeDuration: false,
  319. closeEasing: false,
  320. closeOnHover: true,
  321. extendedTimeOut: 1000,
  322. iconClasses: {
  323. error: 'toast-error',
  324. info: 'toast-info',
  325. success: 'toast-success',
  326. warning: 'toast-warning'
  327. },
  328. iconClass: 'toast-info',
  329. positionClass: 'toast-top-right',
  330. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  331. titleClass: 'toast-title',
  332. messageClass: 'toast-message',
  333. escapeHtml: false,
  334. target: 'body',
  335. closeHtml: '<button type="button">&times;</button>',
  336. closeClass: 'toast-close-button',
  337. newestOnTop: true,
  338. preventDuplicates: false,
  339. progressBar: false,
  340. progressClass: 'toast-progress',
  341. rtl: false
  342. };
  343. }
  344. function publish(args) {
  345. if (!listener) { return; }
  346. listener(args);
  347. }
  348. function notify(map) {
  349. var options = getOptions();
  350. var iconClass = map.iconClass || options.iconClass;
  351. if (typeof (map.optionsOverride) !== 'undefined') {
  352. options = $.extend(options, map.optionsOverride);
  353. iconClass = map.optionsOverride.iconClass || iconClass;
  354. }
  355. if (shouldExit(options, map)) { return; }
  356. toastId++;
  357. $container = getContainer(options, true);
  358. var intervalId = null;
  359. var $toastElement = $('<div/>');
  360. var $titleElement = $('<div/>');
  361. var $messageElement = $('<div/>');
  362. var $progressElement = $('<div/>');
  363. var $closeElement = $(options.closeHtml);
  364. var progressBar = {
  365. intervalId: null,
  366. hideEta: null,
  367. maxHideTime: null
  368. };
  369. var response = {
  370. toastId: toastId,
  371. state: 'visible',
  372. startTime: new Date(),
  373. options: options,
  374. map: map
  375. };
  376. personalizeToast();
  377. displayToast();
  378. handleEvents();
  379. publish(response);
  380. if (options.debug && console) {
  381. console.log(response);
  382. }
  383. return $toastElement;
  384. function escapeHtml(source) {
  385. if (source == null) {
  386. source = '';
  387. }
  388. return source
  389. .replace(/&/g, '&amp;')
  390. .replace(/"/g, '&quot;')
  391. .replace(/'/g, '&#39;')
  392. .replace(/</g, '&lt;')
  393. .replace(/>/g, '&gt;');
  394. }
  395. function personalizeToast() {
  396. setIcon();
  397. setTitle();
  398. setMessage();
  399. setCloseButton();
  400. setProgressBar();
  401. setRTL();
  402. setSequence();
  403. setAria();
  404. }
  405. function setAria() {
  406. var ariaValue = '';
  407. switch (map.iconClass) {
  408. case 'toast-success':
  409. case 'toast-info':
  410. ariaValue = 'polite';
  411. break;
  412. default:
  413. ariaValue = 'assertive';
  414. }
  415. $toastElement.attr('aria-live', ariaValue);
  416. }
  417. function handleEvents() {
  418. if (options.closeOnHover) {
  419. $toastElement.hover(stickAround, delayedHideToast);
  420. }
  421. if (!options.onclick && options.tapToDismiss) {
  422. $toastElement.click(hideToast);
  423. }
  424. if (options.closeButton && $closeElement) {
  425. $closeElement.click(function (event) {
  426. if (event.stopPropagation) {
  427. event.stopPropagation();
  428. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  429. event.cancelBubble = true;
  430. }
  431. if (options.onCloseClick) {
  432. options.onCloseClick(event);
  433. }
  434. hideToast(true);
  435. });
  436. }
  437. if (options.onclick) {
  438. $toastElement.click(function (event) {
  439. options.onclick(event);
  440. hideToast();
  441. });
  442. }
  443. }
  444. function displayToast() {
  445. $toastElement.hide();
  446. $toastElement[options.showMethod](
  447. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  448. );
  449. if (options.timeOut > 0) {
  450. intervalId = setTimeout(hideToast, options.timeOut);
  451. progressBar.maxHideTime = parseFloat(options.timeOut);
  452. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  453. if (options.progressBar) {
  454. progressBar.intervalId = setInterval(updateProgress, 10);
  455. }
  456. }
  457. }
  458. function setIcon() {
  459. if (map.iconClass) {
  460. $toastElement.addClass(options.toastClass).addClass(iconClass);
  461. }
  462. }
  463. function setSequence() {
  464. if (options.newestOnTop) {
  465. $container.prepend($toastElement);
  466. } else {
  467. $container.append($toastElement);
  468. }
  469. }
  470. function setTitle() {
  471. if (map.title) {
  472. var suffix = map.title;
  473. if (options.escapeHtml) {
  474. suffix = escapeHtml(map.title);
  475. }
  476. $titleElement.append(suffix).addClass(options.titleClass);
  477. $toastElement.append($titleElement);
  478. }
  479. }
  480. function setMessage() {
  481. if (map.message) {
  482. var suffix = map.message;
  483. if (options.escapeHtml) {
  484. suffix = escapeHtml(map.message);
  485. }
  486. $messageElement.append(suffix).addClass(options.messageClass);
  487. $toastElement.append($messageElement);
  488. }
  489. }
  490. function setCloseButton() {
  491. if (options.closeButton) {
  492. $closeElement.addClass(options.closeClass).attr('role', 'button');
  493. $toastElement.prepend($closeElement);
  494. }
  495. }
  496. function setProgressBar() {
  497. if (options.progressBar) {
  498. $progressElement.addClass(options.progressClass);
  499. $toastElement.prepend($progressElement);
  500. }
  501. }
  502. function setRTL() {
  503. if (options.rtl) {
  504. $toastElement.addClass('rtl');
  505. }
  506. }
  507. function shouldExit(options, map) {
  508. if (options.preventDuplicates) {
  509. if (map.message === previousToast) {
  510. return true;
  511. } else {
  512. previousToast = map.message;
  513. }
  514. }
  515. return false;
  516. }
  517. function hideToast(override) {
  518. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  519. var duration = override && options.closeDuration !== false ?
  520. options.closeDuration : options.hideDuration;
  521. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  522. if ($(':focus', $toastElement).length && !override) {
  523. return;
  524. }
  525. clearTimeout(progressBar.intervalId);
  526. return $toastElement[method]({
  527. duration: duration,
  528. easing: easing,
  529. complete: function () {
  530. removeToast($toastElement);
  531. clearTimeout(intervalId);
  532. if (options.onHidden && response.state !== 'hidden') {
  533. options.onHidden();
  534. }
  535. response.state = 'hidden';
  536. response.endTime = new Date();
  537. publish(response);
  538. }
  539. });
  540. }
  541. function delayedHideToast() {
  542. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  543. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  544. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  545. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  546. }
  547. }
  548. function stickAround() {
  549. clearTimeout(intervalId);
  550. progressBar.hideEta = 0;
  551. $toastElement.stop(true, true)[options.showMethod](
  552. {duration: options.showDuration, easing: options.showEasing}
  553. );
  554. }
  555. function updateProgress() {
  556. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  557. $progressElement.width(percentage + '%');
  558. }
  559. }
  560. function getOptions() {
  561. return $.extend({}, getDefaults(), toastr.options);
  562. }
  563. function removeToast($toastElement) {
  564. if (!$container) { $container = getContainer(); }
  565. if ($toastElement.is(':visible')) {
  566. return;
  567. }
  568. $toastElement.remove();
  569. $toastElement = null;
  570. if ($container.children().length === 0) {
  571. $container.remove();
  572. previousToast = undefined;
  573. }
  574. }
  575. })();
  576. });
  577. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  578. if (typeof module !== 'undefined' && module.exports) { //Node
  579. module.exports = factory(require('jquery'));
  580. } else {
  581. window.toastr = factory(window.jQuery);
  582. }
  583. }));
  584. define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
  585. var Fast = {
  586. config: {
  587. //toastr默认配置
  588. toastr: {
  589. "closeButton": true,
  590. "debug": false,
  591. "newestOnTop": false,
  592. "progressBar": false,
  593. "positionClass": "toast-top-center",
  594. "preventDuplicates": false,
  595. "onclick": null,
  596. "showDuration": "300",
  597. "hideDuration": "1000",
  598. "timeOut": "5000",
  599. "extendedTimeOut": "1000",
  600. "showEasing": "swing",
  601. "hideEasing": "linear",
  602. "showMethod": "fadeIn",
  603. "hideMethod": "fadeOut"
  604. }
  605. },
  606. events: {
  607. //请求成功的回调
  608. onAjaxSuccess: function (ret, onAjaxSuccess) {
  609. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  610. var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
  611. if (typeof onAjaxSuccess === 'function') {
  612. var result = onAjaxSuccess.call(this, data, ret);
  613. if (result === false)
  614. return;
  615. }
  616. Toastr.success(msg);
  617. },
  618. //请求错误的回调
  619. onAjaxError: function (ret, onAjaxError) {
  620. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  621. if (typeof onAjaxError === 'function') {
  622. var result = onAjaxError.call(this, data, ret);
  623. if (result === false) {
  624. return;
  625. }
  626. }
  627. Toastr.error(ret.msg);
  628. },
  629. //服务器响应数据后
  630. onAjaxResponse: function (response) {
  631. try {
  632. var ret = typeof response === 'object' ? response : JSON.parse(response);
  633. if (!ret.hasOwnProperty('code')) {
  634. $.extend(ret, {code: -2, msg: response, data: null});
  635. }
  636. } catch (e) {
  637. var ret = {code: -1, msg: e.message, data: null};
  638. }
  639. return ret;
  640. }
  641. },
  642. api: {
  643. //发送Ajax请求
  644. ajax: function (options, success, error) {
  645. options = typeof options === 'string' ? {url: options} : options;
  646. var index;
  647. if (typeof options.loading === 'undefined' || options.loading) {
  648. index = Layer.load(options.loading || 0);
  649. }
  650. options = $.extend({
  651. type: "POST",
  652. dataType: "json",
  653. xhrFields: {
  654. withCredentials: true
  655. },
  656. success: function (ret) {
  657. index && Layer.close(index);
  658. ret = Fast.events.onAjaxResponse(ret);
  659. if (ret.code === 1) {
  660. Fast.events.onAjaxSuccess(ret, success);
  661. } else {
  662. Fast.events.onAjaxError(ret, error);
  663. }
  664. },
  665. error: function (xhr) {
  666. index && Layer.close(index);
  667. var ret = {code: xhr.status, msg: xhr.statusText, data: null};
  668. Fast.events.onAjaxError(ret, error);
  669. }
  670. }, options);
  671. return $.ajax(options);
  672. },
  673. //修复URL
  674. fixurl: function (url) {
  675. if (url.substr(0, 1) !== "/") {
  676. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  677. if (!r.test(url)) {
  678. url = Config.moduleurl + "/" + url;
  679. }
  680. } else if (url.substr(0, 8) === "/addons/") {
  681. url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
  682. }
  683. return url;
  684. },
  685. //获取修复后可访问的cdn链接
  686. cdnurl: function (url, domain) {
  687. var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i");
  688. var cdnurl = Config.upload.cdnurl;
  689. url = rule.test(url) || (cdnurl && url.indexOf(cdnurl) === 0) ? url : cdnurl + url;
  690. if (domain && !rule.test(url)) {
  691. domain = typeof domain === 'string' ? domain : location.origin;
  692. url = domain + url;
  693. }
  694. return url;
  695. },
  696. //查询Url参数
  697. query: function (name, url) {
  698. if (!url) {
  699. url = window.location.href;
  700. }
  701. name = name.replace(/[\[\]]/g, "\\$&");
  702. var regex = new RegExp("[?&/]" + name + "([=/]([^&#/?]*)|&|#|$)"),
  703. results = regex.exec(url);
  704. if (!results)
  705. return null;
  706. if (!results[2])
  707. return '';
  708. return decodeURIComponent(results[2].replace(/\+/g, " "));
  709. },
  710. //打开一个弹出窗口
  711. open: function (url, title, options) {
  712. title = options && options.title ? options.title : (title ? title : "");
  713. url = Fast.api.fixurl(url);
  714. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  715. var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
  716. options = $.extend({
  717. type: 2,
  718. title: title,
  719. shadeClose: true,
  720. shade: false,
  721. maxmin: true,
  722. moveOut: true,
  723. area: area,
  724. content: url,
  725. zIndex: Layer.zIndex,
  726. success: function (layero, index) {
  727. var that = this;
  728. //存储callback事件
  729. $(layero).data("callback", that.callback);
  730. //$(layero).removeClass("layui-layer-border");
  731. Layer.setTop(layero);
  732. try {
  733. var frame = Layer.getChildFrame('html', index);
  734. var layerfooter = frame.find(".layer-footer");
  735. Fast.api.layerfooter(layero, index, that);
  736. //绑定事件
  737. if (layerfooter.size() > 0) {
  738. // 监听窗口内的元素及属性变化
  739. // Firefox和Chrome早期版本中带有前缀
  740. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  741. if (MutationObserver) {
  742. // 选择目标节点
  743. var target = layerfooter[0];
  744. // 创建观察者对象
  745. var observer = new MutationObserver(function (mutations) {
  746. Fast.api.layerfooter(layero, index, that);
  747. mutations.forEach(function (mutation) {
  748. });
  749. });
  750. // 配置观察选项:
  751. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  752. // 传入目标节点和观察选项
  753. observer.observe(target, config);
  754. // 随后,你还可以停止观察
  755. // observer.disconnect();
  756. }
  757. }
  758. } catch (e) {
  759. }
  760. if ($(layero).height() > $(window).height()) {
  761. //当弹出窗口大于浏览器可视高度时,重定位
  762. Layer.style(index, {
  763. top: 0,
  764. height: $(window).height()
  765. });
  766. }
  767. }
  768. }, options ? options : {});
  769. if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").size() > 0)) {
  770. if (top.$(".tab-pane.active").length > 0) {
  771. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  772. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  773. } else {
  774. options.area = [$(window).width() + "px", $(window).height() + "px"];
  775. options.offset = ["0px", "0px"];
  776. }
  777. }
  778. return Layer.open(options);
  779. },
  780. //关闭窗口并回传数据
  781. close: function (data) {
  782. var index = parent.Layer.getFrameIndex(window.name);
  783. var callback = parent.$("#layui-layer" + index).data("callback");
  784. //再执行关闭
  785. parent.Layer.close(index);
  786. //再调用回传函数
  787. if (typeof callback === 'function') {
  788. callback.call(undefined, data);
  789. }
  790. },
  791. layerfooter: function (layero, index, that) {
  792. var frame = Layer.getChildFrame('html', index);
  793. var layerfooter = frame.find(".layer-footer");
  794. if (layerfooter.size() > 0) {
  795. $(".layui-layer-footer", layero).remove();
  796. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  797. footer.html(layerfooter.html());
  798. if ($(".row", footer).size() === 0) {
  799. $(">", footer).wrapAll("<div class='row'></div>");
  800. }
  801. footer.insertAfter(layero.find('.layui-layer-content'));
  802. //绑定事件
  803. footer.on("click", ".btn", function () {
  804. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  805. return;
  806. }
  807. var index = footer.find('.btn').index(this);
  808. $(".btn:eq(" + index + ")", layerfooter).trigger("click");
  809. });
  810. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  811. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  812. //重设iframe高度
  813. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  814. }
  815. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  816. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  817. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  818. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  819. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  820. $("iframe", layero).css("height", "100%");
  821. }
  822. },
  823. success: function (options, callback) {
  824. var type = typeof options === 'function';
  825. if (type) {
  826. callback = options;
  827. }
  828. return Layer.msg(__('Operation completed'), $.extend({
  829. offset: 0, icon: 1
  830. }, type ? {} : options), callback);
  831. },
  832. error: function (options, callback) {
  833. var type = typeof options === 'function';
  834. if (type) {
  835. callback = options;
  836. }
  837. return Layer.msg(__('Operation failed'), $.extend({
  838. offset: 0, icon: 2
  839. }, type ? {} : options), callback);
  840. },
  841. msg: function (message, url) {
  842. var callback = typeof url === 'function' ? url : function () {
  843. if (typeof url !== 'undefined' && url) {
  844. location.href = url;
  845. }
  846. };
  847. Layer.msg(message, {
  848. time: 2000
  849. }, callback);
  850. },
  851. toastr: Toastr,
  852. layer: Layer
  853. },
  854. lang: function () {
  855. var args = arguments,
  856. string = args[0],
  857. i = 1;
  858. string = string.toLowerCase();
  859. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  860. if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
  861. if (typeof Lang[string] == 'object')
  862. return Lang[string];
  863. string = Lang[string];
  864. } else if (string.indexOf('.') !== -1 && false) {
  865. var arr = string.split('.');
  866. var current = Lang[arr[0]];
  867. for (var i = 1; i < arr.length; i++) {
  868. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  869. if (typeof current != 'object')
  870. break;
  871. }
  872. if (typeof current == 'object')
  873. return current;
  874. string = current;
  875. } else {
  876. string = args[0];
  877. }
  878. return string.replace(/%((%)|s|d)/g, function (m) {
  879. // m is the matched format, e.g. %s, %d
  880. var val = null;
  881. if (m[2]) {
  882. val = m[2];
  883. } else {
  884. val = args[i];
  885. // A switch statement so that the formatter can be extended. Default is %s
  886. switch (m) {
  887. case '%d':
  888. val = parseFloat(val);
  889. if (isNaN(val)) {
  890. val = 0;
  891. }
  892. break;
  893. }
  894. i++;
  895. }
  896. return val;
  897. });
  898. },
  899. init: function () {
  900. // 对相对地址进行处理
  901. $.ajaxSetup({
  902. beforeSend: function (xhr, setting) {
  903. setting.url = Fast.api.fixurl(setting.url);
  904. }
  905. });
  906. Layer.config({
  907. skin: 'layui-layer-fast'
  908. });
  909. // 绑定ESC关闭窗口事件
  910. $(window).keyup(function (e) {
  911. if (e.keyCode == 27) {
  912. if ($(".layui-layer").size() > 0) {
  913. var index = 0;
  914. $(".layui-layer").each(function () {
  915. index = Math.max(index, parseInt($(this).attr("times")));
  916. });
  917. if (index) {
  918. Layer.close(index);
  919. }
  920. }
  921. }
  922. });
  923. //公共代码
  924. //配置Toastr的参数
  925. Toastr.options = Fast.config.toastr;
  926. }
  927. };
  928. //将Layer暴露到全局中去
  929. window.Layer = Layer;
  930. //将Toastr暴露到全局中去
  931. window.Toastr = Toastr;
  932. //将语言方法暴露到全局中去
  933. window.__ = Fast.lang;
  934. //将Fast渲染至全局
  935. window.Fast = Fast;
  936. //默认初始化执行的代码
  937. Fast.init();
  938. return Fast;
  939. });
  940. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  941. !function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c<d;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define('template',[],function(){return d}):this.template=d}();
  942. //! moment.js
  943. //! version : 2.29.1
  944. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  945. //! license : MIT
  946. //! momentjs.com
  947. ;(function (global, factory) {
  948. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  949. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  950. global.moment = factory()
  951. }(this, (function () { 'use strict';
  952. var hookCallback;
  953. function hooks() {
  954. return hookCallback.apply(null, arguments);
  955. }
  956. // This is done to register the method called with moment()
  957. // without creating circular dependencies.
  958. function setHookCallback(callback) {
  959. hookCallback = callback;
  960. }
  961. function isArray(input) {
  962. return (
  963. input instanceof Array ||
  964. Object.prototype.toString.call(input) === '[object Array]'
  965. );
  966. }
  967. function isObject(input) {
  968. // IE8 will treat undefined and null as object if it wasn't for
  969. // input != null
  970. return (
  971. input != null &&
  972. Object.prototype.toString.call(input) === '[object Object]'
  973. );
  974. }
  975. function hasOwnProp(a, b) {
  976. return Object.prototype.hasOwnProperty.call(a, b);
  977. }
  978. function isObjectEmpty(obj) {
  979. if (Object.getOwnPropertyNames) {
  980. return Object.getOwnPropertyNames(obj).length === 0;
  981. } else {
  982. var k;
  983. for (k in obj) {
  984. if (hasOwnProp(obj, k)) {
  985. return false;
  986. }
  987. }
  988. return true;
  989. }
  990. }
  991. function isUndefined(input) {
  992. return input === void 0;
  993. }
  994. function isNumber(input) {
  995. return (
  996. typeof input === 'number' ||
  997. Object.prototype.toString.call(input) === '[object Number]'
  998. );
  999. }
  1000. function isDate(input) {
  1001. return (
  1002. input instanceof Date ||
  1003. Object.prototype.toString.call(input) === '[object Date]'
  1004. );
  1005. }
  1006. function map(arr, fn) {
  1007. var res = [],
  1008. i;
  1009. for (i = 0; i < arr.length; ++i) {
  1010. res.push(fn(arr[i], i));
  1011. }
  1012. return res;
  1013. }
  1014. function extend(a, b) {
  1015. for (var i in b) {
  1016. if (hasOwnProp(b, i)) {
  1017. a[i] = b[i];
  1018. }
  1019. }
  1020. if (hasOwnProp(b, 'toString')) {
  1021. a.toString = b.toString;
  1022. }
  1023. if (hasOwnProp(b, 'valueOf')) {
  1024. a.valueOf = b.valueOf;
  1025. }
  1026. return a;
  1027. }
  1028. function createUTC(input, format, locale, strict) {
  1029. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1030. }
  1031. function defaultParsingFlags() {
  1032. // We need to deep clone this object.
  1033. return {
  1034. empty: false,
  1035. unusedTokens: [],
  1036. unusedInput: [],
  1037. overflow: -2,
  1038. charsLeftOver: 0,
  1039. nullInput: false,
  1040. invalidEra: null,
  1041. invalidMonth: null,
  1042. invalidFormat: false,
  1043. userInvalidated: false,
  1044. iso: false,
  1045. parsedDateParts: [],
  1046. era: null,
  1047. meridiem: null,
  1048. rfc2822: false,
  1049. weekdayMismatch: false,
  1050. };
  1051. }
  1052. function getParsingFlags(m) {
  1053. if (m._pf == null) {
  1054. m._pf = defaultParsingFlags();
  1055. }
  1056. return m._pf;
  1057. }
  1058. var some;
  1059. if (Array.prototype.some) {
  1060. some = Array.prototype.some;
  1061. } else {
  1062. some = function (fun) {
  1063. var t = Object(this),
  1064. len = t.length >>> 0,
  1065. i;
  1066. for (i = 0; i < len; i++) {
  1067. if (i in t && fun.call(this, t[i], i, t)) {
  1068. return true;
  1069. }
  1070. }
  1071. return false;
  1072. };
  1073. }
  1074. function isValid(m) {
  1075. if (m._isValid == null) {
  1076. var flags = getParsingFlags(m),
  1077. parsedParts = some.call(flags.parsedDateParts, function (i) {
  1078. return i != null;
  1079. }),
  1080. isNowValid =
  1081. !isNaN(m._d.getTime()) &&
  1082. flags.overflow < 0 &&
  1083. !flags.empty &&
  1084. !flags.invalidEra &&
  1085. !flags.invalidMonth &&
  1086. !flags.invalidWeekday &&
  1087. !flags.weekdayMismatch &&
  1088. !flags.nullInput &&
  1089. !flags.invalidFormat &&
  1090. !flags.userInvalidated &&
  1091. (!flags.meridiem || (flags.meridiem && parsedParts));
  1092. if (m._strict) {
  1093. isNowValid =
  1094. isNowValid &&
  1095. flags.charsLeftOver === 0 &&
  1096. flags.unusedTokens.length === 0 &&
  1097. flags.bigHour === undefined;
  1098. }
  1099. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1100. m._isValid = isNowValid;
  1101. } else {
  1102. return isNowValid;
  1103. }
  1104. }
  1105. return m._isValid;
  1106. }
  1107. function createInvalid(flags) {
  1108. var m = createUTC(NaN);
  1109. if (flags != null) {
  1110. extend(getParsingFlags(m), flags);
  1111. } else {
  1112. getParsingFlags(m).userInvalidated = true;
  1113. }
  1114. return m;
  1115. }
  1116. // Plugins that add properties should also add the key here (null value),
  1117. // so we can properly clone ourselves.
  1118. var momentProperties = (hooks.momentProperties = []),
  1119. updateInProgress = false;
  1120. function copyConfig(to, from) {
  1121. var i, prop, val;
  1122. if (!isUndefined(from._isAMomentObject)) {
  1123. to._isAMomentObject = from._isAMomentObject;
  1124. }
  1125. if (!isUndefined(from._i)) {
  1126. to._i = from._i;
  1127. }
  1128. if (!isUndefined(from._f)) {
  1129. to._f = from._f;
  1130. }
  1131. if (!isUndefined(from._l)) {
  1132. to._l = from._l;
  1133. }
  1134. if (!isUndefined(from._strict)) {
  1135. to._strict = from._strict;
  1136. }
  1137. if (!isUndefined(from._tzm)) {
  1138. to._tzm = from._tzm;
  1139. }
  1140. if (!isUndefined(from._isUTC)) {
  1141. to._isUTC = from._isUTC;
  1142. }
  1143. if (!isUndefined(from._offset)) {
  1144. to._offset = from._offset;
  1145. }
  1146. if (!isUndefined(from._pf)) {
  1147. to._pf = getParsingFlags(from);
  1148. }
  1149. if (!isUndefined(from._locale)) {
  1150. to._locale = from._locale;
  1151. }
  1152. if (momentProperties.length > 0) {
  1153. for (i = 0; i < momentProperties.length; i++) {
  1154. prop = momentProperties[i];
  1155. val = from[prop];
  1156. if (!isUndefined(val)) {
  1157. to[prop] = val;
  1158. }
  1159. }
  1160. }
  1161. return to;
  1162. }
  1163. // Moment prototype object
  1164. function Moment(config) {
  1165. copyConfig(this, config);
  1166. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1167. if (!this.isValid()) {
  1168. this._d = new Date(NaN);
  1169. }
  1170. // Prevent infinite loop in case updateOffset creates new moment
  1171. // objects.
  1172. if (updateInProgress === false) {
  1173. updateInProgress = true;
  1174. hooks.updateOffset(this);
  1175. updateInProgress = false;
  1176. }
  1177. }
  1178. function isMoment(obj) {
  1179. return (
  1180. obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
  1181. );
  1182. }
  1183. function warn(msg) {
  1184. if (
  1185. hooks.suppressDeprecationWarnings === false &&
  1186. typeof console !== 'undefined' &&
  1187. console.warn
  1188. ) {
  1189. console.warn('Deprecation warning: ' + msg);
  1190. }
  1191. }
  1192. function deprecate(msg, fn) {
  1193. var firstTime = true;
  1194. return extend(function () {
  1195. if (hooks.deprecationHandler != null) {
  1196. hooks.deprecationHandler(null, msg);
  1197. }
  1198. if (firstTime) {
  1199. var args = [],
  1200. arg,
  1201. i,
  1202. key;
  1203. for (i = 0; i < arguments.length; i++) {
  1204. arg = '';
  1205. if (typeof arguments[i] === 'object') {
  1206. arg += '\n[' + i + '] ';
  1207. for (key in arguments[0]) {
  1208. if (hasOwnProp(arguments[0], key)) {
  1209. arg += key + ': ' + arguments[0][key] + ', ';
  1210. }
  1211. }
  1212. arg = arg.slice(0, -2); // Remove trailing comma and space
  1213. } else {
  1214. arg = arguments[i];
  1215. }
  1216. args.push(arg);
  1217. }
  1218. warn(
  1219. msg +
  1220. '\nArguments: ' +
  1221. Array.prototype.slice.call(args).join('') +
  1222. '\n' +
  1223. new Error().stack
  1224. );
  1225. firstTime = false;
  1226. }
  1227. return fn.apply(this, arguments);
  1228. }, fn);
  1229. }
  1230. var deprecations = {};
  1231. function deprecateSimple(name, msg) {
  1232. if (hooks.deprecationHandler != null) {
  1233. hooks.deprecationHandler(name, msg);
  1234. }
  1235. if (!deprecations[name]) {
  1236. warn(msg);
  1237. deprecations[name] = true;
  1238. }
  1239. }
  1240. hooks.suppressDeprecationWarnings = false;
  1241. hooks.deprecationHandler = null;
  1242. function isFunction(input) {
  1243. return (
  1244. (typeof Function !== 'undefined' && input instanceof Function) ||
  1245. Object.prototype.toString.call(input) === '[object Function]'
  1246. );
  1247. }
  1248. function set(config) {
  1249. var prop, i;
  1250. for (i in config) {
  1251. if (hasOwnProp(config, i)) {
  1252. prop = config[i];
  1253. if (isFunction(prop)) {
  1254. this[i] = prop;
  1255. } else {
  1256. this['_' + i] = prop;
  1257. }
  1258. }
  1259. }
  1260. this._config = config;
  1261. // Lenient ordinal parsing accepts just a number in addition to
  1262. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  1263. // TODO: Remove "ordinalParse" fallback in next major release.
  1264. this._dayOfMonthOrdinalParseLenient = new RegExp(
  1265. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  1266. '|' +
  1267. /\d{1,2}/.source
  1268. );
  1269. }
  1270. function mergeConfigs(parentConfig, childConfig) {
  1271. var res = extend({}, parentConfig),
  1272. prop;
  1273. for (prop in childConfig) {
  1274. if (hasOwnProp(childConfig, prop)) {
  1275. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1276. res[prop] = {};
  1277. extend(res[prop], parentConfig[prop]);
  1278. extend(res[prop], childConfig[prop]);
  1279. } else if (childConfig[prop] != null) {
  1280. res[prop] = childConfig[prop];
  1281. } else {
  1282. delete res[prop];
  1283. }
  1284. }
  1285. }
  1286. for (prop in parentConfig) {
  1287. if (
  1288. hasOwnProp(parentConfig, prop) &&
  1289. !hasOwnProp(childConfig, prop) &&
  1290. isObject(parentConfig[prop])
  1291. ) {
  1292. // make sure changes to properties don't modify parent config
  1293. res[prop] = extend({}, res[prop]);
  1294. }
  1295. }
  1296. return res;
  1297. }
  1298. function Locale(config) {
  1299. if (config != null) {
  1300. this.set(config);
  1301. }
  1302. }
  1303. var keys;
  1304. if (Object.keys) {
  1305. keys = Object.keys;
  1306. } else {
  1307. keys = function (obj) {
  1308. var i,
  1309. res = [];
  1310. for (i in obj) {
  1311. if (hasOwnProp(obj, i)) {
  1312. res.push(i);
  1313. }
  1314. }
  1315. return res;
  1316. };
  1317. }
  1318. var defaultCalendar = {
  1319. sameDay: '[Today at] LT',
  1320. nextDay: '[Tomorrow at] LT',
  1321. nextWeek: 'dddd [at] LT',
  1322. lastDay: '[Yesterday at] LT',
  1323. lastWeek: '[Last] dddd [at] LT',
  1324. sameElse: 'L',
  1325. };
  1326. function calendar(key, mom, now) {
  1327. var output = this._calendar[key] || this._calendar['sameElse'];
  1328. return isFunction(output) ? output.call(mom, now) : output;
  1329. }
  1330. function zeroFill(number, targetLength, forceSign) {
  1331. var absNumber = '' + Math.abs(number),
  1332. zerosToFill = targetLength - absNumber.length,
  1333. sign = number >= 0;
  1334. return (
  1335. (sign ? (forceSign ? '+' : '') : '-') +
  1336. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
  1337. absNumber
  1338. );
  1339. }
  1340. var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
  1341. localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
  1342. formatFunctions = {},
  1343. formatTokenFunctions = {};
  1344. // token: 'M'
  1345. // padded: ['MM', 2]
  1346. // ordinal: 'Mo'
  1347. // callback: function () { this.month() + 1 }
  1348. function addFormatToken(token, padded, ordinal, callback) {
  1349. var func = callback;
  1350. if (typeof callback === 'string') {
  1351. func = function () {
  1352. return this[callback]();
  1353. };
  1354. }
  1355. if (token) {
  1356. formatTokenFunctions[token] = func;
  1357. }
  1358. if (padded) {
  1359. formatTokenFunctions[padded[0]] = function () {
  1360. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1361. };
  1362. }
  1363. if (ordinal) {
  1364. formatTokenFunctions[ordinal] = function () {
  1365. return this.localeData().ordinal(
  1366. func.apply(this, arguments),
  1367. token
  1368. );
  1369. };
  1370. }
  1371. }
  1372. function removeFormattingTokens(input) {
  1373. if (input.match(/\[[\s\S]/)) {
  1374. return input.replace(/^\[|\]$/g, '');
  1375. }
  1376. return input.replace(/\\/g, '');
  1377. }
  1378. function makeFormatFunction(format) {
  1379. var array = format.match(formattingTokens),
  1380. i,
  1381. length;
  1382. for (i = 0, length = array.length; i < length; i++) {
  1383. if (formatTokenFunctions[array[i]]) {
  1384. array[i] = formatTokenFunctions[array[i]];
  1385. } else {
  1386. array[i] = removeFormattingTokens(array[i]);
  1387. }
  1388. }
  1389. return function (mom) {
  1390. var output = '',
  1391. i;
  1392. for (i = 0; i < length; i++) {
  1393. output += isFunction(array[i])
  1394. ? array[i].call(mom, format)
  1395. : array[i];
  1396. }
  1397. return output;
  1398. };
  1399. }
  1400. // format date using native date object
  1401. function formatMoment(m, format) {
  1402. if (!m.isValid()) {
  1403. return m.localeData().invalidDate();
  1404. }
  1405. format = expandFormat(format, m.localeData());
  1406. formatFunctions[format] =
  1407. formatFunctions[format] || makeFormatFunction(format);
  1408. return formatFunctions[format](m);
  1409. }
  1410. function expandFormat(format, locale) {
  1411. var i = 5;
  1412. function replaceLongDateFormatTokens(input) {
  1413. return locale.longDateFormat(input) || input;
  1414. }
  1415. localFormattingTokens.lastIndex = 0;
  1416. while (i >= 0 && localFormattingTokens.test(format)) {
  1417. format = format.replace(
  1418. localFormattingTokens,
  1419. replaceLongDateFormatTokens
  1420. );
  1421. localFormattingTokens.lastIndex = 0;
  1422. i -= 1;
  1423. }
  1424. return format;
  1425. }
  1426. var defaultLongDateFormat = {
  1427. LTS: 'h:mm:ss A',
  1428. LT: 'h:mm A',
  1429. L: 'MM/DD/YYYY',
  1430. LL: 'MMMM D, YYYY',
  1431. LLL: 'MMMM D, YYYY h:mm A',
  1432. LLLL: 'dddd, MMMM D, YYYY h:mm A',
  1433. };
  1434. function longDateFormat(key) {
  1435. var format = this._longDateFormat[key],
  1436. formatUpper = this._longDateFormat[key.toUpperCase()];
  1437. if (format || !formatUpper) {
  1438. return format;
  1439. }
  1440. this._longDateFormat[key] = formatUpper
  1441. .match(formattingTokens)
  1442. .map(function (tok) {
  1443. if (
  1444. tok === 'MMMM' ||
  1445. tok === 'MM' ||
  1446. tok === 'DD' ||
  1447. tok === 'dddd'
  1448. ) {
  1449. return tok.slice(1);
  1450. }
  1451. return tok;
  1452. })
  1453. .join('');
  1454. return this._longDateFormat[key];
  1455. }
  1456. var defaultInvalidDate = 'Invalid date';
  1457. function invalidDate() {
  1458. return this._invalidDate;
  1459. }
  1460. var defaultOrdinal = '%d',
  1461. defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  1462. function ordinal(number) {
  1463. return this._ordinal.replace('%d', number);
  1464. }
  1465. var defaultRelativeTime = {
  1466. future: 'in %s',
  1467. past: '%s ago',
  1468. s: 'a few seconds',
  1469. ss: '%d seconds',
  1470. m: 'a minute',
  1471. mm: '%d minutes',
  1472. h: 'an hour',
  1473. hh: '%d hours',
  1474. d: 'a day',
  1475. dd: '%d days',
  1476. w: 'a week',
  1477. ww: '%d weeks',
  1478. M: 'a month',
  1479. MM: '%d months',
  1480. y: 'a year',
  1481. yy: '%d years',
  1482. };
  1483. function relativeTime(number, withoutSuffix, string, isFuture) {
  1484. var output = this._relativeTime[string];
  1485. return isFunction(output)
  1486. ? output(number, withoutSuffix, string, isFuture)
  1487. : output.replace(/%d/i, number);
  1488. }
  1489. function pastFuture(diff, output) {
  1490. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1491. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1492. }
  1493. var aliases = {};
  1494. function addUnitAlias(unit, shorthand) {
  1495. var lowerCase = unit.toLowerCase();
  1496. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1497. }
  1498. function normalizeUnits(units) {
  1499. return typeof units === 'string'
  1500. ? aliases[units] || aliases[units.toLowerCase()]
  1501. : undefined;
  1502. }
  1503. function normalizeObjectUnits(inputObject) {
  1504. var normalizedInput = {},
  1505. normalizedProp,
  1506. prop;
  1507. for (prop in inputObject) {
  1508. if (hasOwnProp(inputObject, prop)) {
  1509. normalizedProp = normalizeUnits(prop);
  1510. if (normalizedProp) {
  1511. normalizedInput[normalizedProp] = inputObject[prop];
  1512. }
  1513. }
  1514. }
  1515. return normalizedInput;
  1516. }
  1517. var priorities = {};
  1518. function addUnitPriority(unit, priority) {
  1519. priorities[unit] = priority;
  1520. }
  1521. function getPrioritizedUnits(unitsObj) {
  1522. var units = [],
  1523. u;
  1524. for (u in unitsObj) {
  1525. if (hasOwnProp(unitsObj, u)) {
  1526. units.push({ unit: u, priority: priorities[u] });
  1527. }
  1528. }
  1529. units.sort(function (a, b) {
  1530. return a.priority - b.priority;
  1531. });
  1532. return units;
  1533. }
  1534. function isLeapYear(year) {
  1535. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1536. }
  1537. function absFloor(number) {
  1538. if (number < 0) {
  1539. // -0 -> 0
  1540. return Math.ceil(number) || 0;
  1541. } else {
  1542. return Math.floor(number);
  1543. }
  1544. }
  1545. function toInt(argumentForCoercion) {
  1546. var coercedNumber = +argumentForCoercion,
  1547. value = 0;
  1548. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1549. value = absFloor(coercedNumber);
  1550. }
  1551. return value;
  1552. }
  1553. function makeGetSet(unit, keepTime) {
  1554. return function (value) {
  1555. if (value != null) {
  1556. set$1(this, unit, value);
  1557. hooks.updateOffset(this, keepTime);
  1558. return this;
  1559. } else {
  1560. return get(this, unit);
  1561. }
  1562. };
  1563. }
  1564. function get(mom, unit) {
  1565. return mom.isValid()
  1566. ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
  1567. : NaN;
  1568. }
  1569. function set$1(mom, unit, value) {
  1570. if (mom.isValid() && !isNaN(value)) {
  1571. if (
  1572. unit === 'FullYear' &&
  1573. isLeapYear(mom.year()) &&
  1574. mom.month() === 1 &&
  1575. mom.date() === 29
  1576. ) {
  1577. value = toInt(value);
  1578. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
  1579. value,
  1580. mom.month(),
  1581. daysInMonth(value, mom.month())
  1582. );
  1583. } else {
  1584. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1585. }
  1586. }
  1587. }
  1588. // MOMENTS
  1589. function stringGet(units) {
  1590. units = normalizeUnits(units);
  1591. if (isFunction(this[units])) {
  1592. return this[units]();
  1593. }
  1594. return this;
  1595. }
  1596. function stringSet(units, value) {
  1597. if (typeof units === 'object') {
  1598. units = normalizeObjectUnits(units);
  1599. var prioritized = getPrioritizedUnits(units),
  1600. i;
  1601. for (i = 0; i < prioritized.length; i++) {
  1602. this[prioritized[i].unit](units[prioritized[i].unit]);
  1603. }
  1604. } else {
  1605. units = normalizeUnits(units);
  1606. if (isFunction(this[units])) {
  1607. return this[units](value);
  1608. }
  1609. }
  1610. return this;
  1611. }
  1612. var match1 = /\d/, // 0 - 9
  1613. match2 = /\d\d/, // 00 - 99
  1614. match3 = /\d{3}/, // 000 - 999
  1615. match4 = /\d{4}/, // 0000 - 9999
  1616. match6 = /[+-]?\d{6}/, // -999999 - 999999
  1617. match1to2 = /\d\d?/, // 0 - 99
  1618. match3to4 = /\d\d\d\d?/, // 999 - 9999
  1619. match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999
  1620. match1to3 = /\d{1,3}/, // 0 - 999
  1621. match1to4 = /\d{1,4}/, // 0 - 9999
  1622. match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
  1623. matchUnsigned = /\d+/, // 0 - inf
  1624. matchSigned = /[+-]?\d+/, // -inf - inf
  1625. matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
  1626. matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1627. matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
  1628. // any word (or two) characters or numbers including two/three word month in arabic.
  1629. // includes scottish gaelic two word and hyphenated months
  1630. matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
  1631. regexes;
  1632. regexes = {};
  1633. function addRegexToken(token, regex, strictRegex) {
  1634. regexes[token] = isFunction(regex)
  1635. ? regex
  1636. : function (isStrict, localeData) {
  1637. return isStrict && strictRegex ? strictRegex : regex;
  1638. };
  1639. }
  1640. function getParseRegexForToken(token, config) {
  1641. if (!hasOwnProp(regexes, token)) {
  1642. return new RegExp(unescapeFormat(token));
  1643. }
  1644. return regexes[token](config._strict, config._locale);
  1645. }
  1646. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1647. function unescapeFormat(s) {
  1648. return regexEscape(
  1649. s
  1650. .replace('\\', '')
  1651. .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (
  1652. matched,
  1653. p1,
  1654. p2,
  1655. p3,
  1656. p4
  1657. ) {
  1658. return p1 || p2 || p3 || p4;
  1659. })
  1660. );
  1661. }
  1662. function regexEscape(s) {
  1663. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1664. }
  1665. var tokens = {};
  1666. function addParseToken(token, callback) {
  1667. var i,
  1668. func = callback;
  1669. if (typeof token === 'string') {
  1670. token = [token];
  1671. }
  1672. if (isNumber(callback)) {
  1673. func = function (input, array) {
  1674. array[callback] = toInt(input);
  1675. };
  1676. }
  1677. for (i = 0; i < token.length; i++) {
  1678. tokens[token[i]] = func;
  1679. }
  1680. }
  1681. function addWeekParseToken(token, callback) {
  1682. addParseToken(token, function (input, array, config, token) {
  1683. config._w = config._w || {};
  1684. callback(input, config._w, config, token);
  1685. });
  1686. }
  1687. function addTimeToArrayFromToken(token, input, config) {
  1688. if (input != null && hasOwnProp(tokens, token)) {
  1689. tokens[token](input, config._a, config, token);
  1690. }
  1691. }
  1692. var YEAR = 0,
  1693. MONTH = 1,
  1694. DATE = 2,
  1695. HOUR = 3,
  1696. MINUTE = 4,
  1697. SECOND = 5,
  1698. MILLISECOND = 6,
  1699. WEEK = 7,
  1700. WEEKDAY = 8;
  1701. function mod(n, x) {
  1702. return ((n % x) + x) % x;
  1703. }
  1704. var indexOf;
  1705. if (Array.prototype.indexOf) {
  1706. indexOf = Array.prototype.indexOf;
  1707. } else {
  1708. indexOf = function (o) {
  1709. // I know
  1710. var i;
  1711. for (i = 0; i < this.length; ++i) {
  1712. if (this[i] === o) {
  1713. return i;
  1714. }
  1715. }
  1716. return -1;
  1717. };
  1718. }
  1719. function daysInMonth(year, month) {
  1720. if (isNaN(year) || isNaN(month)) {
  1721. return NaN;
  1722. }
  1723. var modMonth = mod(month, 12);
  1724. year += (month - modMonth) / 12;
  1725. return modMonth === 1
  1726. ? isLeapYear(year)
  1727. ? 29
  1728. : 28
  1729. : 31 - ((modMonth % 7) % 2);
  1730. }
  1731. // FORMATTING
  1732. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1733. return this.month() + 1;
  1734. });
  1735. addFormatToken('MMM', 0, 0, function (format) {
  1736. return this.localeData().monthsShort(this, format);
  1737. });
  1738. addFormatToken('MMMM', 0, 0, function (format) {
  1739. return this.localeData().months(this, format);
  1740. });
  1741. // ALIASES
  1742. addUnitAlias('month', 'M');
  1743. // PRIORITY
  1744. addUnitPriority('month', 8);
  1745. // PARSING
  1746. addRegexToken('M', match1to2);
  1747. addRegexToken('MM', match1to2, match2);
  1748. addRegexToken('MMM', function (isStrict, locale) {
  1749. return locale.monthsShortRegex(isStrict);
  1750. });
  1751. addRegexToken('MMMM', function (isStrict, locale) {
  1752. return locale.monthsRegex(isStrict);
  1753. });
  1754. addParseToken(['M', 'MM'], function (input, array) {
  1755. array[MONTH] = toInt(input) - 1;
  1756. });
  1757. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1758. var month = config._locale.monthsParse(input, token, config._strict);
  1759. // if we didn't find a month name, mark the date as invalid.
  1760. if (month != null) {
  1761. array[MONTH] = month;
  1762. } else {
  1763. getParsingFlags(config).invalidMonth = input;
  1764. }
  1765. });
  1766. // LOCALES
  1767. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  1768. '_'
  1769. ),
  1770. defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(
  1771. '_'
  1772. ),
  1773. MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
  1774. defaultMonthsShortRegex = matchWord,
  1775. defaultMonthsRegex = matchWord;
  1776. function localeMonths(m, format) {
  1777. if (!m) {
  1778. return isArray(this._months)
  1779. ? this._months
  1780. : this._months['standalone'];
  1781. }
  1782. return isArray(this._months)
  1783. ? this._months[m.month()]
  1784. : this._months[
  1785. (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
  1786. ? 'format'
  1787. : 'standalone'
  1788. ][m.month()];
  1789. }
  1790. function localeMonthsShort(m, format) {
  1791. if (!m) {
  1792. return isArray(this._monthsShort)
  1793. ? this._monthsShort
  1794. : this._monthsShort['standalone'];
  1795. }
  1796. return isArray(this._monthsShort)
  1797. ? this._monthsShort[m.month()]
  1798. : this._monthsShort[
  1799. MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
  1800. ][m.month()];
  1801. }
  1802. function handleStrictParse(monthName, format, strict) {
  1803. var i,
  1804. ii,
  1805. mom,
  1806. llc = monthName.toLocaleLowerCase();
  1807. if (!this._monthsParse) {
  1808. // this is not used
  1809. this._monthsParse = [];
  1810. this._longMonthsParse = [];
  1811. this._shortMonthsParse = [];
  1812. for (i = 0; i < 12; ++i) {
  1813. mom = createUTC([2000, i]);
  1814. this._shortMonthsParse[i] = this.monthsShort(
  1815. mom,
  1816. ''
  1817. ).toLocaleLowerCase();
  1818. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1819. }
  1820. }
  1821. if (strict) {
  1822. if (format === 'MMM') {
  1823. ii = indexOf.call(this._shortMonthsParse, llc);
  1824. return ii !== -1 ? ii : null;
  1825. } else {
  1826. ii = indexOf.call(this._longMonthsParse, llc);
  1827. return ii !== -1 ? ii : null;
  1828. }
  1829. } else {
  1830. if (format === 'MMM') {
  1831. ii = indexOf.call(this._shortMonthsParse, llc);
  1832. if (ii !== -1) {
  1833. return ii;
  1834. }
  1835. ii = indexOf.call(this._longMonthsParse, llc);
  1836. return ii !== -1 ? ii : null;
  1837. } else {
  1838. ii = indexOf.call(this._longMonthsParse, llc);
  1839. if (ii !== -1) {
  1840. return ii;
  1841. }
  1842. ii = indexOf.call(this._shortMonthsParse, llc);
  1843. return ii !== -1 ? ii : null;
  1844. }
  1845. }
  1846. }
  1847. function localeMonthsParse(monthName, format, strict) {
  1848. var i, mom, regex;
  1849. if (this._monthsParseExact) {
  1850. return handleStrictParse.call(this, monthName, format, strict);
  1851. }
  1852. if (!this._monthsParse) {
  1853. this._monthsParse = [];
  1854. this._longMonthsParse = [];
  1855. this._shortMonthsParse = [];
  1856. }
  1857. // TODO: add sorting
  1858. // Sorting makes sure if one month (or abbr) is a prefix of another
  1859. // see sorting in computeMonthsParse
  1860. for (i = 0; i < 12; i++) {
  1861. // make the regex if we don't have it already
  1862. mom = createUTC([2000, i]);
  1863. if (strict && !this._longMonthsParse[i]) {
  1864. this._longMonthsParse[i] = new RegExp(
  1865. '^' + this.months(mom, '').replace('.', '') + '$',
  1866. 'i'
  1867. );
  1868. this._shortMonthsParse[i] = new RegExp(
  1869. '^' + this.monthsShort(mom, '').replace('.', '') + '$',
  1870. 'i'
  1871. );
  1872. }
  1873. if (!strict && !this._monthsParse[i]) {
  1874. regex =
  1875. '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1876. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1877. }
  1878. // test the regex
  1879. if (
  1880. strict &&
  1881. format === 'MMMM' &&
  1882. this._longMonthsParse[i].test(monthName)
  1883. ) {
  1884. return i;
  1885. } else if (
  1886. strict &&
  1887. format === 'MMM' &&
  1888. this._shortMonthsParse[i].test(monthName)
  1889. ) {
  1890. return i;
  1891. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1892. return i;
  1893. }
  1894. }
  1895. }
  1896. // MOMENTS
  1897. function setMonth(mom, value) {
  1898. var dayOfMonth;
  1899. if (!mom.isValid()) {
  1900. // No op
  1901. return mom;
  1902. }
  1903. if (typeof value === 'string') {
  1904. if (/^\d+$/.test(value)) {
  1905. value = toInt(value);
  1906. } else {
  1907. value = mom.localeData().monthsParse(value);
  1908. // TODO: Another silent failure?
  1909. if (!isNumber(value)) {
  1910. return mom;
  1911. }
  1912. }
  1913. }
  1914. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1915. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1916. return mom;
  1917. }
  1918. function getSetMonth(value) {
  1919. if (value != null) {
  1920. setMonth(this, value);
  1921. hooks.updateOffset(this, true);
  1922. return this;
  1923. } else {
  1924. return get(this, 'Month');
  1925. }
  1926. }
  1927. function getDaysInMonth() {
  1928. return daysInMonth(this.year(), this.month());
  1929. }
  1930. function monthsShortRegex(isStrict) {
  1931. if (this._monthsParseExact) {
  1932. if (!hasOwnProp(this, '_monthsRegex')) {
  1933. computeMonthsParse.call(this);
  1934. }
  1935. if (isStrict) {
  1936. return this._monthsShortStrictRegex;
  1937. } else {
  1938. return this._monthsShortRegex;
  1939. }
  1940. } else {
  1941. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1942. this._monthsShortRegex = defaultMonthsShortRegex;
  1943. }
  1944. return this._monthsShortStrictRegex && isStrict
  1945. ? this._monthsShortStrictRegex
  1946. : this._monthsShortRegex;
  1947. }
  1948. }
  1949. function monthsRegex(isStrict) {
  1950. if (this._monthsParseExact) {
  1951. if (!hasOwnProp(this, '_monthsRegex')) {
  1952. computeMonthsParse.call(this);
  1953. }
  1954. if (isStrict) {
  1955. return this._monthsStrictRegex;
  1956. } else {
  1957. return this._monthsRegex;
  1958. }
  1959. } else {
  1960. if (!hasOwnProp(this, '_monthsRegex')) {
  1961. this._monthsRegex = defaultMonthsRegex;
  1962. }
  1963. return this._monthsStrictRegex && isStrict
  1964. ? this._monthsStrictRegex
  1965. : this._monthsRegex;
  1966. }
  1967. }
  1968. function computeMonthsParse() {
  1969. function cmpLenRev(a, b) {
  1970. return b.length - a.length;
  1971. }
  1972. var shortPieces = [],
  1973. longPieces = [],
  1974. mixedPieces = [],
  1975. i,
  1976. mom;
  1977. for (i = 0; i < 12; i++) {
  1978. // make the regex if we don't have it already
  1979. mom = createUTC([2000, i]);
  1980. shortPieces.push(this.monthsShort(mom, ''));
  1981. longPieces.push(this.months(mom, ''));
  1982. mixedPieces.push(this.months(mom, ''));
  1983. mixedPieces.push(this.monthsShort(mom, ''));
  1984. }
  1985. // Sorting makes sure if one month (or abbr) is a prefix of another it
  1986. // will match the longer piece.
  1987. shortPieces.sort(cmpLenRev);
  1988. longPieces.sort(cmpLenRev);
  1989. mixedPieces.sort(cmpLenRev);
  1990. for (i = 0; i < 12; i++) {
  1991. shortPieces[i] = regexEscape(shortPieces[i]);
  1992. longPieces[i] = regexEscape(longPieces[i]);
  1993. }
  1994. for (i = 0; i < 24; i++) {
  1995. mixedPieces[i] = regexEscape(mixedPieces[i]);
  1996. }
  1997. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  1998. this._monthsShortRegex = this._monthsRegex;
  1999. this._monthsStrictRegex = new RegExp(
  2000. '^(' + longPieces.join('|') + ')',
  2001. 'i'
  2002. );
  2003. this._monthsShortStrictRegex = new RegExp(
  2004. '^(' + shortPieces.join('|') + ')',
  2005. 'i'
  2006. );
  2007. }
  2008. // FORMATTING
  2009. addFormatToken('Y', 0, 0, function () {
  2010. var y = this.year();
  2011. return y <= 9999 ? zeroFill(y, 4) : '+' + y;
  2012. });
  2013. addFormatToken(0, ['YY', 2], 0, function () {
  2014. return this.year() % 100;
  2015. });
  2016. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2017. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2018. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2019. // ALIASES
  2020. addUnitAlias('year', 'y');
  2021. // PRIORITIES
  2022. addUnitPriority('year', 1);
  2023. // PARSING
  2024. addRegexToken('Y', matchSigned);
  2025. addRegexToken('YY', match1to2, match2);
  2026. addRegexToken('YYYY', match1to4, match4);
  2027. addRegexToken('YYYYY', match1to6, match6);
  2028. addRegexToken('YYYYYY', match1to6, match6);
  2029. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2030. addParseToken('YYYY', function (input, array) {
  2031. array[YEAR] =
  2032. input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2033. });
  2034. addParseToken('YY', function (input, array) {
  2035. array[YEAR] = hooks.parseTwoDigitYear(input);
  2036. });
  2037. addParseToken('Y', function (input, array) {
  2038. array[YEAR] = parseInt(input, 10);
  2039. });
  2040. // HELPERS
  2041. function daysInYear(year) {
  2042. return isLeapYear(year) ? 366 : 365;
  2043. }
  2044. // HOOKS
  2045. hooks.parseTwoDigitYear = function (input) {
  2046. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2047. };
  2048. // MOMENTS
  2049. var getSetYear = makeGetSet('FullYear', true);
  2050. function getIsLeapYear() {
  2051. return isLeapYear(this.year());
  2052. }
  2053. function createDate(y, m, d, h, M, s, ms) {
  2054. // can't just apply() to create a date:
  2055. // https://stackoverflow.com/q/181348
  2056. var date;
  2057. // the date constructor remaps years 0-99 to 1900-1999
  2058. if (y < 100 && y >= 0) {
  2059. // preserve leap years using a full 400 year cycle, then reset
  2060. date = new Date(y + 400, m, d, h, M, s, ms);
  2061. if (isFinite(date.getFullYear())) {
  2062. date.setFullYear(y);
  2063. }
  2064. } else {
  2065. date = new Date(y, m, d, h, M, s, ms);
  2066. }
  2067. return date;
  2068. }
  2069. function createUTCDate(y) {
  2070. var date, args;
  2071. // the Date.UTC function remaps years 0-99 to 1900-1999
  2072. if (y < 100 && y >= 0) {
  2073. args = Array.prototype.slice.call(arguments);
  2074. // preserve leap years using a full 400 year cycle, then reset
  2075. args[0] = y + 400;
  2076. date = new Date(Date.UTC.apply(null, args));
  2077. if (isFinite(date.getUTCFullYear())) {
  2078. date.setUTCFullYear(y);
  2079. }
  2080. } else {
  2081. date = new Date(Date.UTC.apply(null, arguments));
  2082. }
  2083. return date;
  2084. }
  2085. // start-of-first-week - start-of-year
  2086. function firstWeekOffset(year, dow, doy) {
  2087. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2088. fwd = 7 + dow - doy,
  2089. // first-week day local weekday -- which local weekday is fwd
  2090. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  2091. return -fwdlw + fwd - 1;
  2092. }
  2093. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  2094. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  2095. var localWeekday = (7 + weekday - dow) % 7,
  2096. weekOffset = firstWeekOffset(year, dow, doy),
  2097. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  2098. resYear,
  2099. resDayOfYear;
  2100. if (dayOfYear <= 0) {
  2101. resYear = year - 1;
  2102. resDayOfYear = daysInYear(resYear) + dayOfYear;
  2103. } else if (dayOfYear > daysInYear(year)) {
  2104. resYear = year + 1;
  2105. resDayOfYear = dayOfYear - daysInYear(year);
  2106. } else {
  2107. resYear = year;
  2108. resDayOfYear = dayOfYear;
  2109. }
  2110. return {
  2111. year: resYear,
  2112. dayOfYear: resDayOfYear,
  2113. };
  2114. }
  2115. function weekOfYear(mom, dow, doy) {
  2116. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  2117. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  2118. resWeek,
  2119. resYear;
  2120. if (week < 1) {
  2121. resYear = mom.year() - 1;
  2122. resWeek = week + weeksInYear(resYear, dow, doy);
  2123. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  2124. resWeek = week - weeksInYear(mom.year(), dow, doy);
  2125. resYear = mom.year() + 1;
  2126. } else {
  2127. resYear = mom.year();
  2128. resWeek = week;
  2129. }
  2130. return {
  2131. week: resWeek,
  2132. year: resYear,
  2133. };
  2134. }
  2135. function weeksInYear(year, dow, doy) {
  2136. var weekOffset = firstWeekOffset(year, dow, doy),
  2137. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  2138. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  2139. }
  2140. // FORMATTING
  2141. addFormatToken('w', ['ww', 2], 'wo', 'week');
  2142. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  2143. // ALIASES
  2144. addUnitAlias('week', 'w');
  2145. addUnitAlias('isoWeek', 'W');
  2146. // PRIORITIES
  2147. addUnitPriority('week', 5);
  2148. addUnitPriority('isoWeek', 5);
  2149. // PARSING
  2150. addRegexToken('w', match1to2);
  2151. addRegexToken('ww', match1to2, match2);
  2152. addRegexToken('W', match1to2);
  2153. addRegexToken('WW', match1to2, match2);
  2154. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (
  2155. input,
  2156. week,
  2157. config,
  2158. token
  2159. ) {
  2160. week[token.substr(0, 1)] = toInt(input);
  2161. });
  2162. // HELPERS
  2163. // LOCALES
  2164. function localeWeek(mom) {
  2165. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2166. }
  2167. var defaultLocaleWeek = {
  2168. dow: 0, // Sunday is the first day of the week.
  2169. doy: 6, // The week that contains Jan 6th is the first week of the year.
  2170. };
  2171. function localeFirstDayOfWeek() {
  2172. return this._week.dow;
  2173. }
  2174. function localeFirstDayOfYear() {
  2175. return this._week.doy;
  2176. }
  2177. // MOMENTS
  2178. function getSetWeek(input) {
  2179. var week = this.localeData().week(this);
  2180. return input == null ? week : this.add((input - week) * 7, 'd');
  2181. }
  2182. function getSetISOWeek(input) {
  2183. var week = weekOfYear(this, 1, 4).week;
  2184. return input == null ? week : this.add((input - week) * 7, 'd');
  2185. }
  2186. // FORMATTING
  2187. addFormatToken('d', 0, 'do', 'day');
  2188. addFormatToken('dd', 0, 0, function (format) {
  2189. return this.localeData().weekdaysMin(this, format);
  2190. });
  2191. addFormatToken('ddd', 0, 0, function (format) {
  2192. return this.localeData().weekdaysShort(this, format);
  2193. });
  2194. addFormatToken('dddd', 0, 0, function (format) {
  2195. return this.localeData().weekdays(this, format);
  2196. });
  2197. addFormatToken('e', 0, 0, 'weekday');
  2198. addFormatToken('E', 0, 0, 'isoWeekday');
  2199. // ALIASES
  2200. addUnitAlias('day', 'd');
  2201. addUnitAlias('weekday', 'e');
  2202. addUnitAlias('isoWeekday', 'E');
  2203. // PRIORITY
  2204. addUnitPriority('day', 11);
  2205. addUnitPriority('weekday', 11);
  2206. addUnitPriority('isoWeekday', 11);
  2207. // PARSING
  2208. addRegexToken('d', match1to2);
  2209. addRegexToken('e', match1to2);
  2210. addRegexToken('E', match1to2);
  2211. addRegexToken('dd', function (isStrict, locale) {
  2212. return locale.weekdaysMinRegex(isStrict);
  2213. });
  2214. addRegexToken('ddd', function (isStrict, locale) {
  2215. return locale.weekdaysShortRegex(isStrict);
  2216. });
  2217. addRegexToken('dddd', function (isStrict, locale) {
  2218. return locale.weekdaysRegex(isStrict);
  2219. });
  2220. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2221. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2222. // if we didn't get a weekday name, mark the date as invalid
  2223. if (weekday != null) {
  2224. week.d = weekday;
  2225. } else {
  2226. getParsingFlags(config).invalidWeekday = input;
  2227. }
  2228. });
  2229. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2230. week[token] = toInt(input);
  2231. });
  2232. // HELPERS
  2233. function parseWeekday(input, locale) {
  2234. if (typeof input !== 'string') {
  2235. return input;
  2236. }
  2237. if (!isNaN(input)) {
  2238. return parseInt(input, 10);
  2239. }
  2240. input = locale.weekdaysParse(input);
  2241. if (typeof input === 'number') {
  2242. return input;
  2243. }
  2244. return null;
  2245. }
  2246. function parseIsoWeekday(input, locale) {
  2247. if (typeof input === 'string') {
  2248. return locale.weekdaysParse(input) % 7 || 7;
  2249. }
  2250. return isNaN(input) ? null : input;
  2251. }
  2252. // LOCALES
  2253. function shiftWeekdays(ws, n) {
  2254. return ws.slice(n, 7).concat(ws.slice(0, n));
  2255. }
  2256. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  2257. '_'
  2258. ),
  2259. defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  2260. defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  2261. defaultWeekdaysRegex = matchWord,
  2262. defaultWeekdaysShortRegex = matchWord,
  2263. defaultWeekdaysMinRegex = matchWord;
  2264. function localeWeekdays(m, format) {
  2265. var weekdays = isArray(this._weekdays)
  2266. ? this._weekdays
  2267. : this._weekdays[
  2268. m && m !== true && this._weekdays.isFormat.test(format)
  2269. ? 'format'
  2270. : 'standalone'
  2271. ];
  2272. return m === true
  2273. ? shiftWeekdays(weekdays, this._week.dow)
  2274. : m
  2275. ? weekdays[m.day()]
  2276. : weekdays;
  2277. }
  2278. function localeWeekdaysShort(m) {
  2279. return m === true
  2280. ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  2281. : m
  2282. ? this._weekdaysShort[m.day()]
  2283. : this._weekdaysShort;
  2284. }
  2285. function localeWeekdaysMin(m) {
  2286. return m === true
  2287. ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  2288. : m
  2289. ? this._weekdaysMin[m.day()]
  2290. : this._weekdaysMin;
  2291. }
  2292. function handleStrictParse$1(weekdayName, format, strict) {
  2293. var i,
  2294. ii,
  2295. mom,
  2296. llc = weekdayName.toLocaleLowerCase();
  2297. if (!this._weekdaysParse) {
  2298. this._weekdaysParse = [];
  2299. this._shortWeekdaysParse = [];
  2300. this._minWeekdaysParse = [];
  2301. for (i = 0; i < 7; ++i) {
  2302. mom = createUTC([2000, 1]).day(i);
  2303. this._minWeekdaysParse[i] = this.weekdaysMin(
  2304. mom,
  2305. ''
  2306. ).toLocaleLowerCase();
  2307. this._shortWeekdaysParse[i] = this.weekdaysShort(
  2308. mom,
  2309. ''
  2310. ).toLocaleLowerCase();
  2311. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2312. }
  2313. }
  2314. if (strict) {
  2315. if (format === 'dddd') {
  2316. ii = indexOf.call(this._weekdaysParse, llc);
  2317. return ii !== -1 ? ii : null;
  2318. } else if (format === 'ddd') {
  2319. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2320. return ii !== -1 ? ii : null;
  2321. } else {
  2322. ii = indexOf.call(this._minWeekdaysParse, llc);
  2323. return ii !== -1 ? ii : null;
  2324. }
  2325. } else {
  2326. if (format === 'dddd') {
  2327. ii = indexOf.call(this._weekdaysParse, llc);
  2328. if (ii !== -1) {
  2329. return ii;
  2330. }
  2331. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2332. if (ii !== -1) {
  2333. return ii;
  2334. }
  2335. ii = indexOf.call(this._minWeekdaysParse, llc);
  2336. return ii !== -1 ? ii : null;
  2337. } else if (format === 'ddd') {
  2338. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2339. if (ii !== -1) {
  2340. return ii;
  2341. }
  2342. ii = indexOf.call(this._weekdaysParse, llc);
  2343. if (ii !== -1) {
  2344. return ii;
  2345. }
  2346. ii = indexOf.call(this._minWeekdaysParse, llc);
  2347. return ii !== -1 ? ii : null;
  2348. } else {
  2349. ii = indexOf.call(this._minWeekdaysParse, llc);
  2350. if (ii !== -1) {
  2351. return ii;
  2352. }
  2353. ii = indexOf.call(this._weekdaysParse, llc);
  2354. if (ii !== -1) {
  2355. return ii;
  2356. }
  2357. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2358. return ii !== -1 ? ii : null;
  2359. }
  2360. }
  2361. }
  2362. function localeWeekdaysParse(weekdayName, format, strict) {
  2363. var i, mom, regex;
  2364. if (this._weekdaysParseExact) {
  2365. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2366. }
  2367. if (!this._weekdaysParse) {
  2368. this._weekdaysParse = [];
  2369. this._minWeekdaysParse = [];
  2370. this._shortWeekdaysParse = [];
  2371. this._fullWeekdaysParse = [];
  2372. }
  2373. for (i = 0; i < 7; i++) {
  2374. // make the regex if we don't have it already
  2375. mom = createUTC([2000, 1]).day(i);
  2376. if (strict && !this._fullWeekdaysParse[i]) {
  2377. this._fullWeekdaysParse[i] = new RegExp(
  2378. '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
  2379. 'i'
  2380. );
  2381. this._shortWeekdaysParse[i] = new RegExp(
  2382. '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
  2383. 'i'
  2384. );
  2385. this._minWeekdaysParse[i] = new RegExp(
  2386. '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
  2387. 'i'
  2388. );
  2389. }
  2390. if (!this._weekdaysParse[i]) {
  2391. regex =
  2392. '^' +
  2393. this.weekdays(mom, '') +
  2394. '|^' +
  2395. this.weekdaysShort(mom, '') +
  2396. '|^' +
  2397. this.weekdaysMin(mom, '');
  2398. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2399. }
  2400. // test the regex
  2401. if (
  2402. strict &&
  2403. format === 'dddd' &&
  2404. this._fullWeekdaysParse[i].test(weekdayName)
  2405. ) {
  2406. return i;
  2407. } else if (
  2408. strict &&
  2409. format === 'ddd' &&
  2410. this._shortWeekdaysParse[i].test(weekdayName)
  2411. ) {
  2412. return i;
  2413. } else if (
  2414. strict &&
  2415. format === 'dd' &&
  2416. this._minWeekdaysParse[i].test(weekdayName)
  2417. ) {
  2418. return i;
  2419. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2420. return i;
  2421. }
  2422. }
  2423. }
  2424. // MOMENTS
  2425. function getSetDayOfWeek(input) {
  2426. if (!this.isValid()) {
  2427. return input != null ? this : NaN;
  2428. }
  2429. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2430. if (input != null) {
  2431. input = parseWeekday(input, this.localeData());
  2432. return this.add(input - day, 'd');
  2433. } else {
  2434. return day;
  2435. }
  2436. }
  2437. function getSetLocaleDayOfWeek(input) {
  2438. if (!this.isValid()) {
  2439. return input != null ? this : NaN;
  2440. }
  2441. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2442. return input == null ? weekday : this.add(input - weekday, 'd');
  2443. }
  2444. function getSetISODayOfWeek(input) {
  2445. if (!this.isValid()) {
  2446. return input != null ? this : NaN;
  2447. }
  2448. // behaves the same as moment#day except
  2449. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2450. // as a setter, sunday should belong to the previous week.
  2451. if (input != null) {
  2452. var weekday = parseIsoWeekday(input, this.localeData());
  2453. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2454. } else {
  2455. return this.day() || 7;
  2456. }
  2457. }
  2458. function weekdaysRegex(isStrict) {
  2459. if (this._weekdaysParseExact) {
  2460. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2461. computeWeekdaysParse.call(this);
  2462. }
  2463. if (isStrict) {
  2464. return this._weekdaysStrictRegex;
  2465. } else {
  2466. return this._weekdaysRegex;
  2467. }
  2468. } else {
  2469. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2470. this._weekdaysRegex = defaultWeekdaysRegex;
  2471. }
  2472. return this._weekdaysStrictRegex && isStrict
  2473. ? this._weekdaysStrictRegex
  2474. : this._weekdaysRegex;
  2475. }
  2476. }
  2477. function weekdaysShortRegex(isStrict) {
  2478. if (this._weekdaysParseExact) {
  2479. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2480. computeWeekdaysParse.call(this);
  2481. }
  2482. if (isStrict) {
  2483. return this._weekdaysShortStrictRegex;
  2484. } else {
  2485. return this._weekdaysShortRegex;
  2486. }
  2487. } else {
  2488. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2489. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2490. }
  2491. return this._weekdaysShortStrictRegex && isStrict
  2492. ? this._weekdaysShortStrictRegex
  2493. : this._weekdaysShortRegex;
  2494. }
  2495. }
  2496. function weekdaysMinRegex(isStrict) {
  2497. if (this._weekdaysParseExact) {
  2498. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2499. computeWeekdaysParse.call(this);
  2500. }
  2501. if (isStrict) {
  2502. return this._weekdaysMinStrictRegex;
  2503. } else {
  2504. return this._weekdaysMinRegex;
  2505. }
  2506. } else {
  2507. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2508. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2509. }
  2510. return this._weekdaysMinStrictRegex && isStrict
  2511. ? this._weekdaysMinStrictRegex
  2512. : this._weekdaysMinRegex;
  2513. }
  2514. }
  2515. function computeWeekdaysParse() {
  2516. function cmpLenRev(a, b) {
  2517. return b.length - a.length;
  2518. }
  2519. var minPieces = [],
  2520. shortPieces = [],
  2521. longPieces = [],
  2522. mixedPieces = [],
  2523. i,
  2524. mom,
  2525. minp,
  2526. shortp,
  2527. longp;
  2528. for (i = 0; i < 7; i++) {
  2529. // make the regex if we don't have it already
  2530. mom = createUTC([2000, 1]).day(i);
  2531. minp = regexEscape(this.weekdaysMin(mom, ''));
  2532. shortp = regexEscape(this.weekdaysShort(mom, ''));
  2533. longp = regexEscape(this.weekdays(mom, ''));
  2534. minPieces.push(minp);
  2535. shortPieces.push(shortp);
  2536. longPieces.push(longp);
  2537. mixedPieces.push(minp);
  2538. mixedPieces.push(shortp);
  2539. mixedPieces.push(longp);
  2540. }
  2541. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2542. // will match the longer piece.
  2543. minPieces.sort(cmpLenRev);
  2544. shortPieces.sort(cmpLenRev);
  2545. longPieces.sort(cmpLenRev);
  2546. mixedPieces.sort(cmpLenRev);
  2547. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2548. this._weekdaysShortRegex = this._weekdaysRegex;
  2549. this._weekdaysMinRegex = this._weekdaysRegex;
  2550. this._weekdaysStrictRegex = new RegExp(
  2551. '^(' + longPieces.join('|') + ')',
  2552. 'i'
  2553. );
  2554. this._weekdaysShortStrictRegex = new RegExp(
  2555. '^(' + shortPieces.join('|') + ')',
  2556. 'i'
  2557. );
  2558. this._weekdaysMinStrictRegex = new RegExp(
  2559. '^(' + minPieces.join('|') + ')',
  2560. 'i'
  2561. );
  2562. }
  2563. // FORMATTING
  2564. function hFormat() {
  2565. return this.hours() % 12 || 12;
  2566. }
  2567. function kFormat() {
  2568. return this.hours() || 24;
  2569. }
  2570. addFormatToken('H', ['HH', 2], 0, 'hour');
  2571. addFormatToken('h', ['hh', 2], 0, hFormat);
  2572. addFormatToken('k', ['kk', 2], 0, kFormat);
  2573. addFormatToken('hmm', 0, 0, function () {
  2574. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2575. });
  2576. addFormatToken('hmmss', 0, 0, function () {
  2577. return (
  2578. '' +
  2579. hFormat.apply(this) +
  2580. zeroFill(this.minutes(), 2) +
  2581. zeroFill(this.seconds(), 2)
  2582. );
  2583. });
  2584. addFormatToken('Hmm', 0, 0, function () {
  2585. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2586. });
  2587. addFormatToken('Hmmss', 0, 0, function () {
  2588. return (
  2589. '' +
  2590. this.hours() +
  2591. zeroFill(this.minutes(), 2) +
  2592. zeroFill(this.seconds(), 2)
  2593. );
  2594. });
  2595. function meridiem(token, lowercase) {
  2596. addFormatToken(token, 0, 0, function () {
  2597. return this.localeData().meridiem(
  2598. this.hours(),
  2599. this.minutes(),
  2600. lowercase
  2601. );
  2602. });
  2603. }
  2604. meridiem('a', true);
  2605. meridiem('A', false);
  2606. // ALIASES
  2607. addUnitAlias('hour', 'h');
  2608. // PRIORITY
  2609. addUnitPriority('hour', 13);
  2610. // PARSING
  2611. function matchMeridiem(isStrict, locale) {
  2612. return locale._meridiemParse;
  2613. }
  2614. addRegexToken('a', matchMeridiem);
  2615. addRegexToken('A', matchMeridiem);
  2616. addRegexToken('H', match1to2);
  2617. addRegexToken('h', match1to2);
  2618. addRegexToken('k', match1to2);
  2619. addRegexToken('HH', match1to2, match2);
  2620. addRegexToken('hh', match1to2, match2);
  2621. addRegexToken('kk', match1to2, match2);
  2622. addRegexToken('hmm', match3to4);
  2623. addRegexToken('hmmss', match5to6);
  2624. addRegexToken('Hmm', match3to4);
  2625. addRegexToken('Hmmss', match5to6);
  2626. addParseToken(['H', 'HH'], HOUR);
  2627. addParseToken(['k', 'kk'], function (input, array, config) {
  2628. var kInput = toInt(input);
  2629. array[HOUR] = kInput === 24 ? 0 : kInput;
  2630. });
  2631. addParseToken(['a', 'A'], function (input, array, config) {
  2632. config._isPm = config._locale.isPM(input);
  2633. config._meridiem = input;
  2634. });
  2635. addParseToken(['h', 'hh'], function (input, array, config) {
  2636. array[HOUR] = toInt(input);
  2637. getParsingFlags(config).bigHour = true;
  2638. });
  2639. addParseToken('hmm', function (input, array, config) {
  2640. var pos = input.length - 2;
  2641. array[HOUR] = toInt(input.substr(0, pos));
  2642. array[MINUTE] = toInt(input.substr(pos));
  2643. getParsingFlags(config).bigHour = true;
  2644. });
  2645. addParseToken('hmmss', function (input, array, config) {
  2646. var pos1 = input.length - 4,
  2647. pos2 = input.length - 2;
  2648. array[HOUR] = toInt(input.substr(0, pos1));
  2649. array[MINUTE] = toInt(input.substr(pos1, 2));
  2650. array[SECOND] = toInt(input.substr(pos2));
  2651. getParsingFlags(config).bigHour = true;
  2652. });
  2653. addParseToken('Hmm', function (input, array, config) {
  2654. var pos = input.length - 2;
  2655. array[HOUR] = toInt(input.substr(0, pos));
  2656. array[MINUTE] = toInt(input.substr(pos));
  2657. });
  2658. addParseToken('Hmmss', function (input, array, config) {
  2659. var pos1 = input.length - 4,
  2660. pos2 = input.length - 2;
  2661. array[HOUR] = toInt(input.substr(0, pos1));
  2662. array[MINUTE] = toInt(input.substr(pos1, 2));
  2663. array[SECOND] = toInt(input.substr(pos2));
  2664. });
  2665. // LOCALES
  2666. function localeIsPM(input) {
  2667. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2668. // Using charAt should be more compatible.
  2669. return (input + '').toLowerCase().charAt(0) === 'p';
  2670. }
  2671. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
  2672. // Setting the hour should keep the time, because the user explicitly
  2673. // specified which hour they want. So trying to maintain the same hour (in
  2674. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2675. // this rule.
  2676. getSetHour = makeGetSet('Hours', true);
  2677. function localeMeridiem(hours, minutes, isLower) {
  2678. if (hours > 11) {
  2679. return isLower ? 'pm' : 'PM';
  2680. } else {
  2681. return isLower ? 'am' : 'AM';
  2682. }
  2683. }
  2684. var baseConfig = {
  2685. calendar: defaultCalendar,
  2686. longDateFormat: defaultLongDateFormat,
  2687. invalidDate: defaultInvalidDate,
  2688. ordinal: defaultOrdinal,
  2689. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  2690. relativeTime: defaultRelativeTime,
  2691. months: defaultLocaleMonths,
  2692. monthsShort: defaultLocaleMonthsShort,
  2693. week: defaultLocaleWeek,
  2694. weekdays: defaultLocaleWeekdays,
  2695. weekdaysMin: defaultLocaleWeekdaysMin,
  2696. weekdaysShort: defaultLocaleWeekdaysShort,
  2697. meridiemParse: defaultLocaleMeridiemParse,
  2698. };
  2699. // internal storage for locale config files
  2700. var locales = {},
  2701. localeFamilies = {},
  2702. globalLocale;
  2703. function commonPrefix(arr1, arr2) {
  2704. var i,
  2705. minl = Math.min(arr1.length, arr2.length);
  2706. for (i = 0; i < minl; i += 1) {
  2707. if (arr1[i] !== arr2[i]) {
  2708. return i;
  2709. }
  2710. }
  2711. return minl;
  2712. }
  2713. function normalizeLocale(key) {
  2714. return key ? key.toLowerCase().replace('_', '-') : key;
  2715. }
  2716. // pick the locale from the array
  2717. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2718. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2719. function chooseLocale(names) {
  2720. var i = 0,
  2721. j,
  2722. next,
  2723. locale,
  2724. split;
  2725. while (i < names.length) {
  2726. split = normalizeLocale(names[i]).split('-');
  2727. j = split.length;
  2728. next = normalizeLocale(names[i + 1]);
  2729. next = next ? next.split('-') : null;
  2730. while (j > 0) {
  2731. locale = loadLocale(split.slice(0, j).join('-'));
  2732. if (locale) {
  2733. return locale;
  2734. }
  2735. if (
  2736. next &&
  2737. next.length >= j &&
  2738. commonPrefix(split, next) >= j - 1
  2739. ) {
  2740. //the next array item is better than a shallower substring of this one
  2741. break;
  2742. }
  2743. j--;
  2744. }
  2745. i++;
  2746. }
  2747. return globalLocale;
  2748. }
  2749. function loadLocale(name) {
  2750. var oldLocale = null,
  2751. aliasedRequire;
  2752. // TODO: Find a better way to register and load all the locales in Node
  2753. if (
  2754. locales[name] === undefined &&
  2755. typeof module !== 'undefined' &&
  2756. module &&
  2757. module.exports
  2758. ) {
  2759. try {
  2760. oldLocale = globalLocale._abbr;
  2761. aliasedRequire = require;
  2762. aliasedRequire('./locale/' + name);
  2763. getSetGlobalLocale(oldLocale);
  2764. } catch (e) {
  2765. // mark as not found to avoid repeating expensive file require call causing high CPU
  2766. // when trying to find en-US, en_US, en-us for every format call
  2767. locales[name] = null; // null means not found
  2768. }
  2769. }
  2770. return locales[name];
  2771. }
  2772. // This function will load locale and then set the global locale. If
  2773. // no arguments are passed in, it will simply return the current global
  2774. // locale key.
  2775. function getSetGlobalLocale(key, values) {
  2776. var data;
  2777. if (key) {
  2778. if (isUndefined(values)) {
  2779. data = getLocale(key);
  2780. } else {
  2781. data = defineLocale(key, values);
  2782. }
  2783. if (data) {
  2784. // moment.duration._locale = moment._locale = data;
  2785. globalLocale = data;
  2786. } else {
  2787. if (typeof console !== 'undefined' && console.warn) {
  2788. //warn user if arguments are passed but the locale could not be set
  2789. console.warn(
  2790. 'Locale ' + key + ' not found. Did you forget to load it?'
  2791. );
  2792. }
  2793. }
  2794. }
  2795. return globalLocale._abbr;
  2796. }
  2797. function defineLocale(name, config) {
  2798. if (config !== null) {
  2799. var locale,
  2800. parentConfig = baseConfig;
  2801. config.abbr = name;
  2802. if (locales[name] != null) {
  2803. deprecateSimple(
  2804. 'defineLocaleOverride',
  2805. 'use moment.updateLocale(localeName, config) to change ' +
  2806. 'an existing locale. moment.defineLocale(localeName, ' +
  2807. 'config) should only be used for creating a new locale ' +
  2808. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
  2809. );
  2810. parentConfig = locales[name]._config;
  2811. } else if (config.parentLocale != null) {
  2812. if (locales[config.parentLocale] != null) {
  2813. parentConfig = locales[config.parentLocale]._config;
  2814. } else {
  2815. locale = loadLocale(config.parentLocale);
  2816. if (locale != null) {
  2817. parentConfig = locale._config;
  2818. } else {
  2819. if (!localeFamilies[config.parentLocale]) {
  2820. localeFamilies[config.parentLocale] = [];
  2821. }
  2822. localeFamilies[config.parentLocale].push({
  2823. name: name,
  2824. config: config,
  2825. });
  2826. return null;
  2827. }
  2828. }
  2829. }
  2830. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2831. if (localeFamilies[name]) {
  2832. localeFamilies[name].forEach(function (x) {
  2833. defineLocale(x.name, x.config);
  2834. });
  2835. }
  2836. // backwards compat for now: also set the locale
  2837. // make sure we set the locale AFTER all child locales have been
  2838. // created, so we won't end up with the child locale set.
  2839. getSetGlobalLocale(name);
  2840. return locales[name];
  2841. } else {
  2842. // useful for testing
  2843. delete locales[name];
  2844. return null;
  2845. }
  2846. }
  2847. function updateLocale(name, config) {
  2848. if (config != null) {
  2849. var locale,
  2850. tmpLocale,
  2851. parentConfig = baseConfig;
  2852. if (locales[name] != null && locales[name].parentLocale != null) {
  2853. // Update existing child locale in-place to avoid memory-leaks
  2854. locales[name].set(mergeConfigs(locales[name]._config, config));
  2855. } else {
  2856. // MERGE
  2857. tmpLocale = loadLocale(name);
  2858. if (tmpLocale != null) {
  2859. parentConfig = tmpLocale._config;
  2860. }
  2861. config = mergeConfigs(parentConfig, config);
  2862. if (tmpLocale == null) {
  2863. // updateLocale is called for creating a new locale
  2864. // Set abbr so it will have a name (getters return
  2865. // undefined otherwise).
  2866. config.abbr = name;
  2867. }
  2868. locale = new Locale(config);
  2869. locale.parentLocale = locales[name];
  2870. locales[name] = locale;
  2871. }
  2872. // backwards compat for now: also set the locale
  2873. getSetGlobalLocale(name);
  2874. } else {
  2875. // pass null for config to unupdate, useful for tests
  2876. if (locales[name] != null) {
  2877. if (locales[name].parentLocale != null) {
  2878. locales[name] = locales[name].parentLocale;
  2879. if (name === getSetGlobalLocale()) {
  2880. getSetGlobalLocale(name);
  2881. }
  2882. } else if (locales[name] != null) {
  2883. delete locales[name];
  2884. }
  2885. }
  2886. }
  2887. return locales[name];
  2888. }
  2889. // returns locale data
  2890. function getLocale(key) {
  2891. var locale;
  2892. if (key && key._locale && key._locale._abbr) {
  2893. key = key._locale._abbr;
  2894. }
  2895. if (!key) {
  2896. return globalLocale;
  2897. }
  2898. if (!isArray(key)) {
  2899. //short-circuit everything else
  2900. locale = loadLocale(key);
  2901. if (locale) {
  2902. return locale;
  2903. }
  2904. key = [key];
  2905. }
  2906. return chooseLocale(key);
  2907. }
  2908. function listLocales() {
  2909. return keys(locales);
  2910. }
  2911. function checkOverflow(m) {
  2912. var overflow,
  2913. a = m._a;
  2914. if (a && getParsingFlags(m).overflow === -2) {
  2915. overflow =
  2916. a[MONTH] < 0 || a[MONTH] > 11
  2917. ? MONTH
  2918. : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
  2919. ? DATE
  2920. : a[HOUR] < 0 ||
  2921. a[HOUR] > 24 ||
  2922. (a[HOUR] === 24 &&
  2923. (a[MINUTE] !== 0 ||
  2924. a[SECOND] !== 0 ||
  2925. a[MILLISECOND] !== 0))
  2926. ? HOUR
  2927. : a[MINUTE] < 0 || a[MINUTE] > 59
  2928. ? MINUTE
  2929. : a[SECOND] < 0 || a[SECOND] > 59
  2930. ? SECOND
  2931. : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
  2932. ? MILLISECOND
  2933. : -1;
  2934. if (
  2935. getParsingFlags(m)._overflowDayOfYear &&
  2936. (overflow < YEAR || overflow > DATE)
  2937. ) {
  2938. overflow = DATE;
  2939. }
  2940. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2941. overflow = WEEK;
  2942. }
  2943. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2944. overflow = WEEKDAY;
  2945. }
  2946. getParsingFlags(m).overflow = overflow;
  2947. }
  2948. return m;
  2949. }
  2950. // iso 8601 regex
  2951. // 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)
  2952. 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)?)?$/,
  2953. 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)?)?$/,
  2954. tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
  2955. isoDates = [
  2956. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2957. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2958. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2959. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2960. ['YYYY-DDD', /\d{4}-\d{3}/],
  2961. ['YYYY-MM', /\d{4}-\d\d/, false],
  2962. ['YYYYYYMMDD', /[+-]\d{10}/],
  2963. ['YYYYMMDD', /\d{8}/],
  2964. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2965. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2966. ['YYYYDDD', /\d{7}/],
  2967. ['YYYYMM', /\d{6}/, false],
  2968. ['YYYY', /\d{4}/, false],
  2969. ],
  2970. // iso time formats and regexes
  2971. isoTimes = [
  2972. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2973. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2974. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2975. ['HH:mm', /\d\d:\d\d/],
  2976. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2977. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2978. ['HHmmss', /\d\d\d\d\d\d/],
  2979. ['HHmm', /\d\d\d\d/],
  2980. ['HH', /\d\d/],
  2981. ],
  2982. aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
  2983. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  2984. rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
  2985. obsOffsets = {
  2986. UT: 0,
  2987. GMT: 0,
  2988. EDT: -4 * 60,
  2989. EST: -5 * 60,
  2990. CDT: -5 * 60,
  2991. CST: -6 * 60,
  2992. MDT: -6 * 60,
  2993. MST: -7 * 60,
  2994. PDT: -7 * 60,
  2995. PST: -8 * 60,
  2996. };
  2997. // date from iso format
  2998. function configFromISO(config) {
  2999. var i,
  3000. l,
  3001. string = config._i,
  3002. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3003. allowTime,
  3004. dateFormat,
  3005. timeFormat,
  3006. tzFormat;
  3007. if (match) {
  3008. getParsingFlags(config).iso = true;
  3009. for (i = 0, l = isoDates.length; i < l; i++) {
  3010. if (isoDates[i][1].exec(match[1])) {
  3011. dateFormat = isoDates[i][0];
  3012. allowTime = isoDates[i][2] !== false;
  3013. break;
  3014. }
  3015. }
  3016. if (dateFormat == null) {
  3017. config._isValid = false;
  3018. return;
  3019. }
  3020. if (match[3]) {
  3021. for (i = 0, l = isoTimes.length; i < l; i++) {
  3022. if (isoTimes[i][1].exec(match[3])) {
  3023. // match[2] should be 'T' or space
  3024. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3025. break;
  3026. }
  3027. }
  3028. if (timeFormat == null) {
  3029. config._isValid = false;
  3030. return;
  3031. }
  3032. }
  3033. if (!allowTime && timeFormat != null) {
  3034. config._isValid = false;
  3035. return;
  3036. }
  3037. if (match[4]) {
  3038. if (tzRegex.exec(match[4])) {
  3039. tzFormat = 'Z';
  3040. } else {
  3041. config._isValid = false;
  3042. return;
  3043. }
  3044. }
  3045. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3046. configFromStringAndFormat(config);
  3047. } else {
  3048. config._isValid = false;
  3049. }
  3050. }
  3051. function extractFromRFC2822Strings(
  3052. yearStr,
  3053. monthStr,
  3054. dayStr,
  3055. hourStr,
  3056. minuteStr,
  3057. secondStr
  3058. ) {
  3059. var result = [
  3060. untruncateYear(yearStr),
  3061. defaultLocaleMonthsShort.indexOf(monthStr),
  3062. parseInt(dayStr, 10),
  3063. parseInt(hourStr, 10),
  3064. parseInt(minuteStr, 10),
  3065. ];
  3066. if (secondStr) {
  3067. result.push(parseInt(secondStr, 10));
  3068. }
  3069. return result;
  3070. }
  3071. function untruncateYear(yearStr) {
  3072. var year = parseInt(yearStr, 10);
  3073. if (year <= 49) {
  3074. return 2000 + year;
  3075. } else if (year <= 999) {
  3076. return 1900 + year;
  3077. }
  3078. return year;
  3079. }
  3080. function preprocessRFC2822(s) {
  3081. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  3082. return s
  3083. .replace(/\([^)]*\)|[\n\t]/g, ' ')
  3084. .replace(/(\s\s+)/g, ' ')
  3085. .replace(/^\s\s*/, '')
  3086. .replace(/\s\s*$/, '');
  3087. }
  3088. function checkWeekday(weekdayStr, parsedInput, config) {
  3089. if (weekdayStr) {
  3090. // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
  3091. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  3092. weekdayActual = new Date(
  3093. parsedInput[0],
  3094. parsedInput[1],
  3095. parsedInput[2]
  3096. ).getDay();
  3097. if (weekdayProvided !== weekdayActual) {
  3098. getParsingFlags(config).weekdayMismatch = true;
  3099. config._isValid = false;
  3100. return false;
  3101. }
  3102. }
  3103. return true;
  3104. }
  3105. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  3106. if (obsOffset) {
  3107. return obsOffsets[obsOffset];
  3108. } else if (militaryOffset) {
  3109. // the only allowed military tz is Z
  3110. return 0;
  3111. } else {
  3112. var hm = parseInt(numOffset, 10),
  3113. m = hm % 100,
  3114. h = (hm - m) / 100;
  3115. return h * 60 + m;
  3116. }
  3117. }
  3118. // date and time from ref 2822 format
  3119. function configFromRFC2822(config) {
  3120. var match = rfc2822.exec(preprocessRFC2822(config._i)),
  3121. parsedArray;
  3122. if (match) {
  3123. parsedArray = extractFromRFC2822Strings(
  3124. match[4],
  3125. match[3],
  3126. match[2],
  3127. match[5],
  3128. match[6],
  3129. match[7]
  3130. );
  3131. if (!checkWeekday(match[1], parsedArray, config)) {
  3132. return;
  3133. }
  3134. config._a = parsedArray;
  3135. config._tzm = calculateOffset(match[8], match[9], match[10]);
  3136. config._d = createUTCDate.apply(null, config._a);
  3137. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3138. getParsingFlags(config).rfc2822 = true;
  3139. } else {
  3140. config._isValid = false;
  3141. }
  3142. }
  3143. // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
  3144. function configFromString(config) {
  3145. var matched = aspNetJsonRegex.exec(config._i);
  3146. if (matched !== null) {
  3147. config._d = new Date(+matched[1]);
  3148. return;
  3149. }
  3150. configFromISO(config);
  3151. if (config._isValid === false) {
  3152. delete config._isValid;
  3153. } else {
  3154. return;
  3155. }
  3156. configFromRFC2822(config);
  3157. if (config._isValid === false) {
  3158. delete config._isValid;
  3159. } else {
  3160. return;
  3161. }
  3162. if (config._strict) {
  3163. config._isValid = false;
  3164. } else {
  3165. // Final attempt, use Input Fallback
  3166. hooks.createFromInputFallback(config);
  3167. }
  3168. }
  3169. hooks.createFromInputFallback = deprecate(
  3170. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  3171. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  3172. 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3173. function (config) {
  3174. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3175. }
  3176. );
  3177. // Pick the first defined of two or three arguments.
  3178. function defaults(a, b, c) {
  3179. if (a != null) {
  3180. return a;
  3181. }
  3182. if (b != null) {
  3183. return b;
  3184. }
  3185. return c;
  3186. }
  3187. function currentDateArray(config) {
  3188. // hooks is actually the exported moment object
  3189. var nowValue = new Date(hooks.now());
  3190. if (config._useUTC) {
  3191. return [
  3192. nowValue.getUTCFullYear(),
  3193. nowValue.getUTCMonth(),
  3194. nowValue.getUTCDate(),
  3195. ];
  3196. }
  3197. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3198. }
  3199. // convert an array to a date.
  3200. // the array should mirror the parameters below
  3201. // note: all values past the year are optional and will default to the lowest possible value.
  3202. // [year, month, day , hour, minute, second, millisecond]
  3203. function configFromArray(config) {
  3204. var i,
  3205. date,
  3206. input = [],
  3207. currentDate,
  3208. expectedWeekday,
  3209. yearToUse;
  3210. if (config._d) {
  3211. return;
  3212. }
  3213. currentDate = currentDateArray(config);
  3214. //compute day of the year from weeks and weekdays
  3215. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3216. dayOfYearFromWeekInfo(config);
  3217. }
  3218. //if the day of the year is set, figure out what it is
  3219. if (config._dayOfYear != null) {
  3220. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3221. if (
  3222. config._dayOfYear > daysInYear(yearToUse) ||
  3223. config._dayOfYear === 0
  3224. ) {
  3225. getParsingFlags(config)._overflowDayOfYear = true;
  3226. }
  3227. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3228. config._a[MONTH] = date.getUTCMonth();
  3229. config._a[DATE] = date.getUTCDate();
  3230. }
  3231. // Default to current date.
  3232. // * if no year, month, day of month are given, default to today
  3233. // * if day of month is given, default month and year
  3234. // * if month is given, default only year
  3235. // * if year is given, don't default anything
  3236. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3237. config._a[i] = input[i] = currentDate[i];
  3238. }
  3239. // Zero out whatever was not defaulted, including time
  3240. for (; i < 7; i++) {
  3241. config._a[i] = input[i] =
  3242. config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
  3243. }
  3244. // Check for 24:00:00.000
  3245. if (
  3246. config._a[HOUR] === 24 &&
  3247. config._a[MINUTE] === 0 &&
  3248. config._a[SECOND] === 0 &&
  3249. config._a[MILLISECOND] === 0
  3250. ) {
  3251. config._nextDay = true;
  3252. config._a[HOUR] = 0;
  3253. }
  3254. config._d = (config._useUTC ? createUTCDate : createDate).apply(
  3255. null,
  3256. input
  3257. );
  3258. expectedWeekday = config._useUTC
  3259. ? config._d.getUTCDay()
  3260. : config._d.getDay();
  3261. // Apply timezone offset from input. The actual utcOffset can be changed
  3262. // with parseZone.
  3263. if (config._tzm != null) {
  3264. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3265. }
  3266. if (config._nextDay) {
  3267. config._a[HOUR] = 24;
  3268. }
  3269. // check for mismatching day of week
  3270. if (
  3271. config._w &&
  3272. typeof config._w.d !== 'undefined' &&
  3273. config._w.d !== expectedWeekday
  3274. ) {
  3275. getParsingFlags(config).weekdayMismatch = true;
  3276. }
  3277. }
  3278. function dayOfYearFromWeekInfo(config) {
  3279. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  3280. w = config._w;
  3281. if (w.GG != null || w.W != null || w.E != null) {
  3282. dow = 1;
  3283. doy = 4;
  3284. // TODO: We need to take the current isoWeekYear, but that depends on
  3285. // how we interpret now (local, utc, fixed offset). So create
  3286. // a now version of current config (take local/utc/offset flags, and
  3287. // create now).
  3288. weekYear = defaults(
  3289. w.GG,
  3290. config._a[YEAR],
  3291. weekOfYear(createLocal(), 1, 4).year
  3292. );
  3293. week = defaults(w.W, 1);
  3294. weekday = defaults(w.E, 1);
  3295. if (weekday < 1 || weekday > 7) {
  3296. weekdayOverflow = true;
  3297. }
  3298. } else {
  3299. dow = config._locale._week.dow;
  3300. doy = config._locale._week.doy;
  3301. curWeek = weekOfYear(createLocal(), dow, doy);
  3302. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3303. // Default to current week.
  3304. week = defaults(w.w, curWeek.week);
  3305. if (w.d != null) {
  3306. // weekday -- low day numbers are considered next week
  3307. weekday = w.d;
  3308. if (weekday < 0 || weekday > 6) {
  3309. weekdayOverflow = true;
  3310. }
  3311. } else if (w.e != null) {
  3312. // local weekday -- counting starts from beginning of week
  3313. weekday = w.e + dow;
  3314. if (w.e < 0 || w.e > 6) {
  3315. weekdayOverflow = true;
  3316. }
  3317. } else {
  3318. // default to beginning of week
  3319. weekday = dow;
  3320. }
  3321. }
  3322. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3323. getParsingFlags(config)._overflowWeeks = true;
  3324. } else if (weekdayOverflow != null) {
  3325. getParsingFlags(config)._overflowWeekday = true;
  3326. } else {
  3327. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3328. config._a[YEAR] = temp.year;
  3329. config._dayOfYear = temp.dayOfYear;
  3330. }
  3331. }
  3332. // constant that refers to the ISO standard
  3333. hooks.ISO_8601 = function () {};
  3334. // constant that refers to the RFC 2822 form
  3335. hooks.RFC_2822 = function () {};
  3336. // date from string and format string
  3337. function configFromStringAndFormat(config) {
  3338. // TODO: Move this to another part of the creation flow to prevent circular deps
  3339. if (config._f === hooks.ISO_8601) {
  3340. configFromISO(config);
  3341. return;
  3342. }
  3343. if (config._f === hooks.RFC_2822) {
  3344. configFromRFC2822(config);
  3345. return;
  3346. }
  3347. config._a = [];
  3348. getParsingFlags(config).empty = true;
  3349. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3350. var string = '' + config._i,
  3351. i,
  3352. parsedInput,
  3353. tokens,
  3354. token,
  3355. skipped,
  3356. stringLength = string.length,
  3357. totalParsedInputLength = 0,
  3358. era;
  3359. tokens =
  3360. expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3361. for (i = 0; i < tokens.length; i++) {
  3362. token = tokens[i];
  3363. parsedInput = (string.match(getParseRegexForToken(token, config)) ||
  3364. [])[0];
  3365. if (parsedInput) {
  3366. skipped = string.substr(0, string.indexOf(parsedInput));
  3367. if (skipped.length > 0) {
  3368. getParsingFlags(config).unusedInput.push(skipped);
  3369. }
  3370. string = string.slice(
  3371. string.indexOf(parsedInput) + parsedInput.length
  3372. );
  3373. totalParsedInputLength += parsedInput.length;
  3374. }
  3375. // don't parse if it's not a known token
  3376. if (formatTokenFunctions[token]) {
  3377. if (parsedInput) {
  3378. getParsingFlags(config).empty = false;
  3379. } else {
  3380. getParsingFlags(config).unusedTokens.push(token);
  3381. }
  3382. addTimeToArrayFromToken(token, parsedInput, config);
  3383. } else if (config._strict && !parsedInput) {
  3384. getParsingFlags(config).unusedTokens.push(token);
  3385. }
  3386. }
  3387. // add remaining unparsed input length to the string
  3388. getParsingFlags(config).charsLeftOver =
  3389. stringLength - totalParsedInputLength;
  3390. if (string.length > 0) {
  3391. getParsingFlags(config).unusedInput.push(string);
  3392. }
  3393. // clear _12h flag if hour is <= 12
  3394. if (
  3395. config._a[HOUR] <= 12 &&
  3396. getParsingFlags(config).bigHour === true &&
  3397. config._a[HOUR] > 0
  3398. ) {
  3399. getParsingFlags(config).bigHour = undefined;
  3400. }
  3401. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3402. getParsingFlags(config).meridiem = config._meridiem;
  3403. // handle meridiem
  3404. config._a[HOUR] = meridiemFixWrap(
  3405. config._locale,
  3406. config._a[HOUR],
  3407. config._meridiem
  3408. );
  3409. // handle era
  3410. era = getParsingFlags(config).era;
  3411. if (era !== null) {
  3412. config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
  3413. }
  3414. configFromArray(config);
  3415. checkOverflow(config);
  3416. }
  3417. function meridiemFixWrap(locale, hour, meridiem) {
  3418. var isPm;
  3419. if (meridiem == null) {
  3420. // nothing to do
  3421. return hour;
  3422. }
  3423. if (locale.meridiemHour != null) {
  3424. return locale.meridiemHour(hour, meridiem);
  3425. } else if (locale.isPM != null) {
  3426. // Fallback
  3427. isPm = locale.isPM(meridiem);
  3428. if (isPm && hour < 12) {
  3429. hour += 12;
  3430. }
  3431. if (!isPm && hour === 12) {
  3432. hour = 0;
  3433. }
  3434. return hour;
  3435. } else {
  3436. // this is not supposed to happen
  3437. return hour;
  3438. }
  3439. }
  3440. // date from string and array of format strings
  3441. function configFromStringAndArray(config) {
  3442. var tempConfig,
  3443. bestMoment,
  3444. scoreToBeat,
  3445. i,
  3446. currentScore,
  3447. validFormatFound,
  3448. bestFormatIsValid = false;
  3449. if (config._f.length === 0) {
  3450. getParsingFlags(config).invalidFormat = true;
  3451. config._d = new Date(NaN);
  3452. return;
  3453. }
  3454. for (i = 0; i < config._f.length; i++) {
  3455. currentScore = 0;
  3456. validFormatFound = false;
  3457. tempConfig = copyConfig({}, config);
  3458. if (config._useUTC != null) {
  3459. tempConfig._useUTC = config._useUTC;
  3460. }
  3461. tempConfig._f = config._f[i];
  3462. configFromStringAndFormat(tempConfig);
  3463. if (isValid(tempConfig)) {
  3464. validFormatFound = true;
  3465. }
  3466. // if there is any input that was not parsed add a penalty for that format
  3467. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3468. //or tokens
  3469. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3470. getParsingFlags(tempConfig).score = currentScore;
  3471. if (!bestFormatIsValid) {
  3472. if (
  3473. scoreToBeat == null ||
  3474. currentScore < scoreToBeat ||
  3475. validFormatFound
  3476. ) {
  3477. scoreToBeat = currentScore;
  3478. bestMoment = tempConfig;
  3479. if (validFormatFound) {
  3480. bestFormatIsValid = true;
  3481. }
  3482. }
  3483. } else {
  3484. if (currentScore < scoreToBeat) {
  3485. scoreToBeat = currentScore;
  3486. bestMoment = tempConfig;
  3487. }
  3488. }
  3489. }
  3490. extend(config, bestMoment || tempConfig);
  3491. }
  3492. function configFromObject(config) {
  3493. if (config._d) {
  3494. return;
  3495. }
  3496. var i = normalizeObjectUnits(config._i),
  3497. dayOrDate = i.day === undefined ? i.date : i.day;
  3498. config._a = map(
  3499. [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  3500. function (obj) {
  3501. return obj && parseInt(obj, 10);
  3502. }
  3503. );
  3504. configFromArray(config);
  3505. }
  3506. function createFromConfig(config) {
  3507. var res = new Moment(checkOverflow(prepareConfig(config)));
  3508. if (res._nextDay) {
  3509. // Adding is smart enough around DST
  3510. res.add(1, 'd');
  3511. res._nextDay = undefined;
  3512. }
  3513. return res;
  3514. }
  3515. function prepareConfig(config) {
  3516. var input = config._i,
  3517. format = config._f;
  3518. config._locale = config._locale || getLocale(config._l);
  3519. if (input === null || (format === undefined && input === '')) {
  3520. return createInvalid({ nullInput: true });
  3521. }
  3522. if (typeof input === 'string') {
  3523. config._i = input = config._locale.preparse(input);
  3524. }
  3525. if (isMoment(input)) {
  3526. return new Moment(checkOverflow(input));
  3527. } else if (isDate(input)) {
  3528. config._d = input;
  3529. } else if (isArray(format)) {
  3530. configFromStringAndArray(config);
  3531. } else if (format) {
  3532. configFromStringAndFormat(config);
  3533. } else {
  3534. configFromInput(config);
  3535. }
  3536. if (!isValid(config)) {
  3537. config._d = null;
  3538. }
  3539. return config;
  3540. }
  3541. function configFromInput(config) {
  3542. var input = config._i;
  3543. if (isUndefined(input)) {
  3544. config._d = new Date(hooks.now());
  3545. } else if (isDate(input)) {
  3546. config._d = new Date(input.valueOf());
  3547. } else if (typeof input === 'string') {
  3548. configFromString(config);
  3549. } else if (isArray(input)) {
  3550. config._a = map(input.slice(0), function (obj) {
  3551. return parseInt(obj, 10);
  3552. });
  3553. configFromArray(config);
  3554. } else if (isObject(input)) {
  3555. configFromObject(config);
  3556. } else if (isNumber(input)) {
  3557. // from milliseconds
  3558. config._d = new Date(input);
  3559. } else {
  3560. hooks.createFromInputFallback(config);
  3561. }
  3562. }
  3563. function createLocalOrUTC(input, format, locale, strict, isUTC) {
  3564. var c = {};
  3565. if (format === true || format === false) {
  3566. strict = format;
  3567. format = undefined;
  3568. }
  3569. if (locale === true || locale === false) {
  3570. strict = locale;
  3571. locale = undefined;
  3572. }
  3573. if (
  3574. (isObject(input) && isObjectEmpty(input)) ||
  3575. (isArray(input) && input.length === 0)
  3576. ) {
  3577. input = undefined;
  3578. }
  3579. // object construction must be done this way.
  3580. // https://github.com/moment/moment/issues/1423
  3581. c._isAMomentObject = true;
  3582. c._useUTC = c._isUTC = isUTC;
  3583. c._l = locale;
  3584. c._i = input;
  3585. c._f = format;
  3586. c._strict = strict;
  3587. return createFromConfig(c);
  3588. }
  3589. function createLocal(input, format, locale, strict) {
  3590. return createLocalOrUTC(input, format, locale, strict, false);
  3591. }
  3592. var prototypeMin = deprecate(
  3593. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3594. function () {
  3595. var other = createLocal.apply(null, arguments);
  3596. if (this.isValid() && other.isValid()) {
  3597. return other < this ? this : other;
  3598. } else {
  3599. return createInvalid();
  3600. }
  3601. }
  3602. ),
  3603. prototypeMax = deprecate(
  3604. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3605. function () {
  3606. var other = createLocal.apply(null, arguments);
  3607. if (this.isValid() && other.isValid()) {
  3608. return other > this ? this : other;
  3609. } else {
  3610. return createInvalid();
  3611. }
  3612. }
  3613. );
  3614. // Pick a moment m from moments so that m[fn](other) is true for all
  3615. // other. This relies on the function fn to be transitive.
  3616. //
  3617. // moments should either be an array of moment objects or an array, whose
  3618. // first element is an array of moment objects.
  3619. function pickBy(fn, moments) {
  3620. var res, i;
  3621. if (moments.length === 1 && isArray(moments[0])) {
  3622. moments = moments[0];
  3623. }
  3624. if (!moments.length) {
  3625. return createLocal();
  3626. }
  3627. res = moments[0];
  3628. for (i = 1; i < moments.length; ++i) {
  3629. if (!moments[i].isValid() || moments[i][fn](res)) {
  3630. res = moments[i];
  3631. }
  3632. }
  3633. return res;
  3634. }
  3635. // TODO: Use [].sort instead?
  3636. function min() {
  3637. var args = [].slice.call(arguments, 0);
  3638. return pickBy('isBefore', args);
  3639. }
  3640. function max() {
  3641. var args = [].slice.call(arguments, 0);
  3642. return pickBy('isAfter', args);
  3643. }
  3644. var now = function () {
  3645. return Date.now ? Date.now() : +new Date();
  3646. };
  3647. var ordering = [
  3648. 'year',
  3649. 'quarter',
  3650. 'month',
  3651. 'week',
  3652. 'day',
  3653. 'hour',
  3654. 'minute',
  3655. 'second',
  3656. 'millisecond',
  3657. ];
  3658. function isDurationValid(m) {
  3659. var key,
  3660. unitHasDecimal = false,
  3661. i;
  3662. for (key in m) {
  3663. if (
  3664. hasOwnProp(m, key) &&
  3665. !(
  3666. indexOf.call(ordering, key) !== -1 &&
  3667. (m[key] == null || !isNaN(m[key]))
  3668. )
  3669. ) {
  3670. return false;
  3671. }
  3672. }
  3673. for (i = 0; i < ordering.length; ++i) {
  3674. if (m[ordering[i]]) {
  3675. if (unitHasDecimal) {
  3676. return false; // only allow non-integers for smallest unit
  3677. }
  3678. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  3679. unitHasDecimal = true;
  3680. }
  3681. }
  3682. }
  3683. return true;
  3684. }
  3685. function isValid$1() {
  3686. return this._isValid;
  3687. }
  3688. function createInvalid$1() {
  3689. return createDuration(NaN);
  3690. }
  3691. function Duration(duration) {
  3692. var normalizedInput = normalizeObjectUnits(duration),
  3693. years = normalizedInput.year || 0,
  3694. quarters = normalizedInput.quarter || 0,
  3695. months = normalizedInput.month || 0,
  3696. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  3697. days = normalizedInput.day || 0,
  3698. hours = normalizedInput.hour || 0,
  3699. minutes = normalizedInput.minute || 0,
  3700. seconds = normalizedInput.second || 0,
  3701. milliseconds = normalizedInput.millisecond || 0;
  3702. this._isValid = isDurationValid(normalizedInput);
  3703. // representation for dateAddRemove
  3704. this._milliseconds =
  3705. +milliseconds +
  3706. seconds * 1e3 + // 1000
  3707. minutes * 6e4 + // 1000 * 60
  3708. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3709. // Because of dateAddRemove treats 24 hours as different from a
  3710. // day when working around DST, we need to store them separately
  3711. this._days = +days + weeks * 7;
  3712. // It is impossible to translate months into days without knowing
  3713. // which months you are are talking about, so we have to store
  3714. // it separately.
  3715. this._months = +months + quarters * 3 + years * 12;
  3716. this._data = {};
  3717. this._locale = getLocale();
  3718. this._bubble();
  3719. }
  3720. function isDuration(obj) {
  3721. return obj instanceof Duration;
  3722. }
  3723. function absRound(number) {
  3724. if (number < 0) {
  3725. return Math.round(-1 * number) * -1;
  3726. } else {
  3727. return Math.round(number);
  3728. }
  3729. }
  3730. // compare two arrays, return the number of differences
  3731. function compareArrays(array1, array2, dontConvert) {
  3732. var len = Math.min(array1.length, array2.length),
  3733. lengthDiff = Math.abs(array1.length - array2.length),
  3734. diffs = 0,
  3735. i;
  3736. for (i = 0; i < len; i++) {
  3737. if (
  3738. (dontConvert && array1[i] !== array2[i]) ||
  3739. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
  3740. ) {
  3741. diffs++;
  3742. }
  3743. }
  3744. return diffs + lengthDiff;
  3745. }
  3746. // FORMATTING
  3747. function offset(token, separator) {
  3748. addFormatToken(token, 0, 0, function () {
  3749. var offset = this.utcOffset(),
  3750. sign = '+';
  3751. if (offset < 0) {
  3752. offset = -offset;
  3753. sign = '-';
  3754. }
  3755. return (
  3756. sign +
  3757. zeroFill(~~(offset / 60), 2) +
  3758. separator +
  3759. zeroFill(~~offset % 60, 2)
  3760. );
  3761. });
  3762. }
  3763. offset('Z', ':');
  3764. offset('ZZ', '');
  3765. // PARSING
  3766. addRegexToken('Z', matchShortOffset);
  3767. addRegexToken('ZZ', matchShortOffset);
  3768. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3769. config._useUTC = true;
  3770. config._tzm = offsetFromString(matchShortOffset, input);
  3771. });
  3772. // HELPERS
  3773. // timezone chunker
  3774. // '+10:00' > ['10', '00']
  3775. // '-1530' > ['-15', '30']
  3776. var chunkOffset = /([\+\-]|\d\d)/gi;
  3777. function offsetFromString(matcher, string) {
  3778. var matches = (string || '').match(matcher),
  3779. chunk,
  3780. parts,
  3781. minutes;
  3782. if (matches === null) {
  3783. return null;
  3784. }
  3785. chunk = matches[matches.length - 1] || [];
  3786. parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3787. minutes = +(parts[1] * 60) + toInt(parts[2]);
  3788. return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
  3789. }
  3790. // Return a moment from input, that is local/utc/zone equivalent to model.
  3791. function cloneWithOffset(input, model) {
  3792. var res, diff;
  3793. if (model._isUTC) {
  3794. res = model.clone();
  3795. diff =
  3796. (isMoment(input) || isDate(input)
  3797. ? input.valueOf()
  3798. : createLocal(input).valueOf()) - res.valueOf();
  3799. // Use low-level api, because this fn is low-level api.
  3800. res._d.setTime(res._d.valueOf() + diff);
  3801. hooks.updateOffset(res, false);
  3802. return res;
  3803. } else {
  3804. return createLocal(input).local();
  3805. }
  3806. }
  3807. function getDateOffset(m) {
  3808. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3809. // https://github.com/moment/moment/pull/1871
  3810. return -Math.round(m._d.getTimezoneOffset());
  3811. }
  3812. // HOOKS
  3813. // This function will be called whenever a moment is mutated.
  3814. // It is intended to keep the offset in sync with the timezone.
  3815. hooks.updateOffset = function () {};
  3816. // MOMENTS
  3817. // keepLocalTime = true means only change the timezone, without
  3818. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3819. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3820. // +0200, so we adjust the time as needed, to be valid.
  3821. //
  3822. // Keeping the time actually adds/subtracts (one hour)
  3823. // from the actual represented time. That is why we call updateOffset
  3824. // a second time. In case it wants us to change the offset again
  3825. // _changeInProgress == true case, then we have to adjust, because
  3826. // there is no such time in the given timezone.
  3827. function getSetOffset(input, keepLocalTime, keepMinutes) {
  3828. var offset = this._offset || 0,
  3829. localAdjust;
  3830. if (!this.isValid()) {
  3831. return input != null ? this : NaN;
  3832. }
  3833. if (input != null) {
  3834. if (typeof input === 'string') {
  3835. input = offsetFromString(matchShortOffset, input);
  3836. if (input === null) {
  3837. return this;
  3838. }
  3839. } else if (Math.abs(input) < 16 && !keepMinutes) {
  3840. input = input * 60;
  3841. }
  3842. if (!this._isUTC && keepLocalTime) {
  3843. localAdjust = getDateOffset(this);
  3844. }
  3845. this._offset = input;
  3846. this._isUTC = true;
  3847. if (localAdjust != null) {
  3848. this.add(localAdjust, 'm');
  3849. }
  3850. if (offset !== input) {
  3851. if (!keepLocalTime || this._changeInProgress) {
  3852. addSubtract(
  3853. this,
  3854. createDuration(input - offset, 'm'),
  3855. 1,
  3856. false
  3857. );
  3858. } else if (!this._changeInProgress) {
  3859. this._changeInProgress = true;
  3860. hooks.updateOffset(this, true);
  3861. this._changeInProgress = null;
  3862. }
  3863. }
  3864. return this;
  3865. } else {
  3866. return this._isUTC ? offset : getDateOffset(this);
  3867. }
  3868. }
  3869. function getSetZone(input, keepLocalTime) {
  3870. if (input != null) {
  3871. if (typeof input !== 'string') {
  3872. input = -input;
  3873. }
  3874. this.utcOffset(input, keepLocalTime);
  3875. return this;
  3876. } else {
  3877. return -this.utcOffset();
  3878. }
  3879. }
  3880. function setOffsetToUTC(keepLocalTime) {
  3881. return this.utcOffset(0, keepLocalTime);
  3882. }
  3883. function setOffsetToLocal(keepLocalTime) {
  3884. if (this._isUTC) {
  3885. this.utcOffset(0, keepLocalTime);
  3886. this._isUTC = false;
  3887. if (keepLocalTime) {
  3888. this.subtract(getDateOffset(this), 'm');
  3889. }
  3890. }
  3891. return this;
  3892. }
  3893. function setOffsetToParsedOffset() {
  3894. if (this._tzm != null) {
  3895. this.utcOffset(this._tzm, false, true);
  3896. } else if (typeof this._i === 'string') {
  3897. var tZone = offsetFromString(matchOffset, this._i);
  3898. if (tZone != null) {
  3899. this.utcOffset(tZone);
  3900. } else {
  3901. this.utcOffset(0, true);
  3902. }
  3903. }
  3904. return this;
  3905. }
  3906. function hasAlignedHourOffset(input) {
  3907. if (!this.isValid()) {
  3908. return false;
  3909. }
  3910. input = input ? createLocal(input).utcOffset() : 0;
  3911. return (this.utcOffset() - input) % 60 === 0;
  3912. }
  3913. function isDaylightSavingTime() {
  3914. return (
  3915. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3916. this.utcOffset() > this.clone().month(5).utcOffset()
  3917. );
  3918. }
  3919. function isDaylightSavingTimeShifted() {
  3920. if (!isUndefined(this._isDSTShifted)) {
  3921. return this._isDSTShifted;
  3922. }
  3923. var c = {},
  3924. other;
  3925. copyConfig(c, this);
  3926. c = prepareConfig(c);
  3927. if (c._a) {
  3928. other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  3929. this._isDSTShifted =
  3930. this.isValid() && compareArrays(c._a, other.toArray()) > 0;
  3931. } else {
  3932. this._isDSTShifted = false;
  3933. }
  3934. return this._isDSTShifted;
  3935. }
  3936. function isLocal() {
  3937. return this.isValid() ? !this._isUTC : false;
  3938. }
  3939. function isUtcOffset() {
  3940. return this.isValid() ? this._isUTC : false;
  3941. }
  3942. function isUtc() {
  3943. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3944. }
  3945. // ASP.NET json date format regex
  3946. var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
  3947. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3948. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3949. // and further modified to allow for strings containing both week and day
  3950. isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  3951. function createDuration(input, key) {
  3952. var duration = input,
  3953. // matching against regexp is expensive, do it on demand
  3954. match = null,
  3955. sign,
  3956. ret,
  3957. diffRes;
  3958. if (isDuration(input)) {
  3959. duration = {
  3960. ms: input._milliseconds,
  3961. d: input._days,
  3962. M: input._months,
  3963. };
  3964. } else if (isNumber(input) || !isNaN(+input)) {
  3965. duration = {};
  3966. if (key) {
  3967. duration[key] = +input;
  3968. } else {
  3969. duration.milliseconds = +input;
  3970. }
  3971. } else if ((match = aspNetRegex.exec(input))) {
  3972. sign = match[1] === '-' ? -1 : 1;
  3973. duration = {
  3974. y: 0,
  3975. d: toInt(match[DATE]) * sign,
  3976. h: toInt(match[HOUR]) * sign,
  3977. m: toInt(match[MINUTE]) * sign,
  3978. s: toInt(match[SECOND]) * sign,
  3979. ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
  3980. };
  3981. } else if ((match = isoRegex.exec(input))) {
  3982. sign = match[1] === '-' ? -1 : 1;
  3983. duration = {
  3984. y: parseIso(match[2], sign),
  3985. M: parseIso(match[3], sign),
  3986. w: parseIso(match[4], sign),
  3987. d: parseIso(match[5], sign),
  3988. h: parseIso(match[6], sign),
  3989. m: parseIso(match[7], sign),
  3990. s: parseIso(match[8], sign),
  3991. };
  3992. } else if (duration == null) {
  3993. // checks for null or undefined
  3994. duration = {};
  3995. } else if (
  3996. typeof duration === 'object' &&
  3997. ('from' in duration || 'to' in duration)
  3998. ) {
  3999. diffRes = momentsDifference(
  4000. createLocal(duration.from),
  4001. createLocal(duration.to)
  4002. );
  4003. duration = {};
  4004. duration.ms = diffRes.milliseconds;
  4005. duration.M = diffRes.months;
  4006. }
  4007. ret = new Duration(duration);
  4008. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4009. ret._locale = input._locale;
  4010. }
  4011. if (isDuration(input) && hasOwnProp(input, '_isValid')) {
  4012. ret._isValid = input._isValid;
  4013. }
  4014. return ret;
  4015. }
  4016. createDuration.fn = Duration.prototype;
  4017. createDuration.invalid = createInvalid$1;
  4018. function parseIso(inp, sign) {
  4019. // We'd normally use ~~inp for this, but unfortunately it also
  4020. // converts floats to ints.
  4021. // inp may be undefined, so careful calling replace on it.
  4022. var res = inp && parseFloat(inp.replace(',', '.'));
  4023. // apply sign while we're at it
  4024. return (isNaN(res) ? 0 : res) * sign;
  4025. }
  4026. function positiveMomentsDifference(base, other) {
  4027. var res = {};
  4028. res.months =
  4029. other.month() - base.month() + (other.year() - base.year()) * 12;
  4030. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4031. --res.months;
  4032. }
  4033. res.milliseconds = +other - +base.clone().add(res.months, 'M');
  4034. return res;
  4035. }
  4036. function momentsDifference(base, other) {
  4037. var res;
  4038. if (!(base.isValid() && other.isValid())) {
  4039. return { milliseconds: 0, months: 0 };
  4040. }
  4041. other = cloneWithOffset(other, base);
  4042. if (base.isBefore(other)) {
  4043. res = positiveMomentsDifference(base, other);
  4044. } else {
  4045. res = positiveMomentsDifference(other, base);
  4046. res.milliseconds = -res.milliseconds;
  4047. res.months = -res.months;
  4048. }
  4049. return res;
  4050. }
  4051. // TODO: remove 'name' arg after deprecation is removed
  4052. function createAdder(direction, name) {
  4053. return function (val, period) {
  4054. var dur, tmp;
  4055. //invert the arguments, but complain about it
  4056. if (period !== null && !isNaN(+period)) {
  4057. deprecateSimple(
  4058. name,
  4059. 'moment().' +
  4060. name +
  4061. '(period, number) is deprecated. Please use moment().' +
  4062. name +
  4063. '(number, period). ' +
  4064. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
  4065. );
  4066. tmp = val;
  4067. val = period;
  4068. period = tmp;
  4069. }
  4070. dur = createDuration(val, period);
  4071. addSubtract(this, dur, direction);
  4072. return this;
  4073. };
  4074. }
  4075. function addSubtract(mom, duration, isAdding, updateOffset) {
  4076. var milliseconds = duration._milliseconds,
  4077. days = absRound(duration._days),
  4078. months = absRound(duration._months);
  4079. if (!mom.isValid()) {
  4080. // No op
  4081. return;
  4082. }
  4083. updateOffset = updateOffset == null ? true : updateOffset;
  4084. if (months) {
  4085. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4086. }
  4087. if (days) {
  4088. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4089. }
  4090. if (milliseconds) {
  4091. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4092. }
  4093. if (updateOffset) {
  4094. hooks.updateOffset(mom, days || months);
  4095. }
  4096. }
  4097. var add = createAdder(1, 'add'),
  4098. subtract = createAdder(-1, 'subtract');
  4099. function isString(input) {
  4100. return typeof input === 'string' || input instanceof String;
  4101. }
  4102. // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
  4103. function isMomentInput(input) {
  4104. return (
  4105. isMoment(input) ||
  4106. isDate(input) ||
  4107. isString(input) ||
  4108. isNumber(input) ||
  4109. isNumberOrStringArray(input) ||
  4110. isMomentInputObject(input) ||
  4111. input === null ||
  4112. input === undefined
  4113. );
  4114. }
  4115. function isMomentInputObject(input) {
  4116. var objectTest = isObject(input) && !isObjectEmpty(input),
  4117. propertyTest = false,
  4118. properties = [
  4119. 'years',
  4120. 'year',
  4121. 'y',
  4122. 'months',
  4123. 'month',
  4124. 'M',
  4125. 'days',
  4126. 'day',
  4127. 'd',
  4128. 'dates',
  4129. 'date',
  4130. 'D',
  4131. 'hours',
  4132. 'hour',
  4133. 'h',
  4134. 'minutes',
  4135. 'minute',
  4136. 'm',
  4137. 'seconds',
  4138. 'second',
  4139. 's',
  4140. 'milliseconds',
  4141. 'millisecond',
  4142. 'ms',
  4143. ],
  4144. i,
  4145. property;
  4146. for (i = 0; i < properties.length; i += 1) {
  4147. property = properties[i];
  4148. propertyTest = propertyTest || hasOwnProp(input, property);
  4149. }
  4150. return objectTest && propertyTest;
  4151. }
  4152. function isNumberOrStringArray(input) {
  4153. var arrayTest = isArray(input),
  4154. dataTypeTest = false;
  4155. if (arrayTest) {
  4156. dataTypeTest =
  4157. input.filter(function (item) {
  4158. return !isNumber(item) && isString(input);
  4159. }).length === 0;
  4160. }
  4161. return arrayTest && dataTypeTest;
  4162. }
  4163. function isCalendarSpec(input) {
  4164. var objectTest = isObject(input) && !isObjectEmpty(input),
  4165. propertyTest = false,
  4166. properties = [
  4167. 'sameDay',
  4168. 'nextDay',
  4169. 'lastDay',
  4170. 'nextWeek',
  4171. 'lastWeek',
  4172. 'sameElse',
  4173. ],
  4174. i,
  4175. property;
  4176. for (i = 0; i < properties.length; i += 1) {
  4177. property = properties[i];
  4178. propertyTest = propertyTest || hasOwnProp(input, property);
  4179. }
  4180. return objectTest && propertyTest;
  4181. }
  4182. function getCalendarFormat(myMoment, now) {
  4183. var diff = myMoment.diff(now, 'days', true);
  4184. return diff < -6
  4185. ? 'sameElse'
  4186. : diff < -1
  4187. ? 'lastWeek'
  4188. : diff < 0
  4189. ? 'lastDay'
  4190. : diff < 1
  4191. ? 'sameDay'
  4192. : diff < 2
  4193. ? 'nextDay'
  4194. : diff < 7
  4195. ? 'nextWeek'
  4196. : 'sameElse';
  4197. }
  4198. function calendar$1(time, formats) {
  4199. // Support for single parameter, formats only overload to the calendar function
  4200. if (arguments.length === 1) {
  4201. if (!arguments[0]) {
  4202. time = undefined;
  4203. formats = undefined;
  4204. } else if (isMomentInput(arguments[0])) {
  4205. time = arguments[0];
  4206. formats = undefined;
  4207. } else if (isCalendarSpec(arguments[0])) {
  4208. formats = arguments[0];
  4209. time = undefined;
  4210. }
  4211. }
  4212. // We want to compare the start of today, vs this.
  4213. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4214. var now = time || createLocal(),
  4215. sod = cloneWithOffset(now, this).startOf('day'),
  4216. format = hooks.calendarFormat(this, sod) || 'sameElse',
  4217. output =
  4218. formats &&
  4219. (isFunction(formats[format])
  4220. ? formats[format].call(this, now)
  4221. : formats[format]);
  4222. return this.format(
  4223. output || this.localeData().calendar(format, this, createLocal(now))
  4224. );
  4225. }
  4226. function clone() {
  4227. return new Moment(this);
  4228. }
  4229. function isAfter(input, units) {
  4230. var localInput = isMoment(input) ? input : createLocal(input);
  4231. if (!(this.isValid() && localInput.isValid())) {
  4232. return false;
  4233. }
  4234. units = normalizeUnits(units) || 'millisecond';
  4235. if (units === 'millisecond') {
  4236. return this.valueOf() > localInput.valueOf();
  4237. } else {
  4238. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4239. }
  4240. }
  4241. function isBefore(input, units) {
  4242. var localInput = isMoment(input) ? input : createLocal(input);
  4243. if (!(this.isValid() && localInput.isValid())) {
  4244. return false;
  4245. }
  4246. units = normalizeUnits(units) || 'millisecond';
  4247. if (units === 'millisecond') {
  4248. return this.valueOf() < localInput.valueOf();
  4249. } else {
  4250. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4251. }
  4252. }
  4253. function isBetween(from, to, units, inclusivity) {
  4254. var localFrom = isMoment(from) ? from : createLocal(from),
  4255. localTo = isMoment(to) ? to : createLocal(to);
  4256. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  4257. return false;
  4258. }
  4259. inclusivity = inclusivity || '()';
  4260. return (
  4261. (inclusivity[0] === '('
  4262. ? this.isAfter(localFrom, units)
  4263. : !this.isBefore(localFrom, units)) &&
  4264. (inclusivity[1] === ')'
  4265. ? this.isBefore(localTo, units)
  4266. : !this.isAfter(localTo, units))
  4267. );
  4268. }
  4269. function isSame(input, units) {
  4270. var localInput = isMoment(input) ? input : createLocal(input),
  4271. inputMs;
  4272. if (!(this.isValid() && localInput.isValid())) {
  4273. return false;
  4274. }
  4275. units = normalizeUnits(units) || 'millisecond';
  4276. if (units === 'millisecond') {
  4277. return this.valueOf() === localInput.valueOf();
  4278. } else {
  4279. inputMs = localInput.valueOf();
  4280. return (
  4281. this.clone().startOf(units).valueOf() <= inputMs &&
  4282. inputMs <= this.clone().endOf(units).valueOf()
  4283. );
  4284. }
  4285. }
  4286. function isSameOrAfter(input, units) {
  4287. return this.isSame(input, units) || this.isAfter(input, units);
  4288. }
  4289. function isSameOrBefore(input, units) {
  4290. return this.isSame(input, units) || this.isBefore(input, units);
  4291. }
  4292. function diff(input, units, asFloat) {
  4293. var that, zoneDelta, output;
  4294. if (!this.isValid()) {
  4295. return NaN;
  4296. }
  4297. that = cloneWithOffset(input, this);
  4298. if (!that.isValid()) {
  4299. return NaN;
  4300. }
  4301. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4302. units = normalizeUnits(units);
  4303. switch (units) {
  4304. case 'year':
  4305. output = monthDiff(this, that) / 12;
  4306. break;
  4307. case 'month':
  4308. output = monthDiff(this, that);
  4309. break;
  4310. case 'quarter':
  4311. output = monthDiff(this, that) / 3;
  4312. break;
  4313. case 'second':
  4314. output = (this - that) / 1e3;
  4315. break; // 1000
  4316. case 'minute':
  4317. output = (this - that) / 6e4;
  4318. break; // 1000 * 60
  4319. case 'hour':
  4320. output = (this - that) / 36e5;
  4321. break; // 1000 * 60 * 60
  4322. case 'day':
  4323. output = (this - that - zoneDelta) / 864e5;
  4324. break; // 1000 * 60 * 60 * 24, negate dst
  4325. case 'week':
  4326. output = (this - that - zoneDelta) / 6048e5;
  4327. break; // 1000 * 60 * 60 * 24 * 7, negate dst
  4328. default:
  4329. output = this - that;
  4330. }
  4331. return asFloat ? output : absFloor(output);
  4332. }
  4333. function monthDiff(a, b) {
  4334. if (a.date() < b.date()) {
  4335. // end-of-month calculations work correct when the start month has more
  4336. // days than the end month.
  4337. return -monthDiff(b, a);
  4338. }
  4339. // difference in months
  4340. var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
  4341. // b is in (anchor - 1 month, anchor + 1 month)
  4342. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4343. anchor2,
  4344. adjust;
  4345. if (b - anchor < 0) {
  4346. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4347. // linear across the month
  4348. adjust = (b - anchor) / (anchor - anchor2);
  4349. } else {
  4350. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4351. // linear across the month
  4352. adjust = (b - anchor) / (anchor2 - anchor);
  4353. }
  4354. //check for negative zero, return zero if negative zero
  4355. return -(wholeMonthDiff + adjust) || 0;
  4356. }
  4357. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4358. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4359. function toString() {
  4360. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4361. }
  4362. function toISOString(keepOffset) {
  4363. if (!this.isValid()) {
  4364. return null;
  4365. }
  4366. var utc = keepOffset !== true,
  4367. m = utc ? this.clone().utc() : this;
  4368. if (m.year() < 0 || m.year() > 9999) {
  4369. return formatMoment(
  4370. m,
  4371. utc
  4372. ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
  4373. : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4374. );
  4375. }
  4376. if (isFunction(Date.prototype.toISOString)) {
  4377. // native implementation is ~50x faster, use it when we can
  4378. if (utc) {
  4379. return this.toDate().toISOString();
  4380. } else {
  4381. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
  4382. .toISOString()
  4383. .replace('Z', formatMoment(m, 'Z'));
  4384. }
  4385. }
  4386. return formatMoment(
  4387. m,
  4388. utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4389. );
  4390. }
  4391. /**
  4392. * Return a human readable representation of a moment that can
  4393. * also be evaluated to get a new moment which is the same
  4394. *
  4395. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4396. */
  4397. function inspect() {
  4398. if (!this.isValid()) {
  4399. return 'moment.invalid(/* ' + this._i + ' */)';
  4400. }
  4401. var func = 'moment',
  4402. zone = '',
  4403. prefix,
  4404. year,
  4405. datetime,
  4406. suffix;
  4407. if (!this.isLocal()) {
  4408. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4409. zone = 'Z';
  4410. }
  4411. prefix = '[' + func + '("]';
  4412. year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
  4413. datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4414. suffix = zone + '[")]';
  4415. return this.format(prefix + year + datetime + suffix);
  4416. }
  4417. function format(inputString) {
  4418. if (!inputString) {
  4419. inputString = this.isUtc()
  4420. ? hooks.defaultFormatUtc
  4421. : hooks.defaultFormat;
  4422. }
  4423. var output = formatMoment(this, inputString);
  4424. return this.localeData().postformat(output);
  4425. }
  4426. function from(time, withoutSuffix) {
  4427. if (
  4428. this.isValid() &&
  4429. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4430. ) {
  4431. return createDuration({ to: this, from: time })
  4432. .locale(this.locale())
  4433. .humanize(!withoutSuffix);
  4434. } else {
  4435. return this.localeData().invalidDate();
  4436. }
  4437. }
  4438. function fromNow(withoutSuffix) {
  4439. return this.from(createLocal(), withoutSuffix);
  4440. }
  4441. function to(time, withoutSuffix) {
  4442. if (
  4443. this.isValid() &&
  4444. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4445. ) {
  4446. return createDuration({ from: this, to: time })
  4447. .locale(this.locale())
  4448. .humanize(!withoutSuffix);
  4449. } else {
  4450. return this.localeData().invalidDate();
  4451. }
  4452. }
  4453. function toNow(withoutSuffix) {
  4454. return this.to(createLocal(), withoutSuffix);
  4455. }
  4456. // If passed a locale key, it will set the locale for this
  4457. // instance. Otherwise, it will return the locale configuration
  4458. // variables for this instance.
  4459. function locale(key) {
  4460. var newLocaleData;
  4461. if (key === undefined) {
  4462. return this._locale._abbr;
  4463. } else {
  4464. newLocaleData = getLocale(key);
  4465. if (newLocaleData != null) {
  4466. this._locale = newLocaleData;
  4467. }
  4468. return this;
  4469. }
  4470. }
  4471. var lang = deprecate(
  4472. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4473. function (key) {
  4474. if (key === undefined) {
  4475. return this.localeData();
  4476. } else {
  4477. return this.locale(key);
  4478. }
  4479. }
  4480. );
  4481. function localeData() {
  4482. return this._locale;
  4483. }
  4484. var MS_PER_SECOND = 1000,
  4485. MS_PER_MINUTE = 60 * MS_PER_SECOND,
  4486. MS_PER_HOUR = 60 * MS_PER_MINUTE,
  4487. MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  4488. // actual modulo - handles negative numbers (for dates before 1970):
  4489. function mod$1(dividend, divisor) {
  4490. return ((dividend % divisor) + divisor) % divisor;
  4491. }
  4492. function localStartOfDate(y, m, d) {
  4493. // the date constructor remaps years 0-99 to 1900-1999
  4494. if (y < 100 && y >= 0) {
  4495. // preserve leap years using a full 400 year cycle, then reset
  4496. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  4497. } else {
  4498. return new Date(y, m, d).valueOf();
  4499. }
  4500. }
  4501. function utcStartOfDate(y, m, d) {
  4502. // Date.UTC remaps years 0-99 to 1900-1999
  4503. if (y < 100 && y >= 0) {
  4504. // preserve leap years using a full 400 year cycle, then reset
  4505. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  4506. } else {
  4507. return Date.UTC(y, m, d);
  4508. }
  4509. }
  4510. function startOf(units) {
  4511. var time, startOfDate;
  4512. units = normalizeUnits(units);
  4513. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4514. return this;
  4515. }
  4516. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4517. switch (units) {
  4518. case 'year':
  4519. time = startOfDate(this.year(), 0, 1);
  4520. break;
  4521. case 'quarter':
  4522. time = startOfDate(
  4523. this.year(),
  4524. this.month() - (this.month() % 3),
  4525. 1
  4526. );
  4527. break;
  4528. case 'month':
  4529. time = startOfDate(this.year(), this.month(), 1);
  4530. break;
  4531. case 'week':
  4532. time = startOfDate(
  4533. this.year(),
  4534. this.month(),
  4535. this.date() - this.weekday()
  4536. );
  4537. break;
  4538. case 'isoWeek':
  4539. time = startOfDate(
  4540. this.year(),
  4541. this.month(),
  4542. this.date() - (this.isoWeekday() - 1)
  4543. );
  4544. break;
  4545. case 'day':
  4546. case 'date':
  4547. time = startOfDate(this.year(), this.month(), this.date());
  4548. break;
  4549. case 'hour':
  4550. time = this._d.valueOf();
  4551. time -= mod$1(
  4552. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4553. MS_PER_HOUR
  4554. );
  4555. break;
  4556. case 'minute':
  4557. time = this._d.valueOf();
  4558. time -= mod$1(time, MS_PER_MINUTE);
  4559. break;
  4560. case 'second':
  4561. time = this._d.valueOf();
  4562. time -= mod$1(time, MS_PER_SECOND);
  4563. break;
  4564. }
  4565. this._d.setTime(time);
  4566. hooks.updateOffset(this, true);
  4567. return this;
  4568. }
  4569. function endOf(units) {
  4570. var time, startOfDate;
  4571. units = normalizeUnits(units);
  4572. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4573. return this;
  4574. }
  4575. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4576. switch (units) {
  4577. case 'year':
  4578. time = startOfDate(this.year() + 1, 0, 1) - 1;
  4579. break;
  4580. case 'quarter':
  4581. time =
  4582. startOfDate(
  4583. this.year(),
  4584. this.month() - (this.month() % 3) + 3,
  4585. 1
  4586. ) - 1;
  4587. break;
  4588. case 'month':
  4589. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  4590. break;
  4591. case 'week':
  4592. time =
  4593. startOfDate(
  4594. this.year(),
  4595. this.month(),
  4596. this.date() - this.weekday() + 7
  4597. ) - 1;
  4598. break;
  4599. case 'isoWeek':
  4600. time =
  4601. startOfDate(
  4602. this.year(),
  4603. this.month(),
  4604. this.date() - (this.isoWeekday() - 1) + 7
  4605. ) - 1;
  4606. break;
  4607. case 'day':
  4608. case 'date':
  4609. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  4610. break;
  4611. case 'hour':
  4612. time = this._d.valueOf();
  4613. time +=
  4614. MS_PER_HOUR -
  4615. mod$1(
  4616. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4617. MS_PER_HOUR
  4618. ) -
  4619. 1;
  4620. break;
  4621. case 'minute':
  4622. time = this._d.valueOf();
  4623. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  4624. break;
  4625. case 'second':
  4626. time = this._d.valueOf();
  4627. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  4628. break;
  4629. }
  4630. this._d.setTime(time);
  4631. hooks.updateOffset(this, true);
  4632. return this;
  4633. }
  4634. function valueOf() {
  4635. return this._d.valueOf() - (this._offset || 0) * 60000;
  4636. }
  4637. function unix() {
  4638. return Math.floor(this.valueOf() / 1000);
  4639. }
  4640. function toDate() {
  4641. return new Date(this.valueOf());
  4642. }
  4643. function toArray() {
  4644. var m = this;
  4645. return [
  4646. m.year(),
  4647. m.month(),
  4648. m.date(),
  4649. m.hour(),
  4650. m.minute(),
  4651. m.second(),
  4652. m.millisecond(),
  4653. ];
  4654. }
  4655. function toObject() {
  4656. var m = this;
  4657. return {
  4658. years: m.year(),
  4659. months: m.month(),
  4660. date: m.date(),
  4661. hours: m.hours(),
  4662. minutes: m.minutes(),
  4663. seconds: m.seconds(),
  4664. milliseconds: m.milliseconds(),
  4665. };
  4666. }
  4667. function toJSON() {
  4668. // new Date(NaN).toJSON() === null
  4669. return this.isValid() ? this.toISOString() : null;
  4670. }
  4671. function isValid$2() {
  4672. return isValid(this);
  4673. }
  4674. function parsingFlags() {
  4675. return extend({}, getParsingFlags(this));
  4676. }
  4677. function invalidAt() {
  4678. return getParsingFlags(this).overflow;
  4679. }
  4680. function creationData() {
  4681. return {
  4682. input: this._i,
  4683. format: this._f,
  4684. locale: this._locale,
  4685. isUTC: this._isUTC,
  4686. strict: this._strict,
  4687. };
  4688. }
  4689. addFormatToken('N', 0, 0, 'eraAbbr');
  4690. addFormatToken('NN', 0, 0, 'eraAbbr');
  4691. addFormatToken('NNN', 0, 0, 'eraAbbr');
  4692. addFormatToken('NNNN', 0, 0, 'eraName');
  4693. addFormatToken('NNNNN', 0, 0, 'eraNarrow');
  4694. addFormatToken('y', ['y', 1], 'yo', 'eraYear');
  4695. addFormatToken('y', ['yy', 2], 0, 'eraYear');
  4696. addFormatToken('y', ['yyy', 3], 0, 'eraYear');
  4697. addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
  4698. addRegexToken('N', matchEraAbbr);
  4699. addRegexToken('NN', matchEraAbbr);
  4700. addRegexToken('NNN', matchEraAbbr);
  4701. addRegexToken('NNNN', matchEraName);
  4702. addRegexToken('NNNNN', matchEraNarrow);
  4703. addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (
  4704. input,
  4705. array,
  4706. config,
  4707. token
  4708. ) {
  4709. var era = config._locale.erasParse(input, token, config._strict);
  4710. if (era) {
  4711. getParsingFlags(config).era = era;
  4712. } else {
  4713. getParsingFlags(config).invalidEra = input;
  4714. }
  4715. });
  4716. addRegexToken('y', matchUnsigned);
  4717. addRegexToken('yy', matchUnsigned);
  4718. addRegexToken('yyy', matchUnsigned);
  4719. addRegexToken('yyyy', matchUnsigned);
  4720. addRegexToken('yo', matchEraYearOrdinal);
  4721. addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
  4722. addParseToken(['yo'], function (input, array, config, token) {
  4723. var match;
  4724. if (config._locale._eraYearOrdinalRegex) {
  4725. match = input.match(config._locale._eraYearOrdinalRegex);
  4726. }
  4727. if (config._locale.eraYearOrdinalParse) {
  4728. array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
  4729. } else {
  4730. array[YEAR] = parseInt(input, 10);
  4731. }
  4732. });
  4733. function localeEras(m, format) {
  4734. var i,
  4735. l,
  4736. date,
  4737. eras = this._eras || getLocale('en')._eras;
  4738. for (i = 0, l = eras.length; i < l; ++i) {
  4739. switch (typeof eras[i].since) {
  4740. case 'string':
  4741. // truncate time
  4742. date = hooks(eras[i].since).startOf('day');
  4743. eras[i].since = date.valueOf();
  4744. break;
  4745. }
  4746. switch (typeof eras[i].until) {
  4747. case 'undefined':
  4748. eras[i].until = +Infinity;
  4749. break;
  4750. case 'string':
  4751. // truncate time
  4752. date = hooks(eras[i].until).startOf('day').valueOf();
  4753. eras[i].until = date.valueOf();
  4754. break;
  4755. }
  4756. }
  4757. return eras;
  4758. }
  4759. function localeErasParse(eraName, format, strict) {
  4760. var i,
  4761. l,
  4762. eras = this.eras(),
  4763. name,
  4764. abbr,
  4765. narrow;
  4766. eraName = eraName.toUpperCase();
  4767. for (i = 0, l = eras.length; i < l; ++i) {
  4768. name = eras[i].name.toUpperCase();
  4769. abbr = eras[i].abbr.toUpperCase();
  4770. narrow = eras[i].narrow.toUpperCase();
  4771. if (strict) {
  4772. switch (format) {
  4773. case 'N':
  4774. case 'NN':
  4775. case 'NNN':
  4776. if (abbr === eraName) {
  4777. return eras[i];
  4778. }
  4779. break;
  4780. case 'NNNN':
  4781. if (name === eraName) {
  4782. return eras[i];
  4783. }
  4784. break;
  4785. case 'NNNNN':
  4786. if (narrow === eraName) {
  4787. return eras[i];
  4788. }
  4789. break;
  4790. }
  4791. } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
  4792. return eras[i];
  4793. }
  4794. }
  4795. }
  4796. function localeErasConvertYear(era, year) {
  4797. var dir = era.since <= era.until ? +1 : -1;
  4798. if (year === undefined) {
  4799. return hooks(era.since).year();
  4800. } else {
  4801. return hooks(era.since).year() + (year - era.offset) * dir;
  4802. }
  4803. }
  4804. function getEraName() {
  4805. var i,
  4806. l,
  4807. val,
  4808. eras = this.localeData().eras();
  4809. for (i = 0, l = eras.length; i < l; ++i) {
  4810. // truncate time
  4811. val = this.clone().startOf('day').valueOf();
  4812. if (eras[i].since <= val && val <= eras[i].until) {
  4813. return eras[i].name;
  4814. }
  4815. if (eras[i].until <= val && val <= eras[i].since) {
  4816. return eras[i].name;
  4817. }
  4818. }
  4819. return '';
  4820. }
  4821. function getEraNarrow() {
  4822. var i,
  4823. l,
  4824. val,
  4825. eras = this.localeData().eras();
  4826. for (i = 0, l = eras.length; i < l; ++i) {
  4827. // truncate time
  4828. val = this.clone().startOf('day').valueOf();
  4829. if (eras[i].since <= val && val <= eras[i].until) {
  4830. return eras[i].narrow;
  4831. }
  4832. if (eras[i].until <= val && val <= eras[i].since) {
  4833. return eras[i].narrow;
  4834. }
  4835. }
  4836. return '';
  4837. }
  4838. function getEraAbbr() {
  4839. var i,
  4840. l,
  4841. val,
  4842. eras = this.localeData().eras();
  4843. for (i = 0, l = eras.length; i < l; ++i) {
  4844. // truncate time
  4845. val = this.clone().startOf('day').valueOf();
  4846. if (eras[i].since <= val && val <= eras[i].until) {
  4847. return eras[i].abbr;
  4848. }
  4849. if (eras[i].until <= val && val <= eras[i].since) {
  4850. return eras[i].abbr;
  4851. }
  4852. }
  4853. return '';
  4854. }
  4855. function getEraYear() {
  4856. var i,
  4857. l,
  4858. dir,
  4859. val,
  4860. eras = this.localeData().eras();
  4861. for (i = 0, l = eras.length; i < l; ++i) {
  4862. dir = eras[i].since <= eras[i].until ? +1 : -1;
  4863. // truncate time
  4864. val = this.clone().startOf('day').valueOf();
  4865. if (
  4866. (eras[i].since <= val && val <= eras[i].until) ||
  4867. (eras[i].until <= val && val <= eras[i].since)
  4868. ) {
  4869. return (
  4870. (this.year() - hooks(eras[i].since).year()) * dir +
  4871. eras[i].offset
  4872. );
  4873. }
  4874. }
  4875. return this.year();
  4876. }
  4877. function erasNameRegex(isStrict) {
  4878. if (!hasOwnProp(this, '_erasNameRegex')) {
  4879. computeErasParse.call(this);
  4880. }
  4881. return isStrict ? this._erasNameRegex : this._erasRegex;
  4882. }
  4883. function erasAbbrRegex(isStrict) {
  4884. if (!hasOwnProp(this, '_erasAbbrRegex')) {
  4885. computeErasParse.call(this);
  4886. }
  4887. return isStrict ? this._erasAbbrRegex : this._erasRegex;
  4888. }
  4889. function erasNarrowRegex(isStrict) {
  4890. if (!hasOwnProp(this, '_erasNarrowRegex')) {
  4891. computeErasParse.call(this);
  4892. }
  4893. return isStrict ? this._erasNarrowRegex : this._erasRegex;
  4894. }
  4895. function matchEraAbbr(isStrict, locale) {
  4896. return locale.erasAbbrRegex(isStrict);
  4897. }
  4898. function matchEraName(isStrict, locale) {
  4899. return locale.erasNameRegex(isStrict);
  4900. }
  4901. function matchEraNarrow(isStrict, locale) {
  4902. return locale.erasNarrowRegex(isStrict);
  4903. }
  4904. function matchEraYearOrdinal(isStrict, locale) {
  4905. return locale._eraYearOrdinalRegex || matchUnsigned;
  4906. }
  4907. function computeErasParse() {
  4908. var abbrPieces = [],
  4909. namePieces = [],
  4910. narrowPieces = [],
  4911. mixedPieces = [],
  4912. i,
  4913. l,
  4914. eras = this.eras();
  4915. for (i = 0, l = eras.length; i < l; ++i) {
  4916. namePieces.push(regexEscape(eras[i].name));
  4917. abbrPieces.push(regexEscape(eras[i].abbr));
  4918. narrowPieces.push(regexEscape(eras[i].narrow));
  4919. mixedPieces.push(regexEscape(eras[i].name));
  4920. mixedPieces.push(regexEscape(eras[i].abbr));
  4921. mixedPieces.push(regexEscape(eras[i].narrow));
  4922. }
  4923. this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  4924. this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
  4925. this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
  4926. this._erasNarrowRegex = new RegExp(
  4927. '^(' + narrowPieces.join('|') + ')',
  4928. 'i'
  4929. );
  4930. }
  4931. // FORMATTING
  4932. addFormatToken(0, ['gg', 2], 0, function () {
  4933. return this.weekYear() % 100;
  4934. });
  4935. addFormatToken(0, ['GG', 2], 0, function () {
  4936. return this.isoWeekYear() % 100;
  4937. });
  4938. function addWeekYearFormatToken(token, getter) {
  4939. addFormatToken(0, [token, token.length], 0, getter);
  4940. }
  4941. addWeekYearFormatToken('gggg', 'weekYear');
  4942. addWeekYearFormatToken('ggggg', 'weekYear');
  4943. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4944. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4945. // ALIASES
  4946. addUnitAlias('weekYear', 'gg');
  4947. addUnitAlias('isoWeekYear', 'GG');
  4948. // PRIORITY
  4949. addUnitPriority('weekYear', 1);
  4950. addUnitPriority('isoWeekYear', 1);
  4951. // PARSING
  4952. addRegexToken('G', matchSigned);
  4953. addRegexToken('g', matchSigned);
  4954. addRegexToken('GG', match1to2, match2);
  4955. addRegexToken('gg', match1to2, match2);
  4956. addRegexToken('GGGG', match1to4, match4);
  4957. addRegexToken('gggg', match1to4, match4);
  4958. addRegexToken('GGGGG', match1to6, match6);
  4959. addRegexToken('ggggg', match1to6, match6);
  4960. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (
  4961. input,
  4962. week,
  4963. config,
  4964. token
  4965. ) {
  4966. week[token.substr(0, 2)] = toInt(input);
  4967. });
  4968. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4969. week[token] = hooks.parseTwoDigitYear(input);
  4970. });
  4971. // MOMENTS
  4972. function getSetWeekYear(input) {
  4973. return getSetWeekYearHelper.call(
  4974. this,
  4975. input,
  4976. this.week(),
  4977. this.weekday(),
  4978. this.localeData()._week.dow,
  4979. this.localeData()._week.doy
  4980. );
  4981. }
  4982. function getSetISOWeekYear(input) {
  4983. return getSetWeekYearHelper.call(
  4984. this,
  4985. input,
  4986. this.isoWeek(),
  4987. this.isoWeekday(),
  4988. 1,
  4989. 4
  4990. );
  4991. }
  4992. function getISOWeeksInYear() {
  4993. return weeksInYear(this.year(), 1, 4);
  4994. }
  4995. function getISOWeeksInISOWeekYear() {
  4996. return weeksInYear(this.isoWeekYear(), 1, 4);
  4997. }
  4998. function getWeeksInYear() {
  4999. var weekInfo = this.localeData()._week;
  5000. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  5001. }
  5002. function getWeeksInWeekYear() {
  5003. var weekInfo = this.localeData()._week;
  5004. return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
  5005. }
  5006. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  5007. var weeksTarget;
  5008. if (input == null) {
  5009. return weekOfYear(this, dow, doy).year;
  5010. } else {
  5011. weeksTarget = weeksInYear(input, dow, doy);
  5012. if (week > weeksTarget) {
  5013. week = weeksTarget;
  5014. }
  5015. return setWeekAll.call(this, input, week, weekday, dow, doy);
  5016. }
  5017. }
  5018. function setWeekAll(weekYear, week, weekday, dow, doy) {
  5019. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  5020. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  5021. this.year(date.getUTCFullYear());
  5022. this.month(date.getUTCMonth());
  5023. this.date(date.getUTCDate());
  5024. return this;
  5025. }
  5026. // FORMATTING
  5027. addFormatToken('Q', 0, 'Qo', 'quarter');
  5028. // ALIASES
  5029. addUnitAlias('quarter', 'Q');
  5030. // PRIORITY
  5031. addUnitPriority('quarter', 7);
  5032. // PARSING
  5033. addRegexToken('Q', match1);
  5034. addParseToken('Q', function (input, array) {
  5035. array[MONTH] = (toInt(input) - 1) * 3;
  5036. });
  5037. // MOMENTS
  5038. function getSetQuarter(input) {
  5039. return input == null
  5040. ? Math.ceil((this.month() + 1) / 3)
  5041. : this.month((input - 1) * 3 + (this.month() % 3));
  5042. }
  5043. // FORMATTING
  5044. addFormatToken('D', ['DD', 2], 'Do', 'date');
  5045. // ALIASES
  5046. addUnitAlias('date', 'D');
  5047. // PRIORITY
  5048. addUnitPriority('date', 9);
  5049. // PARSING
  5050. addRegexToken('D', match1to2);
  5051. addRegexToken('DD', match1to2, match2);
  5052. addRegexToken('Do', function (isStrict, locale) {
  5053. // TODO: Remove "ordinalParse" fallback in next major release.
  5054. return isStrict
  5055. ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
  5056. : locale._dayOfMonthOrdinalParseLenient;
  5057. });
  5058. addParseToken(['D', 'DD'], DATE);
  5059. addParseToken('Do', function (input, array) {
  5060. array[DATE] = toInt(input.match(match1to2)[0]);
  5061. });
  5062. // MOMENTS
  5063. var getSetDayOfMonth = makeGetSet('Date', true);
  5064. // FORMATTING
  5065. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  5066. // ALIASES
  5067. addUnitAlias('dayOfYear', 'DDD');
  5068. // PRIORITY
  5069. addUnitPriority('dayOfYear', 4);
  5070. // PARSING
  5071. addRegexToken('DDD', match1to3);
  5072. addRegexToken('DDDD', match3);
  5073. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  5074. config._dayOfYear = toInt(input);
  5075. });
  5076. // HELPERS
  5077. // MOMENTS
  5078. function getSetDayOfYear(input) {
  5079. var dayOfYear =
  5080. Math.round(
  5081. (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
  5082. ) + 1;
  5083. return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
  5084. }
  5085. // FORMATTING
  5086. addFormatToken('m', ['mm', 2], 0, 'minute');
  5087. // ALIASES
  5088. addUnitAlias('minute', 'm');
  5089. // PRIORITY
  5090. addUnitPriority('minute', 14);
  5091. // PARSING
  5092. addRegexToken('m', match1to2);
  5093. addRegexToken('mm', match1to2, match2);
  5094. addParseToken(['m', 'mm'], MINUTE);
  5095. // MOMENTS
  5096. var getSetMinute = makeGetSet('Minutes', false);
  5097. // FORMATTING
  5098. addFormatToken('s', ['ss', 2], 0, 'second');
  5099. // ALIASES
  5100. addUnitAlias('second', 's');
  5101. // PRIORITY
  5102. addUnitPriority('second', 15);
  5103. // PARSING
  5104. addRegexToken('s', match1to2);
  5105. addRegexToken('ss', match1to2, match2);
  5106. addParseToken(['s', 'ss'], SECOND);
  5107. // MOMENTS
  5108. var getSetSecond = makeGetSet('Seconds', false);
  5109. // FORMATTING
  5110. addFormatToken('S', 0, 0, function () {
  5111. return ~~(this.millisecond() / 100);
  5112. });
  5113. addFormatToken(0, ['SS', 2], 0, function () {
  5114. return ~~(this.millisecond() / 10);
  5115. });
  5116. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  5117. addFormatToken(0, ['SSSS', 4], 0, function () {
  5118. return this.millisecond() * 10;
  5119. });
  5120. addFormatToken(0, ['SSSSS', 5], 0, function () {
  5121. return this.millisecond() * 100;
  5122. });
  5123. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  5124. return this.millisecond() * 1000;
  5125. });
  5126. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  5127. return this.millisecond() * 10000;
  5128. });
  5129. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  5130. return this.millisecond() * 100000;
  5131. });
  5132. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  5133. return this.millisecond() * 1000000;
  5134. });
  5135. // ALIASES
  5136. addUnitAlias('millisecond', 'ms');
  5137. // PRIORITY
  5138. addUnitPriority('millisecond', 16);
  5139. // PARSING
  5140. addRegexToken('S', match1to3, match1);
  5141. addRegexToken('SS', match1to3, match2);
  5142. addRegexToken('SSS', match1to3, match3);
  5143. var token, getSetMillisecond;
  5144. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  5145. addRegexToken(token, matchUnsigned);
  5146. }
  5147. function parseMs(input, array) {
  5148. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5149. }
  5150. for (token = 'S'; token.length <= 9; token += 'S') {
  5151. addParseToken(token, parseMs);
  5152. }
  5153. getSetMillisecond = makeGetSet('Milliseconds', false);
  5154. // FORMATTING
  5155. addFormatToken('z', 0, 0, 'zoneAbbr');
  5156. addFormatToken('zz', 0, 0, 'zoneName');
  5157. // MOMENTS
  5158. function getZoneAbbr() {
  5159. return this._isUTC ? 'UTC' : '';
  5160. }
  5161. function getZoneName() {
  5162. return this._isUTC ? 'Coordinated Universal Time' : '';
  5163. }
  5164. var proto = Moment.prototype;
  5165. proto.add = add;
  5166. proto.calendar = calendar$1;
  5167. proto.clone = clone;
  5168. proto.diff = diff;
  5169. proto.endOf = endOf;
  5170. proto.format = format;
  5171. proto.from = from;
  5172. proto.fromNow = fromNow;
  5173. proto.to = to;
  5174. proto.toNow = toNow;
  5175. proto.get = stringGet;
  5176. proto.invalidAt = invalidAt;
  5177. proto.isAfter = isAfter;
  5178. proto.isBefore = isBefore;
  5179. proto.isBetween = isBetween;
  5180. proto.isSame = isSame;
  5181. proto.isSameOrAfter = isSameOrAfter;
  5182. proto.isSameOrBefore = isSameOrBefore;
  5183. proto.isValid = isValid$2;
  5184. proto.lang = lang;
  5185. proto.locale = locale;
  5186. proto.localeData = localeData;
  5187. proto.max = prototypeMax;
  5188. proto.min = prototypeMin;
  5189. proto.parsingFlags = parsingFlags;
  5190. proto.set = stringSet;
  5191. proto.startOf = startOf;
  5192. proto.subtract = subtract;
  5193. proto.toArray = toArray;
  5194. proto.toObject = toObject;
  5195. proto.toDate = toDate;
  5196. proto.toISOString = toISOString;
  5197. proto.inspect = inspect;
  5198. if (typeof Symbol !== 'undefined' && Symbol.for != null) {
  5199. proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
  5200. return 'Moment<' + this.format() + '>';
  5201. };
  5202. }
  5203. proto.toJSON = toJSON;
  5204. proto.toString = toString;
  5205. proto.unix = unix;
  5206. proto.valueOf = valueOf;
  5207. proto.creationData = creationData;
  5208. proto.eraName = getEraName;
  5209. proto.eraNarrow = getEraNarrow;
  5210. proto.eraAbbr = getEraAbbr;
  5211. proto.eraYear = getEraYear;
  5212. proto.year = getSetYear;
  5213. proto.isLeapYear = getIsLeapYear;
  5214. proto.weekYear = getSetWeekYear;
  5215. proto.isoWeekYear = getSetISOWeekYear;
  5216. proto.quarter = proto.quarters = getSetQuarter;
  5217. proto.month = getSetMonth;
  5218. proto.daysInMonth = getDaysInMonth;
  5219. proto.week = proto.weeks = getSetWeek;
  5220. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  5221. proto.weeksInYear = getWeeksInYear;
  5222. proto.weeksInWeekYear = getWeeksInWeekYear;
  5223. proto.isoWeeksInYear = getISOWeeksInYear;
  5224. proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
  5225. proto.date = getSetDayOfMonth;
  5226. proto.day = proto.days = getSetDayOfWeek;
  5227. proto.weekday = getSetLocaleDayOfWeek;
  5228. proto.isoWeekday = getSetISODayOfWeek;
  5229. proto.dayOfYear = getSetDayOfYear;
  5230. proto.hour = proto.hours = getSetHour;
  5231. proto.minute = proto.minutes = getSetMinute;
  5232. proto.second = proto.seconds = getSetSecond;
  5233. proto.millisecond = proto.milliseconds = getSetMillisecond;
  5234. proto.utcOffset = getSetOffset;
  5235. proto.utc = setOffsetToUTC;
  5236. proto.local = setOffsetToLocal;
  5237. proto.parseZone = setOffsetToParsedOffset;
  5238. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5239. proto.isDST = isDaylightSavingTime;
  5240. proto.isLocal = isLocal;
  5241. proto.isUtcOffset = isUtcOffset;
  5242. proto.isUtc = isUtc;
  5243. proto.isUTC = isUtc;
  5244. proto.zoneAbbr = getZoneAbbr;
  5245. proto.zoneName = getZoneName;
  5246. proto.dates = deprecate(
  5247. 'dates accessor is deprecated. Use date instead.',
  5248. getSetDayOfMonth
  5249. );
  5250. proto.months = deprecate(
  5251. 'months accessor is deprecated. Use month instead',
  5252. getSetMonth
  5253. );
  5254. proto.years = deprecate(
  5255. 'years accessor is deprecated. Use year instead',
  5256. getSetYear
  5257. );
  5258. proto.zone = deprecate(
  5259. 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
  5260. getSetZone
  5261. );
  5262. proto.isDSTShifted = deprecate(
  5263. 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
  5264. isDaylightSavingTimeShifted
  5265. );
  5266. function createUnix(input) {
  5267. return createLocal(input * 1000);
  5268. }
  5269. function createInZone() {
  5270. return createLocal.apply(null, arguments).parseZone();
  5271. }
  5272. function preParsePostFormat(string) {
  5273. return string;
  5274. }
  5275. var proto$1 = Locale.prototype;
  5276. proto$1.calendar = calendar;
  5277. proto$1.longDateFormat = longDateFormat;
  5278. proto$1.invalidDate = invalidDate;
  5279. proto$1.ordinal = ordinal;
  5280. proto$1.preparse = preParsePostFormat;
  5281. proto$1.postformat = preParsePostFormat;
  5282. proto$1.relativeTime = relativeTime;
  5283. proto$1.pastFuture = pastFuture;
  5284. proto$1.set = set;
  5285. proto$1.eras = localeEras;
  5286. proto$1.erasParse = localeErasParse;
  5287. proto$1.erasConvertYear = localeErasConvertYear;
  5288. proto$1.erasAbbrRegex = erasAbbrRegex;
  5289. proto$1.erasNameRegex = erasNameRegex;
  5290. proto$1.erasNarrowRegex = erasNarrowRegex;
  5291. proto$1.months = localeMonths;
  5292. proto$1.monthsShort = localeMonthsShort;
  5293. proto$1.monthsParse = localeMonthsParse;
  5294. proto$1.monthsRegex = monthsRegex;
  5295. proto$1.monthsShortRegex = monthsShortRegex;
  5296. proto$1.week = localeWeek;
  5297. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5298. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5299. proto$1.weekdays = localeWeekdays;
  5300. proto$1.weekdaysMin = localeWeekdaysMin;
  5301. proto$1.weekdaysShort = localeWeekdaysShort;
  5302. proto$1.weekdaysParse = localeWeekdaysParse;
  5303. proto$1.weekdaysRegex = weekdaysRegex;
  5304. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5305. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5306. proto$1.isPM = localeIsPM;
  5307. proto$1.meridiem = localeMeridiem;
  5308. function get$1(format, index, field, setter) {
  5309. var locale = getLocale(),
  5310. utc = createUTC().set(setter, index);
  5311. return locale[field](utc, format);
  5312. }
  5313. function listMonthsImpl(format, index, field) {
  5314. if (isNumber(format)) {
  5315. index = format;
  5316. format = undefined;
  5317. }
  5318. format = format || '';
  5319. if (index != null) {
  5320. return get$1(format, index, field, 'month');
  5321. }
  5322. var i,
  5323. out = [];
  5324. for (i = 0; i < 12; i++) {
  5325. out[i] = get$1(format, i, field, 'month');
  5326. }
  5327. return out;
  5328. }
  5329. // ()
  5330. // (5)
  5331. // (fmt, 5)
  5332. // (fmt)
  5333. // (true)
  5334. // (true, 5)
  5335. // (true, fmt, 5)
  5336. // (true, fmt)
  5337. function listWeekdaysImpl(localeSorted, format, index, field) {
  5338. if (typeof localeSorted === 'boolean') {
  5339. if (isNumber(format)) {
  5340. index = format;
  5341. format = undefined;
  5342. }
  5343. format = format || '';
  5344. } else {
  5345. format = localeSorted;
  5346. index = format;
  5347. localeSorted = false;
  5348. if (isNumber(format)) {
  5349. index = format;
  5350. format = undefined;
  5351. }
  5352. format = format || '';
  5353. }
  5354. var locale = getLocale(),
  5355. shift = localeSorted ? locale._week.dow : 0,
  5356. i,
  5357. out = [];
  5358. if (index != null) {
  5359. return get$1(format, (index + shift) % 7, field, 'day');
  5360. }
  5361. for (i = 0; i < 7; i++) {
  5362. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5363. }
  5364. return out;
  5365. }
  5366. function listMonths(format, index) {
  5367. return listMonthsImpl(format, index, 'months');
  5368. }
  5369. function listMonthsShort(format, index) {
  5370. return listMonthsImpl(format, index, 'monthsShort');
  5371. }
  5372. function listWeekdays(localeSorted, format, index) {
  5373. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5374. }
  5375. function listWeekdaysShort(localeSorted, format, index) {
  5376. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5377. }
  5378. function listWeekdaysMin(localeSorted, format, index) {
  5379. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5380. }
  5381. getSetGlobalLocale('en', {
  5382. eras: [
  5383. {
  5384. since: '0001-01-01',
  5385. until: +Infinity,
  5386. offset: 1,
  5387. name: 'Anno Domini',
  5388. narrow: 'AD',
  5389. abbr: 'AD',
  5390. },
  5391. {
  5392. since: '0000-12-31',
  5393. until: -Infinity,
  5394. offset: 1,
  5395. name: 'Before Christ',
  5396. narrow: 'BC',
  5397. abbr: 'BC',
  5398. },
  5399. ],
  5400. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5401. ordinal: function (number) {
  5402. var b = number % 10,
  5403. output =
  5404. toInt((number % 100) / 10) === 1
  5405. ? 'th'
  5406. : b === 1
  5407. ? 'st'
  5408. : b === 2
  5409. ? 'nd'
  5410. : b === 3
  5411. ? 'rd'
  5412. : 'th';
  5413. return number + output;
  5414. },
  5415. });
  5416. // Side effect imports
  5417. hooks.lang = deprecate(
  5418. 'moment.lang is deprecated. Use moment.locale instead.',
  5419. getSetGlobalLocale
  5420. );
  5421. hooks.langData = deprecate(
  5422. 'moment.langData is deprecated. Use moment.localeData instead.',
  5423. getLocale
  5424. );
  5425. var mathAbs = Math.abs;
  5426. function abs() {
  5427. var data = this._data;
  5428. this._milliseconds = mathAbs(this._milliseconds);
  5429. this._days = mathAbs(this._days);
  5430. this._months = mathAbs(this._months);
  5431. data.milliseconds = mathAbs(data.milliseconds);
  5432. data.seconds = mathAbs(data.seconds);
  5433. data.minutes = mathAbs(data.minutes);
  5434. data.hours = mathAbs(data.hours);
  5435. data.months = mathAbs(data.months);
  5436. data.years = mathAbs(data.years);
  5437. return this;
  5438. }
  5439. function addSubtract$1(duration, input, value, direction) {
  5440. var other = createDuration(input, value);
  5441. duration._milliseconds += direction * other._milliseconds;
  5442. duration._days += direction * other._days;
  5443. duration._months += direction * other._months;
  5444. return duration._bubble();
  5445. }
  5446. // supports only 2.0-style add(1, 's') or add(duration)
  5447. function add$1(input, value) {
  5448. return addSubtract$1(this, input, value, 1);
  5449. }
  5450. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5451. function subtract$1(input, value) {
  5452. return addSubtract$1(this, input, value, -1);
  5453. }
  5454. function absCeil(number) {
  5455. if (number < 0) {
  5456. return Math.floor(number);
  5457. } else {
  5458. return Math.ceil(number);
  5459. }
  5460. }
  5461. function bubble() {
  5462. var milliseconds = this._milliseconds,
  5463. days = this._days,
  5464. months = this._months,
  5465. data = this._data,
  5466. seconds,
  5467. minutes,
  5468. hours,
  5469. years,
  5470. monthsFromDays;
  5471. // if we have a mix of positive and negative values, bubble down first
  5472. // check: https://github.com/moment/moment/issues/2166
  5473. if (
  5474. !(
  5475. (milliseconds >= 0 && days >= 0 && months >= 0) ||
  5476. (milliseconds <= 0 && days <= 0 && months <= 0)
  5477. )
  5478. ) {
  5479. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5480. days = 0;
  5481. months = 0;
  5482. }
  5483. // The following code bubbles up values, see the tests for
  5484. // examples of what that means.
  5485. data.milliseconds = milliseconds % 1000;
  5486. seconds = absFloor(milliseconds / 1000);
  5487. data.seconds = seconds % 60;
  5488. minutes = absFloor(seconds / 60);
  5489. data.minutes = minutes % 60;
  5490. hours = absFloor(minutes / 60);
  5491. data.hours = hours % 24;
  5492. days += absFloor(hours / 24);
  5493. // convert days to months
  5494. monthsFromDays = absFloor(daysToMonths(days));
  5495. months += monthsFromDays;
  5496. days -= absCeil(monthsToDays(monthsFromDays));
  5497. // 12 months -> 1 year
  5498. years = absFloor(months / 12);
  5499. months %= 12;
  5500. data.days = days;
  5501. data.months = months;
  5502. data.years = years;
  5503. return this;
  5504. }
  5505. function daysToMonths(days) {
  5506. // 400 years have 146097 days (taking into account leap year rules)
  5507. // 400 years have 12 months === 4800
  5508. return (days * 4800) / 146097;
  5509. }
  5510. function monthsToDays(months) {
  5511. // the reverse of daysToMonths
  5512. return (months * 146097) / 4800;
  5513. }
  5514. function as(units) {
  5515. if (!this.isValid()) {
  5516. return NaN;
  5517. }
  5518. var days,
  5519. months,
  5520. milliseconds = this._milliseconds;
  5521. units = normalizeUnits(units);
  5522. if (units === 'month' || units === 'quarter' || units === 'year') {
  5523. days = this._days + milliseconds / 864e5;
  5524. months = this._months + daysToMonths(days);
  5525. switch (units) {
  5526. case 'month':
  5527. return months;
  5528. case 'quarter':
  5529. return months / 3;
  5530. case 'year':
  5531. return months / 12;
  5532. }
  5533. } else {
  5534. // handle milliseconds separately because of floating point math errors (issue #1867)
  5535. days = this._days + Math.round(monthsToDays(this._months));
  5536. switch (units) {
  5537. case 'week':
  5538. return days / 7 + milliseconds / 6048e5;
  5539. case 'day':
  5540. return days + milliseconds / 864e5;
  5541. case 'hour':
  5542. return days * 24 + milliseconds / 36e5;
  5543. case 'minute':
  5544. return days * 1440 + milliseconds / 6e4;
  5545. case 'second':
  5546. return days * 86400 + milliseconds / 1000;
  5547. // Math.floor prevents floating point math errors here
  5548. case 'millisecond':
  5549. return Math.floor(days * 864e5) + milliseconds;
  5550. default:
  5551. throw new Error('Unknown unit ' + units);
  5552. }
  5553. }
  5554. }
  5555. // TODO: Use this.as('ms')?
  5556. function valueOf$1() {
  5557. if (!this.isValid()) {
  5558. return NaN;
  5559. }
  5560. return (
  5561. this._milliseconds +
  5562. this._days * 864e5 +
  5563. (this._months % 12) * 2592e6 +
  5564. toInt(this._months / 12) * 31536e6
  5565. );
  5566. }
  5567. function makeAs(alias) {
  5568. return function () {
  5569. return this.as(alias);
  5570. };
  5571. }
  5572. var asMilliseconds = makeAs('ms'),
  5573. asSeconds = makeAs('s'),
  5574. asMinutes = makeAs('m'),
  5575. asHours = makeAs('h'),
  5576. asDays = makeAs('d'),
  5577. asWeeks = makeAs('w'),
  5578. asMonths = makeAs('M'),
  5579. asQuarters = makeAs('Q'),
  5580. asYears = makeAs('y');
  5581. function clone$1() {
  5582. return createDuration(this);
  5583. }
  5584. function get$2(units) {
  5585. units = normalizeUnits(units);
  5586. return this.isValid() ? this[units + 's']() : NaN;
  5587. }
  5588. function makeGetter(name) {
  5589. return function () {
  5590. return this.isValid() ? this._data[name] : NaN;
  5591. };
  5592. }
  5593. var milliseconds = makeGetter('milliseconds'),
  5594. seconds = makeGetter('seconds'),
  5595. minutes = makeGetter('minutes'),
  5596. hours = makeGetter('hours'),
  5597. days = makeGetter('days'),
  5598. months = makeGetter('months'),
  5599. years = makeGetter('years');
  5600. function weeks() {
  5601. return absFloor(this.days() / 7);
  5602. }
  5603. var round = Math.round,
  5604. thresholds = {
  5605. ss: 44, // a few seconds to seconds
  5606. s: 45, // seconds to minute
  5607. m: 45, // minutes to hour
  5608. h: 22, // hours to day
  5609. d: 26, // days to month/week
  5610. w: null, // weeks to month
  5611. M: 11, // months to year
  5612. };
  5613. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5614. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5615. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5616. }
  5617. function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
  5618. var duration = createDuration(posNegDuration).abs(),
  5619. seconds = round(duration.as('s')),
  5620. minutes = round(duration.as('m')),
  5621. hours = round(duration.as('h')),
  5622. days = round(duration.as('d')),
  5623. months = round(duration.as('M')),
  5624. weeks = round(duration.as('w')),
  5625. years = round(duration.as('y')),
  5626. a =
  5627. (seconds <= thresholds.ss && ['s', seconds]) ||
  5628. (seconds < thresholds.s && ['ss', seconds]) ||
  5629. (minutes <= 1 && ['m']) ||
  5630. (minutes < thresholds.m && ['mm', minutes]) ||
  5631. (hours <= 1 && ['h']) ||
  5632. (hours < thresholds.h && ['hh', hours]) ||
  5633. (days <= 1 && ['d']) ||
  5634. (days < thresholds.d && ['dd', days]);
  5635. if (thresholds.w != null) {
  5636. a =
  5637. a ||
  5638. (weeks <= 1 && ['w']) ||
  5639. (weeks < thresholds.w && ['ww', weeks]);
  5640. }
  5641. a = a ||
  5642. (months <= 1 && ['M']) ||
  5643. (months < thresholds.M && ['MM', months]) ||
  5644. (years <= 1 && ['y']) || ['yy', years];
  5645. a[2] = withoutSuffix;
  5646. a[3] = +posNegDuration > 0;
  5647. a[4] = locale;
  5648. return substituteTimeAgo.apply(null, a);
  5649. }
  5650. // This function allows you to set the rounding function for relative time strings
  5651. function getSetRelativeTimeRounding(roundingFunction) {
  5652. if (roundingFunction === undefined) {
  5653. return round;
  5654. }
  5655. if (typeof roundingFunction === 'function') {
  5656. round = roundingFunction;
  5657. return true;
  5658. }
  5659. return false;
  5660. }
  5661. // This function allows you to set a threshold for relative time strings
  5662. function getSetRelativeTimeThreshold(threshold, limit) {
  5663. if (thresholds[threshold] === undefined) {
  5664. return false;
  5665. }
  5666. if (limit === undefined) {
  5667. return thresholds[threshold];
  5668. }
  5669. thresholds[threshold] = limit;
  5670. if (threshold === 's') {
  5671. thresholds.ss = limit - 1;
  5672. }
  5673. return true;
  5674. }
  5675. function humanize(argWithSuffix, argThresholds) {
  5676. if (!this.isValid()) {
  5677. return this.localeData().invalidDate();
  5678. }
  5679. var withSuffix = false,
  5680. th = thresholds,
  5681. locale,
  5682. output;
  5683. if (typeof argWithSuffix === 'object') {
  5684. argThresholds = argWithSuffix;
  5685. argWithSuffix = false;
  5686. }
  5687. if (typeof argWithSuffix === 'boolean') {
  5688. withSuffix = argWithSuffix;
  5689. }
  5690. if (typeof argThresholds === 'object') {
  5691. th = Object.assign({}, thresholds, argThresholds);
  5692. if (argThresholds.s != null && argThresholds.ss == null) {
  5693. th.ss = argThresholds.s - 1;
  5694. }
  5695. }
  5696. locale = this.localeData();
  5697. output = relativeTime$1(this, !withSuffix, th, locale);
  5698. if (withSuffix) {
  5699. output = locale.pastFuture(+this, output);
  5700. }
  5701. return locale.postformat(output);
  5702. }
  5703. var abs$1 = Math.abs;
  5704. function sign(x) {
  5705. return (x > 0) - (x < 0) || +x;
  5706. }
  5707. function toISOString$1() {
  5708. // for ISO strings we do not use the normal bubbling rules:
  5709. // * milliseconds bubble up until they become hours
  5710. // * days do not bubble at all
  5711. // * months bubble up until they become years
  5712. // This is because there is no context-free conversion between hours and days
  5713. // (think of clock changes)
  5714. // and also not between days and months (28-31 days per month)
  5715. if (!this.isValid()) {
  5716. return this.localeData().invalidDate();
  5717. }
  5718. var seconds = abs$1(this._milliseconds) / 1000,
  5719. days = abs$1(this._days),
  5720. months = abs$1(this._months),
  5721. minutes,
  5722. hours,
  5723. years,
  5724. s,
  5725. total = this.asSeconds(),
  5726. totalSign,
  5727. ymSign,
  5728. daysSign,
  5729. hmsSign;
  5730. if (!total) {
  5731. // this is the same as C#'s (Noda) and python (isodate)...
  5732. // but not other JS (goog.date)
  5733. return 'P0D';
  5734. }
  5735. // 3600 seconds -> 60 minutes -> 1 hour
  5736. minutes = absFloor(seconds / 60);
  5737. hours = absFloor(minutes / 60);
  5738. seconds %= 60;
  5739. minutes %= 60;
  5740. // 12 months -> 1 year
  5741. years = absFloor(months / 12);
  5742. months %= 12;
  5743. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5744. s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  5745. totalSign = total < 0 ? '-' : '';
  5746. ymSign = sign(this._months) !== sign(total) ? '-' : '';
  5747. daysSign = sign(this._days) !== sign(total) ? '-' : '';
  5748. hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  5749. return (
  5750. totalSign +
  5751. 'P' +
  5752. (years ? ymSign + years + 'Y' : '') +
  5753. (months ? ymSign + months + 'M' : '') +
  5754. (days ? daysSign + days + 'D' : '') +
  5755. (hours || minutes || seconds ? 'T' : '') +
  5756. (hours ? hmsSign + hours + 'H' : '') +
  5757. (minutes ? hmsSign + minutes + 'M' : '') +
  5758. (seconds ? hmsSign + s + 'S' : '')
  5759. );
  5760. }
  5761. var proto$2 = Duration.prototype;
  5762. proto$2.isValid = isValid$1;
  5763. proto$2.abs = abs;
  5764. proto$2.add = add$1;
  5765. proto$2.subtract = subtract$1;
  5766. proto$2.as = as;
  5767. proto$2.asMilliseconds = asMilliseconds;
  5768. proto$2.asSeconds = asSeconds;
  5769. proto$2.asMinutes = asMinutes;
  5770. proto$2.asHours = asHours;
  5771. proto$2.asDays = asDays;
  5772. proto$2.asWeeks = asWeeks;
  5773. proto$2.asMonths = asMonths;
  5774. proto$2.asQuarters = asQuarters;
  5775. proto$2.asYears = asYears;
  5776. proto$2.valueOf = valueOf$1;
  5777. proto$2._bubble = bubble;
  5778. proto$2.clone = clone$1;
  5779. proto$2.get = get$2;
  5780. proto$2.milliseconds = milliseconds;
  5781. proto$2.seconds = seconds;
  5782. proto$2.minutes = minutes;
  5783. proto$2.hours = hours;
  5784. proto$2.days = days;
  5785. proto$2.weeks = weeks;
  5786. proto$2.months = months;
  5787. proto$2.years = years;
  5788. proto$2.humanize = humanize;
  5789. proto$2.toISOString = toISOString$1;
  5790. proto$2.toString = toISOString$1;
  5791. proto$2.toJSON = toISOString$1;
  5792. proto$2.locale = locale;
  5793. proto$2.localeData = localeData;
  5794. proto$2.toIsoString = deprecate(
  5795. 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
  5796. toISOString$1
  5797. );
  5798. proto$2.lang = lang;
  5799. // FORMATTING
  5800. addFormatToken('X', 0, 0, 'unix');
  5801. addFormatToken('x', 0, 0, 'valueOf');
  5802. // PARSING
  5803. addRegexToken('x', matchSigned);
  5804. addRegexToken('X', matchTimestamp);
  5805. addParseToken('X', function (input, array, config) {
  5806. config._d = new Date(parseFloat(input) * 1000);
  5807. });
  5808. addParseToken('x', function (input, array, config) {
  5809. config._d = new Date(toInt(input));
  5810. });
  5811. //! moment.js
  5812. hooks.version = '2.29.1';
  5813. setHookCallback(createLocal);
  5814. hooks.fn = proto;
  5815. hooks.min = min;
  5816. hooks.max = max;
  5817. hooks.now = now;
  5818. hooks.utc = createUTC;
  5819. hooks.unix = createUnix;
  5820. hooks.months = listMonths;
  5821. hooks.isDate = isDate;
  5822. hooks.locale = getSetGlobalLocale;
  5823. hooks.invalid = createInvalid;
  5824. hooks.duration = createDuration;
  5825. hooks.isMoment = isMoment;
  5826. hooks.weekdays = listWeekdays;
  5827. hooks.parseZone = createInZone;
  5828. hooks.localeData = getLocale;
  5829. hooks.isDuration = isDuration;
  5830. hooks.monthsShort = listMonthsShort;
  5831. hooks.weekdaysMin = listWeekdaysMin;
  5832. hooks.defineLocale = defineLocale;
  5833. hooks.updateLocale = updateLocale;
  5834. hooks.locales = listLocales;
  5835. hooks.weekdaysShort = listWeekdaysShort;
  5836. hooks.normalizeUnits = normalizeUnits;
  5837. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5838. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5839. hooks.calendarFormat = getCalendarFormat;
  5840. hooks.prototype = proto;
  5841. // currently HTML5 input type only supports 24-hour formats
  5842. hooks.HTML5_FMT = {
  5843. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  5844. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  5845. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  5846. DATE: 'YYYY-MM-DD', // <input type="date" />
  5847. TIME: 'HH:mm', // <input type="time" />
  5848. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  5849. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  5850. WEEK: 'GGGG-[W]WW', // <input type="week" />
  5851. MONTH: 'YYYY-MM', // <input type="month" />
  5852. };
  5853. return hooks;
  5854. })));
  5855. define('moment', ['moment/moment'], function (main) { return main; });
  5856. define('frontend',['fast', 'template', 'moment'], function (Fast, Template, Moment) {
  5857. var Frontend = {
  5858. api: Fast.api,
  5859. init: function () {
  5860. var si = {};
  5861. //发送验证码
  5862. $(document).on("click", ".btn-captcha", function (e) {
  5863. var type = $(this).data("type") ? $(this).data("type") : 'mobile';
  5864. var btn = this;
  5865. Frontend.api.sendcaptcha = function (btn, type, data, callback) {
  5866. $(btn).addClass("disabled", true).text("发送中...");
  5867. Frontend.api.ajax({url: $(btn).data("url"), data: data}, function (data, ret) {
  5868. clearInterval(si[type]);
  5869. var seconds = 60;
  5870. si[type] = setInterval(function () {
  5871. seconds--;
  5872. if (seconds <= 0) {
  5873. clearInterval(si);
  5874. $(btn).removeClass("disabled").text("发送验证码");
  5875. } else {
  5876. $(btn).addClass("disabled").text(seconds + "秒后可再次发送");
  5877. }
  5878. }, 1000);
  5879. if (typeof callback == 'function') {
  5880. callback.call(this, data, ret);
  5881. }
  5882. }, function () {
  5883. $(btn).removeClass("disabled").text('发送验证码');
  5884. });
  5885. };
  5886. if (['mobile', 'email'].indexOf(type) > -1) {
  5887. var element = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : $("input[name='" + type + "']", $(this).closest("form"));
  5888. var text = type === 'email' ? '邮箱' : '手机号码';
  5889. if (element.val() === "") {
  5890. Layer.msg(text + "不能为空!");
  5891. element.focus();
  5892. return false;
  5893. } else if (type === 'mobile' && !element.val().match(/^1[3-9]\d{9}$/)) {
  5894. Layer.msg("请输入正确的" + text + "!");
  5895. element.focus();
  5896. return false;
  5897. } else if (type === 'email' && !element.val().match(/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/)) {
  5898. Layer.msg("请输入正确的" + text + "!");
  5899. element.focus();
  5900. return false;
  5901. }
  5902. element.isValid(function (v) {
  5903. if (v) {
  5904. var data = {event: $(btn).data("event")};
  5905. data[type] = element.val();
  5906. Frontend.api.sendcaptcha(btn, type, data);
  5907. } else {
  5908. Layer.msg("请确认已经输入了正确的" + text + "!");
  5909. }
  5910. });
  5911. } else {
  5912. var data = {event: $(btn).data("event")};
  5913. Frontend.api.sendcaptcha(btn, type, data, function (data, ret) {
  5914. Layer.open({title: false, area: ["400px", "430px"], content: "<img src='" + data.image + "' width='400' height='400' /><div class='text-center panel-title'>扫一扫关注公众号获取验证码</div>", type: 1});
  5915. });
  5916. }
  5917. return false;
  5918. });
  5919. //tooltip和popover
  5920. if (!('ontouchstart' in document.documentElement)) {
  5921. $('body').tooltip({selector: '[data-toggle="tooltip"]'});
  5922. }
  5923. $('body').popover({selector: '[data-toggle="popover"]'});
  5924. // 手机端左右滑动切换菜单栏
  5925. if ('ontouchstart' in document.documentElement) {
  5926. var startX, startY, moveEndX, moveEndY, relativeX, relativeY, element;
  5927. element = $('body', document);
  5928. element.on("touchstart", function (e) {
  5929. startX = e.originalEvent.changedTouches[0].pageX;
  5930. startY = e.originalEvent.changedTouches[0].pageY;
  5931. });
  5932. element.on("touchend", function (e) {
  5933. moveEndX = e.originalEvent.changedTouches[0].pageX;
  5934. moveEndY = e.originalEvent.changedTouches[0].pageY;
  5935. relativeX = moveEndX - startX;
  5936. relativeY = moveEndY - startY;
  5937. // 判断标准
  5938. //右滑
  5939. if (relativeX > 45) {
  5940. if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) {
  5941. element.addClass("sidebar-open");
  5942. }
  5943. }
  5944. //左滑
  5945. else if (relativeX < -45) {
  5946. if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) {
  5947. element.removeClass("sidebar-open");
  5948. }
  5949. }
  5950. });
  5951. }
  5952. $(document).on("click", ".sidebar-toggle", function () {
  5953. $("body").toggleClass("sidebar-open");
  5954. });
  5955. }
  5956. };
  5957. Frontend.api = $.extend(Fast.api, Frontend.api);
  5958. //将Template渲染至全局,以便于在子框架中调用
  5959. window.Template = Template;
  5960. //将Moment渲染至全局,以便于在子框架中调用
  5961. window.Moment = Moment;
  5962. //将Frontend渲染至全局,以便于在子框架中调用
  5963. window.Frontend = Frontend;
  5964. Frontend.init();
  5965. return Frontend;
  5966. });
  5967. define('frontend-init',['frontend'], function (Frontend) {
  5968. });
  5969. //! moment.js locale configuration
  5970. //! locale : Chinese (China) [zh-cn]
  5971. //! author : suupic : https://github.com/suupic
  5972. //! author : Zeno Zeng : https://github.com/zenozeng
  5973. //! author : uu109 : https://github.com/uu109
  5974. ;(function (global, factory) {
  5975. typeof exports === 'object' && typeof module !== 'undefined'
  5976. && typeof require === 'function' ? factory(require('../moment')) :
  5977. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  5978. factory(global.moment)
  5979. }(this, (function (moment) { 'use strict';
  5980. //! moment.js locale configuration
  5981. var zhCn = moment.defineLocale('zh-cn', {
  5982. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  5983. '_'
  5984. ),
  5985. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  5986. '_'
  5987. ),
  5988. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  5989. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  5990. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  5991. longDateFormat: {
  5992. LT: 'HH:mm',
  5993. LTS: 'HH:mm:ss',
  5994. L: 'YYYY/MM/DD',
  5995. LL: 'YYYY年M月D日',
  5996. LLL: 'YYYY年M月D日Ah点mm分',
  5997. LLLL: 'YYYY年M月D日ddddAh点mm分',
  5998. l: 'YYYY/M/D',
  5999. ll: 'YYYY年M月D日',
  6000. lll: 'YYYY年M月D日 HH:mm',
  6001. llll: 'YYYY年M月D日dddd HH:mm',
  6002. },
  6003. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  6004. meridiemHour: function (hour, meridiem) {
  6005. if (hour === 12) {
  6006. hour = 0;
  6007. }
  6008. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  6009. return hour;
  6010. } else if (meridiem === '下午' || meridiem === '晚上') {
  6011. return hour + 12;
  6012. } else {
  6013. // '中午'
  6014. return hour >= 11 ? hour : hour + 12;
  6015. }
  6016. },
  6017. meridiem: function (hour, minute, isLower) {
  6018. var hm = hour * 100 + minute;
  6019. if (hm < 600) {
  6020. return '凌晨';
  6021. } else if (hm < 900) {
  6022. return '早上';
  6023. } else if (hm < 1130) {
  6024. return '上午';
  6025. } else if (hm < 1230) {
  6026. return '中午';
  6027. } else if (hm < 1800) {
  6028. return '下午';
  6029. } else {
  6030. return '晚上';
  6031. }
  6032. },
  6033. calendar: {
  6034. sameDay: '[今天]LT',
  6035. nextDay: '[明天]LT',
  6036. nextWeek: function (now) {
  6037. if (now.week() !== this.week()) {
  6038. return '[下]dddLT';
  6039. } else {
  6040. return '[本]dddLT';
  6041. }
  6042. },
  6043. lastDay: '[昨天]LT',
  6044. lastWeek: function (now) {
  6045. if (this.week() !== now.week()) {
  6046. return '[上]dddLT';
  6047. } else {
  6048. return '[本]dddLT';
  6049. }
  6050. },
  6051. sameElse: 'L',
  6052. },
  6053. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  6054. ordinal: function (number, period) {
  6055. switch (period) {
  6056. case 'd':
  6057. case 'D':
  6058. case 'DDD':
  6059. return number + '日';
  6060. case 'M':
  6061. return number + '月';
  6062. case 'w':
  6063. case 'W':
  6064. return number + '周';
  6065. default:
  6066. return number;
  6067. }
  6068. },
  6069. relativeTime: {
  6070. future: '%s后',
  6071. past: '%s前',
  6072. s: '几秒',
  6073. ss: '%d 秒',
  6074. m: '1 分钟',
  6075. mm: '%d 分钟',
  6076. h: '1 小时',
  6077. hh: '%d 小时',
  6078. d: '1 天',
  6079. dd: '%d 天',
  6080. w: '1 周',
  6081. ww: '%d 周',
  6082. M: '1 个月',
  6083. MM: '%d 个月',
  6084. y: '1 年',
  6085. yy: '%d 年',
  6086. },
  6087. week: {
  6088. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6089. dow: 1, // Monday is the first day of the week.
  6090. doy: 4, // The week that contains Jan 4th is the first week of the year.
  6091. },
  6092. });
  6093. return zhCn;
  6094. })));
  6095. (function($){"use strict";var cachedWidth=null;var sprintf=function(str){var args=arguments,flag=true,i=1;str=str.replace(/%s/g,function(){var arg=args[i++];if(typeof arg==="undefined"){flag=false;return""}return arg});return flag?str:""};var getPropertyFromOther=function(list,from,to,value){var result="";$.each(list,function(i,item){if(item[from]===value){result=item[to];return false}return true});return result};var getFieldIndex=function(columns,field){var index=-1;$.each(columns,function(i,column){if(column.field===field){index=i;return false}return true});return index};var setFieldIndex=function(columns){var i,j,k,totalCol=0,flag=[];for(i=0;i<columns[0].length;i++){totalCol+=columns[0][i].colspan||1}for(i=0;i<columns.length;i++){flag[i]=[];for(j=0;j<totalCol;j++){flag[i][j]=false}}for(i=0;i<columns.length;i++){for(j=0;j<columns[i].length;j++){var r=columns[i][j],rowspan=r.rowspan||1,colspan=r.colspan||1,index=$.inArray(false,flag[i]);if(colspan===1){r.fieldIndex=index;if(typeof r.field==="undefined"){r.field=index}}for(k=0;k<rowspan;k++){flag[i+k][index]=true}for(k=0;k<colspan;k++){flag[i][index+k]=true}}}};var getScrollBarWidth=function(){if(cachedWidth===null){var inner=$("<p/>").addClass("fixed-table-scroll-inner"),outer=$("<div/>").addClass("fixed-table-scroll-outer"),w1,w2;outer.append(inner);$("body").append(outer);w1=inner[0].offsetWidth;outer.css("overflow","scroll");w2=inner[0].offsetWidth;if(w1===w2){w2=outer[0].clientWidth}outer.remove();cachedWidth=w1-w2}return cachedWidth};var calculateObjectValue=function(self,name,args,defaultValue){var func=name;if(typeof name==="string"){var names=name.split(".");if(names.length>1){func=window;$.each(names,function(i,f){func=func[f]})}else{func=window[name]}}if(typeof func==="object"){return func}if(typeof func==="function"){return func.apply(self,args||[])}if(!func&&typeof name==="string"&&sprintf.apply(this,[name].concat(args))){return sprintf.apply(this,[name].concat(args))}return defaultValue};var compareObjects=function(objectA,objectB,compareLength){var objectAProperties=Object.getOwnPropertyNames(objectA),objectBProperties=Object.getOwnPropertyNames(objectB),propName="";if(compareLength){if(objectAProperties.length!==objectBProperties.length){return false}}for(var i=0;i<objectAProperties.length;i++){propName=objectAProperties[i];if($.inArray(propName,objectBProperties)>-1){if(objectA[propName]!==objectB[propName]){return false}}}return true};var escapeHTML=function(text){if(typeof text==="string"){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/`/g,"&#x60;")}return text};var getRealDataAttr=function(dataAttr){for(var attr in dataAttr){var auxAttr=attr.split(/(?=[A-Z])/).join("-").toLowerCase();if(auxAttr!==attr){dataAttr[auxAttr]=dataAttr[attr];delete dataAttr[attr]}}return dataAttr};var getItemField=function(item,field,escape){var value=item;if(typeof field!=="string"||item.hasOwnProperty(field)){return escape?escapeHTML(item[field]):item[field]}var props=field.split(".");for(var p in props){if(props.hasOwnProperty(p)){value=value&&value[props[p]]}}return escape?escapeHTML(value):value};var isIEBrowser=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||!!navigator.userAgent.match(/Trident.*rv\:11\./))};var objectKeys=function(){if(!Object.keys){Object.keys=function(){var hasOwnProperty=Object.prototype.hasOwnProperty,hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;return function(obj){if(typeof obj!=="object"&&(typeof obj!=="function"||obj===null)){throw new TypeError("Object.keys called on non-object")}var result=[],prop,i;for(prop in obj){if(hasOwnProperty.call(obj,prop)){result.push(prop)}}if(hasDontEnumBug){for(i=0;i<dontEnumsLength;i++){if(hasOwnProperty.call(obj,dontEnums[i])){result.push(dontEnums[i])}}}return result}}()}};var BootstrapTable=function(el,options){this.options=options;this.$el=$(el);this.$el_=this.$el.clone();this.timeoutId_=0;this.timeoutFooter_=0;this.init()};BootstrapTable.DEFAULTS={classes:"table table-hover",sortClass:undefined,locale:undefined,height:undefined,undefinedText:"-",sortName:undefined,sortOrder:"asc",sortStable:false,striped:false,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:undefined,ajax:undefined,cache:true,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(params){return params},queryParamsType:"limit",responseHandler:function(res){return res},pagination:false,onlyInfoPagination:false,paginationLoop:true,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"&lsaquo;",paginationNextText:"&rsaquo;",search:false,searchOnEnterKey:false,strictSearch:false,searchAlign:"right",selectItemName:"btSelectItem",showHeader:true,showFooter:false,showColumns:false,showPaginationSwitch:false,showRefresh:false,showToggle:false,buttonsAlign:"right",smartDisplay:true,escape:false,minimumCountColumns:1,idField:undefined,uniqueId:undefined,cardView:false,detailView:false,detailFormatter:function(index,row){return""},trimOnSearch:true,clickToSelect:false,singleSelect:false,toolbar:undefined,toolbarAlign:"left",checkboxHeader:true,sortable:true,silentSort:true,maintainSelected:false,searchTimeOut:500,searchText:"",iconSize:undefined,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:$.noop,customSort:$.noop,rowStyle:function(row,index){return{}},rowAttributes:function(row,index){return{}},footerStyle:function(row,index){return{}},onAll:function(name,args){return false},onClickCell:function(field,value,row,$element){return false},onDblClickCell:function(field,value,row,$element){return false},onClickRow:function(item,$element){return false},onDblClickRow:function(item,$element){return false},onSort:function(name,order){return false},onCheck:function(row){return false},onUncheck:function(row){return false},onCheckAll:function(rows){return false},onUncheckAll:function(rows){return false},onCheckSome:function(rows){return false},onUncheckSome:function(rows){return false},onLoadSuccess:function(data){return false},onLoadError:function(status){return false},onColumnSwitch:function(field,checked){return false},onPageChange:function(number,size){return false},onSearch:function(text){return false},onToggle:function(cardView){return false},onPreBody:function(data){return false},onPostBody:function(){return false},onPostHeader:function(){return false},onExpandRow:function(index,row,$detail){return false},onCollapseRow:function(index,row){return false},onRefreshOptions:function(options){return false},onRefresh:function(params){return false},onResetView:function(){return false}};BootstrapTable.LOCALES={};BootstrapTable.LOCALES["en-US"]=BootstrapTable.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(pageNumber){return sprintf("%s rows per page",pageNumber)},formatShowingRows:function(pageFrom,pageTo,totalRows){return sprintf("Showing %s to %s of %s rows",pageFrom,pageTo,totalRows)},formatDetailPagination:function(totalRows){return sprintf("Showing %s rows",totalRows)},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"}};$.extend(BootstrapTable.DEFAULTS,BootstrapTable.LOCALES["en-US"]);BootstrapTable.COLUMN_DEFAULTS={radio:false,checkbox:false,checkboxEnabled:true,field:undefined,title:undefined,titleTooltip:undefined,class:undefined,align:undefined,halign:undefined,falign:undefined,valign:undefined,width:undefined,sortable:false,order:"asc",visible:true,switchable:true,clickToSelect:true,formatter:undefined,footerFormatter:undefined,events:undefined,sorter:undefined,sortName:undefined,cellStyle:undefined,searchable:true,searchFormatter:true,cardVisible:true,escape:false};BootstrapTable.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"};BootstrapTable.prototype.init=function(){this.initLocale();this.initContainer();this.initTable();this.initHeader();this.initData();this.initHiddenRows();this.initFooter();this.initToolbar();this.initPagination();this.initBody();this.initSearchText();this.initServer()};BootstrapTable.prototype.initLocale=function(){if(this.options.locale){var parts=this.options.locale.split(/-|_/);parts[0].toLowerCase();if(parts[1])parts[1].toUpperCase();if($.fn.bootstrapTable.locales[this.options.locale]){$.extend(this.options,$.fn.bootstrapTable.locales[this.options.locale])}else if($.fn.bootstrapTable.locales[parts.join("-")]){$.extend(this.options,$.fn.bootstrapTable.locales[parts.join("-")])}else if($.fn.bootstrapTable.locales[parts[0]]){$.extend(this.options,$.fn.bootstrapTable.locales[parts[0]])}}};BootstrapTable.prototype.initContainer=function(){this.$container=$(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?'<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>',this.options.paginationVAlign==="bottom"||this.options.paginationVAlign==="both"?'<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);if(this.options.striped){this.$el.addClass("table-striped")}if($.inArray("table-no-bordered",this.options.classes.split(" "))!==-1){this.$tableContainer.addClass("table-no-bordered")}};BootstrapTable.prototype.initTable=function(){var that=this,columns=[],data=[];this.$header=this.$el.find(">thead");if(!this.$header.length){this.$header=$("<thead></thead>").appendTo(this.$el)}this.$header.find("tr").each(function(){var column=[];$(this).find("th").each(function(){if(typeof $(this).data("field")!=="undefined"){$(this).data("field",$(this).data("field")+"")}column.push($.extend({},{title:$(this).html(),class:$(this).attr("class"),titleTooltip:$(this).attr("title"),rowspan:$(this).attr("rowspan")?+$(this).attr("rowspan"):undefined,colspan:$(this).attr("colspan")?+$(this).attr("colspan"):undefined},$(this).data()))});columns.push(column)});if(!$.isArray(this.options.columns[0])){this.options.columns=[this.options.columns]}this.options.columns=$.extend(true,[],columns,this.options.columns);this.columns=[];setFieldIndex(this.options.columns);$.each(this.options.columns,function(i,columns){$.each(columns,function(j,column){column=$.extend({},BootstrapTable.COLUMN_DEFAULTS,column);if(typeof column.fieldIndex!=="undefined"){that.columns[column.fieldIndex]=column}that.options.columns[i][j]=column})});if(this.options.data.length){return}var m=[];this.$el.find(">tbody>tr").each(function(y){var row={};row._id=$(this).attr("id");row._class=$(this).attr("class");row._data=getRealDataAttr($(this).data());$(this).find(">td").each(function(x){var $this=$(this),cspan=+$this.attr("colspan")||1,rspan=+$this.attr("rowspan")||1,tx,ty;for(;m[y]&&m[y][x];x++);for(tx=x;tx<x+cspan;tx++){for(ty=y;ty<y+rspan;ty++){if(!m[ty]){m[ty]=[]}m[ty][tx]=true}}var field=that.columns[x].field;row[field]=$(this).html();row["_"+field+"_id"]=$(this).attr("id");row["_"+field+"_class"]=$(this).attr("class");row["_"+field+"_rowspan"]=$(this).attr("rowspan");row["_"+field+"_colspan"]=$(this).attr("colspan");row["_"+field+"_title"]=$(this).attr("title");row["_"+field+"_data"]=getRealDataAttr($(this).data())});data.push(row)});this.options.data=data;if(data.length)this.fromHtml=true};BootstrapTable.prototype.initHeader=function(){var that=this,visibleColumns={},html=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]};$.each(this.options.columns,function(i,columns){html.push("<tr>");if(i===0&&!that.options.cardView&&that.options.detailView){html.push(sprintf('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',that.options.columns.length))}$.each(columns,function(j,column){var text="",halign="",align="",style="",class_=sprintf(' class="%s"',column["class"]),order=that.options.sortOrder||column.order,unitWidth="px",width=column.width;if(column.width!==undefined&&!that.options.cardView){if(typeof column.width==="string"){if(column.width.indexOf("%")!==-1){unitWidth="%"}}}if(column.width&&typeof column.width==="string"){width=column.width.replace("%","").replace("px","")}halign=sprintf("text-align: %s; ",column.halign?column.halign:column.align);align=sprintf("text-align: %s; ",column.align);style=sprintf("vertical-align: %s; ",column.valign);style+=sprintf("width: %s; ",(column.checkbox||column.radio)&&!width?"36px":width?width+unitWidth:undefined);if(typeof column.fieldIndex!=="undefined"){that.header.fields[column.fieldIndex]=column.field;that.header.styles[column.fieldIndex]=align+style;that.header.classes[column.fieldIndex]=class_;that.header.formatters[column.fieldIndex]=column.formatter;that.header.events[column.fieldIndex]=column.events;that.header.sorters[column.fieldIndex]=column.sorter;that.header.sortNames[column.fieldIndex]=column.sortName;that.header.cellStyles[column.fieldIndex]=column.cellStyle;that.header.searchables[column.fieldIndex]=column.searchable;if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}visibleColumns[column.field]=column}html.push("<th"+sprintf(' title="%s"',column.titleTooltip),column.checkbox||column.radio?sprintf(' class="bs-checkbox %s"',column["class"]||""):class_,sprintf(' style="%s"',halign+style),sprintf(' rowspan="%s"',column.rowspan),sprintf(' colspan="%s"',column.colspan),sprintf(' data-field="%s"',column.field),">");html.push(sprintf('<div class="th-inner %s">',that.options.sortable&&column.sortable?"sortable both":""));text=that.options.escape?escapeHTML(column.title):column.title;if(column.checkbox){if(!that.options.singleSelect&&that.options.checkboxHeader){text='<input name="btSelectAll" type="checkbox" />'}that.header.stateField=column.field}if(column.radio){text="";that.header.stateField=column.field;that.options.singleSelect=true}html.push(text);html.push("</div>");html.push('<div class="fht-cell"></div>');html.push("</div>");html.push("</th>")});html.push("</tr>")});this.$header.html(html.join(""));this.$header.find("th[data-field]").each(function(i){$(this).data(visibleColumns[$(this).data("field")])});this.$container.off("click",".th-inner").on("click",".th-inner",function(event){var target=$(this);if(that.options.detailView){if(target.closest(".bootstrap-table")[0]!==that.$container[0])return false}if(that.options.sortable&&target.parent().data().sortable){that.onSort(event)}});this.$header.children().children().off("keypress").on("keypress",function(event){if(that.options.sortable&&$(this).data().sortable){var code=event.keyCode||event.which;if(code==13){that.onSort(event)}}});$(window).off("resize.bootstrap-table");if(!this.options.showHeader||this.options.cardView){this.$header.hide();this.$tableHeader.hide();this.$tableLoading.css("top",0)}else{this.$header.show();this.$tableHeader.show();this.$tableLoading.css("top",this.$header.outerHeight()+1);this.getCaret();$(window).on("resize.bootstrap-table",$.proxy(this.resetWidth,this))}this.$selectAll=this.$header.find('[name="btSelectAll"]');this.$selectAll.off("click").on("click",function(){var checked=$(this).prop("checked");that[checked?"checkAll":"uncheckAll"]();that.updateSelected()})};BootstrapTable.prototype.initFooter=function(){if(!this.options.showFooter||this.options.cardView){this.$tableFooter.hide()}else{this.$tableFooter.show()}};BootstrapTable.prototype.initData=function(data,type){if(type==="append"){this.data=this.data.concat(data)}else if(type==="prepend"){this.data=[].concat(data).concat(this.data)}else{this.data=data||this.options.data}if(type==="append"){this.options.data=this.options.data.concat(data)}else if(type==="prepend"){this.options.data=[].concat(data).concat(this.options.data)}else{this.options.data=this.data}if(this.options.sidePagination==="server"){return}this.initSort()};BootstrapTable.prototype.initSort=function(){var that=this,name=this.options.sortName,order=this.options.sortOrder==="desc"?-1:1,index=$.inArray(this.options.sortName,this.header.fields),timeoutId=0;if(this.options.customSort!==$.noop){this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]);return}if(index!==-1){if(this.options.sortStable){$.each(this.data,function(i,row){if(!row.hasOwnProperty("_position"))row._position=i})}this.data.sort(function(a,b){if(that.header.sortNames[index]){name=that.header.sortNames[index]}var aa=getItemField(a,name,that.options.escape),bb=getItemField(b,name,that.options.escape),value=calculateObjectValue(that.header,that.header.sorters[index],[aa,bb]);if(value!==undefined){return order*value}if(aa===undefined||aa===null){aa=""}if(bb===undefined||bb===null){bb=""}if(that.options.sortStable&&aa===bb){aa=a._position;bb=b._position}if($.isNumeric(aa)&&$.isNumeric(bb)){aa=parseFloat(aa);bb=parseFloat(bb);if(aa<bb){return order*-1}return order}if(aa===bb){return 0}if(typeof aa!=="string"){aa=aa.toString()}if(aa.localeCompare(bb)===-1){return order*-1}return order});if(this.options.sortClass!==undefined){clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.$el.removeClass(that.options.sortClass);var index=that.$header.find(sprintf('[data-field="%s"]',that.options.sortName).index()+1);that.$el.find(sprintf("tr td:nth-child(%s)",index)).addClass(that.options.sortClass)},250)}}};BootstrapTable.prototype.onSort=function(event){var $this=event.type==="keypress"?$(event.currentTarget):$(event.currentTarget).parent(),$this_=this.$header.find("th").eq($this.index());this.$header.add(this.$header_).find("span.order").remove();if(this.options.sortName===$this.data("field")){this.options.sortOrder=this.options.sortOrder==="asc"?"desc":"asc"}else{this.options.sortName=$this.data("field");this.options.sortOrder=$this.data("order")==="asc"?"desc":"asc"}this.trigger("sort",this.options.sortName,this.options.sortOrder);$this.add($this_).data("order",this.options.sortOrder);this.getCaret();if(this.options.sidePagination==="server"){this.initServer(this.options.silentSort);return}this.initSort();this.initBody()};BootstrapTable.prototype.initToolbar=function(){var that=this,html=[],timeoutId=0,$keepOpen,$search,switchableCount=0;if(this.$toolbar.find(".bs-bars").children().length){$("body").append($(this.options.toolbar))}this.$toolbar.html("");if(typeof this.options.toolbar==="string"||typeof this.options.toolbar==="object"){$(sprintf('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append($(this.options.toolbar))}html=[sprintf('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)];if(typeof this.options.icons==="string"){this.options.icons=calculateObjectValue(null,this.options.icons)}if(this.options.showPaginationSwitch){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',this.options.formatPaginationSwitch()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>")}if(this.options.showRefresh){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" aria-label="refresh" title="%s">',this.options.formatRefresh()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>")}if(this.options.showToggle){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" aria-label="toggle" title="%s">',this.options.formatToggle()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>")}if(this.options.showColumns){html.push(sprintf('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" aria-label="columns" class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">');$.each(this.columns,function(i,column){if(column.radio||column.checkbox){return}if(that.options.cardView&&!column.cardVisible){return}var checked=column.visible?' checked="checked"':"";if(column.switchable){html.push(sprintf('<li role="menuitem">'+'<label><input type="checkbox" data-field="%s" value="%s"%s> %s</label>'+"</li>",column.field,i,checked,column.title));switchableCount++}});html.push("</ul>","</div>")}html.push("</div>");if(this.showToolbar||html.length>2){this.$toolbar.append(html.join(""))}if(this.options.showPaginationSwitch){this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",$.proxy(this.togglePagination,this))}if(this.options.showRefresh){this.$toolbar.find('button[name="refresh"]').off("click").on("click",$.proxy(this.refresh,this))}if(this.options.showToggle){this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){that.toggleView()})}if(this.options.showColumns){$keepOpen=this.$toolbar.find(".keep-open");if(switchableCount<=this.options.minimumCountColumns){$keepOpen.find("input").prop("disabled",true)}$keepOpen.find("li").off("click").on("click",function(event){event.stopImmediatePropagation()});$keepOpen.find("input").off("click").on("click",function(){var $this=$(this);that.toggleColumn($(this).val(),$this.prop("checked"),false);that.trigger("column-switch",$(this).data("field"),$this.prop("checked"))})}if(this.options.search){html=[];html.push('<div class="pull-'+this.options.searchAlign+' search">',sprintf('<input class="form-control'+sprintf(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>");this.$toolbar.append(html.join(""));$search=this.$toolbar.find(".search input");$search.off("keyup drop blur").on("keyup drop blur",function(event){if(that.options.searchOnEnterKey&&event.keyCode!==13){return}if($.inArray(event.keyCode,[37,38,39,40])>-1){return}clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)});if(isIEBrowser()){$search.off("mouseup").on("mouseup",function(event){clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)})}}};BootstrapTable.prototype.onSearch=function(event){var text=$.trim($(event.currentTarget).val());if(this.options.trimOnSearch&&$(event.currentTarget).val()!==text){$(event.currentTarget).val(text)}if(text===this.searchText){return}this.searchText=text;this.options.searchText=text;this.options.pageNumber=1;this.initSearch();this.updatePagination();this.trigger("search",text)};BootstrapTable.prototype.initSearch=function(){var that=this;if(this.options.sidePagination!=="server"){if(this.options.customSearch!==$.noop){this.options.customSearch.apply(this,[this.searchText]);return}var s=this.searchText&&(this.options.escape?escapeHTML(this.searchText):this.searchText).toLowerCase();var f=$.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=f?$.grep(this.options.data,function(item,i){for(var key in f){if($.isArray(f[key])&&$.inArray(item[key],f[key])===-1||!$.isArray(f[key])&&item[key]!==f[key]){return false}}return true}):this.options.data;this.data=s?$.grep(this.data,function(item,i){for(var j=0;j<that.header.fields.length;j++){if(!that.header.searchables[j]){continue}var key=$.isNumeric(that.header.fields[j])?parseInt(that.header.fields[j],10):that.header.fields[j];var column=that.columns[getFieldIndex(that.columns,key)];var value;if(typeof key==="string"){value=item;var props=key.split(".");for(var prop_index=0;prop_index<props.length;prop_index++){value=value[props[prop_index]]}if(column&&column.searchFormatter){value=calculateObjectValue(column,that.header.formatters[j],[value,item,i],value)}}else{value=item[key]}if(typeof value==="string"||typeof value==="number"){if(that.options.strictSearch){if((value+"").toLowerCase()===s){return true}}else{if((value+"").toLowerCase().indexOf(s)!==-1){return true}}}}return false}):this.data}};BootstrapTable.prototype.initPagination=function(){if(!this.options.pagination){this.$pagination.hide();return}else{this.$pagination.show()}var that=this,html=[],$allSelected=false,i,from,to,$pageList,$first,$pre,$next,$last,$number,data=this.getData(),pageList=this.options.pageList;if(this.options.sidePagination!=="server"){this.options.totalRows=data.length}this.totalPages=0;if(this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows()){this.options.pageSize=this.options.totalRows;$allSelected=true}else if(this.options.pageSize===this.options.totalRows){var pageLst=typeof this.options.pageList==="string"?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;if($.inArray(this.options.formatAllRows().toLowerCase(),pageLst)>-1){$allSelected=true}}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;if(this.pageTo>this.options.totalRows){this.pageTo=this.options.totalRows}html.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>");if(!this.options.onlyInfoPagination){html.push('<span class="page-list">');var pageNumber=[sprintf('<span class="btn-group %s">',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?"dropdown":"dropup"),'<button type="button" class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',$allSelected?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if(typeof this.options.pageList==="string"){var list=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");pageList=[];$.each(list,function(i,value){pageList.push(value.toUpperCase()===that.options.formatAllRows().toUpperCase()?that.options.formatAllRows():+value)})}$.each(pageList,function(i,page){if(!that.options.smartDisplay||i===0||pageList[i-1]<that.options.totalRows){var active;if($allSelected){active=page===that.options.formatAllRows()?' class="active"':""}else{active=page===that.options.pageSize?' class="active"':""}pageNumber.push(sprintf('<li role="menuitem"%s><a href="#">%s</a></li>',active,page))}});pageNumber.push("</ul></span>");html.push(this.options.formatRecordsPerPage(pageNumber.join("")));html.push("</span>");html.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+sprintf(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="#">'+this.options.paginationPreText+"</a></li>");if(this.totalPages<5){from=1;to=this.totalPages}else{from=this.options.pageNumber-2;to=from+4;if(from<1){from=1;to=5}if(to>this.totalPages){to=this.totalPages;from=to-4}}if(this.totalPages>=6){if(this.options.pageNumber>=3){html.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="#">',1,"</a>","</li>");from++}if(this.options.pageNumber>=4){if(this.options.pageNumber==4||this.totalPages==6||this.totalPages==7){from--}else{html.push('<li class="page-first-separator disabled">','<a href="#">...</a>',"</li>")}to--}}if(this.totalPages>=7){if(this.options.pageNumber>=this.totalPages-2){from--}}if(this.totalPages==6){if(this.options.pageNumber>=this.totalPages-2){to++}}else if(this.totalPages>=7){if(this.totalPages==7||this.options.pageNumber>=this.totalPages-3){to++}}for(i=from;i<=to;i++){html.push('<li class="page-number'+(i===this.options.pageNumber?" active":"")+'">','<a href="#">',i,"</a>","</li>")}if(this.totalPages>=8){if(this.options.pageNumber<=this.totalPages-4){html.push('<li class="page-last-separator disabled">','<a href="#">...</a>',"</li>")}}if(this.totalPages>=6){if(this.options.pageNumber<=this.totalPages-3){html.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="#">',this.totalPages,"</a>","</li>")}}html.push('<li class="page-next"><a href="#">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(html.join(""));if(!this.options.onlyInfoPagination){$pageList=this.$pagination.find(".page-list a");$first=this.$pagination.find(".page-first");$pre=this.$pagination.find(".page-pre");$next=this.$pagination.find(".page-next");$last=this.$pagination.find(".page-last");$number=this.$pagination.find(".page-number");if(this.options.smartDisplay){if(this.totalPages<=1){this.$pagination.find("div.pagination").hide()}if(pageList.length<2||this.options.totalRows<=pageList[0]){this.$pagination.find("span.page-list").hide()}this.$pagination[this.getData().length?"show":"hide"]()}if(!this.options.paginationLoop){if(this.options.pageNumber===1){$pre.addClass("disabled")}if(this.options.pageNumber===this.totalPages){$next.addClass("disabled")}}if($allSelected){this.options.pageSize=this.options.formatAllRows()}$pageList.off("click").on("click",$.proxy(this.onPageListChange,this));$first.off("click").on("click",$.proxy(this.onPageFirst,this));$pre.off("click").on("click",$.proxy(this.onPagePre,this));$next.off("click").on("click",$.proxy(this.onPageNext,this));$last.off("click").on("click",$.proxy(this.onPageLast,this));$number.off("click").on("click",$.proxy(this.onPageNumber,this))}};BootstrapTable.prototype.updatePagination=function(event){if(event&&$(event.currentTarget).hasClass("disabled")){return}if(!this.options.maintainSelected){this.resetRows()}this.initPagination();if(this.options.sidePagination==="server"){this.initServer()}else{this.initBody()}this.trigger("page-change",this.options.pageNumber,this.options.pageSize)};BootstrapTable.prototype.onPageListChange=function(event){var $this=$(event.currentTarget);$this.parent().addClass("active").siblings().removeClass("active");this.options.pageSize=$this.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+$this.text();this.$toolbar.find(".page-size").text(this.options.pageSize);this.updatePagination(event);return false};BootstrapTable.prototype.onPageFirst=function(event){this.options.pageNumber=1;this.updatePagination(event);return false};BootstrapTable.prototype.onPagePre=function(event){if(this.options.pageNumber-1===0){this.options.pageNumber=this.options.totalPages}else{this.options.pageNumber--}this.updatePagination(event);return false};BootstrapTable.prototype.onPageNext=function(event){if(this.options.pageNumber+1>this.options.totalPages){this.options.pageNumber=1}else{this.options.pageNumber++}this.updatePagination(event);return false};BootstrapTable.prototype.onPageLast=function(event){this.options.pageNumber=this.totalPages;this.updatePagination(event);return false};BootstrapTable.prototype.onPageNumber=function(event){if(this.options.pageNumber===+$(event.currentTarget).text()){return}this.options.pageNumber=+$(event.currentTarget).text();this.updatePagination(event);return false};BootstrapTable.prototype.initRow=function(item,i,data,parentDom){var that=this,key,html=[],style={},csses=[],data_="",attributes={},htmlAttributes=[];if($.inArray(item,this.hiddenRows)>-1){return}style=calculateObjectValue(this.options,this.options.rowStyle,[item,i],style);if(style&&style.css){for(key in style.css){csses.push(key+": "+style.css[key])}}attributes=calculateObjectValue(this.options,this.options.rowAttributes,[item,i],attributes);if(attributes){for(key in attributes){htmlAttributes.push(sprintf('%s="%s"',key,escapeHTML(attributes[key])))}}if(item._data&&!$.isEmptyObject(item._data)){$.each(item._data,function(k,v){if(k==="index"){return}data_+=sprintf(' data-%s="%s"',k,v)})}html.push("<tr",sprintf(" %s",htmlAttributes.join(" ")),sprintf(' id="%s"',$.isArray(item)?undefined:item._id),sprintf(' class="%s"',style.classes||($.isArray(item)?undefined:item._class)),sprintf(' data-index="%s"',i),sprintf(' data-uniqueid="%s"',item[this.options.uniqueId]),sprintf("%s",data_),">");if(this.options.cardView){html.push(sprintf('<td colspan="%s"><div class="card-views">',this.header.fields.length))}if(!this.options.cardView&&this.options.detailView){html.push("<td>",'<a class="detail-icon" href="#">',sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>")}$.each(this.header.fields,function(j,field){var text="",value_=getItemField(item,field,that.options.escape),value="",type="",cellStyle={},id_="",class_=that.header.classes[j],data_="",rowspan_="",colspan_="",title_="",column=that.columns[j];if(that.fromHtml&&typeof value_==="undefined"){return}if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}if(column.escape){value_=escapeHTML(value_)}style=sprintf('style="%s"',csses.concat(that.header.styles[j]).join("; "));if(item["_"+field+"_id"]){id_=sprintf(' id="%s"',item["_"+field+"_id"])}if(item["_"+field+"_class"]){class_=sprintf(' class="%s"',item["_"+field+"_class"])}if(item["_"+field+"_rowspan"]){rowspan_=sprintf(' rowspan="%s"',item["_"+field+"_rowspan"])}if(item["_"+field+"_colspan"]){colspan_=sprintf(' colspan="%s"',item["_"+field+"_colspan"])}if(item["_"+field+"_title"]){title_=sprintf(' title="%s"',item["_"+field+"_title"])}cellStyle=calculateObjectValue(that.header,that.header.cellStyles[j],[value_,item,i,field],cellStyle);if(cellStyle.classes){class_=sprintf(' class="%s"',cellStyle.classes)}if(cellStyle.css){var csses_=[];for(var key in cellStyle.css){csses_.push(key+": "+cellStyle.css[key])}style=sprintf('style="%s"',csses_.concat(that.header.styles[j]).join("; "))}value=calculateObjectValue(column,that.header.formatters[j],[value_,item,i],value_);if(item["_"+field+"_data"]&&!$.isEmptyObject(item["_"+field+"_data"])){$.each(item["_"+field+"_data"],function(k,v){if(k==="index"){return}data_+=sprintf(' data-%s="%s"',k,v)})}if(column.checkbox||column.radio){type=column.checkbox?"checkbox":type;type=column.radio?"radio":type;text=[sprintf(that.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',column["class"]||""),"<input"+sprintf(' data-index="%s"',i)+sprintf(' name="%s"',that.options.selectItemName)+sprintf(' type="%s"',type)+sprintf(' value="%s"',item[that.options.idField])+sprintf(' checked="%s"',value===true||(value_||value&&value.checked)?"checked":undefined)+sprintf(' disabled="%s"',!column.checkboxEnabled||value&&value.disabled?"disabled":undefined)+" />",that.header.formatters[j]&&typeof value==="string"?value:"",that.options.cardView?"</div>":"</td>"].join("");item[that.header.stateField]=value===true||value&&value.checked}else{value=typeof value==="undefined"||value===null?that.options.undefinedText:value;text=that.options.cardView?['<div class="card-view">',that.options.showHeader?sprintf('<span class="title" %s>%s</span>',style,getPropertyFromOther(that.columns,"field","title",field)):"",sprintf('<span class="value">%s</span>',value),"</div>"].join(""):[sprintf("<td%s %s %s %s %s %s %s>",id_,class_,style,data_,rowspan_,colspan_,title_),value,"</td>"].join("");if(that.options.cardView&&that.options.smartDisplay&&value===""){text='<div class="card-view"></div>'}}html.push(text)});if(this.options.cardView){html.push("</div></td>")}html.push("</tr>");return html.join(" ")};BootstrapTable.prototype.initBody=function(fixedScroll){var that=this,html=[],data=this.getData();this.trigger("pre-body",data);this.$body=this.$el.find(">tbody");if(!this.$body.length){this.$body=$("<tbody></tbody>").appendTo(this.$el)}if(!this.options.pagination||this.options.sidePagination==="server"){this.pageFrom=1;this.pageTo=data.length}var trFragments=$(document.createDocumentFragment());var hasTr;for(var i=this.pageFrom-1;i<this.pageTo;i++){var item=data[i];var tr=this.initRow(item,i,data,trFragments);hasTr=hasTr||!!tr;if(tr&&tr!==true){trFragments.append(tr)}}if(!hasTr){trFragments.append('<tr class="no-records-found">'+sprintf('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches())+"</tr>")}this.$body.html(trFragments);if(!fixedScroll){this.scrollTo(0)}this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(e){var $td=$(this),$tr=$td.parent(),item=that.data[$tr.data("index")],index=$td[0].cellIndex,fields=that.getVisibleFields(),field=fields[that.options.detailView&&!that.options.cardView?index-1:index],column=that.columns[getFieldIndex(that.columns,field)],value=getItemField(item,field,that.options.escape);if($td.find(".detail-icon").length){return}that.trigger(e.type==="click"?"click-cell":"dbl-click-cell",field,value,item,$td);that.trigger(e.type==="click"?"click-row":"dbl-click-row",item,$tr,field);if(e.type==="click"&&that.options.clickToSelect&&column.clickToSelect){var $selectItem=$tr.find(sprintf('[name="%s"]',that.options.selectItemName));if($selectItem.length){$selectItem[0].click()}}});this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var $this=$(this),$tr=$this.parent().parent(),index=$tr.data("index"),row=data[index];if($tr.next().is("tr.detail-view")){$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailOpen));that.trigger("collapse-row",index,row);$tr.next().remove()}else{$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailClose));$tr.after(sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>',$tr.find("td").length));var $element=$tr.next().find("td");var content=calculateObjectValue(that.options,that.options.detailFormatter,[index,row,$element],"");if($element.length===1){$element.append(content)}that.trigger("expand-row",index,row,$element)}that.resetView();return false});this.$selectItem=this.$body.find(sprintf('[name="%s"]',this.options.selectItemName));this.$selectItem.off("click").on("click",function(event){event.stopImmediatePropagation();var $this=$(this),checked=$this.prop("checked"),row=that.data[$this.data("index")];if(that.options.maintainSelected&&$(this).is(":radio")){$.each(that.options.data,function(i,row){row[that.header.stateField]=false})}row[that.header.stateField]=checked;if(that.options.singleSelect){that.$selectItem.not(this).each(function(){that.data[$(this).data("index")][that.header.stateField]=false});that.$selectItem.filter(":checked").not(this).prop("checked",false)}that.updateSelected();that.trigger(checked?"check":"uncheck",row,$this)});$.each(this.header.events,function(i,events){if(!events){return}if(typeof events==="string"){events=calculateObjectValue(null,events)}var field=that.header.fields[i],fieldIndex=$.inArray(field,that.getVisibleFields());if(that.options.detailView&&!that.options.cardView){fieldIndex+=1}for(var key in events){that.$body.find(">tr:not(.no-records-found)").each(function(){var $tr=$(this),$td=$tr.find(that.options.cardView?".card-view":"td").eq(fieldIndex),index=key.indexOf(" "),name=key.substring(0,index),el=key.substring(index+1),func=events[key];$td.find(el).off(name).on(name,function(e){var index=$tr.data("index"),row=that.data[index],value=row[field];var props=field.split(".");if(props.length>1){value=row;for(var prop_index=0;prop_index<props.length;prop_index++){value=value[props[prop_index]]}}func.apply(this,[e,value,row,index])})})}});this.updateSelected();this.resetView();this.trigger("post-body",data)};BootstrapTable.prototype.initServer=function(silent,query,url){var that=this,data={},params={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder},request;if(this.options.pagination){params.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize;params.pageNumber=this.options.pageNumber}if(!(url||this.options.url)&&!this.options.ajax){return}if(this.options.queryParamsType==="limit"){params={search:params.searchText,sort:params.sortName,order:params.sortOrder};if(this.options.pagination){params.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1);params.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize}}if(!$.isEmptyObject(this.filterColumnsPartial)){params.filter=JSON.stringify(this.filterColumnsPartial,null)}data=calculateObjectValue(this.options,this.options.queryParams,[params],data);$.extend(data,query||{});if(data===false){return}if(!silent){this.$tableLoading.show()}request=$.extend({},calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:url||this.options.url,data:this.options.contentType==="application/json"&&this.options.method==="post"?JSON.stringify(data):data,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(res){res=calculateObjectValue(that.options,that.options.responseHandler,[res],res);that.load(res);that.trigger("load-success",res);if(!silent)that.$tableLoading.hide()},error:function(res){that.trigger("load-error",res.status,res);if(!silent)that.$tableLoading.hide()}});if(this.options.ajax){calculateObjectValue(this,this.options.ajax,[request],null)}else{if(this._xhr&&this._xhr.readyState!==4){this._xhr.abort()}this._xhr=$.ajax(request)}};BootstrapTable.prototype.initSearchText=function(){if(this.options.search){if(this.options.searchText!==""){var $search=this.$toolbar.find(".search input");$search.val(this.options.searchText);this.onSearch({currentTarget:$search})}}};BootstrapTable.prototype.getCaret=function(){var that=this;$.each(this.$header.find("th"),function(i,th){$(th).find(".sortable").removeClass("desc asc").addClass($(th).data("field")===that.options.sortName?that.options.sortOrder:"both")})};BootstrapTable.prototype.updateSelected=function(){var checkAll=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",checkAll);this.$selectItem.each(function(){$(this).closest("tr")[$(this).prop("checked")?"addClass":"removeClass"]("selected")})};BootstrapTable.prototype.updateRows=function(){var that=this;this.$selectItem.each(function(){that.data[$(this).data("index")][that.header.stateField]=$(this).prop("checked")})};BootstrapTable.prototype.resetRows=function(){var that=this;$.each(this.data,function(i,row){that.$selectAll.prop("checked",false);that.$selectItem.prop("checked",false);if(that.header.stateField){row[that.header.stateField]=false}});this.initHiddenRows()};BootstrapTable.prototype.trigger=function(name){var args=Array.prototype.slice.call(arguments,1);name+=".bs.table";this.options[BootstrapTable.EVENTS[name]].apply(this.options,args);this.$el.trigger($.Event(name),args);this.options.onAll(name,args);this.$el.trigger($.Event("all.bs.table"),[name,args])};BootstrapTable.prototype.resetHeader=function(){clearTimeout(this.timeoutId_);this.timeoutId_=setTimeout($.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)};BootstrapTable.prototype.fitHeader=function(){var that=this,fixedBody,scrollWidth,focused,focusedTemp;if(that.$el.is(":hidden")){that.timeoutId_=setTimeout($.proxy(that.fitHeader,that),100);return}fixedBody=this.$tableBody.get(0);scrollWidth=fixedBody.scrollWidth>fixedBody.clientWidth&&fixedBody.scrollHeight>fixedBody.clientHeight+this.$header.outerHeight()?getScrollBarWidth():0;this.$el.css("margin-top",-this.$header.outerHeight());focused=$(":focus");if(focused.length>0){var $th=focused.parents("th");if($th.length>0){var dataField=$th.attr("data-field");if(dataField!==undefined){var $headerTh=this.$header.find("[data-field='"+dataField+"']");if($headerTh.length>0){$headerTh.find(":input").addClass("focus-temp")}}}}this.$header_=this.$header.clone(true,true);this.$selectAll_=this.$header_.find('[name="btSelectAll"]');this.$tableHeader.css({"margin-right":scrollWidth}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_);focusedTemp=$(".focus-temp:visible:eq(0)");if(focusedTemp.length>0){focusedTemp.focus();this.$header.find(".focus-temp").removeClass("focus-temp")}this.$header.find("th[data-field]").each(function(i){that.$header_.find(sprintf('th[data-field="%s"]',$(this).data("field"))).data($(this).data())});var visibleFields=this.getVisibleFields(),$ths=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this),index=i;if(that.options.detailView&&!that.options.cardView){if(i===0){that.$header_.find("th.detail").find(".fht-cell").width($this.innerWidth())}index=i-1}var $th=that.$header_.find(sprintf('th[data-field="%s"]',visibleFields[index]));if($th.length>1){$th=$($ths[$this[0].cellIndex])}$th.find(".fht-cell").width($this.innerWidth())});this.$tableBody.off("scroll").on("scroll",function(){that.$tableHeader.scrollLeft($(this).scrollLeft());if(that.options.showFooter&&!that.options.cardView){that.$tableFooter.scrollLeft($(this).scrollLeft())}});that.trigger("post-header")};BootstrapTable.prototype.resetFooter=function(){var that=this,data=that.getData(),html=[];if(!this.options.showFooter||this.options.cardView){return}if(!this.options.cardView&&this.options.detailView){html.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>')}$.each(this.columns,function(i,column){var key,falign="",valign="",csses=[],style={},class_=sprintf(' class="%s"',column["class"]);if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}falign=sprintf("text-align: %s; ",column.falign?column.falign:column.align);valign=sprintf("vertical-align: %s; ",column.valign);style=calculateObjectValue(null,that.options.footerStyle);if(style&&style.css){for(key in style.css){csses.push(key+": "+style.css[key])}}html.push("<td",class_,sprintf(' style="%s"',falign+valign+csses.concat().join("; ")),">");html.push('<div class="th-inner">');html.push(calculateObjectValue(column,column.footerFormatter,[data],"&nbsp;")||"&nbsp;");html.push("</div>");html.push('<div class="fht-cell"></div>');html.push("</div>");html.push("</td>")});this.$tableFooter.find("tr").html(html.join(""));this.$tableFooter.show();clearTimeout(this.timeoutFooter_);this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0)};BootstrapTable.prototype.fitFooter=function(){var that=this,$footerTd,elWidth,scrollWidth;clearTimeout(this.timeoutFooter_);if(this.$el.is(":hidden")){this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),100);return}elWidth=this.$el.css("width");scrollWidth=elWidth>this.$tableBody.width()?getScrollBarWidth():0;this.$tableFooter.css({"margin-right":scrollWidth}).find("table").css("width",elWidth).attr("class",this.$el.attr("class"));$footerTd=this.$tableFooter.find("td");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this);$footerTd.eq(i).find(".fht-cell").width($this.innerWidth())})};BootstrapTable.prototype.toggleColumn=function(index,checked,needUpdate){if(index===-1){return}this.columns[index].visible=checked;this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",false);if(needUpdate){$items.filter(sprintf('[value="%s"]',index)).prop("checked",checked)}if($items.filter(":checked").length<=this.options.minimumCountColumns){$items.filter(":checked").prop("disabled",true)}}};BootstrapTable.prototype.getVisibleFields=function(){var that=this,visibleFields=[];$.each(this.header.fields,function(j,field){var column=that.columns[getFieldIndex(that.columns,field)];if(!column.visible){return}visibleFields.push(field)});return visibleFields};BootstrapTable.prototype.resetView=function(params){var padding=0;if(params&&params.height){this.options.height=params.height}this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length);if(this.options.height){var toolbarHeight=this.$toolbar.outerHeight(true),paginationHeight=this.$pagination.outerHeight(true),height=this.options.height-toolbarHeight-paginationHeight;this.$tableContainer.css("height",height+"px")}if(this.options.cardView){this.$el.css("margin-top","0");this.$tableContainer.css("padding-bottom","0");this.$tableFooter.hide();return}if(this.options.showHeader&&this.options.height){this.$tableHeader.show();this.resetHeader();padding+=this.$header.outerHeight()}else{this.$tableHeader.hide();this.trigger("post-header")}if(this.options.showFooter){this.resetFooter();if(this.options.height){padding+=this.$tableFooter.outerHeight()+1}}this.getCaret();this.$tableContainer.css("padding-bottom",padding+"px");this.trigger("reset-view")};BootstrapTable.prototype.getData=function(useCurrentPage){return this.searchText||!$.isEmptyObject(this.filterColumns)||!$.isEmptyObject(this.filterColumnsPartial)?useCurrentPage?this.data.slice(this.pageFrom-1,this.pageTo):this.data:useCurrentPage?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data};BootstrapTable.prototype.load=function(data){var fixedScroll=false;if(this.options.sidePagination==="server"){this.options.totalRows=data[this.options.totalField];fixedScroll=data.fixedScroll;data=data[this.options.dataField]}else if(!$.isArray(data)){fixedScroll=data.fixedScroll;data=data.data}this.initData(data);this.initSearch();this.initPagination();this.initBody(fixedScroll)};BootstrapTable.prototype.append=function(data){this.initData(data,"append");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.prepend=function(data){this.initData(data,"prepend");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.remove=function(params){var len=this.options.data.length,i,row;if(!params.hasOwnProperty("field")||!params.hasOwnProperty("values")){return}for(i=len-1;i>=0;i--){row=this.options.data[i];if(!row.hasOwnProperty(params.field)){continue}if($.inArray(row[params.field],params.values)!==-1){this.options.data.splice(i,1);if(this.options.sidePagination==="server"){this.options.totalRows-=1}}}if(len===this.options.data.length){return}this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.removeAll=function(){if(this.options.data.length>0){this.options.data.splice(0,this.options.data.length);this.initSearch();this.initPagination();this.initBody(true)}};BootstrapTable.prototype.getRowByUniqueId=function(id){var uniqueId=this.options.uniqueId,len=this.options.data.length,dataRow=null,i,row,rowUniqueId;for(i=len-1;i>=0;i--){row=this.options.data[i];if(row.hasOwnProperty(uniqueId)){rowUniqueId=row[uniqueId]}else if(row._data.hasOwnProperty(uniqueId)){rowUniqueId=row._data[uniqueId]}else{continue}if(typeof rowUniqueId==="string"){id=id.toString()}else if(typeof rowUniqueId==="number"){if(Number(rowUniqueId)===rowUniqueId&&rowUniqueId%1===0){id=parseInt(id)}else if(rowUniqueId===Number(rowUniqueId)&&rowUniqueId!==0){id=parseFloat(id)}}if(rowUniqueId===id){dataRow=row;break}}return dataRow};BootstrapTable.prototype.removeByUniqueId=function(id){var len=this.options.data.length,row=this.getRowByUniqueId(id);if(row){this.options.data.splice(this.options.data.indexOf(row),1)}if(len===this.options.data.length){return}this.initSearch();this.initPagination();this.initBody(true)};BootstrapTable.prototype.updateByUniqueId=function(params){var that=this;var allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){var rowId;if(!params.hasOwnProperty("id")||!params.hasOwnProperty("row")){return}rowId=$.inArray(that.getRowByUniqueId(params.id),that.options.data);if(rowId===-1){return}$.extend(that.options.data[rowId],params.row)});this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.insertRow=function(params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("row")){return}this.data.splice(params.index,0,params.row);this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.updateRow=function(params){var that=this;var allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("row")){return}$.extend(that.options.data[params.index],params.row)});this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.initHiddenRows=function(){this.hiddenRows=[]};BootstrapTable.prototype.showRow=function(params){this.toggleRow(params,true)};BootstrapTable.prototype.hideRow=function(params){this.toggleRow(params,false)};BootstrapTable.prototype.toggleRow=function(params,visible){var row,index;if(params.hasOwnProperty("index")){row=this.getData()[params.index]}else if(params.hasOwnProperty("uniqueId")){row=this.getRowByUniqueId(params.uniqueId)}if(!row){return}index=$.inArray(row,this.hiddenRows);if(!visible&&index===-1){this.hiddenRows.push(row)}else if(visible&&index>-1){this.hiddenRows.splice(index,1)}this.initBody(true)};BootstrapTable.prototype.getHiddenRows=function(show){var that=this,data=this.getData(),rows=[];$.each(data,function(i,row){if($.inArray(row,that.hiddenRows)>-1){rows.push(row)}});this.hiddenRows=rows;return rows};BootstrapTable.prototype.mergeCells=function(options){var row=options.index,col=$.inArray(options.field,this.getVisibleFields()),rowspan=options.rowspan||1,colspan=options.colspan||1,i,j,$tr=this.$body.find(">tr"),$td;if(this.options.detailView&&!this.options.cardView){col+=1}$td=$tr.eq(row).find(">td").eq(col);if(row<0||col<0||row>=this.data.length){return}for(i=row;i<row+rowspan;i++){for(j=col;j<col+colspan;j++){$tr.eq(i).find(">td").eq(j).hide()}}$td.attr("rowspan",rowspan).attr("colspan",colspan).show()};BootstrapTable.prototype.updateCell=function(params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("field")||!params.hasOwnProperty("value")){return}this.data[params.index][params.field]=params.value;if(params.reinit===false){return}this.initSort();this.initBody(true)};BootstrapTable.prototype.getOptions=function(){return this.options};BootstrapTable.prototype.getSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]===true})};BootstrapTable.prototype.getAllSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]})};BootstrapTable.prototype.checkAll=function(){this.checkAll_(true)};BootstrapTable.prototype.uncheckAll=function(){this.checkAll_(false)};BootstrapTable.prototype.checkInvert=function(){var that=this;var rows=that.$selectItem.filter(":enabled");var checked=rows.filter(":checked");rows.each(function(){$(this).prop("checked",!$(this).prop("checked"))});that.updateRows();that.updateSelected();that.trigger("uncheck-some",checked);checked=that.getSelections();that.trigger("check-some",checked)};BootstrapTable.prototype.checkAll_=function(checked){var rows;if(!checked){rows=this.getSelections()}this.$selectAll.add(this.$selectAll_).prop("checked",checked);this.$selectItem.filter(":enabled").prop("checked",checked);this.updateRows();if(checked){rows=this.getSelections()}this.trigger(checked?"check-all":"uncheck-all",rows)};BootstrapTable.prototype.check=function(index){this.check_(true,index)};BootstrapTable.prototype.uncheck=function(index){this.check_(false,index)};BootstrapTable.prototype.check_=function(checked,index){var $el=this.$selectItem.filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);this.data[index][this.header.stateField]=checked;this.updateSelected();this.trigger(checked?"check":"uncheck",this.data[index],$el)};BootstrapTable.prototype.checkBy=function(obj){this.checkBy_(true,obj)};BootstrapTable.prototype.uncheckBy=function(obj){this.checkBy_(false,obj)};BootstrapTable.prototype.checkBy_=function(checked,obj){if(!obj.hasOwnProperty("field")||!obj.hasOwnProperty("values")){return}var that=this,rows=[];$.each(this.options.data,function(index,row){if(!row.hasOwnProperty(obj.field)){return false}if($.inArray(row[obj.field],obj.values)!==-1){var $el=that.$selectItem.filter(":enabled").filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);row[that.header.stateField]=checked;rows.push(row);that.trigger(checked?"check":"uncheck",row,$el)}});this.updateSelected();this.trigger(checked?"check-some":"uncheck-some",rows)};BootstrapTable.prototype.destroy=function(){this.$el.insertBefore(this.$container);$(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")||"")};BootstrapTable.prototype.showLoading=function(){this.$tableLoading.show()};BootstrapTable.prototype.hideLoading=function(){this.$tableLoading.hide()};BootstrapTable.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var button=this.$toolbar.find('button[name="paginationSwitch"] i');if(this.options.pagination){button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown)}else{button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp)}this.updatePagination()};BootstrapTable.prototype.refresh=function(params){if(params&&params.url){this.options.url=params.url}if(params&&params.pageNumber){this.options.pageNumber=params.pageNumber}if(params&&params.pageSize){this.options.pageSize=params.pageSize}this.initServer(params&&params.silent,params&&params.query,params&&params.url);this.trigger("refresh",params)};BootstrapTable.prototype.resetWidth=function(){if(this.options.showHeader&&this.options.height){this.fitHeader()}if(this.options.showFooter){this.fitFooter()}};BootstrapTable.prototype.showColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),true,true)};BootstrapTable.prototype.hideColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),false,true)};BootstrapTable.prototype.getHiddenColumns=function(){return $.grep(this.columns,function(column){return!column.visible})};BootstrapTable.prototype.getVisibleColumns=function(){return $.grep(this.columns,function(column){return column.visible})};BootstrapTable.prototype.toggleAllColumns=function(visible){$.each(this.columns,function(i,column){this.columns[i].visible=visible});this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",false);if($items.filter(":checked").length<=this.options.minimumCountColumns){$items.filter(":checked").prop("disabled",true)}}};BootstrapTable.prototype.showAllColumns=function(){this.toggleAllColumns(true)};BootstrapTable.prototype.hideAllColumns=function(){this.toggleAllColumns(false)};BootstrapTable.prototype.filterBy=function(columns){this.filterColumns=$.isEmptyObject(columns)?{}:columns;this.options.pageNumber=1;this.initSearch();this.updatePagination()};BootstrapTable.prototype.scrollTo=function(value){if(typeof value==="string"){value=value==="bottom"?this.$tableBody[0].scrollHeight:0}if(typeof value==="number"){this.$tableBody.scrollTop(value)}if(typeof value==="undefined"){return this.$tableBody.scrollTop()}};BootstrapTable.prototype.getScrollPosition=function(){return this.scrollTo()};BootstrapTable.prototype.selectPage=function(page){if(page>0&&page<=this.options.totalPages){this.options.pageNumber=page;this.updatePagination()}};BootstrapTable.prototype.prevPage=function(){if(this.options.pageNumber>1){this.options.pageNumber--;this.updatePagination()}};BootstrapTable.prototype.nextPage=function(){if(this.options.pageNumber<this.options.totalPages){this.options.pageNumber++;this.updatePagination()}};BootstrapTable.prototype.toggleView=function(){this.options.cardView=!this.options.cardView;this.initHeader();this.initBody();this.trigger("toggle",this.options.cardView)};BootstrapTable.prototype.refreshOptions=function(options){if(compareObjects(this.options,options,true)){return}this.options=$.extend(this.options,options);this.trigger("refresh-options",this.options);this.destroy();this.init()};BootstrapTable.prototype.resetSearch=function(text){var $search=this.$toolbar.find(".search input");$search.val(text||"");this.onSearch({currentTarget:$search})};BootstrapTable.prototype.expandRow_=function(expand,index){var $tr=this.$body.find(sprintf('> tr[data-index="%s"]',index));if($tr.next().is("tr.detail-view")===(expand?false:true)){$tr.find("> td > .detail-icon").click()}};BootstrapTable.prototype.expandRow=function(index){this.expandRow_(true,index)};BootstrapTable.prototype.collapseRow=function(index){this.expandRow_(false,index)};BootstrapTable.prototype.expandAllRows=function(isSubTable){if(isSubTable){var $tr=this.$body.find(sprintf('> tr[data-index="%s"]',0)),that=this,detailIcon=null,executeInterval=false,idInterval=-1;if(!$tr.next().is("tr.detail-view")){$tr.find("> td > .detail-icon").click();executeInterval=true}else if(!$tr.next().next().is("tr.detail-view")){$tr.next().find(".detail-icon").click();executeInterval=true}if(executeInterval){try{idInterval=setInterval(function(){detailIcon=that.$body.find("tr.detail-view").last().find(".detail-icon");if(detailIcon.length>0){detailIcon.click()}else{clearInterval(idInterval)}},1)}catch(ex){clearInterval(idInterval)}}}else{var trs=this.$body.children();for(var i=0;i<trs.length;i++){this.expandRow_(true,$(trs[i]).data("index"))}}};BootstrapTable.prototype.collapseAllRows=function(isSubTable){if(isSubTable){this.expandRow_(false,0)}else{var trs=this.$body.children();for(var i=0;i<trs.length;i++){this.expandRow_(false,$(trs[i]).data("index"))}}};BootstrapTable.prototype.updateFormatText=function(name,text){if(this.options[sprintf("format%s",name)]){if(typeof text==="string"){this.options[sprintf("format%s",name)]=function(){return text}}else if(typeof text==="function"){this.options[sprintf("format%s",name)]=text}}this.initToolbar();this.initPagination();this.initBody()};var allowedMethods=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getHiddenRows","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","getVisibleColumns","showAllColumns","hideAllColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];$.fn.bootstrapTable=function(option){var value,args=Array.prototype.slice.call(arguments,1);this.each(function(){var $this=$(this),data=$this.data("bootstrap.table"),options=$.extend({},BootstrapTable.DEFAULTS,$this.data(),typeof option==="object"&&option);if(typeof option==="string"){if($.inArray(option,allowedMethods)<0){throw new Error("Unknown method: "+option)}if(!data){return}value=data[option].apply(data,args);if(option==="destroy"){$this.removeData("bootstrap.table")}}if(!data){$this.data("bootstrap.table",data=new BootstrapTable(this,options))}});return typeof value==="undefined"?this:value};$.fn.bootstrapTable.Constructor=BootstrapTable;$.fn.bootstrapTable.defaults=BootstrapTable.DEFAULTS;$.fn.bootstrapTable.columnDefaults=BootstrapTable.COLUMN_DEFAULTS;$.fn.bootstrapTable.locales=BootstrapTable.LOCALES;$.fn.bootstrapTable.methods=allowedMethods;$.fn.bootstrapTable.utils={sprintf:sprintf,getFieldIndex:getFieldIndex,compareObjects:compareObjects,calculateObjectValue:calculateObjectValue,getItemField:getItemField,objectKeys:objectKeys,isIEBrowser:isIEBrowser};$(function(){$('[data-toggle="table"]').bootstrapTable()})})(jQuery);
  6096. define("bootstrap-table", ["bootstrap"], (function (global) {
  6097. return function () {
  6098. var ret, fn;
  6099. return ret || global.$.fn.bootstrapTable;
  6100. };
  6101. }(this)));
  6102. /**
  6103. * Bootstrap Table Chinese translation
  6104. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  6105. */
  6106. (function ($) {
  6107. 'use strict';
  6108. $.fn.bootstrapTable.locales['zh-CN'] = {
  6109. formatLoadingMessage: function () {
  6110. return '正在努力地加载数据中,请稍候……';
  6111. },
  6112. formatRecordsPerPage: function (pageNumber) {
  6113. return '每页显示 ' + pageNumber + ' 条记录';
  6114. },
  6115. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  6116. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  6117. },
  6118. formatSearch: function () {
  6119. return '搜索';
  6120. },
  6121. formatNoMatches: function () {
  6122. return '没有找到匹配的记录';
  6123. },
  6124. formatPaginationSwitch: function () {
  6125. return '隐藏/显示分页';
  6126. },
  6127. formatRefresh: function () {
  6128. return '刷新';
  6129. },
  6130. formatToggle: function () {
  6131. return '切换';
  6132. },
  6133. formatColumns: function () {
  6134. return '列';
  6135. },
  6136. formatExport: function () {
  6137. return '导出数据';
  6138. },
  6139. formatClearFilters: function () {
  6140. return '清空过滤';
  6141. }
  6142. };
  6143. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  6144. })(jQuery);
  6145. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  6146. return function () {
  6147. var ret, fn;
  6148. return ret || global.$.fn.bootstrapTable.defaults;
  6149. };
  6150. }(this)));
  6151. /*
  6152. tableExport.jquery.plugin
  6153. Version 1.10.26
  6154. Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
  6155. Based on https://github.com/kayalshri/tableExport.jquery.plugin
  6156. Licensed under the MIT License
  6157. */
  6158. var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(d,k,y){d instanceof String&&(d=String(d));for(var C=d.length,v=0;v<C;v++){var R=d[v];if(k.call(y,R,v,d))return{i:v,v:R}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,k,y){d!=Array.prototype&&d!=Object.prototype&&(d[k]=y.value)};
  6159. $jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(d,k,y,C){if(k){y=$jscomp.global;d=d.split(".");for(C=0;C<d.length-1;C++){var v=d[C];v in y||(y[v]={});y=y[v]}d=d[d.length-1];C=y[d];k=k(C);k!=C&&null!=k&&$jscomp.defineProperty(y,d,{configurable:!0,writable:!0,value:k})}};
  6160. $jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,y){return $jscomp.findInternal(this,d,y).v}},"es6","es3");
  6161. (function(d){d.fn.tableExport=function(k){function y(b){var c=[];v(b,"thead").each(function(){c.push.apply(c,v(d(this),a.theadSelector).toArray())});return c}function C(b){var c=[];v(b,"tbody").each(function(){c.push.apply(c,v(d(this),a.tbodySelector).toArray())});a.tfootSelector.length&&v(b,"tfoot").each(function(){c.push.apply(c,v(d(this),a.tfootSelector).toArray())});return c}function v(b,a){var c=b[0].tagName,q=b.parents(c).length;return b.find(a).filter(function(){return q===d(this).closest(c).parents(c).length})}
  6162. function R(b){var a=[],e=0,q=0,f=0;d(b).find("thead").first().find("th").each(function(b,c){b=void 0!==d(c).attr("data-field");"undefined"!==typeof c.parentNode.rowIndex&&q!==c.parentNode.rowIndex&&(q=c.parentNode.rowIndex,e=f=0);var h=J(c);for(e+=h?h:1;f<e;)a[f]=b?d(c).attr("data-field"):f.toString(),f++});return a}function I(b){var a="undefined"!==typeof b[0].rowIndex,e=!1===a&&"undefined"!==typeof b[0].cellIndex,q=e||a?Ja(b):b.is(":visible"),f=b.attr("data-tableexport-display");e&&"none"!==f&&
  6163. "always"!==f&&(b=d(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,f=b.attr("data-tableexport-display"));a&&"none"!==f&&"always"!==f&&(f=b.closest("table").attr("data-tableexport-display"));return"none"!==f&&(!0===q||"always"===f)}function Ja(b){var a=[];V&&(a=K.filter(function(){var a=!1;this.nodeType===b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex===b[0].rowIndex?a=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex===b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&
  6164. "undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex===b[0].parentNode.rowIndex&&(a=!0));return a}));return!1===V||0===a.length}function ta(b,c,e){var q=!1;I(b)?0<a.ignoreColumn.length&&(-1!==d.inArray(e,a.ignoreColumn)||-1!==d.inArray(e-c,a.ignoreColumn)||S.length>e&&"undefined"!==typeof S[e]&&-1!==d.inArray(S[e],a.ignoreColumn))&&(q=!0):q=!0;return q}function E(b,c,e,q,f){if("function"===typeof f){var h=!1;"function"===typeof a.onIgnoreRow&&(h=a.onIgnoreRow(d(b),e));if(!1===h&&
  6165. (0===a.ignoreRow.length||-1===d.inArray(e,a.ignoreRow)&&-1===d.inArray(e-q,a.ignoreRow))&&I(d(b))){b=v(d(b),c);var n=b.length,l=0,u=0;b.each(function(){var b=d(this),a=J(this),c=T(this),h;d.each(G,function(){if(e>this.s.r&&e<=this.e.r&&l>=this.s.c&&l<=this.e.c)for(h=0;h<=this.e.c-this.s.c;++h)n++,u++,f(null,e,l++)});if(c||a)a=a||1,G.push({s:{r:e,c:l},e:{r:e+(c||1)-1,c:l+a-1}});!1===ta(b,n,u++)&&f(this,e,l++);if(1<a)for(h=0;h<a-1;++h)u++,f(null,e,l++)});d.each(G,function(){if(e>=this.s.r&&e<=this.e.r&&
  6166. l>=this.s.c&&l<=this.e.c)for(ea=0;ea<=this.e.c-this.s.c;++ea)f(null,e,l++)})}}}function ua(b,a,e,d){if("undefined"!==typeof d.images&&(e=d.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect();var c=b.width/b.height,h=a.width/a.height,q=b.width,l=b.height,u=19.049976/25.4,g=0;h<=c?(l=Math.min(b.height,a.height),q=a.width*l/a.height):h>c&&(q=Math.min(b.width,a.width),l=a.height*q/a.width);q*=u;l*=u;l<b.height&&(g=(b.height-l)/2);try{d.doc.addImage(e.src,b.textPos.x,b.y+g,q,l)}catch(Pa){}b.textPos.x+=
  6167. q}}function va(b,c){if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return L(b.output());if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(q){ka(a.fileName+".pdf","data:application/pdf"+(c?"":";base64")+",",c?b.output("blob"):b.output())}}function wa(b,a,e){var c=0;"undefined"!==typeof e&&(c=e.colspan);if(0<=c){for(var f=b.width,d=b.textPos.x,
  6168. n=a.table.columns.indexOf(a.column),l=1;l<c;l++)f+=a.table.columns[n+l].width;1<c&&("right"===b.styles.halign?d=b.textPos.x+f-b.width:"center"===b.styles.halign&&(d=b.textPos.x+(f-b.width)/2));b.width=f;b.textPos.x=d;"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}function xa(b,
  6169. a,e){"undefined"!==typeof b&&null!==b&&(b.hasAttribute("data-tableexport-canvas")?(a=(new Date).getTime(),d(b).attr("data-tableexport-canvas",a),e.images[a]={url:'[data-tableexport-canvas="'+a+'"]',src:null}):"undefined"!==a&&null!=a&&a.each(function(){if(d(this).is("img")){var a=ya(this.src);e.images[a]={url:this.src,src:this.src}}xa(b,d(this).children(),e)}))}function Ka(b,a){function c(b){if(b.url)if(b.src){var c=new Image;q=++f;c.crossOrigin="Anonymous";c.onerror=c.onload=function(){if(c.complete&&
  6170. (0===c.src.indexOf("data:image/")&&(c.width=b.width||c.width||0,c.height=b.height||c.height||0),c.width+c.height)){var e=document.createElement("canvas"),d=e.getContext("2d");e.width=c.width;e.height=c.height;d.drawImage(c,0,0);b.src=e.toDataURL("image/png")}--f||a(q)};c.src=b.url}else{var e=d(b.url);e.length&&(q=++f,html2canvas(e[0]).then(function(c){b.src=c.toDataURL("image/png");--f||a(q)}))}}var q=0,f=0;if("undefined"!==typeof b.images)for(var h in b.images)b.images.hasOwnProperty(h)&&c(b.images[h]);
  6171. (b=f)||(a(q),b=void 0);return b}function za(b,c,e){c.each(function(){if(d(this).is("div")){var c=fa(M(this,"background-color"),[255,255,255]),f=fa(M(this,"border-top-color"),[0,0,0]),h=ha(this,"border-top-width",a.jspdf.unit),n=this.getBoundingClientRect(),l=this.offsetLeft*e.wScaleFactor,u=this.offsetTop*e.hScaleFactor,g=n.width*e.wScaleFactor;n=n.height*e.hScaleFactor;e.doc.setDrawColor.apply(void 0,f);e.doc.setFillColor.apply(void 0,c);e.doc.setLineWidth(h);e.doc.rect(b.x+l,b.y+u,g,n,h?"FD":"F")}else d(this).is("img")&&
  6172. (c=ya(this.src),ua(b,this,c,e));za(b,d(this).children(),e)})}function Aa(b,c,e){if("function"===typeof e.onAutotableText)e.onAutotableText(e.doc,b,c);else{var q=b.textPos.x,f=b.textPos.y,h={halign:b.styles.halign,valign:b.styles.valign};if(c.length){for(c=c[0];c.previousSibling;)c=c.previousSibling;for(var n=!1,l=!1;c;){var u=c.innerText||c.textContent||"",g=u.length&&" "===u[0]?" ":"",k=1<u.length&&" "===u[u.length-1]?" ":"";!0!==a.preserve.leadingWS&&(u=g+la(u));!0!==a.preserve.trailingWS&&(u=ma(u)+
  6173. k);d(c).is("br")&&(q=b.textPos.x,f+=e.doc.internal.getFontSize());d(c).is("b")?n=!0:d(c).is("i")&&(l=!0);(n||l)&&e.doc.setFontType(n&&l?"bolditalic":n?"bold":"italic");if(g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()){"linebreak"===b.styles.overflow&&q>b.textPos.x&&q+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(u.charAt(0))&&(k=u.charAt(0),g=e.doc.getStringUnitWidth(k)*e.doc.internal.getFontSize(),q+g<=b.textPos.x+b.width&&(e.doc.autoTableText(k,q,f,h),u=u.substring(1,u.length)),g=
  6174. e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()),q=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;u.length&&q+g>b.textPos.x+b.width;)u=u.substring(0,u.length-1),g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize();e.doc.autoTableText(u,q,f,h);q+=g}if(n||l)d(c).is("b")?n=!1:d(c).is("i")&&(l=!1),e.doc.setFontType(n||l?n?"bold":"italic":"normal");c=c.nextSibling}b.textPos.x=q;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,h)}}
  6175. function W(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function la(b){return null==b?"":b.toString().replace(/^\s+/,"")}function ma(b){return null==b?"":b.toString().replace(/\s+$/,"")}function La(b){if(0===a.date.html.length)return!1;a.date.pattern.lastIndex=0;var c=a.date.pattern.exec(b);if(null==c)return!1;b=+c[a.date.match_y];if(0>b||8099<b)return!1;var e=1*c[a.date.match_m];c=1*c[a.date.match_d];if(!isFinite(c))return!1;
  6176. var d=new Date(b,e-1,c,0,0,0);return d.getFullYear()===b&&d.getMonth()===e-1&&d.getDate()===c?new Date(Date.UTC(b,e-1,c,0,0,0)):!1}function na(b){b=b||"0";""!==a.numbers.html.thousandsSeparator&&(b=W(b,a.numbers.html.thousandsSeparator,""));"."!==a.numbers.html.decimalMark&&(b=W(b,a.numbers.html.decimalMark,"."));return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Ma(b){-1<b.indexOf("%")?(b=na(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function D(b,c,e,q){var f="",h="text";
  6177. if(null!==b){var n=d(b);n.removeData("teUserDefText");if(n[0].hasAttribute("data-tableexport-canvas"))var l="";else if(n[0].hasAttribute("data-tableexport-value"))l=(l=n.attr("data-tableexport-value"))?l+"":"",n.data("teUserDefText",1);else if(l=n.html(),"function"===typeof a.onCellHtmlData)l=a.onCellHtmlData(n,c,e,l),n.data("teUserDefText",1);else if(""!==l){b=d.parseHTML(l);var g=0,k=0;l="";d.each(b,function(){if(d(this).is("input"))l+=n.find("input").eq(g++).val();else if(d(this).is("select"))l+=
  6178. n.find("select option:selected").eq(k++).text();else if(d(this).is("br"))l+="<br>";else{if("undefined"===typeof d(this).html())l+=d(this).text();else if(void 0===jQuery().bootstrapTable||!1===d(this).hasClass("fht-cell")&&!1===d(this).hasClass("filterControl")&&0===n.parents(".detail-view").length)l+=d(this).html();if(d(this).is("a")){var b=n.find("a").attr("href")||"";f="function"===typeof a.onCellHtmlHyperlink?f+a.onCellHtmlHyperlink(n,c,e,b,l):"href"===a.htmlHyperlink?f+b:f+l;l=""}}})}if(l&&""!==
  6179. l&&!0===a.htmlContent)f=d.trim(l);else if(l&&""!==l)if(""!==n.attr("data-tableexport-cellformat")){var m=l.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi,"\u2060"),p=d("<div/>").html(m).contents();b=!1;m="";d.each(p.text().split("\u2028"),function(b,c){0<b&&(m+=" ");!0!==a.preserve.leadingWS&&(c=la(c));m+=!0!==a.preserve.trailingWS?ma(c):c});d.each(m.split("\u2060"),function(b,c){0<b&&(f+="\n");!0!==a.preserve.leadingWS&&(c=la(c));!0!==a.preserve.trailingWS&&(c=ma(c));f+=c.replace(/\u00AD/g,
  6180. "")});f=f.replace(/\u00A0/g," ");if("json"===a.type||"excel"===a.type&&"xmlss"===a.mso.fileFormat||!1===a.numbers.output)b=na(f),!1!==b&&(h="number",f=Number(b));else if(a.numbers.html.decimalMark!==a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!==a.numbers.output.thousandsSeparator)if(b=na(f),!1!==b){p=(""+b.substr(0>b?1:0)).split(".");1===p.length&&(p[1]="");var t=3<p[0].length?p[0].length%3:0;h="number";f=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?(t?p[0].substr(0,t)+a.numbers.output.thousandsSeparator:
  6181. "")+p[0].substr(t).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):p[0])+(p[1].length?a.numbers.output.decimalMark+p[1]:"")}}else f=l;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(n,c,e,f,h),n.data("teUserDefText",1))}void 0!==q&&(q.type=h);return f}function Ba(b){return 0<b.length&&!0===a.preventInjection&&0<="=+-@".indexOf(b.charAt(0))?"'"+b:b}function Na(b,a,e){return a+"-"+e.toLowerCase()}function fa(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&
  6182. (a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function Ca(b){var a=M(b,"text-align"),e=M(b,"font-weight"),d=M(b,"font-style"),f="";"start"===a&&(a="rtl"===M(b,"direction")?"right":"left");700<=e&&(f="bold");"italic"===d&&(f+=d);""===f&&(f="normal");a={style:{align:a,bcolor:fa(M(b,"background-color"),[255,255,255]),color:fa(M(b,"color"),[0,0,0]),fstyle:f},colspan:J(b),rowspan:T(b)};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function J(b){var a=
  6183. d(b).attr("data-tableexport-colspan");"undefined"===typeof a&&d(b).is("[colspan]")&&(a=d(b).attr("colspan"));return parseInt(a)||0}function T(b){var a=d(b).attr("data-tableexport-rowspan");"undefined"===typeof a&&d(b).is("[rowspan]")&&(a=d(b).attr("rowspan"));return parseInt(a)||0}function M(a,c){try{return window.getComputedStyle?(c=c.replace(/([a-z])([A-Z])/,Na),window.getComputedStyle(a,null).getPropertyValue(c)):a.currentStyle?a.currentStyle[c]:a.style[c]}catch(e){}return""}function ha(a,c,e){c=
  6184. M(a,c).match(/\d+/);if(null!==c){c=c[0];a=a.parentElement;var b=document.createElement("div");b.style.overflow="hidden";b.style.visibility="hidden";a.appendChild(b);b.style.width=100+e;e=100/b.offsetWidth;a.removeChild(b);return c*e}return 0}function Oa(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 oa(a){var b=a.c,e="";for(++b;b;b=Math.floor((b-1)/26))e=String.fromCharCode((b-1)%26+65)+e;return e+(""+(a.r+1))}function pa(a,
  6185. c){if("undefined"===typeof c||"number"===typeof c)return pa(a.s,a.e);"string"!==typeof a&&(a=oa(a));"string"!==typeof c&&(c=oa(c));return a===c?a:a+":"+c}function Da(a,c){var b=Number(a);if(isFinite(b))return b;var d=1;""!==c.thousandsSeparator&&(a=a.replace(new RegExp("([\\d])"+c.thousandsSeparator+"([\\d])","g"),"$1$2"));"."!==c.decimalMark&&(a=a.replace(new RegExp("([\\d])"+c.decimalMark+"([\\d])","g"),"$1.$2"));a=a.replace(/[$]/g,"").replace(/[%]/g,function(){d*=100;return""});if(isFinite(b=Number(a)))return b/
  6186. d;a=a.replace(/[(](.*)[)]/,function(a,b){d=-d;return b});return isFinite(b=Number(a))?b/d:b}function ya(a){var b=0,d;if(0===a.length)return b;var q=0;for(d=a.length;q<d;q++){var f=a.charCodeAt(q);b=(b<<5)-b+f;b|=0}return b}function N(b,c,d,q,f,h){var e=!0;"function"===typeof a.onBeforeSaveToFile&&(e=a.onBeforeSaveToFile(b,c,d,q,f),"boolean"!==typeof e&&(e=!0));if(e)try{if(Ea=new Blob([b],{type:d+";charset="+q}),saveAs(Ea,c,!1===h),"function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(b,c)}catch(l){ka(c,
  6187. "data:"+d+(q.length?";charset="+q:"")+(f.length?";"+f:"")+",",h?"\ufeff"+b:b)}}function ka(b,c,d){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([d]),b);else if(!1!==b&&(0<e.indexOf("MSIE ")||e.match(/Trident.*rv\:11\./))){if(c=document.createElement("iframe")){document.body.appendChild(c);c.setAttribute("style","display:none");c.contentDocument.open("txt/plain","replace");c.contentDocument.write(d);c.contentDocument.close();
  6188. c.contentWindow.focus();switch(b.substr(b.lastIndexOf(".")+1)){case "doc":case "json":case "png":case "pdf":case "xls":case "xlsx":b+=".txt"}c.contentDocument.execCommand("SaveAs",!0,b);document.body.removeChild(c)}}else{var f=document.createElement("a");if(f){var h=null;f.style.display="none";!1!==b?f.download=b:f.target="_blank";"object"===typeof d?(window.URL=window.URL||window.webkitURL,e=[],e.push(d),h=window.URL.createObjectURL(new Blob(e,{type:c})),f.href=h):0<=c.toLowerCase().indexOf("base64,")?
  6189. f.href=c+L(d):f.href=c+encodeURIComponent(d);document.body.appendChild(f);if(document.createEvent)null===ia&&(ia=document.createEvent("MouseEvents")),ia.initEvent("click",!0,!1),f.dispatchEvent(ia);else if(document.createEventObject)f.fireEvent("onclick");else if("function"===typeof f.onclick)f.onclick();setTimeout(function(){h&&window.URL.revokeObjectURL(h);document.body.removeChild(f);if("function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(d,b)},100)}}}function L(a){var b,d="",q=0;if("string"===
  6190. typeof a){a=a.replace(/\x0d\x0a/g,"\n");var f="";for(b=0;b<a.length;b++){var h=a.charCodeAt(b);128>h?f+=String.fromCharCode(h):(127<h&&2048>h?f+=String.fromCharCode(h>>6|192):(f+=String.fromCharCode(h>>12|224),f+=String.fromCharCode(h>>6&63|128)),f+=String.fromCharCode(h&63|128))}a=f}for(;q<a.length;){var n=a.charCodeAt(q++);f=a.charCodeAt(q++);b=a.charCodeAt(q++);h=n>>2;n=(n&3)<<4|f>>4;var l=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?l=g=64:isNaN(b)&&(g=64);d=d+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+
  6191. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return d}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",
  6192. unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml",
  6193. onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,onTableExportBegin:null,onTableExportEnd:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageSize:"A4",pageOrientation:"portrait",
  6194. styles:{header:{background:"#34495E",color:"#FFFFFF",bold:!0,alignment:"center",fillColor:"#34495E"},alternateRow:{fillColor:"#f5f5f5"}},defaultStyle:{color:"#000000",fontSize:8,font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},O={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,
  6195. 595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,
  6196. 161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},B=this,ia=null,r=[],w=[],p=0,t="",S=[],G=[],Ea,K=[],V=!1;d.extend(!0,a,k);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&&
  6197. (a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&"undefined"===a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&&
  6198. "undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html=a.date.html||"";if(a.date.html.length){k=[];k.dd="(3[01]|[12][0-9]|0?[1-9])";k.mm="(1[012]|0?[1-9])";k.yyyy="((?:1[6-9]|2[0-2])\\d{2})";k.yy="(\\d{2})";var z=a.date.html.match(/[^a-zA-Z0-9]/)[0];z=a.date.html.toLowerCase().split(z);a.date.regex="^\\s*";a.date.regex+=k[z[0]];a.date.regex+="(.)";a.date.regex+=k[z[1]];a.date.regex+=
  6199. "\\2";a.date.regex+=k[z[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");k=z.indexOf("dd")+1;a.date.match_d=k+(1<k?1:0);k=z.indexOf("mm")+1;a.date.match_m=k+(1<k?1:0);k=(0<=z.indexOf("yyyy")?z.indexOf("yyyy"):z.indexOf("yy"))+1;a.date.match_y=k+(1<k?1:0)}S=R(B);if("function"===typeof a.onTableExportBegin)a.onTableExportBegin();if("csv"===a.type||"tsv"===a.type||"txt"===a.type){var P="",Z=0;G=[];p=0;var qa=function(b,c,e){b.each(function(){t="";E(this,c,p,e+b.length,function(b,
  6200. c,d){var e=t,f="";if(null!==b)if(b=D(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"===a.type)b instanceof Date&&b.toLocaleString(),f=W(c,"\t"," ");else if(b instanceof Date)f=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(f=Ba(c),f=W(f,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=f.indexOf(a.csvSeparator)||/[\r\n ]/g.test(f))f=a.csvEnclosure+f+a.csvEnclosure;t=e+(f+("tsv"===a.type?"\t":a.csvSeparator))});t=d.trim(t).substring(0,t.length-1);0<t.length&&(0<P.length&&(P+="\n"),P+=t);p++});
  6201. return b.length};Z+=qa(d(B).find("thead").first().find(a.theadSelector),"th,td",Z);v(d(B),"tbody").each(function(){Z+=qa(v(d(this),a.tbodySelector),"td,th",Z)});a.tfootSelector.length&&qa(d(B).find("tfoot").first().find(a.tfootSelector),"td,th",Z);P+="\n";if("string"===a.outputMode)return P;if("base64"===a.outputMode)return L(P);if("window"===a.outputMode){ka(!1,"data:text/"+("csv"===a.type?"csv":"plain")+";charset=utf-8,",P);return}N(P,a.fileName+"."+a.type,"text/"+("csv"===a.type?"csv":"plain"),
  6202. "utf-8","","csv"===a.type&&a.csvUseBOM)}else if("sql"===a.type){p=0;G=[];var A="INSERT INTO "+a.sql.tableEnclosure+a.tableName+a.sql.tableEnclosure+" (";r=y(d(B));d(r).each(function(){E(this,"th,td",p,r.length,function(b,c,d){b=D(b,c,d)||"";-1<b.indexOf(a.sql.columnEnclosure)&&(b=W(b.toString(),a.sql.columnEnclosure,a.sql.columnEnclosure+a.sql.columnEnclosure));A+=a.sql.columnEnclosure+b+a.sql.columnEnclosure+","});p++;A=d.trim(A).substring(0,A.length-1)});A+=") VALUES ";w=C(d(B));d(w).each(function(){t=
  6203. "";E(this,"td,th",p,r.length+w.length,function(a,c,d){a=D(a,c,d)||"";-1<a.indexOf("'")&&(a=W(a.toString(),"'","''"));t+="'"+a+"',"});3<t.length&&(A+="("+t,A=d.trim(A).substring(0,A.length-1),A+="),");p++});A=d.trim(A).substring(0,A.length-1);A+=";";if("string"===a.outputMode)return A;if("base64"===a.outputMode)return L(A);N(A,a.fileName+".sql","application/sql","utf-8","",!1)}else if("json"===a.type){var X=[];G=[];r=y(d(B));d(r).each(function(){var a=[];E(this,"th,td",p,r.length,function(b,d,g){a.push(D(b,
  6204. d,g))});X.push(a)});var ra=[];w=C(d(B));d(w).each(function(){var a={},c=0;E(this,"td,th",p,r.length+w.length,function(b,d,f){X.length?a[X[X.length-1][c]]=D(b,d,f):a[c]=D(b,d,f);c++});!1===d.isEmptyObject(a)&&ra.push(a);p++});k="head"===a.jsonScope?JSON.stringify(X):"data"===a.jsonScope?JSON.stringify(ra):JSON.stringify({header:X,data:ra});if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".json","application/json","utf-8","base64",!1)}else if("xml"===a.type){p=
  6205. 0;G=[];var Q='<?xml version="1.0" encoding="utf-8"?>';Q+="<tabledata><fields>";r=y(d(B));d(r).each(function(){E(this,"th,td",p,r.length,function(a,d,e){Q+="<field>"+D(a,d,e)+"</field>"});p++});Q+="</fields><data>";var Fa=1;w=C(d(B));d(w).each(function(){var a=1;t="";E(this,"td,th",p,r.length+w.length,function(b,d,g){t+="<column-"+a+">"+D(b,d,g)+"</column-"+a+">";a++});0<t.length&&"<column-1></column-1>"!==t&&(Q+='<row id="'+Fa+'">'+t+"</row>",Fa++);p++});Q+="</data></tabledata>";if("string"===a.outputMode)return Q;
  6206. if("base64"===a.outputMode)return L(Q);N(Q,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var sa=[],F=[];d(B).filter(function(){return I(d(this))}).each(function(){function b(a,b,c){var f=[];d(a).each(function(){var b=0,e=0;t="";E(this,"td,th",p,c+a.length,function(a,c,h){if(null!==a){var l="";c=D(a,c,h);h="String";if(!1!==jQuery.isNumeric(c))h="Number";else{var n=Ma(c);!1!==n&&(c=n,h="Number",l+=' ss:StyleID="pct1"')}"Number"!==h&&(c=
  6207. c.replace(/\n/g,"<br>"));n=J(a);a=T(a);d.each(f,function(){if(p>=this.s.r&&p<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||n)a=a||1,n=n||1,f.push({s:{r:p,c:e},e:{r:p+a-1,c:e+n-1}});1<n&&(l+=' ss:MergeAcross="'+(n-1)+'"',e+=n-1);1<a&&(l+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(l+=' ss:Index="'+(e+1)+'"',b=0);t+="<Cell"+l+'><Data ss:Type="'+h+'">'+d("<div />").text(c).html()+"</Data></Cell>\r";e++}});0<t.length&&(H+='<Row ss:AutoFitHeight="0">\r'+
  6208. t+"</Row>\r");p++});return a.length}var c=d(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(F.length+1):"undefined"!==typeof a.mso.worksheetName[F.length]&&(e=a.mso.worksheetName[F.length]);e.length||(e=c.find("caption").text()||"");e.length||(e="Table "+(F.length+1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));F.push(d("<div />").text(e).html());!1===a.exportHiddenCells&&(K=c.find("tr, th, td").filter(":hidden"),V=0<K.length);
  6209. p=0;S=R(this);H="<Table>\r";e=b(y(c),"th,td",0);b(C(c),"td,th",e);H+="</Table>\r";sa.push(H)});k={};z={};for(var m,aa,Y=0,ea=F.length;Y<ea;Y++)m=F[Y],aa=k[m],aa=k[m]=null==aa?1:aa+1,2===aa&&(F[z[m]]=F[z[m]].substring(0,29)+"-1"),1<k[m]?F[Y]=F[Y].substring(0,29)+"-"+k[m]:z[m]=Y;k='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+
  6210. (new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';
  6211. for(z=0;z<sa.length;z++)k+='<Worksheet ss:Name="'+F[z]+'" ss:RightToLeft="'+(a.mso.rtl?"1":"0")+'">\r'+sa[z],k=a.mso.rtl?k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',k+="</Worksheet>\r";k+="</Workbook>\r";if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===
  6212. a.type&&"xlsx"===a.mso.fileFormat){var ba=[],Ga=XLSX.utils.book_new();d(B).filter(function(){return I(d(this))}).each(function(){for(var b=d(this),c={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],h,n=[],l=0,u=0,k,m,p,t,r,w=XLSX.SSF.get_table();l<e.length&&1E7>u;++l)if(k=e[l],m=!1,"function"===typeof a.onIgnoreRow&&(m=a.onIgnoreRow(d(k),l)),!0!==m&&(0===a.ignoreRow.length||-1===d.inArray(l,a.ignoreRow)&&-1===d.inArray(l-e.length,a.ignoreRow))&&!1!==I(d(k))){var y=k.children,
  6213. B=0;for(k=0;k<y.length;++k)r=y[k],t=+J(r)||1,B+=t;var z=0;for(k=m=0;k<y.length;++k)if(r=y[k],t=+J(r)||1,h=k+z,!ta(d(r),B,h+(h<m?m-h:0))){z+=t-1;for(h=0;h<f.length;++h){var v=f[h];v.s.c==m&&v.s.r<=u&&u<=v.e.r&&(m=v.e.c+1,h=-1)}(0<(p=+T(r))||1<t)&&f.push({s:{r:u,c:m},e:{r:u+(p||1)-1,c:m+t-1}});var C={type:""};h=D(r,l,k+z,C);v={t:"s",v:h};var A="";if(""!==(d(r).attr("data-tableexport-cellformat")||"")){var x=parseInt(d(r).attr("data-tableexport-xlsxformatid")||0);0===x&&"function"===typeof a.mso.xslx.formatId.numbers&&
  6214. (x=a.mso.xslx.formatId.numbers(d(r),l,k+z));0===x&&"function"===typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date(d(r),l,k+z));if(49===x||"@"===x)A="s";else if("number"===C.type||0<x&&14>x||36<x&&41>x||48===x)A="n";else if("date"===C.type||13<x&&37>x||44<x&&48>x||56===x)A="d"}else A="s";if(null!=h)if(0===h.length)v.t="z";else if(0!==h.trim().length)if("s"===A)d(r).find("a").length&&(h="href"!==a.htmlHyperlink?h:"",v={f:'=HYPERLINK("'+d(r).find("a").attr("href")+(h.length?'","'+h:"")+'")'});
  6215. else if("function"===C.type)v={f:h};else if("TRUE"===h)v={t:"b",v:!0};else if("FALSE"===h)v={t:"b",v:!1};else if("n"===A||isFinite(Da(h,a.numbers.output))){if(r=Da(h,a.numbers.output),0===x&&"function"!==typeof a.mso.xslx.formatId.numbers&&(x=a.mso.xslx.formatId.numbers),isFinite(r)||isFinite(h))v={t:"n",v:isFinite(r)?r:h,z:"string"===typeof x?x:x in w?w[x]:"0.00"}}else if(!1!==(r=La(h))||"d"===A)0===x&&"function"!==typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date),v={t:"d",v:!1!==r?r:
  6216. h,z:"string"===typeof x?x:x in w?w[x]:"m/d/yy"};c[oa({c:m,r:u})]=v;g.e.c<m&&(g.e.c=m);m+=t}++u}f.length&&(c["!merges"]=f);n.length&&(c["!rows"]=n);g.e.r=u-1;c["!ref"]=pa(g);1E7<=u&&(c["!fullref"]=pa((g.e.r=e.length-l+u-1,g)));e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(ba.length+1):"undefined"!==typeof a.mso.worksheetName[ba.length]&&(e=a.mso.worksheetName[ba.length]);e.length||(e=b.find("caption").text()||"");e.length||(e="Table "+(ba.length+
  6217. 1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));ba.push(e);XLSX.utils.book_append_sheet(Ga,c,e)});k=XLSX.write(Ga,{type:"binary",bookType:a.mso.fileFormat,bookSST:!1});N(Oa(k),a.fileName+"."+a.mso.fileFormat,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","UTF-8","",!1)}else if("excel"===a.type||"xls"===a.type||"word"===a.type||"doc"===a.type){k="excel"===a.type||"xls"===a.type?"excel":"word";z="excel"===k?"xls":"doc";m='xmlns:x="urn:schemas-microsoft-com:office:'+
  6218. k+'"';var H="",ca="";d(B).filter(function(){return I(d(this))}).each(function(){var b=d(this);""===ca&&(ca=a.mso.worksheetName||b.find("caption").text()||"Table",ca=d.trim(ca.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)));!1===a.exportHiddenCells&&(K=b.find("tr, th, td").filter(":hidden"),V=0<K.length);p=0;G=[];S=R(this);H+="<table><thead>";r=y(b);d(r).each(function(){var b=d(this);t="";E(this,"th,td",p,r.length,function(d,c,f){if(null!==d){var e="";t+="<th";if(a.mso.styles.length){var n=document.defaultView.getComputedStyle(d,
  6219. null),l=document.defaultView.getComputedStyle(b[0],null),g;for(g in a.mso.styles){var k=n[a.mso.styles[g]];""===k&&(k=l[a.mso.styles[g]]);""!==k&&"0px none rgb(0, 0, 0)"!==k&&"rgba(0, 0, 0, 0)"!==k&&(e+=""===e?'style="':";",e+=a.mso.styles[g]+":"+k)}}""!==e&&(t+=" "+e+'"');e=J(d);0<e&&(t+=' colspan="'+e+'"');e=T(d);0<e&&(t+=' rowspan="'+e+'"');t+=">"+D(d,c,f)+"</th>"}});0<t.length&&(H+="<tr>"+t+"</tr>");p++});H+="</thead><tbody>";w=C(b);d(w).each(function(){var b=d(this);t="";E(this,"td,th",p,r.length+
  6220. w.length,function(c,g,f){if(null!==c){var e=D(c,g,f),n="",l=d(c).attr("data-tableexport-msonumberformat");"undefined"===typeof l&&"function"===typeof a.mso.onMsoNumberFormat&&(l=a.mso.onMsoNumberFormat(c,g,f));"undefined"!==typeof l&&""!==l&&(n="style=\"mso-number-format:'"+l+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(c,null);f=document.defaultView.getComputedStyle(b[0],null);for(var k in a.mso.styles)l=g[a.mso.styles[k]],""===l&&(l=f[a.mso.styles[k]]),""!==l&&"0px none rgb(0, 0, 0)"!==
  6221. l&&"rgba(0, 0, 0, 0)"!==l&&(n+=""===n?'style="':";",n+=a.mso.styles[k]+":"+l)}t+="<td";""!==n&&(t+=" "+n+'"');n=J(c);0<n&&(t+=' colspan="'+n+'"');c=T(c);0<c&&(t+=' rowspan="'+c+'"');"string"===typeof e&&""!==e&&(e=Ba(e),e=e.replace(/\n/g,"<br>"));t+=">"+e+"</td>"}});0<t.length&&(H+="<tr>"+t+"</tr>");p++});a.displayTableName&&(H+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+D(d("<p>"+a.tableName+"</p>"))+"</td></tr>");H+="</tbody></table>"});m='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+
  6222. m+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+k+'; charset=UTF-8">')+"<head>";"excel"===k&&(m+="\x3c!--[if gte mso 9]>",m+="<xml>",m+="<x:ExcelWorkbook>",m+="<x:ExcelWorksheets>",m+="<x:ExcelWorksheet>",m+="<x:Name>",m+=ca,m+="</x:Name>",m+="<x:WorksheetOptions>",m+="<x:DisplayGridlines/>",a.mso.rtl&&(m+="<x:DisplayRightToLeft/>"),m+="</x:WorksheetOptions>",m+="</x:ExcelWorksheet>",m+="</x:ExcelWorksheets>",m+="</x:ExcelWorkbook>",m+=
  6223. "</xml>",m+="<![endif]--\x3e");m+="<style>";m+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";m+="@page Section1 {size:"+O[a.mso.pageFormat][0]+"pt "+O[a.mso.pageFormat][1]+"pt";m+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";m+="div.Section1 {page:Section1;}";m+="@page Section2 {size:"+O[a.mso.pageFormat][1]+"pt "+O[a.mso.pageFormat][0]+"pt";m+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";
  6224. m+="div.Section2 {page:Section2;}";m+="br {mso-data-placement:same-cell;}";m+="</style>";m+="</head>";m+="<body>";m+='<div class="Section'+("landscape"===a.mso.pageOrientation?"2":"1")+'">';m+=H;m+="</div>";m+="</body>";m+="</html>";if("string"===a.outputMode)return m;if("base64"===a.outputMode)return L(m);N(m,a.fileName+"."+z,"application/vnd.ms-"+k,"","base64",!1)}else if("png"===a.type)html2canvas(d(B)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),d=new ArrayBuffer(c.length),
  6225. g=new Uint8Array(d),f=0;f<c.length;f++)g[f]=c.charCodeAt(f);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return L(b);"window"===a.outputMode?window.open(b):N(d,a.fileName+".png","image/png","","",!1)});else if("pdf"===a.type)if(!0===a.pdfmake.enabled){var U={content:[]};d.extend(!0,U,a.pdfmake.docDefinition);G=[];d(B).filter(function(){return I(d(this))}).each(function(){var b=d(this),c=[],e=[];p=0;var g=function(a,b,c){var f=0;d(a).each(function(){var a=[];E(this,b,p,c,function(c,
  6226. d,f){if("undefined"!==typeof c&&null!==c){var e=J(c),h=T(c);c={text:D(c,d,f)||" "};if(1<e||1<h)c.colSpan=e||1,c.rowSpan=h||1}else c={text:" "};0<=b.indexOf("th")&&(c.style="header");a.push(c)});a.length&&e.push(a);f<a.length&&(f=a.length);p++});return f};r=y(b);for(var f=g(r,"th,td",r.length),h=c.length;h<f;h++)c.push("*");w=C(b);f=g(w,"td",r.length+w.length);for(h=c.length;h<f;h++)c.push("*");U.content.push({table:{headerRows:r.length?r.length:null,widths:c,body:e},layout:{layout:"noBorders",hLineStyle:function(a,
  6227. b){return 0},vLineWidth:function(a,b){return 0},hLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},vLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},fillColor:function(b,c,d){return 0===b%2?a.pdfmake.docDefinition.styles.alternateRow.fillColor:null}},pageBreak:U.content.length?"before":void 0})});
  6228. "undefined"!==typeof pdfMake&&"undefined"!==typeof pdfMake.createPdf&&(pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}},pdfMake.vfs.hasOwnProperty("Mirza-Regular.ttf")?(U.defaultStyle.font="Mirza",d.extend(!0,pdfMake.fonts,{Mirza:{normal:"Mirza-Regular.ttf",bold:"Mirza-Bold.ttf",italics:"Mirza-Medium.ttf",bolditalics:"Mirza-SemiBold.ttf"}})):pdfMake.vfs.hasOwnProperty("gbsn00lp.ttf")?(U.defaultStyle.font=
  6229. "gbsn00lp",d.extend(!0,pdfMake.fonts,{gbsn00lp:{normal:"gbsn00lp.ttf",bold:"gbsn00lp.ttf",italics:"gbsn00lp.ttf",bolditalics:"gbsn00lp.ttf"}})):pdfMake.vfs.hasOwnProperty("ZCOOLXiaoWei-Regular.ttf")&&(U.defaultStyle.font="ZCOOLXiaoWei",d.extend(!0,pdfMake.fonts,{ZCOOLXiaoWei:{normal:"ZCOOLXiaoWei-Regular.ttf",bold:"ZCOOLXiaoWei-Regular.ttf",italics:"ZCOOLXiaoWei-Regular.ttf",bolditalics:"ZCOOLXiaoWei-Regular.ttf"}})),d.extend(!0,pdfMake.fonts,a.pdfmake.fonts),pdfMake.createPdf(U).getBuffer(function(b){N(b,
  6230. a.fileName+".pdf","application/pdf","","",!1)}))}else if(!1===a.jspdf.autotable){k={dim:{w:ha(d(B).first().get(0),"width","mm"),h:ha(d(B).first().get(0),"height","mm")},pagesplit:!1};var Ha=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);Ha.addHTML(d(B).first(),a.jspdf.margins.left,a.jspdf.margins.top,k,function(){va(Ha,!1)})}else{var g=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var ja="",da="",Ia=0;d(B).each(function(){if(I(d(this))){var a=
  6231. ha(d(this).get(0),"width","pt");if(a>Ia){a>O.a0[0]&&(ja="a0",da="l");for(var c in O)O.hasOwnProperty(c)&&O[c][1]>a&&(ja=c,da="l",O[c][0]>a&&(da="p"));Ia=a}}});a.jspdf.format=""===ja?"a4":ja;a.jspdf.orientation=""===da?"w":da}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(d(B).filter(function(){return I(d(this))}).each(function(){var b=
  6232. 0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0<K.length);r=y(d(this));w=C(d(this));d(w).each(function(){E(this,"td,th",r.length+b,r.length+w.length,function(a){xa(a,d(a).children(),g)});b++})}),r=[],w=[]);Ka(g,function(){d(B).filter(function(){return I(d(this))}).each(function(){var b;p=0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0<K.length);S=R(this);g.columns=[];g.rows=[];g.teCells={};if("function"===typeof g.onTable&&
  6233. !1===g.onTable(d(this),a))return!0;a.jspdf.autotable.tableExport=null;var c=d.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=g;c.margin={};d.extend(!0,c.margin,a.jspdf.margins);c.tableExport=g;"function"!==typeof c.beforePageContent&&(c.beforePageContent=function(a){if(1===a.pageCount){var b=a.table.rows.concat(a.table.headerRow);d.each(b,function(){0<this.height&&(this.height+=(2-1.15)/2*this.styles.fontSize,a.table.height+=(2-1.15)/2*this.styles.fontSize)})}});"function"!==typeof c.createdHeaderCell&&
  6234. (c.createdHeaderCell=function(a,b){a.styles=d.extend({},b.row.styles);if("undefined"!==typeof g.columns[b.column.dataKey]){var e=g.columns[b.column.dataKey];if("undefined"!==typeof e.rect){a.contentWidth=e.rect.width;if("undefined"===typeof g.heightRatio||0===g.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;g.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*
  6235. g.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign="inherit"===c.headerStyles.halign?"center":c.headerStyles.halign;a.styles.valign=c.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===c.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===c.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});
  6236. "function"!==typeof c.createdCell&&(c.createdCell=function(a,b){b=g.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===c.styles.halign?"center":c.styles.halign;a.styles.valign=c.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===c.styles.halign&&(a.styles.halign=b.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===c.styles.fontStyle&&
  6237. (a.styles.fontStyle=b.style.fstyle))});"function"!==typeof c.drawHeaderCell&&(c.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?wa(a,b,c):!1});"function"!==typeof c.drawCell&&(c.drawCell=function(a,b){var c=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof c&&c.isCanvas))wa(a,b,c)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"===typeof c||"undefined"!==typeof c.hasUserDefText&&
  6238. !0===c.hasUserDefText||"undefined"===typeof c.elements||!c.elements.length?Aa(a,{},g):(b=a.height/c.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/c.rect.width,b=a.textPos.y,za(a,c.elements,g),a.textPos.y=b,Aa(a,c.elements,g)));else{c=c.elements[0];var e=d(c).attr("data-tableexport-canvas"),f=c.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;ua(a,c,e,g)}return!1});g.headerrows=[];r=y(d(this));d(r).each(function(){b=
  6239. 0;g.headerrows[p]=[];E(this,"th,td",p,r.length,function(a,c,d){var e=Ca(a);e.title=D(a,c,d);e.key=b++;e.rowIndex=p;g.headerrows[p].push(e)});p++});if(0<p)for(var e=p-1;0<=e;)d.each(g.headerrows[e],function(){var a=this;0<e&&null===this.rect&&(a=g.headerrows[e-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&g.columns.push(a)}),e=0<g.columns.length?-1:e-1;var k=0;w=[];w=C(d(this));d(w).each(function(){var a=[];b=0;E(this,"td,th",p,r.length+w.length,
  6240. function(c,e,f){if("undefined"===typeof g.columns[b]){var h={title:"",key:b,style:{hidden:!0}};g.columns.push(h)}a.push(D(c,e,f));"undefined"!==typeof c&&null!==c?(h=Ca(c),h.isCanvas=c.hasAttribute("data-tableexport-canvas"),h.elements=h.isCanvas?d(c):d(c).children(),"undefined"!==typeof d(c).data("teUserDefText")&&(h.hasUserDefText=!0)):(h=d.extend(!0,{},g.teCells[k+":"+(b-1)]),h.colspan=-1);g.teCells[k+":"+b++]=h});a.length&&(g.rows.push(a),k++);p++});if("function"===typeof g.onBeforeAutotable)g.onBeforeAutotable(d(this),
  6241. g.columns,g.rows,c);g.doc.autoTable(g.columns,g.rows,c);if("function"===typeof g.onAfterAutotable)g.onAfterAutotable(d(this),c);a.jspdf.autotable.startY=g.doc.autoTableEndPosY()+c.margin.top});va(g.doc,"undefined"!==typeof g.images&&!1===jQuery.isEmptyObject(g.images));"undefined"!==typeof g.headerrows&&(g.headerrows.length=0);"undefined"!==typeof g.columns&&(g.columns.length=0);"undefined"!==typeof g.rows&&(g.rows.length=0);delete g.doc;g.doc=null})}if("function"===typeof a.onTableExportEnd)a.onTableExportEnd();
  6242. return this}})(jQuery);
  6243. define("tableexport", ["jquery"], (function (global) {
  6244. return function () {
  6245. var ret, fn;
  6246. return ret || global.$.fn.extend;
  6247. };
  6248. }(this)));
  6249. !function(t){"use strict";var o=t.fn.bootstrapTable.utils.sprintf,e={json:"JSON",xml:"XML",png:"PNG",csv:"CSV",txt:"TXT",sql:"SQL",doc:"MS-Word",excel:"MS-Excel",xlsx:"MS-Excel (OpenXML)",powerpoint:"MS-Powerpoint",pdf:"PDF"};t.extend(t.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),t.extend(t.fn.bootstrapTable.defaults.icons,{export:"glyphicon-export icon-share"}),t.extend(t.fn.bootstrapTable.locales,{formatExport:function(){return"Export data"}}),t.extend(t.fn.bootstrapTable.defaults,t.fn.bootstrapTable.locales);var s=t.fn.bootstrapTable.Constructor,i=s.prototype.initToolbar;s.prototype.initToolbar=function(){if(this.showToolbar=this.options.showExport,i.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport){var s=this,n=this.$toolbar.find(">.btn-group"),a=n.find("div.export");if(!a.length){var p=(a=t(['<div class="export btn-group">','<button class="btn'+o(" btn-%s",this.options.buttonsClass)+o(" btn-%s",this.options.iconSize)+' dropdown-toggle" aria-label="export type" title="'+this.options.formatExport()+'" data-toggle="dropdown" type="button">',o('<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(n)).find(".dropdown-menu"),l=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var r=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");l=[],t.each(r,function(t,o){l.push(o.slice(1,-1))})}t.each(l,function(t,o){e.hasOwnProperty(o)&&p.append(['<li role="menuitem" data-type="'+o+'">','<a href="javascript:void(0)">',e[o],"</a>","</li>"].join(""))}),p.find("li").click(function(){var o=t(this).data("type"),e=function(){s.$el.tableExport(t.extend({},s.options.exportOptions,{type:o,escape:!1}))};if("all"===s.options.exportDataType&&s.options.pagination)s.$el.one("server"===s.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){e(),s.togglePagination()}),s.togglePagination();else if("selected"===s.options.exportDataType){var i=s.getData(),n=s.getAllSelections();if("server"===s.options.sidePagination){(i={total:s.options.totalRows})[s.options.dataField]=s.getData();var a="function"==typeof require?require("table"):null;(n={total:s.options.totalRows})[s.options.dataField]=a&&s.options.maintainSelected?a.api.selecteddata(s.$el):s.getAllSelections()}s.load(n),e(),s.load(i)}else e()})}}}}(jQuery);
  6250. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6251. return function () {
  6252. var ret, fn;
  6253. return ret || global.$.fn.bootstrapTable.defaults;
  6254. };
  6255. }(this)));
  6256. (function(factory){if(typeof define==="function"&&define.amd){define('dropzone',["jquery"],factory)}else{factory(jQuery)}})(function(jQuery){var module={exports:{}};"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var Emitter=function(){function Emitter(){_classCallCheck(this,Emitter)}_createClass(Emitter,[{key:"on",value:function on(event,fn){this._callbacks=this._callbacks||{};if(!this._callbacks[event]){this._callbacks[event]=[]}this._callbacks[event].push(fn);return this}},{key:"emit",value:function emit(event){this._callbacks=this._callbacks||{};var callbacks=this._callbacks[event];if(callbacks){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=callbacks[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var callback=_step.value;callback.apply(this,args)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator["return"]!=null){_iterator["return"]()}}finally{if(_didIteratorError){throw _iteratorError}}}}return this}},{key:"off",value:function off(event,fn){if(!this._callbacks||arguments.length===0){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks){return this}if(arguments.length===1){delete this._callbacks[event];return this}for(var i=0;i<callbacks.length;i++){var callback=callbacks[i];if(callback===fn){callbacks.splice(i,1);break}}return this}}]);return Emitter}();var Dropzone=function(_Emitter){_inherits(Dropzone,_Emitter);_createClass(Dropzone,null,[{key:"initClass",value:function initClass(){this.prototype.Emitter=Emitter;this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"];this.prototype.defaultOptions={url:null,method:"post",withCredentials:false,timeout:3e4,parallelUploads:2,uploadMultiple:false,chunking:false,forceChunking:false,chunkSize:2e6,parallelChunkUploads:false,retryChunks:false,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:true,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,clickable:true,ignoreHiddenFiles:true,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:true,autoQueue:true,addRemoveLinks:false,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:false,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function init(){},params:function params(files,xhr,chunk){if(chunk){return{dzuuid:chunk.file.upload.uuid,dzchunkindex:chunk.index,dztotalfilesize:chunk.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:chunk.file.upload.totalChunkCount,dzchunkbyteoffset:chunk.index*this.options.chunkSize}}},accept:function accept(file,done){return done()},chunkSuccess:function(chunk,file,response){},chunksUploaded:function chunksUploaded(file,done){done()},fallback:function fallback(){var messageElement;this.element.className="".concat(this.element.className," dz-browser-not-supported");var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=this.element.getElementsByTagName("div")[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var child=_step2.value;if(/(^| )dz-message($| )/.test(child.className)){messageElement=child;child.className="dz-message";break}}}catch(err){_didIteratorError2=true;_iteratorError2=err}finally{try{if(!_iteratorNormalCompletion2&&_iterator2["return"]!=null){_iterator2["return"]()}}finally{if(_didIteratorError2){throw _iteratorError2}}}if(!messageElement){messageElement=Dropzone.createElement('<div class="dz-message"><span></span></div>');this.element.appendChild(messageElement)}var span=messageElement.getElementsByTagName("span")[0];if(span){if(span.textContent!=null){span.textContent=this.options.dictFallbackMessage}else if(span.innerText!=null){span.innerText=this.options.dictFallbackMessage}}return this.element.appendChild(this.getFallbackForm())},resize:function resize(file,width,height,resizeMethod){var info={srcX:0,srcY:0,srcWidth:file.width,srcHeight:file.height};var srcRatio=file.width/file.height;if(width==null&&height==null){width=info.srcWidth;height=info.srcHeight}else if(width==null){width=height*srcRatio}else if(height==null){height=width/srcRatio}width=Math.min(width,info.srcWidth);height=Math.min(height,info.srcHeight);var trgRatio=width/height;if(info.srcWidth>width||info.srcHeight>height){if(resizeMethod==="crop"){if(srcRatio>trgRatio){info.srcHeight=file.height;info.srcWidth=info.srcHeight*trgRatio}else{info.srcWidth=file.width;info.srcHeight=info.srcWidth/trgRatio}}else if(resizeMethod==="contain"){if(srcRatio>trgRatio){height=width/srcRatio}else{width=height*srcRatio}}else{throw new Error("Unknown resizeMethod '".concat(resizeMethod,"'"))}}info.srcX=(file.width-info.srcWidth)/2;info.srcY=(file.height-info.srcHeight)/2;info.trgWidth=width;info.trgHeight=height;return info},transformFile:function transformFile(file,done){if((this.options.resizeWidth||this.options.resizeHeight)&&file.type.match(/image.*/)){return this.resizeImage(file,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,done)}else{return done(file)}},previewTemplate:'<div class="dz-preview dz-file-preview">\n <div class="dz-image"><img data-dz-thumbnail /></div>\n <div class="dz-details">\n <div class="dz-size"><span data-dz-size></span></div>\n <div class="dz-filename"><span data-dz-name></span></div>\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>Check</title>\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF"></path>\n </g>\n </svg>\n </div>\n <div class="dz-error-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>Error</title>\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">\n <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>',drop:function drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart:function dragstart(e){},dragend:function dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover:function dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave:function dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste:function paste(e){},reset:function reset(){return this.element.classList.remove("dz-started")},addedfile:function addedfile(file){var _this2=this;if(this.element===this.previewsContainer){this.element.classList.add("dz-started")}if(this.previewsContainer){file.previewElement=Dropzone.createElement(this.options.previewTemplate.trim());file.previewTemplate=file.previewElement;this.previewsContainer.appendChild(file.previewElement);var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=file.previewElement.querySelectorAll("[data-dz-name]")[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var node=_step3.value;node.textContent=file.name}}catch(err){_didIteratorError3=true;_iteratorError3=err}finally{try{if(!_iteratorNormalCompletion3&&_iterator3["return"]!=null){_iterator3["return"]()}}finally{if(_didIteratorError3){throw _iteratorError3}}}var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=file.previewElement.querySelectorAll("[data-dz-size]")[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){node=_step4.value;node.innerHTML=this.filesize(file.size)}}catch(err){_didIteratorError4=true;_iteratorError4=err}finally{try{if(!_iteratorNormalCompletion4&&_iterator4["return"]!=null){_iterator4["return"]()}}finally{if(_didIteratorError4){throw _iteratorError4}}}if(this.options.addRemoveLinks){file._removeLink=Dropzone.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>"));file.previewElement.appendChild(file._removeLink)}var removeFileEvent=function removeFileEvent(e){e.preventDefault();e.stopPropagation();if(file.status===Dropzone.UPLOADING){return Dropzone.confirm(_this2.options.dictCancelUploadConfirmation,function(){return _this2.removeFile(file)})}else{if(_this2.options.dictRemoveFileConfirmation){return Dropzone.confirm(_this2.options.dictRemoveFileConfirmation,function(){return _this2.removeFile(file)})}else{return _this2.removeFile(file)}}};var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=file.previewElement.querySelectorAll("[data-dz-remove]")[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var removeLink=_step5.value;removeLink.addEventListener("click",removeFileEvent)}}catch(err){_didIteratorError5=true;_iteratorError5=err}finally{try{if(!_iteratorNormalCompletion5&&_iterator5["return"]!=null){_iterator5["return"]()}}finally{if(_didIteratorError5){throw _iteratorError5}}}}},removedfile:function removedfile(file){if(file.previewElement!=null&&file.previewElement.parentNode!=null){file.previewElement.parentNode.removeChild(file.previewElement)}return this._updateMaxFilesReachedClass()},thumbnail:function thumbnail(file,dataUrl){if(file.previewElement){file.previewElement.classList.remove("dz-file-preview");var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=file.previewElement.querySelectorAll("[data-dz-thumbnail]")[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var thumbnailElement=_step6.value;thumbnailElement.alt=file.name;thumbnailElement.src=dataUrl}}catch(err){_didIteratorError6=true;_iteratorError6=err}finally{try{if(!_iteratorNormalCompletion6&&_iterator6["return"]!=null){_iterator6["return"]()}}finally{if(_didIteratorError6){throw _iteratorError6}}}return setTimeout(function(){return file.previewElement.classList.add("dz-image-preview")},1)}},error:function error(file,message){if(file.previewElement){file.previewElement.classList.add("dz-error");if(typeof message!=="String"&&message.error){message=message.error}var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{for(var _iterator7=file.previewElement.querySelectorAll("[data-dz-errormessage]")[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){var node=_step7.value;node.textContent=message}}catch(err){_didIteratorError7=true;_iteratorError7=err}finally{try{if(!_iteratorNormalCompletion7&&_iterator7["return"]!=null){_iterator7["return"]()}}finally{if(_didIteratorError7){throw _iteratorError7}}}}},errormultiple:function errormultiple(){},processing:function processing(file){if(file.previewElement){file.previewElement.classList.add("dz-processing");if(file._removeLink){return file._removeLink.innerHTML=this.options.dictCancelUpload}}},processingmultiple:function processingmultiple(){},uploadprogress:function uploadprogress(file,progress,bytesSent){if(file.previewElement){var _iteratorNormalCompletion8=true;var _didIteratorError8=false;var _iteratorError8=undefined;try{for(var _iterator8=file.previewElement.querySelectorAll("[data-dz-uploadprogress]")[Symbol.iterator](),_step8;!(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done);_iteratorNormalCompletion8=true){var node=_step8.value;node.nodeName==="PROGRESS"?node.value=progress:node.style.width="".concat(progress,"%")}}catch(err){_didIteratorError8=true;_iteratorError8=err}finally{try{if(!_iteratorNormalCompletion8&&_iterator8["return"]!=null){_iterator8["return"]()}}finally{if(_didIteratorError8){throw _iteratorError8}}}}},totaluploadprogress:function totaluploadprogress(){},sending:function sending(){},sendingmultiple:function sendingmultiple(){},success:function success(file){if(file.previewElement){return file.previewElement.classList.add("dz-success")}},successmultiple:function successmultiple(){},canceled:function canceled(file){return this.emit("error",file,this.options.dictUploadCanceled)},canceledmultiple:function canceledmultiple(){},complete:function complete(file){if(file._removeLink){file._removeLink.innerHTML=this.options.dictRemoveFile}if(file.previewElement){return file.previewElement.classList.add("dz-complete")}},completemultiple:function completemultiple(){},maxfilesexceeded:function maxfilesexceeded(){},maxfilesreached:function maxfilesreached(){},queuecomplete:function queuecomplete(){},addedfiles:function addedfiles(){}};this.prototype._thumbnailQueue=[];this.prototype._processingThumbnail=false}},{key:"extend",value:function extend(target){for(var _len2=arguments.length,objects=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){objects[_key2-1]=arguments[_key2]}for(var _i=0,_objects=objects;_i<_objects.length;_i++){var object=_objects[_i];for(var key in object){var val=object[key];target[key]=val}}return target}}]);function Dropzone(el,options){var _this;_classCallCheck(this,Dropzone);_this=_possibleConstructorReturn(this,_getPrototypeOf(Dropzone).call(this));var fallback,left;_this.element=el;_this.version=Dropzone.version;_this.defaultOptions.previewTemplate=_this.defaultOptions.previewTemplate.replace(/\n*/g,"");_this.clickableElements=[];_this.listeners=[];_this.files=[];if(typeof _this.element==="string"){_this.element=document.querySelector(_this.element)}if(!_this.element||_this.element.nodeType==null){throw new Error("Invalid dropzone element.")}if(_this.element.dropzone){throw new Error("Dropzone already attached.")}Dropzone.instances.push(_assertThisInitialized(_this));_this.element.dropzone=_assertThisInitialized(_this);var elementOptions=(left=Dropzone.optionsForElement(_this.element))!=null?left:{};_this.options=Dropzone.extend({},_this.defaultOptions,elementOptions,options!=null?options:{});if(_this.options.forceFallback||!Dropzone.isBrowserSupported()){return _possibleConstructorReturn(_this,_this.options.fallback.call(_assertThisInitialized(_this)))}if(_this.options.url==null){_this.options.url=_this.element.getAttribute("action")}if(!_this.options.url){throw new Error("No URL provided.")}if(_this.options.acceptedFiles&&_this.options.acceptedMimeTypes){throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.")}if(_this.options.uploadMultiple&&_this.options.chunking){throw new Error("You cannot set both: uploadMultiple and chunking.")}if(_this.options.acceptedMimeTypes){_this.options.acceptedFiles=_this.options.acceptedMimeTypes;delete _this.options.acceptedMimeTypes}if(_this.options.renameFilename!=null){_this.options.renameFile=function(file){return _this.options.renameFilename.call(_assertThisInitialized(_this),file.name,file)}}_this.options.method=typeof _this.options.method!=="function"?_this.options.method.toUpperCase():_this.options.method;if((fallback=_this.getExistingFallback())&&fallback.parentNode){fallback.parentNode.removeChild(fallback)}if(_this.options.previewsContainer!==false){if(_this.options.previewsContainer){_this.previewsContainer=Dropzone.getElement(_this.options.previewsContainer,"previewsContainer")}else{_this.previewsContainer=_this.element}}if(_this.options.clickable){if(_this.options.clickable===true){_this.clickableElements=[_this.element]}else{_this.clickableElements=Dropzone.getElements(_this.options.clickable,"clickable")}}_this.init();return _this}_createClass(Dropzone,[{key:"getAcceptedFiles",value:function getAcceptedFiles(){return this.files.filter(function(file){return file.accepted}).map(function(file){return file})}},{key:"getRejectedFiles",value:function getRejectedFiles(){return this.files.filter(function(file){return!file.accepted}).map(function(file){return file})}},{key:"getFilesWithStatus",value:function getFilesWithStatus(status){return this.files.filter(function(file){return file.status===status}).map(function(file){return file})}},{key:"getQueuedFiles",value:function getQueuedFiles(){return this.getFilesWithStatus(Dropzone.QUEUED)}},{key:"getUploadingFiles",value:function getUploadingFiles(){return this.getFilesWithStatus(Dropzone.UPLOADING)}},{key:"getAddedFiles",value:function getAddedFiles(){return this.getFilesWithStatus(Dropzone.ADDED)}},{key:"getActiveFiles",value:function getActiveFiles(){return this.files.filter(function(file){return file.status===Dropzone.UPLOADING||file.status===Dropzone.QUEUED}).map(function(file){return file})}},{key:"init",value:function init(){var _this3=this;if(this.element.tagName==="form"){this.element.setAttribute("enctype","multipart/form-data")}if(this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")){this.element.appendChild(Dropzone.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>")))}if(this.clickableElements.length){var setupHiddenFileInput=function setupHiddenFileInput(){if(_this3.hiddenFileInput){_this3.hiddenFileInput.parentNode.removeChild(_this3.hiddenFileInput)}_this3.hiddenFileInput=document.createElement("input");_this3.hiddenFileInput.setAttribute("type","file");if(_this3.options.maxFiles===null||_this3.options.maxFiles>1){_this3.hiddenFileInput.setAttribute("multiple","multiple")}_this3.hiddenFileInput.className="dz-hidden-input";if(_this3.options.acceptedFiles!==null){_this3.hiddenFileInput.setAttribute("accept",_this3.options.acceptedFiles)}if(_this3.options.capture!==null){_this3.hiddenFileInput.setAttribute("capture",_this3.options.capture)}_this3.hiddenFileInput.style.visibility="hidden";_this3.hiddenFileInput.style.position="absolute";_this3.hiddenFileInput.style.top="0";_this3.hiddenFileInput.style.left="0";_this3.hiddenFileInput.style.height="0";_this3.hiddenFileInput.style.width="0";Dropzone.getElement(_this3.options.hiddenInputContainer,"hiddenInputContainer").appendChild(_this3.hiddenFileInput);return _this3.hiddenFileInput.addEventListener("change",function(){var files=_this3.hiddenFileInput.files;if(files.length){var _iteratorNormalCompletion9=true;var _didIteratorError9=false;var _iteratorError9=undefined;try{for(var _iterator9=files[Symbol.iterator](),_step9;!(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done);_iteratorNormalCompletion9=true){var file=_step9.value;_this3.addFile(file)}}catch(err){_didIteratorError9=true;_iteratorError9=err}finally{try{if(!_iteratorNormalCompletion9&&_iterator9["return"]!=null){_iterator9["return"]()}}finally{if(_didIteratorError9){throw _iteratorError9}}}}_this3.emit("addedfiles",files);return setupHiddenFileInput()})};setupHiddenFileInput()}this.URL=window.URL!==null?window.URL:window.webkitURL;var _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{for(var _iterator10=this.events[Symbol.iterator](),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){var eventName=_step10.value;this.on(eventName,this.options[eventName])}}catch(err){_didIteratorError10=true;_iteratorError10=err}finally{try{if(!_iteratorNormalCompletion10&&_iterator10["return"]!=null){_iterator10["return"]()}}finally{if(_didIteratorError10){throw _iteratorError10}}}this.on("uploadprogress",function(){return _this3.updateTotalUploadProgress()});this.on("removedfile",function(){return _this3.updateTotalUploadProgress()});this.on("canceled",function(file){return _this3.emit("complete",file)});this.on("complete",function(file){if(_this3.getAddedFiles().length===0&&_this3.getUploadingFiles().length===0&&_this3.getQueuedFiles().length===0){return setTimeout(function(){return _this3.emit("queuecomplete")},0)}});var containsFiles=function containsFiles(e){return e.dataTransfer.types&&e.dataTransfer.types.some(function(type){return type=="Files"})};var noPropagation=function noPropagation(e){if(!containsFiles(e))return;e.stopPropagation();if(e.preventDefault){return e.preventDefault()}else{return e.returnValue=false}};this.listeners=[{element:this.element,events:{dragstart:function dragstart(e){return _this3.emit("dragstart",e)},dragenter:function dragenter(e){noPropagation(e);return _this3.emit("dragenter",e)},dragover:function dragover(e){var efct;try{efct=e.dataTransfer.effectAllowed}catch(error){}e.dataTransfer.dropEffect="move"===efct||"linkMove"===efct?"move":"copy";noPropagation(e);return _this3.emit("dragover",e)},dragleave:function dragleave(e){return _this3.emit("dragleave",e)},drop:function drop(e){noPropagation(e);return _this3.drop(e)},dragend:function dragend(e){return _this3.emit("dragend",e)}}}];this.clickableElements.forEach(function(clickableElement){return _this3.listeners.push({element:clickableElement,events:{click:function click(evt){if(clickableElement!==_this3.element||evt.target===_this3.element||Dropzone.elementInside(evt.target,_this3.element.querySelector(".dz-message"))){_this3.hiddenFileInput.click()}return true}}})});this.enable();return this.options.init.call(this)}},{key:"destroy",value:function destroy(){this.disable();this.removeAllFiles(true);if(this.hiddenFileInput!=null?this.hiddenFileInput.parentNode:undefined){this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);this.hiddenFileInput=null}delete this.element.dropzone;return Dropzone.instances.splice(Dropzone.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function updateTotalUploadProgress(){var totalUploadProgress;var totalBytesSent=0;var totalBytes=0;var activeFiles=this.getActiveFiles();if(activeFiles.length){var _iteratorNormalCompletion11=true;var _didIteratorError11=false;var _iteratorError11=undefined;try{for(var _iterator11=this.getActiveFiles()[Symbol.iterator](),_step11;!(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done);_iteratorNormalCompletion11=true){var file=_step11.value;totalBytesSent+=file.upload.bytesSent;totalBytes+=file.upload.total}}catch(err){_didIteratorError11=true;_iteratorError11=err}finally{try{if(!_iteratorNormalCompletion11&&_iterator11["return"]!=null){_iterator11["return"]()}}finally{if(_didIteratorError11){throw _iteratorError11}}}totalUploadProgress=100*totalBytesSent/totalBytes}else{totalUploadProgress=100}return this.emit("totaluploadprogress",totalUploadProgress,totalBytes,totalBytesSent)}},{key:"_getParamName",value:function _getParamName(n){if(typeof this.options.paramName==="function"){return this.options.paramName(n)}else{return"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(n,"]"):"")}}},{key:"_renameFile",value:function _renameFile(file){if(typeof this.options.renameFile!=="function"){return file.name}return this.options.renameFile(file)}},{key:"getFallbackForm",value:function getFallbackForm(){var existingFallback,form;if(existingFallback=this.getExistingFallback()){return existingFallback}var fieldsString='<div class="dz-fallback">';if(this.options.dictFallbackText){fieldsString+="<p>".concat(this.options.dictFallbackText,"</p>")}fieldsString+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':undefined,' /><input type="submit" value="Upload!"></div>');var fields=Dropzone.createElement(fieldsString);if(this.element.tagName!=="FORM"){form=Dropzone.createElement('<form action="'.concat(this.options.url,'" enctype="multipart/form-data" method="').concat(this.options.method,'"></form>'));form.appendChild(fields)}else{this.element.setAttribute("enctype","multipart/form-data");this.element.setAttribute("method",this.options.method)}return form!=null?form:fields}},{key:"getExistingFallback",value:function getExistingFallback(){var getFallback=function getFallback(elements){var _iteratorNormalCompletion12=true;var _didIteratorError12=false;var _iteratorError12=undefined;try{for(var _iterator12=elements[Symbol.iterator](),_step12;!(_iteratorNormalCompletion12=(_step12=_iterator12.next()).done);_iteratorNormalCompletion12=true){var el=_step12.value;if(/(^| )fallback($| )/.test(el.className)){return el}}}catch(err){_didIteratorError12=true;_iteratorError12=err}finally{try{if(!_iteratorNormalCompletion12&&_iterator12["return"]!=null){_iterator12["return"]()}}finally{if(_didIteratorError12){throw _iteratorError12}}}};for(var _i2=0,_arr=["div","form"];_i2<_arr.length;_i2++){var tagName=_arr[_i2];var fallback;if(fallback=getFallback(this.element.getElementsByTagName(tagName))){return fallback}}}},{key:"setupEventListeners",value:function setupEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.addEventListener(event,listener,false))}return result}()})}},{key:"removeEventListeners",value:function removeEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.removeEventListener(event,listener,false))}return result}()})}},{key:"disable",value:function disable(){var _this4=this;this.clickableElements.forEach(function(element){return element.classList.remove("dz-clickable")});this.removeEventListeners();this.disabled=true;return this.files.map(function(file){return _this4.cancelUpload(file)})}},{key:"enable",value:function enable(){delete this.disabled;this.clickableElements.forEach(function(element){return element.classList.add("dz-clickable")});return this.setupEventListeners()}},{key:"filesize",value:function filesize(size){var selectedSize=0;var selectedUnit="b";if(size>0){var units=["tb","gb","mb","kb","b"];for(var i=0;i<units.length;i++){var unit=units[i];var cutoff=Math.pow(this.options.filesizeBase,4-i)/10;if(size>=cutoff){selectedSize=size/Math.pow(this.options.filesizeBase,4-i);selectedUnit=unit;break}}selectedSize=Math.round(10*selectedSize)/10}return"<strong>".concat(selectedSize,"</strong> ").concat(this.options.dictFileSizeUnits[selectedUnit])}},{key:"_updateMaxFilesReachedClass",value:function _updateMaxFilesReachedClass(){if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){if(this.getAcceptedFiles().length===this.options.maxFiles){this.emit("maxfilesreached",this.files)}return this.element.classList.add("dz-max-files-reached")}else{return this.element.classList.remove("dz-max-files-reached")}}},{key:"drop",value:function drop(e){if(!e.dataTransfer){return}this.emit("drop",e);var files=[];for(var i=0;i<e.dataTransfer.files.length;i++){files[i]=e.dataTransfer.files[i]}if(files.length){var items=e.dataTransfer.items;if(items&&items.length&&items[0].webkitGetAsEntry!=null){this._addFilesFromItems(items)}else{this.handleFiles(files)}}this.emit("addedfiles",files)}},{key:"paste",value:function paste(e){if(__guard__(e!=null?e.clipboardData:undefined,function(x){return x.items})==null){return}this.emit("paste",e);var items=e.clipboardData.items;if(items.length){return this._addFilesFromItems(items)}}},{key:"handleFiles",value:function handleFiles(files){var _iteratorNormalCompletion13=true;var _didIteratorError13=false;var _iteratorError13=undefined;try{for(var _iterator13=files[Symbol.iterator](),_step13;!(_iteratorNormalCompletion13=(_step13=_iterator13.next()).done);_iteratorNormalCompletion13=true){var file=_step13.value;this.addFile(file)}}catch(err){_didIteratorError13=true;_iteratorError13=err}finally{try{if(!_iteratorNormalCompletion13&&_iterator13["return"]!=null){_iterator13["return"]()}}finally{if(_didIteratorError13){throw _iteratorError13}}}}},{key:"_addFilesFromItems",value:function _addFilesFromItems(items){var _this5=this;return function(){var result=[];var _iteratorNormalCompletion14=true;var _didIteratorError14=false;var _iteratorError14=undefined;try{for(var _iterator14=items[Symbol.iterator](),_step14;!(_iteratorNormalCompletion14=(_step14=_iterator14.next()).done);_iteratorNormalCompletion14=true){var item=_step14.value;var entry;if(item.webkitGetAsEntry!=null&&(entry=item.webkitGetAsEntry())){if(entry.isFile){result.push(_this5.addFile(item.getAsFile()))}else if(entry.isDirectory){result.push(_this5._addFilesFromDirectory(entry,entry.name))}else{result.push(undefined)}}else if(item.getAsFile!=null){if(item.kind==null||item.kind==="file"){result.push(_this5.addFile(item.getAsFile()))}else{result.push(undefined)}}else{result.push(undefined)}}}catch(err){_didIteratorError14=true;_iteratorError14=err}finally{try{if(!_iteratorNormalCompletion14&&_iterator14["return"]!=null){_iterator14["return"]()}}finally{if(_didIteratorError14){throw _iteratorError14}}}return result}()}},{key:"_addFilesFromDirectory",value:function _addFilesFromDirectory(directory,path){var _this6=this;var dirReader=directory.createReader();var errorHandler=function errorHandler(error){return __guardMethod__(console,"log",function(o){return o.log(error)})};var readEntries=function readEntries(){return dirReader.readEntries(function(entries){if(entries.length>0){var _iteratorNormalCompletion15=true;var _didIteratorError15=false;var _iteratorError15=undefined;try{for(var _iterator15=entries[Symbol.iterator](),_step15;!(_iteratorNormalCompletion15=(_step15=_iterator15.next()).done);_iteratorNormalCompletion15=true){var entry=_step15.value;if(entry.isFile){entry.file(function(file){if(_this6.options.ignoreHiddenFiles&&file.name.substring(0,1)==="."){return}file.fullPath="".concat(path,"/").concat(file.name);return _this6.addFile(file)})}else if(entry.isDirectory){_this6._addFilesFromDirectory(entry,"".concat(path,"/").concat(entry.name))}}}catch(err){_didIteratorError15=true;_iteratorError15=err}finally{try{if(!_iteratorNormalCompletion15&&_iterator15["return"]!=null){_iterator15["return"]()}}finally{if(_didIteratorError15){throw _iteratorError15}}}readEntries()}return null},errorHandler)};return readEntries()}},{key:"accept",value:function accept(file,done){if(this.options.maxFilesize&&file.size>this.options.maxFilesize*1024*1024){done(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(file.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize))}else if(!Dropzone.isValidFile(file,this.options.acceptedFiles)){done(this.options.dictInvalidFileType)}else if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles));this.emit("maxfilesexceeded",file)}else{this.options.accept.call(this,file,done)}}},{key:"addFile",value:function addFile(file){var _this7=this;file.upload={uuid:Dropzone.uuidv4(),progress:0,total:file.size,bytesSent:0,filename:this._renameFile(file)};this.files.push(file);file.status=Dropzone.ADDED;this.emit("addedfile",file);this._enqueueThumbnail(file);this.accept(file,function(error){if(error){file.accepted=false;_this7._errorProcessing([file],error)}else{file.accepted=true;if(_this7.options.autoQueue){_this7.enqueueFile(file)}}_this7._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function enqueueFiles(files){var _iteratorNormalCompletion16=true;var _didIteratorError16=false;var _iteratorError16=undefined;try{for(var _iterator16=files[Symbol.iterator](),_step16;!(_iteratorNormalCompletion16=(_step16=_iterator16.next()).done);_iteratorNormalCompletion16=true){var file=_step16.value;this.enqueueFile(file)}}catch(err){_didIteratorError16=true;_iteratorError16=err}finally{try{if(!_iteratorNormalCompletion16&&_iterator16["return"]!=null){_iterator16["return"]()}}finally{if(_didIteratorError16){throw _iteratorError16}}}return null}},{key:"enqueueFile",value:function enqueueFile(file){var _this8=this;if(file.status===Dropzone.ADDED&&file.accepted===true){file.status=Dropzone.QUEUED;if(this.options.autoProcessQueue){return setTimeout(function(){return _this8.processQueue()},0)}}else{throw new Error("This file can't be queued because it has already been processed or was rejected.")}}},{key:"_enqueueThumbnail",value:function _enqueueThumbnail(file){var _this9=this;if(this.options.createImageThumbnails&&file.type.match(/image.*/)&&file.size<=this.options.maxThumbnailFilesize*1024*1024){this._thumbnailQueue.push(file);return setTimeout(function(){return _this9._processThumbnailQueue()},0)}}},{key:"_processThumbnailQueue",value:function _processThumbnailQueue(){var _this10=this;if(this._processingThumbnail||this._thumbnailQueue.length===0){return}this._processingThumbnail=true;var file=this._thumbnailQueue.shift();return this.createThumbnail(file,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,true,function(dataUrl){_this10.emit("thumbnail",file,dataUrl);_this10._processingThumbnail=false;return _this10._processThumbnailQueue()})}},{key:"removeFile",value:function removeFile(file){if(file.status===Dropzone.UPLOADING){this.cancelUpload(file)}this.files=without(this.files,file);this.emit("removedfile",file);if(this.files.length===0){return this.emit("reset")}}},{key:"removeAllFiles",value:function removeAllFiles(cancelIfNecessary){if(cancelIfNecessary==null){cancelIfNecessary=false}var _iteratorNormalCompletion17=true;var _didIteratorError17=false;var _iteratorError17=undefined;try{for(var _iterator17=this.files.slice()[Symbol.iterator](),_step17;!(_iteratorNormalCompletion17=(_step17=_iterator17.next()).done);_iteratorNormalCompletion17=true){var file=_step17.value;if(file.status!==Dropzone.UPLOADING||cancelIfNecessary){this.removeFile(file)}}}catch(err){_didIteratorError17=true;_iteratorError17=err}finally{try{if(!_iteratorNormalCompletion17&&_iterator17["return"]!=null){_iterator17["return"]()}}finally{if(_didIteratorError17){throw _iteratorError17}}}return null}},{key:"resizeImage",value:function resizeImage(file,width,height,resizeMethod,callback){var _this11=this;return this.createThumbnail(file,width,height,resizeMethod,true,function(dataUrl,canvas){if(canvas==null){return callback(file)}else{var resizeMimeType=_this11.options.resizeMimeType;if(resizeMimeType==null){resizeMimeType=file.type}var resizedDataURL=canvas.toDataURL(resizeMimeType,_this11.options.resizeQuality);if(resizeMimeType==="image/jpeg"||resizeMimeType==="image/jpg"){resizedDataURL=ExifRestore.restore(file.dataURL,resizedDataURL)}return callback(Dropzone.dataURItoBlob(resizedDataURL))}})}},{key:"createThumbnail",value:function createThumbnail(file,width,height,resizeMethod,fixOrientation,callback){var _this12=this;var fileReader=new FileReader;fileReader.onload=function(){file.dataURL=fileReader.result;if(file.type==="image/svg+xml"){if(callback!=null){callback(fileReader.result)}return}_this12.createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback)};fileReader.readAsDataURL(file)}},{key:"displayExistingFile",value:function displayExistingFile(mockFile,imageUrl,callback,crossOrigin){var _this13=this;var resizeThumbnail=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;this.emit("addedfile",mockFile);this.emit("complete",mockFile);if(!resizeThumbnail){this.emit("thumbnail",mockFile,imageUrl);if(callback)callback()}else{var onDone=function onDone(thumbnail){_this13.emit("thumbnail",mockFile,thumbnail);if(callback)callback()};mockFile.dataURL=imageUrl;this.createThumbnailFromUrl(mockFile,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.resizeMethod,this.options.fixOrientation,onDone,crossOrigin)}}},{key:"createThumbnailFromUrl",value:function createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback,crossOrigin){var _this14=this;var img=document.createElement("img");if(crossOrigin){img.crossOrigin=crossOrigin}img.onload=function(){var loadExif=function loadExif(callback){return callback(1)};if(typeof EXIF!=="undefined"&&EXIF!==null&&fixOrientation){loadExif=function loadExif(callback){return EXIF.getData(img,function(){return callback(EXIF.getTag(this,"Orientation"))})}}return loadExif(function(orientation){file.width=img.width;file.height=img.height;var resizeInfo=_this14.options.resize.call(_this14,file,width,height,resizeMethod);var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");canvas.width=resizeInfo.trgWidth;canvas.height=resizeInfo.trgHeight;if(orientation>4){canvas.width=resizeInfo.trgHeight;canvas.height=resizeInfo.trgWidth}switch(orientation){case 2:ctx.translate(canvas.width,0);ctx.scale(-1,1);break;case 3:ctx.translate(canvas.width,canvas.height);ctx.rotate(Math.PI);break;case 4:ctx.translate(0,canvas.height);ctx.scale(1,-1);break;case 5:ctx.rotate(.5*Math.PI);ctx.scale(1,-1);break;case 6:ctx.rotate(.5*Math.PI);ctx.translate(0,-canvas.width);break;case 7:ctx.rotate(.5*Math.PI);ctx.translate(canvas.height,-canvas.width);ctx.scale(-1,1);break;case 8:ctx.rotate(-.5*Math.PI);ctx.translate(-canvas.height,0);break}drawImageIOSFix(ctx,img,resizeInfo.srcX!=null?resizeInfo.srcX:0,resizeInfo.srcY!=null?resizeInfo.srcY:0,resizeInfo.srcWidth,resizeInfo.srcHeight,resizeInfo.trgX!=null?resizeInfo.trgX:0,resizeInfo.trgY!=null?resizeInfo.trgY:0,resizeInfo.trgWidth,resizeInfo.trgHeight);var thumbnail=canvas.toDataURL("image/png");if(callback!=null){return callback(thumbnail,canvas)}})};if(callback!=null){img.onerror=callback}return img.src=file.dataURL}},{key:"processQueue",value:function processQueue(){var parallelUploads=this.options.parallelUploads;var processingLength=this.getUploadingFiles().length;var i=processingLength;if(processingLength>=parallelUploads){return}var queuedFiles=this.getQueuedFiles();if(!(queuedFiles.length>0)){return}if(this.options.uploadMultiple){return this.processFiles(queuedFiles.slice(0,parallelUploads-processingLength))}else{while(i<parallelUploads){if(!queuedFiles.length){return}this.processFile(queuedFiles.shift());i++}}}},{key:"processFile",value:function processFile(file){return this.processFiles([file])}},{key:"processFiles",value:function processFiles(files){var _iteratorNormalCompletion18=true;var _didIteratorError18=false;var _iteratorError18=undefined;try{for(var _iterator18=files[Symbol.iterator](),_step18;!(_iteratorNormalCompletion18=(_step18=_iterator18.next()).done);_iteratorNormalCompletion18=true){var file=_step18.value;file.processing=true;file.status=Dropzone.UPLOADING;this.emit("processing",file)}}catch(err){_didIteratorError18=true;_iteratorError18=err}finally{try{if(!_iteratorNormalCompletion18&&_iterator18["return"]!=null){_iterator18["return"]()}}finally{if(_didIteratorError18){throw _iteratorError18}}}if(this.options.uploadMultiple){this.emit("processingmultiple",files)}return this.uploadFiles(files)}},{key:"_getFilesWithXhr",value:function _getFilesWithXhr(xhr){var files;return files=this.files.filter(function(file){return file.xhr===xhr}).map(function(file){return file})}},{key:"cancelUpload",value:function cancelUpload(file){if(file.status===Dropzone.UPLOADING){var groupedFiles=this._getFilesWithXhr(file.xhr);var _iteratorNormalCompletion19=true;var _didIteratorError19=false;var _iteratorError19=undefined;try{for(var _iterator19=groupedFiles[Symbol.iterator](),_step19;!(_iteratorNormalCompletion19=(_step19=_iterator19.next()).done);_iteratorNormalCompletion19=true){var groupedFile=_step19.value;groupedFile.status=Dropzone.CANCELED}}catch(err){_didIteratorError19=true;_iteratorError19=err}finally{try{if(!_iteratorNormalCompletion19&&_iterator19["return"]!=null){_iterator19["return"]()}}finally{if(_didIteratorError19){throw _iteratorError19}}}if(typeof file.xhr!=="undefined"){file.xhr.abort()}var _iteratorNormalCompletion20=true;var _didIteratorError20=false;var _iteratorError20=undefined;try{for(var _iterator20=groupedFiles[Symbol.iterator](),_step20;!(_iteratorNormalCompletion20=(_step20=_iterator20.next()).done);_iteratorNormalCompletion20=true){var _groupedFile=_step20.value;this.emit("canceled",_groupedFile)}}catch(err){_didIteratorError20=true;_iteratorError20=err}finally{try{if(!_iteratorNormalCompletion20&&_iterator20["return"]!=null){_iterator20["return"]()}}finally{if(_didIteratorError20){throw _iteratorError20}}}if(this.options.uploadMultiple){this.emit("canceledmultiple",groupedFiles)}}else if(file.status===Dropzone.ADDED||file.status===Dropzone.QUEUED){file.status=Dropzone.CANCELED;this.emit("canceled",file);if(this.options.uploadMultiple){this.emit("canceledmultiple",[file])}}if(this.options.autoProcessQueue){return this.processQueue()}}},{key:"resolveOption",value:function resolveOption(option){if(typeof option==="function"){for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3]}return option.apply(this,args)}return option}},{key:"uploadFile",value:function uploadFile(file){return this.uploadFiles([file])}},{key:"uploadFiles",value:function uploadFiles(files){var _this15=this;this._transformFiles(files,function(transformedFiles){if(_this15.options.chunking){var transformedFile=transformedFiles[0];files[0].upload.chunked=_this15.options.chunking&&(_this15.options.forceChunking||transformedFile.size>_this15.options.chunkSize);files[0].upload.totalChunkCount=Math.ceil(transformedFile.size/_this15.options.chunkSize)}if(files[0].upload.chunked){var file=files[0];var _transformedFile=transformedFiles[0];var startedChunkCount=0;file.upload.chunks=[];var handleNextChunk=function handleNextChunk(){var chunkIndex=0;while(file.upload.chunks[chunkIndex]!==undefined){chunkIndex++}if(chunkIndex>=file.upload.totalChunkCount)return;startedChunkCount++;var start=chunkIndex*_this15.options.chunkSize;var end=Math.min(start+_this15.options.chunkSize,file.size);var dataBlock={name:_this15._getParamName(0),data:_transformedFile.webkitSlice?_transformedFile.webkitSlice(start,end):_transformedFile.slice(start,end),filename:file.upload.filename,chunkIndex:chunkIndex};file.upload.chunks[chunkIndex]={file:file,index:chunkIndex,dataBlock:dataBlock,status:Dropzone.UPLOADING,progress:0,retries:0};_this15._uploadData(files,[dataBlock])};file.upload.finishedChunkUpload=function(chunk,response){var allFinished=true;chunk.status=Dropzone.SUCCESS;_this15.options.chunkSuccess.call(_this15,chunk,file,response);chunk.dataBlock=null;chunk.xhr=null;for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]===undefined){return handleNextChunk()}if(file.upload.chunks[i].status!==Dropzone.SUCCESS){allFinished=false}}if(allFinished){_this15.options.chunksUploaded.call(_this15,file,function(response){_this15._finished(files,response||"",null)})}};if(_this15.options.parallelChunkUploads){for(var i=0;i<file.upload.totalChunkCount;i++){handleNextChunk()}}else{handleNextChunk()}}else{var dataBlocks=[];for(var _i3=0;_i3<files.length;_i3++){dataBlocks[_i3]={name:_this15._getParamName(_i3),data:transformedFiles[_i3],filename:files[_i3].upload.filename}}_this15._uploadData(files,dataBlocks)}})}},{key:"_getChunk",value:function _getChunk(file,xhr){for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]!==undefined&&file.upload.chunks[i].xhr===xhr){return file.upload.chunks[i]}}}},{key:"_uploadData",value:function _uploadData(files,dataBlocks){var _this16=this;var xhr=new XMLHttpRequest;var _iteratorNormalCompletion21=true;var _didIteratorError21=false;var _iteratorError21=undefined;try{for(var _iterator21=files[Symbol.iterator](),_step21;!(_iteratorNormalCompletion21=(_step21=_iterator21.next()).done);_iteratorNormalCompletion21=true){var file=_step21.value;file.xhr=xhr}}catch(err){_didIteratorError21=true;_iteratorError21=err}finally{try{if(!_iteratorNormalCompletion21&&_iterator21["return"]!=null){_iterator21["return"]()}}finally{if(_didIteratorError21){throw _iteratorError21}}}if(files[0].upload.chunked){files[0].upload.chunks[dataBlocks[0].chunkIndex].xhr=xhr}var method=this.resolveOption(this.options.method,files);var url=this.resolveOption(this.options.url,files);xhr.open(method,url,true);xhr.timeout=this.resolveOption(this.options.timeout,files);xhr.withCredentials=!!this.options.withCredentials;xhr.onload=function(e){_this16._finishedUploading(files,xhr,e)};xhr.ontimeout=function(){_this16._handleUploadError(files,xhr,"Request timedout after ".concat(_this16.options.timeout," seconds"))};xhr.onerror=function(){_this16._handleUploadError(files,xhr)};var progressObj=xhr.upload!=null?xhr.upload:xhr;progressObj.onprogress=function(e){return _this16._updateFilesUploadProgress(files,xhr,e)};var headers={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};if(this.options.headers){Dropzone.extend(headers,this.options.headers)}for(var headerName in headers){var headerValue=headers[headerName];if(headerValue){xhr.setRequestHeader(headerName,headerValue)}}var formData=new FormData;if(this.options.params){var additionalParams=this.options.params;if(typeof additionalParams==="function"){additionalParams=additionalParams.call(this,files,xhr,files[0].upload.chunked?this._getChunk(files[0],xhr):null)}for(var key in additionalParams){var value=additionalParams[key];formData.append(key,value)}}var _iteratorNormalCompletion22=true;var _didIteratorError22=false;var _iteratorError22=undefined;try{for(var _iterator22=files[Symbol.iterator](),_step22;!(_iteratorNormalCompletion22=(_step22=_iterator22.next()).done);_iteratorNormalCompletion22=true){var _file=_step22.value;this.emit("sending",_file,xhr,formData)}}catch(err){_didIteratorError22=true;_iteratorError22=err}finally{try{if(!_iteratorNormalCompletion22&&_iterator22["return"]!=null){_iterator22["return"]()}}finally{if(_didIteratorError22){throw _iteratorError22}}}if(this.options.uploadMultiple){this.emit("sendingmultiple",files,xhr,formData)}this._addFormElementData(formData);for(var i=0;i<dataBlocks.length;i++){var dataBlock=dataBlocks[i];formData.append(dataBlock.name,dataBlock.data,dataBlock.filename)}this.submitRequest(xhr,formData,files)}},{key:"_transformFiles",value:function _transformFiles(files,done){var _this17=this;var transformedFiles=[];var doneCounter=0;var _loop=function _loop(i){_this17.options.transformFile.call(_this17,files[i],function(transformedFile){transformedFiles[i]=transformedFile;if(++doneCounter===files.length){done(transformedFiles)}})};for(var i=0;i<files.length;i++){_loop(i)}}},{key:"_addFormElementData",value:function _addFormElementData(formData){if(this.element.tagName==="FORM"){var _iteratorNormalCompletion23=true;var _didIteratorError23=false;var _iteratorError23=undefined;try{for(var _iterator23=this.element.querySelectorAll("input, textarea, select, button")[Symbol.iterator](),_step23;!(_iteratorNormalCompletion23=(_step23=_iterator23.next()).done);_iteratorNormalCompletion23=true){var input=_step23.value;var inputName=input.getAttribute("name");var inputType=input.getAttribute("type");if(inputType)inputType=inputType.toLowerCase();if(typeof inputName==="undefined"||inputName===null)continue;if(input.tagName==="SELECT"&&input.hasAttribute("multiple")){var _iteratorNormalCompletion24=true;var _didIteratorError24=false;var _iteratorError24=undefined;try{for(var _iterator24=input.options[Symbol.iterator](),_step24;!(_iteratorNormalCompletion24=(_step24=_iterator24.next()).done);_iteratorNormalCompletion24=true){var option=_step24.value;if(option.selected){formData.append(inputName,option.value)}}}catch(err){_didIteratorError24=true;_iteratorError24=err}finally{try{if(!_iteratorNormalCompletion24&&_iterator24["return"]!=null){_iterator24["return"]()}}finally{if(_didIteratorError24){throw _iteratorError24}}}}else if(!inputType||inputType!=="checkbox"&&inputType!=="radio"||input.checked){formData.append(inputName,input.value)}}}catch(err){_didIteratorError23=true;_iteratorError23=err}finally{try{if(!_iteratorNormalCompletion23&&_iterator23["return"]!=null){_iterator23["return"]()}}finally{if(_didIteratorError23){throw _iteratorError23}}}}}},{key:"_updateFilesUploadProgress",value:function _updateFilesUploadProgress(files,xhr,e){var progress;if(typeof e!=="undefined"){progress=100*e.loaded/e.total;if(files[0].upload.chunked){var file=files[0];var chunk=this._getChunk(file,xhr);chunk.progress=progress;chunk.total=e.total;chunk.bytesSent=e.loaded;var fileProgress=0,fileTotal,fileBytesSent;file.upload.progress=0;file.upload.total=0;file.upload.bytesSent=0;for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]!==undefined&&file.upload.chunks[i].progress!==undefined){file.upload.progress+=file.upload.chunks[i].progress;file.upload.total+=file.upload.chunks[i].total;file.upload.bytesSent+=file.upload.chunks[i].bytesSent}}file.upload.progress=file.upload.progress/file.upload.totalChunkCount}else{var _iteratorNormalCompletion25=true;var _didIteratorError25=false;var _iteratorError25=undefined;try{for(var _iterator25=files[Symbol.iterator](),_step25;!(_iteratorNormalCompletion25=(_step25=_iterator25.next()).done);_iteratorNormalCompletion25=true){var _file2=_step25.value;_file2.upload.progress=progress;_file2.upload.total=e.total;_file2.upload.bytesSent=e.loaded}}catch(err){_didIteratorError25=true;_iteratorError25=err}finally{try{if(!_iteratorNormalCompletion25&&_iterator25["return"]!=null){_iterator25["return"]()}}finally{if(_didIteratorError25){throw _iteratorError25}}}}var _iteratorNormalCompletion26=true;var _didIteratorError26=false;var _iteratorError26=undefined;try{for(var _iterator26=files[Symbol.iterator](),_step26;!(_iteratorNormalCompletion26=(_step26=_iterator26.next()).done);_iteratorNormalCompletion26=true){var _file3=_step26.value;this.emit("uploadprogress",_file3,_file3.upload.progress,_file3.upload.bytesSent)}}catch(err){_didIteratorError26=true;_iteratorError26=err}finally{try{if(!_iteratorNormalCompletion26&&_iterator26["return"]!=null){_iterator26["return"]()}}finally{if(_didIteratorError26){throw _iteratorError26}}}}else{var allFilesFinished=true;progress=100;var _iteratorNormalCompletion27=true;var _didIteratorError27=false;var _iteratorError27=undefined;try{for(var _iterator27=files[Symbol.iterator](),_step27;!(_iteratorNormalCompletion27=(_step27=_iterator27.next()).done);_iteratorNormalCompletion27=true){var _file4=_step27.value;if(_file4.upload.progress!==100||_file4.upload.bytesSent!==_file4.upload.total){allFilesFinished=false}_file4.upload.progress=progress;_file4.upload.bytesSent=_file4.upload.total}}catch(err){_didIteratorError27=true;_iteratorError27=err}finally{try{if(!_iteratorNormalCompletion27&&_iterator27["return"]!=null){_iterator27["return"]()}}finally{if(_didIteratorError27){throw _iteratorError27}}}if(allFilesFinished){return}var _iteratorNormalCompletion28=true;var _didIteratorError28=false;var _iteratorError28=undefined;try{for(var _iterator28=files[Symbol.iterator](),_step28;!(_iteratorNormalCompletion28=(_step28=_iterator28.next()).done);_iteratorNormalCompletion28=true){var _file5=_step28.value;this.emit("uploadprogress",_file5,progress,_file5.upload.bytesSent)}}catch(err){_didIteratorError28=true;_iteratorError28=err}finally{try{if(!_iteratorNormalCompletion28&&_iterator28["return"]!=null){_iterator28["return"]()}}finally{if(_didIteratorError28){throw _iteratorError28}}}}}},{key:"_finishedUploading",value:function _finishedUploading(files,xhr,e){var response;if(files[0].status===Dropzone.CANCELED){return}if(xhr.readyState!==4){return}if(xhr.responseType!=="arraybuffer"&&xhr.responseType!=="blob"){response=xhr.responseText;if(xhr.getResponseHeader("content-type")&&~xhr.getResponseHeader("content-type").indexOf("application/json")){try{response=JSON.parse(response)}catch(error){e=error;response="Invalid JSON response from server."}}}this._updateFilesUploadProgress(files);if(!(200<=xhr.status&&xhr.status<300)){this._handleUploadError(files,xhr,response)}else{if(files[0].upload.chunked){files[0].upload.finishedChunkUpload(this._getChunk(files[0],xhr),response)}else{this._finished(files,response,e)}}}},{key:"_handleUploadError",value:function _handleUploadError(files,xhr,response){if(files[0].status===Dropzone.CANCELED){return}if(files[0].upload.chunked&&this.options.retryChunks){var chunk=this._getChunk(files[0],xhr);if(chunk.retries++<this.options.retryChunksLimit){this._uploadData(files,[chunk.dataBlock]);return}else{console.warn("Retried this chunk too often. Giving up.")}}this._errorProcessing(files,response||this.options.dictResponseError.replace("{{statusCode}}",xhr.status),xhr)}},{key:"submitRequest",value:function submitRequest(xhr,formData,files){xhr.send(formData)}},{key:"_finished",value:function _finished(files,responseText,e){var _iteratorNormalCompletion29=true;var _didIteratorError29=false;var _iteratorError29=undefined;try{for(var _iterator29=files[Symbol.iterator](),_step29;!(_iteratorNormalCompletion29=(_step29=_iterator29.next()).done);_iteratorNormalCompletion29=true){var file=_step29.value;file.status=Dropzone.SUCCESS;this.emit("success",file,responseText,e);this.emit("complete",file)}}catch(err){_didIteratorError29=true;_iteratorError29=err}finally{try{if(!_iteratorNormalCompletion29&&_iterator29["return"]!=null){_iterator29["return"]()}}finally{if(_didIteratorError29){throw _iteratorError29}}}if(this.options.uploadMultiple){this.emit("successmultiple",files,responseText,e);this.emit("completemultiple",files)}if(this.options.autoProcessQueue){return this.processQueue()}}},{key:"_errorProcessing",value:function _errorProcessing(files,message,xhr){var _iteratorNormalCompletion30=true;var _didIteratorError30=false;var _iteratorError30=undefined;try{for(var _iterator30=files[Symbol.iterator](),_step30;!(_iteratorNormalCompletion30=(_step30=_iterator30.next()).done);_iteratorNormalCompletion30=true){var file=_step30.value;file.status=Dropzone.ERROR;this.emit("error",file,message,xhr);this.emit("complete",file)}}catch(err){_didIteratorError30=true;_iteratorError30=err}finally{try{if(!_iteratorNormalCompletion30&&_iterator30["return"]!=null){_iterator30["return"]()}}finally{if(_didIteratorError30){throw _iteratorError30}}}if(this.options.uploadMultiple){this.emit("errormultiple",files,message,xhr);this.emit("completemultiple",files)}if(this.options.autoProcessQueue){return this.processQueue()}}}],[{key:"uuidv4",value:function uuidv4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c==="x"?r:r&3|8;return v.toString(16)})}}]);return Dropzone}(Emitter);Dropzone.initClass();Dropzone.version="5.7.0";Dropzone.options={};Dropzone.optionsForElement=function(element){if(element.getAttribute("id")){return Dropzone.options[camelize(element.getAttribute("id"))]}else{return undefined}};Dropzone.instances=[];Dropzone.forElement=function(element){if(typeof element==="string"){element=document.querySelector(element)}if((element!=null?element.dropzone:undefined)==null){throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.")}return element.dropzone};Dropzone.autoDiscover=true;Dropzone.discover=function(){var dropzones;if(document.querySelectorAll){dropzones=document.querySelectorAll(".dropzone")}else{dropzones=[];var checkElements=function checkElements(elements){return function(){var result=[];var _iteratorNormalCompletion31=true;var _didIteratorError31=false;var _iteratorError31=undefined;try{for(var _iterator31=elements[Symbol.iterator](),_step31;!(_iteratorNormalCompletion31=(_step31=_iterator31.next()).done);_iteratorNormalCompletion31=true){var el=_step31.value;if(/(^| )dropzone($| )/.test(el.className)){result.push(dropzones.push(el))}else{result.push(undefined)}}}catch(err){_didIteratorError31=true;_iteratorError31=err}finally{try{if(!_iteratorNormalCompletion31&&_iterator31["return"]!=null){_iterator31["return"]()}}finally{if(_didIteratorError31){throw _iteratorError31}}}return result}()};checkElements(document.getElementsByTagName("div"));checkElements(document.getElementsByTagName("form"))}return function(){var result=[];var _iteratorNormalCompletion32=true;var _didIteratorError32=false;var _iteratorError32=undefined;try{for(var _iterator32=dropzones[Symbol.iterator](),_step32;!(_iteratorNormalCompletion32=(_step32=_iterator32.next()).done);_iteratorNormalCompletion32=true){var dropzone=_step32.value;if(Dropzone.optionsForElement(dropzone)!==false){result.push(new Dropzone(dropzone))}else{result.push(undefined)}}}catch(err){_didIteratorError32=true;_iteratorError32=err}finally{try{if(!_iteratorNormalCompletion32&&_iterator32["return"]!=null){_iterator32["return"]()}}finally{if(_didIteratorError32){throw _iteratorError32}}}return result}()};Dropzone.blacklistedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i];Dropzone.isBrowserSupported=function(){var capableBrowser=true;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector){if(!("classList"in document.createElement("a"))){capableBrowser=false}else{var _iteratorNormalCompletion33=true;var _didIteratorError33=false;var _iteratorError33=undefined;try{for(var _iterator33=Dropzone.blacklistedBrowsers[Symbol.iterator](),_step33;!(_iteratorNormalCompletion33=(_step33=_iterator33.next()).done);_iteratorNormalCompletion33=true){var regex=_step33.value;if(regex.test(navigator.userAgent)){capableBrowser=false;continue}}}catch(err){_didIteratorError33=true;_iteratorError33=err}finally{try{if(!_iteratorNormalCompletion33&&_iterator33["return"]!=null){_iterator33["return"]()}}finally{if(_didIteratorError33){throw _iteratorError33}}}}}else{capableBrowser=false}return capableBrowser};Dropzone.dataURItoBlob=function(dataURI){var byteString=atob(dataURI.split(",")[1]);var mimeString=dataURI.split(",")[0].split(":")[1].split(";")[0];var ab=new ArrayBuffer(byteString.length);var ia=new Uint8Array(ab);for(var i=0,end=byteString.length,asc=0<=end;asc?i<=end:i>=end;asc?i++:i--){ia[i]=byteString.charCodeAt(i)}return new Blob([ab],{type:mimeString})};var without=function without(list,rejectedItem){return list.filter(function(item){return item!==rejectedItem}).map(function(item){return item})};var camelize=function camelize(str){return str.replace(/[\-_](\w)/g,function(match){return match.charAt(1).toUpperCase()})};Dropzone.createElement=function(string){var div=document.createElement("div");div.innerHTML=string;return div.childNodes[0]};Dropzone.elementInside=function(element,container){if(element===container){return true}while(element=element.parentNode){if(element===container){return true}}return false};Dropzone.getElement=function(el,name){var element;if(typeof el==="string"){element=document.querySelector(el)}else if(el.nodeType!=null){element=el}if(element==null){throw new Error("Invalid `".concat(name,"` option provided. Please provide a CSS selector or a plain HTML element."))}return element};Dropzone.getElements=function(els,name){var el,elements;if(els instanceof Array){elements=[];try{var _iteratorNormalCompletion34=true;var _didIteratorError34=false;var _iteratorError34=undefined;try{for(var _iterator34=els[Symbol.iterator](),_step34;!(_iteratorNormalCompletion34=(_step34=_iterator34.next()).done);_iteratorNormalCompletion34=true){el=_step34.value;elements.push(this.getElement(el,name))}}catch(err){_didIteratorError34=true;_iteratorError34=err}finally{try{if(!_iteratorNormalCompletion34&&_iterator34["return"]!=null){_iterator34["return"]()}}finally{if(_didIteratorError34){throw _iteratorError34}}}}catch(e){elements=null}}else if(typeof els==="string"){elements=[];var _iteratorNormalCompletion35=true;var _didIteratorError35=false;var _iteratorError35=undefined;try{for(var _iterator35=document.querySelectorAll(els)[Symbol.iterator](),_step35;!(_iteratorNormalCompletion35=(_step35=_iterator35.next()).done);_iteratorNormalCompletion35=true){el=_step35.value;elements.push(el)}}catch(err){_didIteratorError35=true;_iteratorError35=err}finally{try{if(!_iteratorNormalCompletion35&&_iterator35["return"]!=null){_iterator35["return"]()}}finally{if(_didIteratorError35){throw _iteratorError35}}}}else if(els.nodeType!=null){elements=[els]}if(elements==null||!elements.length){throw new Error("Invalid `".concat(name,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."))}return elements};Dropzone.confirm=function(question,accepted,rejected){if(window.confirm(question)){return accepted()}else if(rejected!=null){return rejected()}};Dropzone.isValidFile=function(file,acceptedFiles){if(!acceptedFiles){return true}acceptedFiles=acceptedFiles.split(",");var mimeType=file.type;var baseMimeType=mimeType.replace(/\/.*$/,"");var _iteratorNormalCompletion36=true;var _didIteratorError36=false;var _iteratorError36=undefined;try{for(var _iterator36=acceptedFiles[Symbol.iterator](),_step36;!(_iteratorNormalCompletion36=(_step36=_iterator36.next()).done);_iteratorNormalCompletion36=true){var validType=_step36.value;validType=validType.trim();if(validType.charAt(0)==="."){if(file.name.toLowerCase().indexOf(validType.toLowerCase(),file.name.length-validType.length)!==-1){return true}}else if(/\/\*$/.test(validType)){if(baseMimeType===validType.replace(/\/.*$/,"")){return true}}else{if(mimeType===validType){return true}}}}catch(err){_didIteratorError36=true;_iteratorError36=err}finally{try{if(!_iteratorNormalCompletion36&&_iterator36["return"]!=null){_iterator36["return"]()}}finally{if(_didIteratorError36){throw _iteratorError36}}}return false};if(typeof jQuery!=="undefined"&&jQuery!==null){jQuery.fn.dropzone=function(options){return this.each(function(){return new Dropzone(this,options)})}}if(typeof module!=="undefined"&&module!==null){module.exports=Dropzone}else{window.Dropzone=Dropzone}Dropzone.ADDED="added";Dropzone.QUEUED="queued";Dropzone.ACCEPTED=Dropzone.QUEUED;Dropzone.UPLOADING="uploading";Dropzone.PROCESSING=Dropzone.UPLOADING;Dropzone.CANCELED="canceled";Dropzone.ERROR="error";Dropzone.SUCCESS="success";var detectVerticalSquash=function detectVerticalSquash(img){var iw=img.naturalWidth;var ih=img.naturalHeight;var canvas=document.createElement("canvas");canvas.width=1;canvas.height=ih;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);var _ctx$getImageData=ctx.getImageData(1,0,1,ih),data=_ctx$getImageData.data;var sy=0;var ey=ih;var py=ih;while(py>sy){var alpha=data[(py-1)*4+3];if(alpha===0){ey=py}else{sy=py}py=ey+sy>>1}var ratio=py/ih;if(ratio===0){return 1}else{return ratio}};var drawImageIOSFix=function drawImageIOSFix(ctx,img,sx,sy,sw,sh,dx,dy,dw,dh){var vertSquashRatio=detectVerticalSquash(img);return ctx.drawImage(img,sx,sy,sw,sh,dx,dy,dw,dh/vertSquashRatio)};var ExifRestore=function(){function ExifRestore(){_classCallCheck(this,ExifRestore)}_createClass(ExifRestore,null,[{key:"initClass",value:function initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function encode64(input){var output="";var chr1=undefined;var chr2=undefined;var chr3="";var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4="";var i=0;while(true){chr1=input[i++];chr2=input[i++];chr3=input[i++];enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+this.KEY_STR.charAt(enc1)+this.KEY_STR.charAt(enc2)+this.KEY_STR.charAt(enc3)+this.KEY_STR.charAt(enc4);chr1=chr2=chr3="";enc1=enc2=enc3=enc4="";if(!(i<input.length)){break}}return output}},{key:"restore",value:function restore(origFileBase64,resizedFileBase64){if(!origFileBase64.match("data:image/jpeg;base64,")){return resizedFileBase64}var rawImage=this.decode64(origFileBase64.replace("data:image/jpeg;base64,",""));var segments=this.slice2Segments(rawImage);var image=this.exifManipulation(resizedFileBase64,segments);return"data:image/jpeg;base64,".concat(this.encode64(image))}},{key:"exifManipulation",value:function exifManipulation(resizedFileBase64,segments){var exifArray=this.getExifArray(segments);var newImageArray=this.insertExif(resizedFileBase64,exifArray);var aBuffer=new Uint8Array(newImageArray);return aBuffer}},{key:"getExifArray",value:function getExifArray(segments){var seg=undefined;var x=0;while(x<segments.length){seg=segments[x];if(seg[0]===255&seg[1]===225){return seg}x++}return[]}},{key:"insertExif",value:function insertExif(resizedFileBase64,exifArray){var imageData=resizedFileBase64.replace("data:image/jpeg;base64,","");var buf=this.decode64(imageData);var separatePoint=buf.indexOf(255,3);var mae=buf.slice(0,separatePoint);var ato=buf.slice(separatePoint);var array=mae;array=array.concat(exifArray);array=array.concat(ato);return array}},{key:"slice2Segments",value:function slice2Segments(rawImageArray){var head=0;var segments=[];while(true){var length;if(rawImageArray[head]===255&rawImageArray[head+1]===218){break}if(rawImageArray[head]===255&rawImageArray[head+1]===216){head+=2}else{length=rawImageArray[head+2]*256+rawImageArray[head+3];var endPoint=head+length+2;var seg=rawImageArray.slice(head,endPoint);segments.push(seg);head=endPoint}if(head>rawImageArray.length){break}}return segments}},{key:"decode64",value:function decode64(input){var output="";var chr1=undefined;var chr2=undefined;var chr3="";var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4="";var i=0;var buf=[];var base64test=/[^A-Za-z0-9\+\/\=]/g;if(base64test.exec(input)){console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding.")}input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(true){enc1=this.KEY_STR.indexOf(input.charAt(i++));enc2=this.KEY_STR.indexOf(input.charAt(i++));enc3=this.KEY_STR.indexOf(input.charAt(i++));enc4=this.KEY_STR.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;buf.push(chr1);if(enc3!==64){buf.push(chr2)}if(enc4!==64){buf.push(chr3)}chr1=chr2=chr3="";enc1=enc2=enc3=enc4="";if(!(i<input.length)){break}}return buf}}]);return ExifRestore}();ExifRestore.initClass();var contentLoaded=function contentLoaded(win,fn){var done=false;var top=true;var doc=win.document;var root=doc.documentElement;var add=doc.addEventListener?"addEventListener":"attachEvent";var rem=doc.addEventListener?"removeEventListener":"detachEvent";var pre=doc.addEventListener?"":"on";var init=function init(e){if(e.type==="readystatechange"&&doc.readyState!=="complete"){return}(e.type==="load"?win:doc)[rem](pre+e.type,init,false);if(!done&&(done=true)){return fn.call(win,e.type||e)}};var poll=function poll(){try{root.doScroll("left")}catch(e){setTimeout(poll,50);return}return init("poll")};if(doc.readyState!=="complete"){if(doc.createEventObject&&root.doScroll){try{top=!win.frameElement}catch(error){}if(top){poll()}}doc[add](pre+"DOMContentLoaded",init,false);doc[add](pre+"readystatechange",init,false);return win[add](pre+"load",init,false)}};Dropzone._autoDiscoverFunction=function(){if(Dropzone.autoDiscover){return Dropzone.discover()}};contentLoaded(window,Dropzone._autoDiscoverFunction);function __guard__(value,transform){return typeof value!=="undefined"&&value!==null?transform(value):undefined}function __guardMethod__(obj,methodName,transform){if(typeof obj!=="undefined"&&obj!==null&&typeof obj[methodName]==="function"){return transform(obj,methodName)}else{return undefined}}return module.exports});
  6257. define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined, Dropzone, Template) {
  6258. var Upload = {
  6259. list: {},
  6260. options: {},
  6261. config: {
  6262. container: document.body,
  6263. classname: '.plupload:not([initialized]),.faupload:not([initialized])',
  6264. previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" onerror="this.src=\'' + Fast.api.fixurl("ajax/icon") + '?suffix=<%=suffix%>\';this.onerror=null;" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
  6265. },
  6266. events: {
  6267. //初始化
  6268. onInit: function () {
  6269. },
  6270. //上传成功的回调
  6271. onUploadSuccess: function (up, ret, file) {
  6272. var button = up.element;
  6273. var onUploadSuccess = up.options.onUploadSuccess;
  6274. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6275. //上传成功后回调
  6276. if (button) {
  6277. //如果有文本框则填充
  6278. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  6279. if (input_id) {
  6280. var urlArr = [];
  6281. var inputObj = $("#" + input_id);
  6282. if ($(button).data("multiple") && inputObj.val() !== "") {
  6283. urlArr.push(inputObj.val());
  6284. }
  6285. var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
  6286. urlArr.push(url);
  6287. inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
  6288. }
  6289. //如果有回调函数
  6290. var onDomUploadSuccess = $(button).data("upload-success");
  6291. if (onDomUploadSuccess) {
  6292. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  6293. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  6294. }
  6295. if (typeof onDomUploadSuccess === 'function') {
  6296. var result = onDomUploadSuccess.call(button, data, ret);
  6297. if (result === false)
  6298. return;
  6299. }
  6300. }
  6301. }
  6302. if (typeof onUploadSuccess === 'function') {
  6303. var result = onUploadSuccess.call(button, data, ret);
  6304. if (result === false)
  6305. return;
  6306. }
  6307. },
  6308. //上传错误的回调
  6309. onUploadError: function (up, ret, file) {
  6310. var button = up.element;
  6311. var onUploadError = up.options.onUploadError;
  6312. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6313. if (button) {
  6314. var onDomUploadError = $(button).data("upload-error");
  6315. if (onDomUploadError) {
  6316. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  6317. onDomUploadError = Upload.api.custom[onDomUploadError];
  6318. }
  6319. if (typeof onDomUploadError === 'function') {
  6320. var result = onDomUploadError.call(button, data, ret);
  6321. if (result === false)
  6322. return;
  6323. }
  6324. }
  6325. }
  6326. if (typeof onUploadError === 'function') {
  6327. var result = onUploadError.call(button, data, ret);
  6328. if (result === false) {
  6329. return;
  6330. }
  6331. }
  6332. Toastr.error(ret.msg.toString().replace(/(<([^>]+)>)/gi, "") + "(code:" + ret.code + ")");
  6333. },
  6334. //服务器响应数据后
  6335. onUploadResponse: function (response, up, file) {
  6336. try {
  6337. var ret = typeof response === 'object' ? response : JSON.parse(response);
  6338. if (!ret.hasOwnProperty('code')) {
  6339. $.extend(ret, {code: -2, msg: response, data: null});
  6340. }
  6341. } catch (e) {
  6342. var ret = {code: -1, msg: e.message, data: null};
  6343. }
  6344. return ret;
  6345. },
  6346. //上传全部结束后
  6347. onUploadComplete: function (up, files) {
  6348. var button = up.element;
  6349. var onUploadComplete = up.options.onUploadComplete;
  6350. if (button) {
  6351. var onDomUploadComplete = $(button).data("upload-complete");
  6352. if (onDomUploadComplete) {
  6353. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  6354. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  6355. }
  6356. if (typeof onDomUploadComplete === 'function') {
  6357. var result = onDomUploadComplete.call(button, files);
  6358. if (result === false)
  6359. return;
  6360. }
  6361. }
  6362. }
  6363. if (typeof onUploadComplete === 'function') {
  6364. var result = onUploadComplete.call(button, files);
  6365. if (result === false) {
  6366. return;
  6367. }
  6368. }
  6369. }
  6370. },
  6371. api: {
  6372. //上传接口
  6373. upload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6374. element = typeof element === 'undefined' ? Upload.config.classname : element;
  6375. $(element, Upload.config.container).each(function () {
  6376. if ($(this).attr("initialized")) {
  6377. return true;
  6378. }
  6379. $(this).attr("initialized", true);
  6380. var that = this;
  6381. var id = $(this).prop("id") || $(this).prop("name") || Dropzone.uuidv4();
  6382. var url = $(this).data("url");
  6383. var maxsize = $(this).data("maxsize");
  6384. var maxcount = $(this).data("maxcount");
  6385. var mimetype = $(this).data("mimetype");
  6386. var multipart = $(this).data("multipart");
  6387. var multiple = $(this).data("multiple");
  6388. //填充ID
  6389. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  6390. //预览ID
  6391. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  6392. //上传URL
  6393. url = url ? url : Config.upload.uploadurl;
  6394. url = Fast.api.fixurl(url);
  6395. var chunking = false, chunkSize = Config.upload.chunksize || 2097152, timeout = Config.upload.timeout || 600000;
  6396. //最大可上传文件大小
  6397. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  6398. //文件类型
  6399. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  6400. //请求的表单参数
  6401. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  6402. //是否支持批量上传
  6403. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  6404. //后缀特殊处理
  6405. mimetype = mimetype.split(",").map(function (k) {
  6406. return k.indexOf("/") > -1 ? k : (!k || k === "*" || k.charAt(0) === "." ? k : "." + k);
  6407. }).join(",");
  6408. mimetype = mimetype === '*' ? null : mimetype;
  6409. //最大文件限制转换成mb
  6410. var maxFilesize = (function (maxsize) {
  6411. var matches = maxsize.toString().match(/^([0-9\.]+)(\w+)$/);
  6412. var size = matches ? parseFloat(matches[1]) : parseFloat(maxsize),
  6413. unit = matches ? matches[2].toLowerCase() : 'b';
  6414. var unitDict = {'b': 0, 'k': 1, 'kb': 1, 'm': 2, 'mb': 2, 'gb': 3, 'g': 3, 'tb': 4, 't': 4};
  6415. var y = typeof unitDict[unit] !== 'undefined' ? unitDict[unit] : 0;
  6416. var bytes = size * Math.pow(1024, y);
  6417. return bytes / Math.pow(1024, 2);
  6418. }(maxsize));
  6419. var options = $(this).data() || {};
  6420. options = $.extend(true, {}, options, $(this).data("upload-options") || {});
  6421. delete options.success;
  6422. delete options.url;
  6423. multipart = $.isArray(multipart) ? {} : multipart;
  6424. var params = $(this).data("params") || {};
  6425. var category = typeof params.category !== 'undefined' ? params.category : ($(this).data("category") || '');
  6426. if (category) {
  6427. // multipart.category = category;
  6428. }
  6429. Upload.list[id] = new Dropzone(this, $.extend({
  6430. url: url,
  6431. params: function (files, xhr, chunk) {
  6432. var params = multipart;
  6433. if (chunk) {
  6434. return $.extend({}, params, {
  6435. filesize: chunk.file.size,
  6436. filename: chunk.file.name,
  6437. chunkid: chunk.file.upload.uuid,
  6438. chunkindex: chunk.index,
  6439. chunkcount: chunk.file.upload.totalChunkCount,
  6440. chunksize: this.options.chunkSize,
  6441. chunkfilesize: chunk.dataBlock.data.size,
  6442. width: chunk.file.width || 0,
  6443. height: chunk.file.height || 0,
  6444. type: chunk.file.type,
  6445. });
  6446. }
  6447. return params;
  6448. },
  6449. chunking: chunking,
  6450. chunkSize: chunkSize,
  6451. maxFilesize: maxFilesize,
  6452. acceptedFiles: mimetype,
  6453. maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)),
  6454. timeout: timeout,
  6455. parallelUploads: 1,
  6456. previewsContainer: false,
  6457. dictDefaultMessage: __("Drop files here to upload"),
  6458. dictFallbackMessage: __("Your browser does not support drag'n'drop file uploads"),
  6459. dictFallbackText: __("Please use the fallback form below to upload your files like in the olden days"),
  6460. dictFileTooBig: __("File is too big (%sMiB), Max filesize: %sMiB", "{{filesize}}", "{{maxFilesize}}"),
  6461. dictInvalidFileType: __("You can't upload files of this type"),
  6462. dictResponseError: __("Server responded with %s code.", "{{statusCode}}"),
  6463. dictCancelUpload: __("Cancel upload"),
  6464. dictUploadCanceled: __("Upload canceled"),
  6465. dictCancelUploadConfirmation: __("Are you sure you want to cancel this upload?"),
  6466. dictRemoveFile: __("Remove file"),
  6467. dictMaxFilesExceeded: __("You can only upload a maximum of %s files", "{{maxFiles}}"),
  6468. init: function () {
  6469. Upload.events.onInit.call(this);
  6470. //必须添加dz-message,否则点击icon无法唤起上传窗口
  6471. $(">i", this.element).addClass("dz-message");
  6472. this.options.elementHtml = $(this.element).html();
  6473. },
  6474. sending: function (file, xhr, formData) {
  6475. if (typeof file.category !== 'undefined') {
  6476. formData.append('category', file.category);
  6477. }
  6478. },
  6479. addedfile: function (file) {
  6480. var params = $(this.element).data("params") || {};
  6481. var category = typeof params.category !== 'undefined' ? params.category : ($(this.element).data("category") || '');
  6482. file.category = typeof category === 'function' ? category.call(this, file) : category;
  6483. },
  6484. addedfiles: function (files) {
  6485. if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) {
  6486. var inputObj = $("#" + this.options.inputId);
  6487. if (inputObj.size() > 0) {
  6488. var value = $.trim(inputObj.val());
  6489. var nums = value === '' ? 0 : value.split(/\,/).length;
  6490. var remain = this.options.maxFiles - nums;
  6491. if (remain === 0 || files.length > remain) {
  6492. files = Array.prototype.slice.call(files, remain);
  6493. for (var i = 0; i < files.length; i++) {
  6494. this.removeFile(files[i]);
  6495. }
  6496. Toastr.error(__("You can only upload a maximum of %s files", this.options.maxFiles));
  6497. }
  6498. }
  6499. }
  6500. },
  6501. success: function (file, response) {
  6502. var ret = Upload.events.onUploadResponse(response, this, file);
  6503. file.ret = ret;
  6504. if (ret.code === 1) {
  6505. Upload.events.onUploadSuccess(this, ret, file);
  6506. } else {
  6507. Upload.events.onUploadError(this, ret, file);
  6508. }
  6509. },
  6510. error: function (file, response, xhr) {
  6511. var responseObj = $("<div>" + (xhr && typeof xhr.responseText !== 'undefined' ? xhr.responseText : response) + "</div>");
  6512. responseObj.find("style, title, script").remove();
  6513. var msg = responseObj.text() || __('Network error');
  6514. var ret = {code: 0, data: null, msg: msg};
  6515. Upload.events.onUploadError(this, ret, file);
  6516. },
  6517. uploadprogress: function (file, progress, bytesSent) {
  6518. if (file.upload.chunked) {
  6519. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
  6520. }
  6521. },
  6522. totaluploadprogress: function (progress, bytesSent) {
  6523. if (this.getActiveFiles().length > 0 && !this.options.chunking) {
  6524. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor(progress) + "%");
  6525. }
  6526. },
  6527. queuecomplete: function () {
  6528. Upload.events.onUploadComplete(this, this.files);
  6529. this.removeAllFiles(true);
  6530. $(this.element).prop("disabled", false).html(this.options.elementHtml);
  6531. },
  6532. chunkSuccess: function (chunk, file, response) {
  6533. },
  6534. chunksUploaded: function (file, done) {
  6535. var that = this;
  6536. Fast.api.ajax({
  6537. url: this.options.url,
  6538. data: $.extend({}, multipart, {
  6539. action: 'merge',
  6540. filesize: file.size,
  6541. filename: file.name,
  6542. chunkid: file.upload.uuid,
  6543. chunkcount: file.upload.totalChunkCount,
  6544. })
  6545. }, function (data, ret) {
  6546. done(JSON.stringify(ret));
  6547. return false;
  6548. }, function (data, ret) {
  6549. file.accepted = false;
  6550. that._errorProcessing([file], ret.msg);
  6551. });
  6552. },
  6553. onUploadSuccess: onUploadSuccess,
  6554. onUploadError: onUploadError,
  6555. onUploadComplete: onUploadComplete,
  6556. }, Upload.options, options));
  6557. //拖动排序
  6558. if (preview_id && multiple) {
  6559. require(['dragsort'], function () {
  6560. $("#" + preview_id).dragsort({
  6561. dragSelector: "li a:not(.btn-trash)",
  6562. dragEnd: function () {
  6563. $("#" + preview_id).trigger("fa.preview.change");
  6564. },
  6565. placeHolderTemplate: '<li class="col-xs-3"></li>'
  6566. });
  6567. });
  6568. }
  6569. //刷新隐藏textarea的值
  6570. var refresh = function (name) {
  6571. var data = {};
  6572. var textarea = $("textarea[name='" + name + "']");
  6573. var container = textarea.prev("ul");
  6574. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  6575. var reg = /\[?(\w+)\]?\[(\w+)\]$/g;
  6576. var match = reg.exec(j.name);
  6577. if (!match)
  6578. return true;
  6579. if (!isNaN(match[2])) {
  6580. data[i] = j.value;
  6581. } else {
  6582. match[1] = "x" + parseInt(match[1]);
  6583. if (typeof data[match[1]] === 'undefined') {
  6584. data[match[1]] = {};
  6585. }
  6586. data[match[1]][match[2]] = j.value;
  6587. }
  6588. });
  6589. var result = [];
  6590. $.each(data, function (i, j) {
  6591. result.push(j);
  6592. });
  6593. textarea.val(JSON.stringify(result));
  6594. };
  6595. if (preview_id && input_id) {
  6596. $(document.body).on("keyup change", "#" + input_id, function (e) {
  6597. var inputStr = $("#" + input_id).val();
  6598. var inputArr = inputStr.split(/\,/);
  6599. $("#" + preview_id).empty();
  6600. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  6601. var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}";
  6602. var json = {};
  6603. try {
  6604. json = JSON.parse(extend);
  6605. } catch (e) {
  6606. }
  6607. $.each(inputArr, function (i, j) {
  6608. if (!j) {
  6609. return true;
  6610. }
  6611. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(j);
  6612. suffix = suffix ? suffix[1] : 'file';
  6613. j = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
  6614. var value = (json && typeof json[i] !== 'undefined' ? json[i] : null);
  6615. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: value, row: value, suffix: suffix};
  6616. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  6617. $("#" + preview_id).append(html);
  6618. });
  6619. refresh($("#" + preview_id).data("name"));
  6620. });
  6621. $("#" + input_id).trigger("change");
  6622. }
  6623. if (preview_id) {
  6624. //监听文本框改变事件
  6625. $("#" + preview_id).on('change keyup', "input,textarea,select", function () {
  6626. refresh($(this).closest("ul").data("name"));
  6627. });
  6628. // 监听事件
  6629. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  6630. var urlArr = [];
  6631. $("#" + preview_id + " [data-url]").each(function (i, j) {
  6632. urlArr.push($(this).data("url"));
  6633. });
  6634. if (input_id) {
  6635. $("#" + input_id).val(urlArr.join(","));
  6636. }
  6637. refresh($("#" + preview_id).data("name"));
  6638. });
  6639. // 移除按钮事件
  6640. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  6641. $(this).closest("li").remove();
  6642. $("#" + preview_id).trigger("fa.preview.change");
  6643. });
  6644. }
  6645. if (input_id) {
  6646. //粘贴上传、拖拽上传
  6647. $("body").on('paste drop', "#" + input_id, function (event) {
  6648. var originEvent = event.originalEvent;
  6649. var button = $(".plupload[data-input-id='" + $(this).attr("id") + "'],.faupload[data-input-id='" + $(this).attr("id") + "']");
  6650. if (event.type === 'paste' && originEvent.clipboardData && originEvent.clipboardData.items) {
  6651. var items = originEvent.clipboardData.items;
  6652. if ((items.length === 1 && items[0].type.indexOf("text") > -1) || (items.length === 2 && items[1].type.indexOf("text") > -1)) {
  6653. } else {
  6654. Upload.list[button.attr("id")].paste(originEvent);
  6655. return false;
  6656. }
  6657. }
  6658. if (event.type === 'drop' && originEvent.dataTransfer && originEvent.dataTransfer.files) {
  6659. Upload.list[button.attr("id")].drop(originEvent);
  6660. return false;
  6661. }
  6662. });
  6663. }
  6664. });
  6665. },
  6666. /**
  6667. * @deprecated Use upload instead.
  6668. */
  6669. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6670. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6671. },
  6672. /**
  6673. * @deprecated Use upload instead.
  6674. */
  6675. faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6676. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6677. },
  6678. // AJAX异步上传
  6679. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  6680. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  6681. var id = "dropzone-" + Dropzone.uuidv4();
  6682. $('<button type="button" id="' + id + '" class="btn btn-danger hidden faupload" />').appendTo("body");
  6683. $("#" + id).data("upload-complete", function (files) {
  6684. Layer.close(index);
  6685. Upload.list[id].removeAllFiles(true);
  6686. });
  6687. Upload.api.upload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  6688. setTimeout(function () {
  6689. Upload.list[id].addFile(file);
  6690. }, 1);
  6691. },
  6692. custom: {
  6693. //自定义上传完成回调
  6694. afteruploadcallback: function (response) {
  6695. console.log(this, response);
  6696. alert("Custom Callback,Response URL:" + response.url);
  6697. },
  6698. }
  6699. }
  6700. }
  6701. ;
  6702. return Upload;
  6703. });
  6704. /*! nice-validator 1.1.5
  6705. * (c) 2012-2020 Jony Zhang <niceue@live.com>, MIT Licensed
  6706. * https://github.com/niceue/nice-validator
  6707. */
  6708. ;(function(factory) {
  6709. typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
  6710. typeof define === 'function' && define.amd ? define('validator',['jquery'], factory) :
  6711. factory(jQuery);
  6712. }(function($, undefined) {
  6713. 'use strict';
  6714. var NS = 'validator',
  6715. CLS_NS = '.' + NS,
  6716. CLS_NS_RULE = '.rule',
  6717. CLS_NS_FIELD = '.field',
  6718. CLS_NS_FORM = '.form',
  6719. CLS_WRAPPER = 'nice-' + NS,
  6720. CLS_MSG_BOX = 'msg-box',
  6721. ARIA_INVALID = 'aria-invalid',
  6722. DATA_RULE = 'data-rule',
  6723. DATA_MSG = 'data-msg',
  6724. DATA_TIP = 'data-tip',
  6725. DATA_OK = 'data-ok',
  6726. DATA_TIMELY = 'data-timely',
  6727. DATA_TARGET = 'data-target',
  6728. DATA_DISPLAY = 'data-display',
  6729. DATA_MUST = 'data-must',
  6730. NOVALIDATE = 'novalidate',
  6731. INPUT_SELECTOR = ':verifiable',
  6732. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  6733. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  6734. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  6735. rDoubleBytes = /[^\x00-\xff]/g,
  6736. rPos = /top|right|bottom|left/,
  6737. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  6738. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  6739. noop = $.noop,
  6740. proxy = $.proxy,
  6741. trim = $.trim,
  6742. isFunction = $.isFunction,
  6743. isString = function(s) {
  6744. return typeof s === 'string';
  6745. },
  6746. isObject = function(o) {
  6747. return o && Object.prototype.toString.call(o) === '[object Object]';
  6748. },
  6749. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  6750. attr = function(el, key, value) {
  6751. if (!el || !el.tagName) return null;
  6752. if (value !== undefined) {
  6753. if (value === null) el.removeAttribute(key);
  6754. else el.setAttribute(key, '' + value);
  6755. } else {
  6756. return el.getAttribute(key);
  6757. }
  6758. },
  6759. novalidateonce,
  6760. preinitialized = {},
  6761. defaults = {
  6762. debug: 0,
  6763. theme: 'default',
  6764. ignore: '',
  6765. focusInvalid: true,
  6766. focusCleanup: false,
  6767. stopOnError: false,
  6768. beforeSubmit: null,
  6769. valid: null,
  6770. invalid: null,
  6771. validation: null,
  6772. formClass: 'n-default',
  6773. validClass: 'n-valid',
  6774. invalidClass: 'n-invalid',
  6775. bindClassTo: null
  6776. },
  6777. fieldDefaults = {
  6778. timely: 1,
  6779. display: null,
  6780. target: null,
  6781. ignoreBlank: false,
  6782. showOk: true,
  6783. // Translate ajax response to validation result
  6784. dataFilter: function (data) {
  6785. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  6786. return data;
  6787. }
  6788. },
  6789. msgMaker: function(opt) {
  6790. var html;
  6791. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  6792. if (opt.result) {
  6793. $.each(opt.result, function(i, obj){
  6794. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  6795. });
  6796. } else {
  6797. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  6798. }
  6799. html += '</span>';
  6800. return html;
  6801. },
  6802. msgWrapper: 'span',
  6803. msgArrow: '',
  6804. msgIcon: '<span class="n-icon"></span>',
  6805. msgClass: 'n-right',
  6806. msgStyle: '',
  6807. msgShow: null,
  6808. msgHide: null
  6809. },
  6810. themes = {};
  6811. /** jQuery Plugin
  6812. * @param {Object} options
  6813. debug {Boolean} 0 Whether to enable debug mode
  6814. timely {Number} 1 Whether to enable timely validation
  6815. theme {String} 'default' Theme name
  6816. stopOnError {Boolean} false Whether to stop validate when found an error input
  6817. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  6818. focusInvalid {Boolean} true Whether to focus the field that is invalid
  6819. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  6820. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  6821. beforeSubmit {Function} Do something before submit form
  6822. dataFilter {Function} Convert ajax results
  6823. valid {Function} Triggered when the form is valid
  6824. invalid {Function} Triggered when the form is invalid
  6825. validClass {String} 'n-valid' Add this class name to a valid field
  6826. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  6827. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  6828. display {Function} Callback function to get dynamic display
  6829. target {Function} Callback function to get dynamic target
  6830. msgShow {Function} Trigger this callback when show message
  6831. msgHide {Function} Trigger this callback when hide message
  6832. msgWrapper {String} 'span' Message wrapper tag name
  6833. msgMaker {Function} Callback function to make message HTML
  6834. msgArrow {String} Message arrow template
  6835. msgIcon {String} Message icon template
  6836. msgStyle {String} Custom message css style
  6837. msgClass {String} Additional added to the message class names
  6838. formClass {String} Additional added to the form class names
  6839. messages {Object} Custom messages for the current instance
  6840. rules {Object} Custom rules for the current instance
  6841. fields {Object} Field validation configuration
  6842. {String} key name|#id
  6843. {String|Object} value Rule string or an object which can pass more arguments
  6844. fields[key][rule] {String} Rule string
  6845. fields[key][display] {String|Function}
  6846. fields[key][tip] {String} Custom tip message
  6847. fields[key][ok] {String} Custom success message
  6848. fields[key][msg] {Object} Custom error message
  6849. fields[key][msgStyle] {String} Custom message style
  6850. fields[key][msgClass] {String} A className which added to message placeholder element
  6851. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  6852. fields[key][msgMaker] {Function} A function to custom message HTML
  6853. fields[key][dataFilter] {Function} A function to convert ajax results
  6854. fields[key][valid] {Function} A function triggered when field is valid
  6855. fields[key][invalid] {Function} A function triggered when field is invalid
  6856. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  6857. fields[key][timely] {Boolean} Whether to enable timely validation
  6858. fields[key][target] {jqSelector} Define placement of a message
  6859. */
  6860. $.fn.validator = function(options) {
  6861. var that = this,
  6862. args = arguments;
  6863. if (that.is(INPUT_SELECTOR)) return that;
  6864. if (!that.is('form')) that = this.find('form');
  6865. if (!that.length) that = this;
  6866. that.each(function() {
  6867. var instance = $(this).data(NS);
  6868. if (instance) {
  6869. if ( isString(options) ) {
  6870. if ( options.charAt(0) === '_' ) return;
  6871. instance[options].apply(instance, [].slice.call(args, 1));
  6872. }
  6873. else if (options) {
  6874. instance._reset(true);
  6875. instance._init(this, options);
  6876. }
  6877. } else {
  6878. new Validator(this, options);
  6879. }
  6880. });
  6881. return this;
  6882. };
  6883. // Validate a field, or an area
  6884. $.fn.isValid = function(callback, hideMsg) {
  6885. var me = _getInstance(this[0]),
  6886. hasCallback = isFunction(callback),
  6887. ret, opt;
  6888. if (!me) return true;
  6889. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  6890. me.checkOnly = !!hideMsg;
  6891. opt = me.options;
  6892. ret = me._multiValidate(
  6893. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  6894. function(isValid){
  6895. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  6896. // navigate to the error element
  6897. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  6898. }
  6899. if (hasCallback) {
  6900. if (callback.length) {
  6901. callback(isValid);
  6902. } else if (isValid) {
  6903. callback();
  6904. }
  6905. }
  6906. me.checkOnly = false;
  6907. }
  6908. );
  6909. // If you pass a callback, we maintain the jQuery object chain
  6910. return hasCallback ? this : ret;
  6911. };
  6912. $.extend($.expr.pseudos || $.expr[':'], {
  6913. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  6914. verifiable: function(elem) {
  6915. var name = elem.nodeName.toLowerCase();
  6916. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  6917. name === 'select' ||
  6918. name === 'textarea' ||
  6919. elem.contentEditable === 'true'
  6920. ) && !elem.disabled;
  6921. },
  6922. // any value, but not only whitespace
  6923. filled: function(elem) {
  6924. return !!trim($(elem).val());
  6925. }
  6926. });
  6927. /**
  6928. * Creates a new Validator
  6929. *
  6930. * @class
  6931. * @param {Element} element - form element
  6932. * @param {Object} options - options for validator
  6933. */
  6934. function Validator(element, options) {
  6935. var me = this;
  6936. if ( !(me instanceof Validator) ) {
  6937. return new Validator(element, options);
  6938. }
  6939. if (Validator.pending) {
  6940. $(window).on('validatorready', init);
  6941. } else {
  6942. init();
  6943. }
  6944. function init() {
  6945. me.$el = $(element);
  6946. if (me.$el.length) {
  6947. me._init(me.$el[0], options);
  6948. }
  6949. else if (isString(element)) {
  6950. preinitialized[element] = options;
  6951. }
  6952. }
  6953. }
  6954. Validator.prototype = {
  6955. _init: function(element, options) {
  6956. var me = this,
  6957. opt, themeOpt, dataOpt;
  6958. // Initialization options
  6959. if ( isFunction(options) ) {
  6960. options = {
  6961. valid: options
  6962. };
  6963. }
  6964. options = me._opt = options || {};
  6965. dataOpt = attr(element, 'data-'+ NS +'-option');
  6966. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function('return ' + dataOpt))() : {};
  6967. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  6968. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  6969. me.rules = new Rules(opt.rules, true);
  6970. me.messages = new Messages(opt.messages, true);
  6971. me.Field = _createFieldFactory(me);
  6972. me.elements = me.elements || {};
  6973. me.deferred = {};
  6974. me.errors = {};
  6975. me.fields = {};
  6976. // Initialization fields
  6977. me._initFields(opt.fields);
  6978. // Initialization events and make a cache
  6979. if ( !me.$el.data(NS) ) {
  6980. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  6981. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  6982. me.vetoed = veto.veto = !me.isValid;
  6983. me.ajaxFormOptions = opts;
  6984. })
  6985. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  6986. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  6987. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  6988. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  6989. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  6990. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  6991. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  6992. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  6993. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  6994. // cache the novalidate attribute value
  6995. me._NOVALIDATE = attr(element, NOVALIDATE);
  6996. // Initialization is complete, stop off default HTML5 form validation
  6997. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  6998. attr(element, NOVALIDATE, NOVALIDATE);
  6999. }
  7000. // Display all messages in target container
  7001. if ( isString(opt.target) ) {
  7002. me.$el.find(opt.target).addClass('msg-container');
  7003. }
  7004. },
  7005. // Guess whether the form use ajax submit
  7006. _guessAjax: function(form) {
  7007. var me = this;
  7008. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7009. // if there is a "valid.form" event
  7010. var events = ($._data || $.data)(form, 'events');
  7011. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7012. }
  7013. function issetEvent(events, name, namespace) {
  7014. return !!(
  7015. events && events[name]
  7016. && $.map(events[name], function(e){
  7017. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7018. }).length )
  7019. }
  7020. },
  7021. _initFields: function(fields) {
  7022. var me = this, k, arr, i,
  7023. clear = fields === null;
  7024. // Processing field information
  7025. if (clear) fields = me.fields;
  7026. if ( isObject(fields) ) {
  7027. for (k in fields) {
  7028. if (~k.indexOf(',')) {
  7029. arr = k.split(',');
  7030. i = arr.length;
  7031. while (i--) {
  7032. initField(trim(arr[i]), fields[k]);
  7033. }
  7034. } else {
  7035. initField(k, fields[k]);
  7036. }
  7037. }
  7038. }
  7039. // Parsing DOM rules
  7040. me.$el.find(INPUT_SELECTOR).each(function() {
  7041. me._parse(this);
  7042. });
  7043. function initField(k, v) {
  7044. // delete a field from settings
  7045. if ( v === null || clear ) {
  7046. var el = me.elements[k];
  7047. if (el) me._resetElement(el, true);
  7048. delete me.fields[k];
  7049. } else {
  7050. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7051. }
  7052. }
  7053. },
  7054. // Parsing a field
  7055. _parse: function(el) {
  7056. var me = this,
  7057. field,
  7058. key = el.name,
  7059. display,
  7060. timely,
  7061. dataRule = attr(el, DATA_RULE);
  7062. dataRule && attr(el, DATA_RULE, null);
  7063. // If the field has passed the key as id mode, or it doesn't has a name
  7064. if ( el.id && (
  7065. ('#' + el.id in me.fields) ||
  7066. !key ||
  7067. // If dataRule and element are diffrent from old's, we use ID mode.
  7068. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7069. )
  7070. ) {
  7071. key = '#' + el.id;
  7072. }
  7073. // Generate id
  7074. if (!key) {
  7075. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  7076. }
  7077. field = me.getField(key, true);
  7078. // The priority of passing parameter by DOM is higher than by JS.
  7079. field.rule = dataRule || field.rule;
  7080. if (display = attr(el, DATA_DISPLAY)) {
  7081. field.display = display;
  7082. }
  7083. if (field.rule) {
  7084. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7085. field.must = true;
  7086. }
  7087. if ( /\brequired\b/.test(field.rule) ) {
  7088. field.required = true;
  7089. }
  7090. if (timely = attr(el, DATA_TIMELY)) {
  7091. field.timely = +timely;
  7092. } else if (field.timely > 3) {
  7093. attr(el, DATA_TIMELY, field.timely);
  7094. }
  7095. me._parseRule(field);
  7096. field.old = {};
  7097. }
  7098. if ( isString(field.target) ) {
  7099. attr(el, DATA_TARGET, field.target);
  7100. }
  7101. if ( isString(field.tip) ) {
  7102. attr(el, DATA_TIP, field.tip);
  7103. }
  7104. return me.fields[key] = field;
  7105. },
  7106. // Parsing field rules
  7107. _parseRule: function(field) {
  7108. var arr = rDisplay.exec(field.rule);
  7109. if (!arr) return;
  7110. // current rule index
  7111. field._i = 0;
  7112. if (arr[1]) {
  7113. field.display = arr[1];
  7114. }
  7115. if (arr[2]) {
  7116. field._rules = [];
  7117. arr[2].replace(rRules, function(){
  7118. var args = arguments;
  7119. args[4] = args[4] || args[5];
  7120. field._rules.push({
  7121. and: args[1] === '&',
  7122. not: args[2] === '!',
  7123. or: args[6] === '|',
  7124. method: args[3],
  7125. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7126. });
  7127. });
  7128. }
  7129. },
  7130. // Verify a zone
  7131. _multiValidate: function($inputs, doneCallback){
  7132. var me = this,
  7133. opt = me.options;
  7134. me.hasError = false;
  7135. if (opt.ignore) {
  7136. $inputs = $inputs.not(opt.ignore);
  7137. }
  7138. $inputs.each(function() {
  7139. me._validate(this);
  7140. if (me.hasError && opt.stopOnError) {
  7141. // stop the validation
  7142. return false;
  7143. }
  7144. });
  7145. // Need to wait for all fields validation complete, especially asynchronous validation
  7146. if (doneCallback) {
  7147. me.validating = true;
  7148. $.when.apply(
  7149. null,
  7150. $.map(me.deferred, function(v){return v;})
  7151. ).done(function(){
  7152. doneCallback.call(me, !me.hasError);
  7153. me.validating = false;
  7154. });
  7155. }
  7156. // If the form does not contain asynchronous validation, the return value is correct.
  7157. // Otherwise, you should detect form validation result through "doneCallback".
  7158. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7159. },
  7160. // Validate the whole form
  7161. _submit: function(e) {
  7162. var me = this,
  7163. opt = me.options,
  7164. form = e.target,
  7165. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  7166. e.preventDefault();
  7167. if (
  7168. novalidateonce && ~(novalidateonce = false) ||
  7169. // Prevent duplicate submission
  7170. me.submiting ||
  7171. // Receive the "validate" event only from the form.
  7172. e.type === 'validate' && me.$el[0] !== form ||
  7173. // trigger the beforeSubmit callback.
  7174. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7175. ) {
  7176. return;
  7177. }
  7178. if (me.isAjaxSubmit === undefined) {
  7179. me._guessAjax(form);
  7180. }
  7181. me._debug('log', '\n<<< event: ' + e.type);
  7182. me._reset();
  7183. me.submiting = true;
  7184. me._multiValidate(
  7185. me.$el.find(INPUT_SELECTOR),
  7186. function(isValid){
  7187. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7188. errors;
  7189. if (!isValid) {
  7190. if (opt.focusInvalid) {
  7191. // navigate to the error element
  7192. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7193. }
  7194. errors = $.map(me.errors, function(err){return err;});
  7195. }
  7196. // releasing submit
  7197. me.submiting = false;
  7198. me.isValid = isValid;
  7199. // trigger callback and event
  7200. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7201. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7202. me._debug('log', '>>> ' + ret);
  7203. if (!isValid) return;
  7204. // For jquery.form plugin
  7205. if (me.vetoed) {
  7206. $(form).ajaxSubmit(me.ajaxFormOptions);
  7207. }
  7208. else if (canSubmit && !me.isAjaxSubmit) {
  7209. document.createElement('form').submit.call(form);
  7210. }
  7211. }
  7212. );
  7213. },
  7214. _reset: function(e) {
  7215. var me = this;
  7216. me.errors = {};
  7217. if (e) {
  7218. me.reseting = true;
  7219. me.$el.find(INPUT_SELECTOR).each( function(){
  7220. me._resetElement(this);
  7221. });
  7222. delete me.reseting;
  7223. }
  7224. },
  7225. _resetElement: function(el, all) {
  7226. this._setClass(el, null);
  7227. this.hideMsg(el);
  7228. },
  7229. // Handle events: "focusin/click"
  7230. _focusin: function(e) {
  7231. var me = this,
  7232. opt = me.options,
  7233. el = e.target,
  7234. timely,
  7235. msg;
  7236. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7237. return;
  7238. }
  7239. if (opt.focusCleanup) {
  7240. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7241. me._setClass(el, null);
  7242. me.hideMsg(el);
  7243. }
  7244. }
  7245. msg = attr(el, DATA_TIP);
  7246. if (msg) {
  7247. me.showMsg(el, {
  7248. type: 'tip',
  7249. msg: msg
  7250. });
  7251. } else {
  7252. if (attr(el, DATA_RULE)) {
  7253. me._parse(el);
  7254. }
  7255. if (timely = attr(el, DATA_TIMELY)) {
  7256. if ( timely === 8 || timely === 9 ) {
  7257. me._focusout(e);
  7258. }
  7259. }
  7260. }
  7261. },
  7262. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7263. _focusout: function(e) {
  7264. var me = this,
  7265. opt = me.options,
  7266. el = e.target,
  7267. etype = e.type,
  7268. etype0,
  7269. focusin = etype === 'focusin',
  7270. special = etype === 'validate',
  7271. elem,
  7272. field,
  7273. old,
  7274. value,
  7275. timestamp,
  7276. key, specialKey,
  7277. timely,
  7278. timer = 0;
  7279. if (etype === 'compositionstart') {
  7280. me.pauseValidate = true;
  7281. }
  7282. if (etype === 'compositionend') {
  7283. me.pauseValidate = false;
  7284. }
  7285. if (me.pauseValidate) {
  7286. return;
  7287. }
  7288. // For checkbox and radio
  7289. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  7290. // Get field
  7291. if (!(field = me.getField(elem)) || !field.rule) {
  7292. return;
  7293. }
  7294. // Cache event type
  7295. etype0 = field._e;
  7296. field._e = etype;
  7297. timely = field.timely;
  7298. if (!special) {
  7299. if (!timely || (_checkable(el) && etype !== 'click')) {
  7300. return;
  7301. }
  7302. value = field.getValue();
  7303. // not validate field unless fill a value
  7304. if ( field.ignoreBlank && !value && !focusin ) {
  7305. me.hideMsg(el);
  7306. return;
  7307. }
  7308. if ( etype === 'focusout' ) {
  7309. if (etype0 === 'change') {
  7310. return;
  7311. }
  7312. if ( timely === 2 || timely === 8 ) {
  7313. old = field.old;
  7314. if (value && old) {
  7315. if (field.isValid && !old.showOk) {
  7316. me.hideMsg(el);
  7317. } else {
  7318. me._makeMsg(el, field, old);
  7319. }
  7320. } else {
  7321. return;
  7322. }
  7323. }
  7324. }
  7325. else {
  7326. if ( timely < 2 && !e.data ) {
  7327. return;
  7328. }
  7329. // mark timestamp to reduce the frequency of the received event
  7330. timestamp = +new Date();
  7331. if ( timestamp - (el._ts || 0) < 100 ) {
  7332. return;
  7333. }
  7334. el._ts = timestamp;
  7335. // handle keyup
  7336. if ( etype === 'keyup' ) {
  7337. if (etype0 === 'input') {
  7338. return;
  7339. }
  7340. key = e.keyCode;
  7341. specialKey = {
  7342. 8: 1, // Backspace
  7343. 9: 1, // Tab
  7344. 16: 1, // Shift
  7345. 32: 1, // Space
  7346. 46: 1 // Delete
  7347. };
  7348. // only gets focus, no validation
  7349. if ( key === 9 && !value ) {
  7350. return;
  7351. }
  7352. // do not validate, if triggered by these keys
  7353. if ( key < 48 && !specialKey[key] ) {
  7354. return;
  7355. }
  7356. }
  7357. if ( !focusin ) {
  7358. // keyboard events, reducing the frequency of validation
  7359. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  7360. }
  7361. }
  7362. }
  7363. // if the current field is ignored
  7364. if ( opt.ignore && $(el).is(opt.ignore) ) {
  7365. return;
  7366. }
  7367. clearTimeout(field._t);
  7368. if (timer) {
  7369. field._t = setTimeout(function() {
  7370. me._validate(el, field);
  7371. }, timer);
  7372. } else {
  7373. if (special) field.old = {};
  7374. me._validate(el, field);
  7375. }
  7376. },
  7377. _setClass: function(el, isValid) {
  7378. var $el = $(el), opt = this.options;
  7379. if (opt.bindClassTo) {
  7380. $el = $el.closest(opt.bindClassTo);
  7381. }
  7382. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  7383. if (isValid !== null) {
  7384. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  7385. }
  7386. },
  7387. _showmsg: function(e, type, msg) {
  7388. var me = this,
  7389. el = e.target;
  7390. if ( me.$el.is(el) ) {
  7391. if (isObject(type)) {
  7392. me.showMsg(type)
  7393. }
  7394. else if ( type === 'tip' ) {
  7395. me.$el.find(INPUT_SELECTOR +'['+ DATA_TIP +']', el).each(function(){
  7396. me.showMsg(this, {type: type, msg: msg});
  7397. });
  7398. }
  7399. }
  7400. else {
  7401. me.showMsg(el, {type: type, msg: msg});
  7402. }
  7403. },
  7404. _hidemsg: function(e) {
  7405. var $el = $(e.target);
  7406. if ( $el.is(INPUT_SELECTOR) ) {
  7407. this.hideMsg($el);
  7408. }
  7409. },
  7410. // Validated a field
  7411. _validatedField: function(el, field, ret) {
  7412. var me = this,
  7413. opt = me.options,
  7414. isValid = field.isValid = ret.isValid = !!ret.isValid,
  7415. callback = isValid ? 'valid' : 'invalid';
  7416. ret.key = field.key;
  7417. ret.ruleName = field._r;
  7418. ret.id = el.id;
  7419. ret.value = field.value;
  7420. me.elements[field.key] = ret.element = el;
  7421. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  7422. if (isValid) {
  7423. ret.type = 'ok';
  7424. } else {
  7425. if (me.submiting) {
  7426. me.errors[field.key] = ret.msg;
  7427. }
  7428. me.hasError = true;
  7429. }
  7430. // cache result
  7431. field.old = ret;
  7432. // trigger callback
  7433. isFunction(field[callback]) && field[callback].call(me, el, ret);
  7434. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  7435. // trigger event
  7436. $(el).attr( ARIA_INVALID, isValid ? null : true )
  7437. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  7438. me.$el.triggerHandler('validation', [ret, me]);
  7439. if (me.checkOnly) return;
  7440. // set className
  7441. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  7442. me._makeMsg.apply(me, arguments);
  7443. },
  7444. _makeMsg: function(el, field, ret) {
  7445. // show or hide the message
  7446. if (field.msgMaker) {
  7447. ret = $.extend({}, ret);
  7448. if (field._e === 'focusin') {
  7449. ret.type = 'tip';
  7450. }
  7451. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  7452. }
  7453. },
  7454. // Validated a rule
  7455. _validatedRule: function(el, field, ret, msgOpt) {
  7456. field = field || me.getField(el);
  7457. msgOpt = msgOpt || {};
  7458. var me = this,
  7459. msg,
  7460. rule,
  7461. method = field._r,
  7462. timely = field.timely,
  7463. special = timely === 9 || timely === 8,
  7464. transfer,
  7465. temp,
  7466. isValid = false;
  7467. // use null to break validation from a field
  7468. if (ret === null) {
  7469. me._validatedField(el, field, {isValid: true, skip: true});
  7470. field._i = 0;
  7471. return;
  7472. }
  7473. else if (ret === undefined) {
  7474. transfer = true;
  7475. }
  7476. else if (ret === true || ret === '') {
  7477. isValid = true;
  7478. }
  7479. else if (isString(ret)) {
  7480. msg = ret;
  7481. }
  7482. else if (isObject(ret)) {
  7483. if (ret.error) {
  7484. msg = ret.error;
  7485. } else {
  7486. msg = ret.ok;
  7487. isValid = true;
  7488. }
  7489. }
  7490. else {
  7491. isValid = !!ret
  7492. }
  7493. rule = field._rules[field._i];
  7494. if (rule.not) {
  7495. msg = undefined;
  7496. isValid = method === 'required' || !isValid;
  7497. }
  7498. if (rule.or) {
  7499. if (isValid) {
  7500. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  7501. field._i++;
  7502. }
  7503. } else {
  7504. transfer = true;
  7505. }
  7506. }
  7507. else if (rule.and) {
  7508. if (!field.isValid) transfer = true;
  7509. }
  7510. if (transfer) {
  7511. isValid = true;
  7512. }
  7513. // message analysis, and throw rule level event
  7514. else {
  7515. if (isValid) {
  7516. if (field.showOk !== false) {
  7517. temp = attr(el, DATA_OK);
  7518. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  7519. if (!isString(msg) && isString(field.showOk)) {
  7520. msg = field.showOk;
  7521. }
  7522. if (isString(msg)) {
  7523. msgOpt.showOk = isValid;
  7524. }
  7525. }
  7526. }
  7527. if (!isValid || special) {
  7528. /* rule message priority:
  7529. 1. custom DOM message
  7530. 2. custom field message;
  7531. 3. global defined message;
  7532. 4. rule returned message;
  7533. 5. default message;
  7534. */
  7535. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  7536. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  7537. });
  7538. }
  7539. if (!isValid) field.isValid = isValid;
  7540. msgOpt.msg = msg;
  7541. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  7542. }
  7543. if (special && (!transfer || rule.and)) {
  7544. if (!isValid && !field._m) field._m = msg;
  7545. field._v = field._v || [];
  7546. field._v.push({
  7547. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  7548. msg: msg || rule.msg
  7549. });
  7550. }
  7551. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  7552. // the current rule has passed, continue to validate
  7553. if ( (isValid || special) && field._i < field._rules.length - 1) {
  7554. field._i++;
  7555. me._checkRule(el, field);
  7556. }
  7557. // field was invalid, or all fields was valid
  7558. else {
  7559. field._i = 0;
  7560. if (special) {
  7561. msgOpt.isValid = field.isValid;
  7562. msgOpt.result = field._v;
  7563. msgOpt.msg = field._m || '';
  7564. if (!field.value && (field._e === 'focusin')) {
  7565. msgOpt.type = 'tip';
  7566. }
  7567. } else {
  7568. msgOpt.isValid = isValid;
  7569. }
  7570. me._validatedField(el, field, msgOpt);
  7571. delete field._m;
  7572. delete field._v;
  7573. }
  7574. },
  7575. // Verify a rule form a field
  7576. _checkRule: function(el, field) {
  7577. var me = this,
  7578. ret,
  7579. fn,
  7580. old,
  7581. key = field.key,
  7582. rule = field._rules[field._i],
  7583. method = rule.method,
  7584. params = rule.params;
  7585. // request has been sent, wait it
  7586. if (me.submiting && me.deferred[key]) {
  7587. return;
  7588. }
  7589. old = field.old;
  7590. field._r = method;
  7591. if (old && !field.must && !rule.must && rule.result !== undefined &&
  7592. old.ruleName === method && old.id === el.id &&
  7593. field.value && old.value === field.value )
  7594. {
  7595. // get result from cache
  7596. ret = rule.result;
  7597. }
  7598. else {
  7599. // get result from current rule
  7600. fn = _getDataRule(el, method) || me.rules[method] || noop;
  7601. ret = fn.call(field, el, params, field);
  7602. if (fn.msg) rule.msg = fn.msg;
  7603. }
  7604. // asynchronous validation
  7605. if (isObject(ret) && isFunction(ret.then)) {
  7606. me.deferred[key] = ret;
  7607. // whether the field valid is unknown
  7608. field.isValid = undefined;
  7609. // show loading message
  7610. !me.checkOnly && me.showMsg(el, {
  7611. type: 'loading',
  7612. msg: me.messages.loading
  7613. }, field);
  7614. // waiting to parse the response data
  7615. ret.then(
  7616. function(d, textStatus, jqXHR) {
  7617. var data = trim(jqXHR.responseText),
  7618. result,
  7619. dataFilter = field.dataFilter;
  7620. // detect if data is json or jsonp format
  7621. if (/jsonp?/.test(this.dataType)) {
  7622. data = d;
  7623. } else if (data.charAt(0) === '{') {
  7624. data = $.parseJSON(data);
  7625. }
  7626. // filter data
  7627. result = dataFilter.call(this, data, field);
  7628. if (result === undefined) result = dataFilter.call(this, data.data, field);
  7629. rule.data = this.data;
  7630. rule.result = field.old ? result : undefined;
  7631. me._validatedRule(el, field, result);
  7632. },
  7633. function(jqXHR, textStatus){
  7634. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  7635. }
  7636. ).always(function(){
  7637. delete me.deferred[key];
  7638. });
  7639. }
  7640. // other result
  7641. else {
  7642. me._validatedRule(el, field, ret);
  7643. }
  7644. },
  7645. // Processing the validation
  7646. _validate: function(el, field) {
  7647. var me = this;
  7648. // doesn't validate the element that has "disabled" or "novalidate" attribute
  7649. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  7650. return;
  7651. }
  7652. field = field || me.getField(el);
  7653. if (!field) return;
  7654. if (!field._rules) me._parse(el);
  7655. if (!field._rules) return;
  7656. me._debug('info', field.key);
  7657. field.isValid = true;
  7658. field.element = el;
  7659. // Cache the value
  7660. field.value = field.getValue();
  7661. // if the field is not required, and that has a blank value
  7662. if (!field.required && !field.must && !field.value) {
  7663. if (!_checkable(el)) {
  7664. me._validatedField(el, field, {isValid: true});
  7665. return true;
  7666. }
  7667. }
  7668. me._checkRule(el, field);
  7669. return field.isValid;
  7670. },
  7671. _debug: function(type, messages) {
  7672. if (window.console && this.options.debug) {
  7673. console[type](messages);
  7674. }
  7675. },
  7676. /**
  7677. * Detecting whether the value of an element that matches a rule
  7678. *
  7679. * @method test
  7680. * @param {Element} el - input element
  7681. * @param {String} rule - rule name
  7682. */
  7683. test: function(el, rule) {
  7684. var me = this,
  7685. ret,
  7686. parts = rRule.exec(rule),
  7687. field,
  7688. method,
  7689. params;
  7690. if (parts) {
  7691. method = parts[1];
  7692. if (method in me.rules) {
  7693. params = parts[2] || parts[3];
  7694. params = params ? params.split(', ') : undefined;
  7695. field = me.getField(el, true);
  7696. field._r = method;
  7697. field.value = field.getValue();
  7698. ret = me.rules[method].call(field, el, params);
  7699. }
  7700. }
  7701. return ret === true || ret === undefined || ret === null;
  7702. },
  7703. _getDisplay: function(el, str) {
  7704. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  7705. },
  7706. _getMsgOpt: function(obj, field) {
  7707. var opt = field ? field : this.options;
  7708. return $.extend({
  7709. type: 'error',
  7710. pos: _getPos(opt.msgClass),
  7711. target: opt.target,
  7712. wrapper: opt.msgWrapper,
  7713. style: opt.msgStyle,
  7714. cls: opt.msgClass,
  7715. arrow: opt.msgArrow,
  7716. icon: opt.msgIcon
  7717. }, isString(obj) ? {msg: obj} : obj);
  7718. },
  7719. _getMsgDOM: function(el, msgOpt) {
  7720. var $el = $(el), $msgbox, datafor, tgt, container;
  7721. if ( $el.is(INPUT_SELECTOR) ) {
  7722. tgt = msgOpt.target || attr(el, DATA_TARGET);
  7723. if (tgt) {
  7724. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  7725. if (tgt.length) {
  7726. if ( tgt.is(INPUT_SELECTOR) ) {
  7727. $el = tgt
  7728. el = tgt.get(0);
  7729. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  7730. $msgbox = tgt;
  7731. } else {
  7732. container = tgt;
  7733. }
  7734. }
  7735. }
  7736. if (!$msgbox) {
  7737. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  7738. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  7739. }
  7740. } else {
  7741. $msgbox = $el;
  7742. }
  7743. // Create new message box
  7744. if (!msgOpt.hide && !$msgbox.length) {
  7745. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  7746. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  7747. 'style': msgOpt.style || undefined,
  7748. 'for': datafor
  7749. });
  7750. if (container) {
  7751. $msgbox.appendTo(container);
  7752. } else {
  7753. if ( _checkable(el) ) {
  7754. var $parent = $el.parent();
  7755. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  7756. } else {
  7757. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  7758. }
  7759. }
  7760. }
  7761. return $msgbox;
  7762. },
  7763. /**
  7764. * Show validation message
  7765. *
  7766. * @method showMsg
  7767. * @param {Element} el - input element
  7768. * @param {Object} msgOpt
  7769. */
  7770. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7771. if (!el) return;
  7772. var me = this,
  7773. opt = me.options,
  7774. msgShow,
  7775. msgMaker,
  7776. temp,
  7777. $msgbox;
  7778. if (isObject(el) && !el.jquery && !msgOpt) {
  7779. $.each(el, function(key, msg) {
  7780. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  7781. me.showMsg(el, msg);
  7782. });
  7783. return;
  7784. }
  7785. if ($(el).is(INPUT_SELECTOR)) {
  7786. field = field || me.getField(el);
  7787. }
  7788. if (!(msgMaker = (field || opt).msgMaker)) {
  7789. return;
  7790. }
  7791. msgOpt = me._getMsgOpt(msgOpt, field);
  7792. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  7793. // ok or tip
  7794. if (!msgOpt.msg && msgOpt.type !== 'error') {
  7795. temp = attr(el, 'data-' + msgOpt.type);
  7796. if (temp !== null) msgOpt.msg = temp;
  7797. }
  7798. if ( !isString(msgOpt.msg) ) {
  7799. return;
  7800. }
  7801. $msgbox = me._getMsgDOM(el, msgOpt);
  7802. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  7803. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  7804. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  7805. }
  7806. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  7807. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  7808. msgShow.call(me, $msgbox, msgOpt.type);
  7809. }
  7810. },
  7811. /**
  7812. * Hide validation message
  7813. *
  7814. * @method hideMsg
  7815. * @param {Element} el - input element
  7816. * @param {Object} msgOpt optional
  7817. */
  7818. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7819. var me = this,
  7820. opt = me.options,
  7821. msgHide,
  7822. $msgbox;
  7823. el = $(el).get(0);
  7824. if ($(el).is(INPUT_SELECTOR)) {
  7825. field = field || me.getField(el);
  7826. if (field) {
  7827. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  7828. }
  7829. }
  7830. msgOpt = me._getMsgOpt(msgOpt, field);
  7831. msgOpt.hide = true;
  7832. $msgbox = me._getMsgDOM(el, msgOpt);
  7833. if (!$msgbox.length) return;
  7834. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  7835. msgHide.call(me, $msgbox, msgOpt.type);
  7836. } else {
  7837. $msgbox[0].style.display = 'none';
  7838. $msgbox[0].innerHTML = '';
  7839. }
  7840. },
  7841. /**
  7842. * Get field information
  7843. *
  7844. * @method getField
  7845. * @param {Element} - input element
  7846. * @return {Object} field
  7847. */
  7848. getField: function(el, must) {
  7849. var me = this,
  7850. key,
  7851. field;
  7852. if (isString(el)) {
  7853. key = el;
  7854. el = undefined;
  7855. } else {
  7856. if (attr(el, DATA_RULE)) {
  7857. return me._parse(el);
  7858. }
  7859. if (el.id && '#' + el.id in me.fields || !el.name) {
  7860. key = '#' + el.id;
  7861. } else {
  7862. key = el.name;
  7863. }
  7864. }
  7865. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  7866. field.element = el;
  7867. }
  7868. return field;
  7869. },
  7870. /**
  7871. * Config a field
  7872. *
  7873. * @method: setField
  7874. * @param {String} key
  7875. * @param {Object} obj
  7876. */
  7877. setField: function(key, obj) {
  7878. var fields = {};
  7879. if (!key) return;
  7880. // update this field
  7881. if (isString(key)) {
  7882. fields[key] = obj;
  7883. }
  7884. // update fields
  7885. else {
  7886. fields = key;
  7887. }
  7888. this._initFields(fields);
  7889. },
  7890. /**
  7891. * Detecting whether the form is valid
  7892. *
  7893. * @method isFormValid
  7894. * @return {Boolean}
  7895. */
  7896. isFormValid: function() {
  7897. var fields = this.fields, k, field;
  7898. for (k in fields) {
  7899. field = fields[k];
  7900. if (!field._rules || !field.required && !field.must && !field.value) continue;
  7901. if (!field.isValid) return false;
  7902. }
  7903. return true;
  7904. },
  7905. /**
  7906. * Prevent submission form
  7907. *
  7908. * @method holdSubmit
  7909. * @param {Boolean} hold - If set to false, will release the hold
  7910. */
  7911. holdSubmit: function(hold) {
  7912. this.submiting = hold === undefined || hold;
  7913. },
  7914. /**
  7915. * Clean validation messages
  7916. *
  7917. * @method cleanUp
  7918. */
  7919. cleanUp: function() {
  7920. this._reset(1);
  7921. },
  7922. /**
  7923. * Destroy the validation
  7924. *
  7925. * @method destroy
  7926. */
  7927. destroy: function() {
  7928. this._reset(1);
  7929. this.$el.off(CLS_NS).removeData(NS);
  7930. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  7931. }
  7932. };
  7933. /**
  7934. * Create Field Factory
  7935. *
  7936. * @class
  7937. * @param {Object} context
  7938. * @return {Function} Factory
  7939. */
  7940. function _createFieldFactory(context) {
  7941. function FieldFactory() {
  7942. var options = this.options;
  7943. for (var i in options) {
  7944. if (i in fieldDefaults) this[i] = options[i];
  7945. }
  7946. $.extend(this, {
  7947. _valHook: function() {
  7948. return this.element.contentEditable === 'true' ? 'text' : 'val';
  7949. },
  7950. getValue: function() {
  7951. var elem = this.element;
  7952. if (elem.type === 'number' && elem.validity && elem.validity.badInput) {
  7953. return 'NaN';
  7954. }
  7955. return $(elem)[this._valHook()]();
  7956. },
  7957. setValue: function(value) {
  7958. $(this.element)[this._valHook()](this.value = value);
  7959. },
  7960. // Get a range of validation messages
  7961. getRangeMsg: function(value, params, suffix) {
  7962. if (!params) return;
  7963. var me = this,
  7964. msg = me.messages[me._r] || '',
  7965. result,
  7966. p = params[0].split('~'),
  7967. e = params[1] === 'false',
  7968. a = p[0],
  7969. b = p[1],
  7970. c = 'rg',
  7971. args = [''],
  7972. isNumber = trim(value) && +value === +value;
  7973. function compare(large, small) {
  7974. return !e ? large >= small : large > small;
  7975. }
  7976. if (p.length === 2) {
  7977. if (a && b) {
  7978. if (isNumber && compare(value, +a) && compare(+b, value)) {
  7979. result = true;
  7980. }
  7981. args = args.concat(p);
  7982. c = e ? 'gtlt' : 'rg';
  7983. }
  7984. else if (a && !b) {
  7985. if (isNumber && compare(value, +a)) {
  7986. result = true;
  7987. }
  7988. args.push(a);
  7989. c = e ? 'gt' : 'gte';
  7990. }
  7991. else if (!a && b) {
  7992. if (isNumber && compare(+b, value)) {
  7993. result = true;
  7994. }
  7995. args.push(b);
  7996. c = e ? 'lt' : 'lte';
  7997. }
  7998. }
  7999. else {
  8000. if (value === +a) {
  8001. result = true;
  8002. }
  8003. args.push(a);
  8004. c = 'eq';
  8005. }
  8006. if (msg) {
  8007. if (suffix && msg[c + suffix]) {
  8008. c += suffix;
  8009. }
  8010. args[0] = msg[c];
  8011. }
  8012. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8013. },
  8014. // Render message template
  8015. renderMsg: function() {
  8016. var args = arguments,
  8017. tpl = args[0],
  8018. i = args.length;
  8019. if (!tpl) return;
  8020. while (--i) {
  8021. tpl = tpl.replace('{' + i + '}', args[i]);
  8022. }
  8023. return tpl;
  8024. }
  8025. });
  8026. }
  8027. function Field(key, obj, oldField) {
  8028. this.key = key;
  8029. this.validator = context;
  8030. $.extend(this, oldField, obj);
  8031. }
  8032. FieldFactory.prototype = context;
  8033. Field.prototype = new FieldFactory();
  8034. return Field;
  8035. }
  8036. /**
  8037. * Create Rules
  8038. *
  8039. * @class
  8040. * @param {Object} obj rules
  8041. * @param {Object} context context
  8042. */
  8043. function Rules(obj, context) {
  8044. if (!isObject(obj)) return;
  8045. var k, that = context ? context === true ? this : context : Rules.prototype;
  8046. for (k in obj) {
  8047. if (_checkRuleName(k)) {
  8048. that[k] = _getRule(obj[k]);
  8049. }
  8050. }
  8051. }
  8052. /**
  8053. * Create Messages
  8054. *
  8055. * @class
  8056. * @param {Object} obj rules
  8057. * @param {Object} context context
  8058. */
  8059. function Messages(obj, context) {
  8060. if (!isObject(obj)) return;
  8061. var k, that = context ? context === true ? this : context : Messages.prototype;
  8062. for (k in obj) {
  8063. that[k] = obj[k];
  8064. }
  8065. }
  8066. // Rule converted factory
  8067. function _getRule(fn) {
  8068. switch ($.type(fn)) {
  8069. case 'function':
  8070. return fn;
  8071. case 'array':
  8072. var f = function() {
  8073. return fn[0].test(this.value) || fn[1] || false;
  8074. };
  8075. f.msg = fn[1];
  8076. return f;
  8077. case 'regexp':
  8078. return function() {
  8079. return fn.test(this.value);
  8080. };
  8081. }
  8082. }
  8083. // Get instance by an element
  8084. function _getInstance(el) {
  8085. var wrap, k, options;
  8086. if (!el || !el.tagName) return;
  8087. switch (el.tagName) {
  8088. case 'INPUT':
  8089. case 'SELECT':
  8090. case 'TEXTAREA':
  8091. case 'BUTTON':
  8092. case 'FIELDSET':
  8093. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8094. break;
  8095. case 'FORM':
  8096. wrap = el;
  8097. break;
  8098. default:
  8099. wrap = $(el).closest('.' + CLS_WRAPPER);
  8100. }
  8101. for (k in preinitialized) {
  8102. if ($(wrap).is(k)) {
  8103. options = preinitialized[k];
  8104. break;
  8105. }
  8106. }
  8107. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8108. }
  8109. // Get custom rules on the node
  8110. function _getDataRule(el, method) {
  8111. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8112. if ( fn && (fn = new Function('return ' + fn)()) ) {
  8113. return _getRule(fn);
  8114. }
  8115. }
  8116. // Get custom messages on the node
  8117. function _getDataMsg(el, field, m) {
  8118. var msg = field.msg,
  8119. item = field._r;
  8120. if ( isObject(msg) ) msg = msg[item];
  8121. if ( !isString(msg) ) {
  8122. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8123. }
  8124. return msg;
  8125. }
  8126. // Get message position
  8127. function _getPos(str) {
  8128. var pos;
  8129. if (str) pos = rPos.exec(str);
  8130. return pos && pos[0];
  8131. }
  8132. // Check whether the element is checkbox or radio
  8133. function _checkable(el) {
  8134. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8135. }
  8136. // Parse date string to timestamp
  8137. function _parseDate(str) {
  8138. return Date.parse(str.replace(/\.|\-/g, '/'));
  8139. }
  8140. // Rule name only allows alphanumeric characters and underscores
  8141. function _checkRuleName(name) {
  8142. return /^\w+$/.test(name);
  8143. }
  8144. // Translate field key to jQuery selector.
  8145. function _key2selector(key) {
  8146. var isID = key.charAt(0) === '#';
  8147. key = key.replace(/([:.{(|)}/\[\]])/g, '\\$1');
  8148. return isID ? key : '[name="'+ key +'"]:first';
  8149. }
  8150. // Fixed a issue cause by refresh page in IE.
  8151. $(window).on('beforeunload', function(){
  8152. this.focus();
  8153. });
  8154. $(document)
  8155. .on('click', ':submit', function(){
  8156. var input = this, attrNode;
  8157. if (!input.form) return;
  8158. // Shim for "formnovalidate"
  8159. attrNode = input.getAttributeNode('formnovalidate');
  8160. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8161. novalidateonce = true;
  8162. }
  8163. })
  8164. // Automatic initializing form validation
  8165. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8166. if ( attr(this, NOVALIDATE) !== null ) return;
  8167. var $form = $(this), me;
  8168. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8169. if ( !$.isEmptyObject(me.fields) ) {
  8170. // Execute event handler
  8171. if (e.type === 'focusin') {
  8172. me._focusin(e);
  8173. } else {
  8174. me._submit(e);
  8175. }
  8176. } else {
  8177. attr(this, NOVALIDATE, NOVALIDATE);
  8178. $form.off(CLS_NS).removeData(NS);
  8179. }
  8180. }
  8181. });
  8182. new Messages({
  8183. fallback: 'This field is not valid.',
  8184. loading: 'Validating...'
  8185. });
  8186. // Built-in rules (global)
  8187. new Rules({
  8188. /**
  8189. * required
  8190. *
  8191. * @example:
  8192. required
  8193. required(jqSelector)
  8194. required(anotherRule)
  8195. required(not, -1)
  8196. required(from, .contact)
  8197. */
  8198. required: function(element, params) {
  8199. var me = this,
  8200. val = trim(me.value),
  8201. isValid = true;
  8202. if (params) {
  8203. if ( params.length === 1 ) {
  8204. if ( !_checkRuleName(params[0]) ) {
  8205. if (!val && !$(params[0], me.$el).length ) {
  8206. return null;
  8207. }
  8208. }
  8209. else if ( me.rules[params[0]] ) {
  8210. if ( !val && !me.test(element, params[0]) ) {
  8211. return null;
  8212. }
  8213. me._r = 'required'
  8214. }
  8215. }
  8216. else if ( params[0] === 'not' ) {
  8217. $.each(params.slice(1), function() {
  8218. return (isValid = val !== trim(this));
  8219. });
  8220. }
  8221. else if ( params[0] === 'from' ) {
  8222. var $elements = me.$el.find(params[1]),
  8223. VALIDATED = '_validated_',
  8224. ret;
  8225. isValid = $elements.filter(function(){
  8226. var field = me.getField(this);
  8227. return field && !!trim(field.getValue());
  8228. }).length >= (params[2] || 1);
  8229. if (isValid) {
  8230. if (!val) ret = null;
  8231. } else {
  8232. ret = _getDataMsg($elements[0], me) || false;
  8233. }
  8234. if ( !$(element).data(VALIDATED) ) {
  8235. $elements.data(VALIDATED, 1).each(function(){
  8236. if (element !== this) {
  8237. me._validate(this);
  8238. }
  8239. }).removeData(VALIDATED);
  8240. }
  8241. return ret;
  8242. }
  8243. }
  8244. return isValid && !!val;
  8245. },
  8246. /**
  8247. * integer
  8248. *
  8249. * @example:
  8250. integer
  8251. integer[+]
  8252. integer[+0]
  8253. integer[-]
  8254. integer[-0]
  8255. */
  8256. integer: function(element, params) {
  8257. var re, z = '0|',
  8258. p = '[1-9]\\d*',
  8259. key = params ? params[0] : '*';
  8260. switch (key) {
  8261. case '+':
  8262. re = p;
  8263. break;
  8264. case '-':
  8265. re = '-' + p;
  8266. break;
  8267. case '+0':
  8268. re = z + p;
  8269. break;
  8270. case '-0':
  8271. re = z + '-' + p;
  8272. break;
  8273. default:
  8274. re = z + '-?' + p;
  8275. }
  8276. re = '^(?:' + re + ')$';
  8277. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  8278. },
  8279. /**
  8280. * match another field
  8281. *
  8282. * @example:
  8283. match[password] Match the password field (two values ​​must be the same)
  8284. match[eq, password] Ditto
  8285. match[neq, count] The value must be not equal to the value of the count field
  8286. match[lt, count] The value must be less than the value of the count field
  8287. match[lte, count] The value must be less than or equal to the value of the count field
  8288. match[gt, count] The value must be greater than the value of the count field
  8289. match[gte, count] The value must be greater than or equal to the value of the count field
  8290. match[gte, startDate, date]
  8291. match[gte, startTime, time]
  8292. **/
  8293. match: function(element, params) {
  8294. if (!params) return;
  8295. var me = this,
  8296. isValid = true,
  8297. a, b,
  8298. key, msg, type = 'eq', parser,
  8299. selector2, elem2, field2;
  8300. if (params.length === 1) {
  8301. key = params[0];
  8302. } else {
  8303. type = params[0];
  8304. key = params[1];
  8305. }
  8306. selector2 = _key2selector(key);
  8307. elem2 = me.$el.find(selector2)[0];
  8308. // If the compared field is not exist
  8309. if (!elem2) return;
  8310. field2 = me.getField(elem2);
  8311. a = me.value;
  8312. b = field2.getValue();
  8313. if (!me._match) {
  8314. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  8315. $(element).trigger('validate');
  8316. });
  8317. me._match = field2._match = 1;
  8318. }
  8319. // If both fields are blank
  8320. if (!me.required && a === '' && b === '') {
  8321. return null;
  8322. }
  8323. parser = params[2];
  8324. if (parser) {
  8325. if (/^date(time)?$/i.test(parser)) {
  8326. a = _parseDate(a);
  8327. b = _parseDate(b);
  8328. } else if (parser === 'time') {
  8329. a = +a.replace(/:/g, '');
  8330. b = +b.replace(/:/g, '');
  8331. }
  8332. }
  8333. // If the compared field is incorrect, we only ensure that this field is correct.
  8334. if (type !== 'eq' && !isNaN(+a) && isNaN(+b)) {
  8335. return true;
  8336. }
  8337. switch (type) {
  8338. case 'lt':
  8339. isValid = +a < +b; break;
  8340. case 'lte':
  8341. isValid = +a <= +b; break;
  8342. case 'gte':
  8343. isValid = +a >= +b; break;
  8344. case 'gt':
  8345. isValid = +a > +b; break;
  8346. case 'neq':
  8347. isValid = a !== b; break;
  8348. default:
  8349. isValid = a === b;
  8350. }
  8351. return isValid || (
  8352. isObject(me.messages.match)
  8353. && me.messages.match[type].replace( '{1}', me._getDisplay( elem2, field2.display || key ) )
  8354. );
  8355. },
  8356. /**
  8357. * range numbers
  8358. *
  8359. * @example:
  8360. range[0~99] Number 0-99
  8361. range[0~] Number greater than or equal to 0
  8362. range[~100] Number less than or equal to 100
  8363. **/
  8364. range: function(element, params) {
  8365. return this.getRangeMsg(this.value, params);
  8366. },
  8367. /**
  8368. * how many checkbox or radio inputs that checked
  8369. *
  8370. * @example:
  8371. checked; no empty, same to required
  8372. checked[1~3] 1-3 items
  8373. checked[1~] greater than 1 item
  8374. checked[~3] less than 3 items
  8375. checked[3] 3 items
  8376. **/
  8377. checked: function(element, params) {
  8378. if ( !_checkable(element) ) return;
  8379. var me = this,
  8380. elem, count;
  8381. if (element.name) {
  8382. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  8383. var el = this;
  8384. if (!elem && _checkable(el)) elem = el;
  8385. return !el.disabled && el.checked;
  8386. }).length;
  8387. } else {
  8388. elem = element;
  8389. count = elem.checked;
  8390. }
  8391. if (params) {
  8392. return me.getRangeMsg(count, params);
  8393. } else {
  8394. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  8395. }
  8396. },
  8397. /**
  8398. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  8399. *
  8400. * @example:
  8401. length[6~16] 6-16 characters
  8402. length[6~] Greater than 6 characters
  8403. length[~16] Less than 16 characters
  8404. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  8405. **/
  8406. length: function(element, params) {
  8407. var value = this.value,
  8408. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  8409. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  8410. },
  8411. /**
  8412. * remote validation
  8413. *
  8414. * @description
  8415. * remote([get:]url [, name1, [name2 ...]]);
  8416. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  8417. 1. text:
  8418. '' 'Error Message'
  8419. 2. json:
  8420. {"ok": ""} {"error": "Error Message"}
  8421. 3. json wrapper:
  8422. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  8423. * @example
  8424. The simplest: remote(path/to/server);
  8425. With parameters: remote(path/to/server, name1, name2, ...);
  8426. By GET: remote(get:path/to/server, name1, name2, ...);
  8427. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  8428. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  8429. CORS remote(cors:path/to/server)
  8430. JSONP remote(jsonp:path/to/server)
  8431. */
  8432. remote: function(element, params) {
  8433. if (!params) return;
  8434. var me = this,
  8435. arr = rAjaxType.exec(params[0]),
  8436. rule = me._rules[me._i],
  8437. data = {},
  8438. queryString = '',
  8439. url = arr[3],
  8440. type = arr[2] || 'POST', // GET / POST
  8441. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  8442. dataType;
  8443. rule.must = true;
  8444. data[element.name] = me.value;
  8445. // There are extra fields
  8446. if (params[1]) {
  8447. $.map(params.slice(1), function(name) {
  8448. var arr, key;
  8449. if (~name.indexOf('=')) {
  8450. queryString += '&' + name;
  8451. } else {
  8452. arr = name.split(':');
  8453. name = trim(arr[0]);
  8454. key = trim(arr[1]) || name;
  8455. data[ name ] = me.$el.find( _key2selector(key) ).val();
  8456. }
  8457. });
  8458. }
  8459. data = $.param(data) + queryString;
  8460. if (!me.must && rule.data && rule.data === data) {
  8461. return rule.result;
  8462. }
  8463. // Cross-domain request, force jsonp dataType
  8464. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  8465. dataType = 'jsonp';
  8466. }
  8467. // Asynchronous validation need return jqXHR objects
  8468. return $.ajax({
  8469. url: url,
  8470. type: type,
  8471. data: data,
  8472. dataType: dataType
  8473. });
  8474. },
  8475. /**
  8476. * filter characters, direct filtration without prompting error (support custom regular expressions)
  8477. *
  8478. * @example
  8479. * filter filtering unsafe characters
  8480. * filter(regexp) filtering the "regexp" matched characters
  8481. */
  8482. filter: function(element, params) {
  8483. var value = this.value,
  8484. temp = value.replace( params ? (new RegExp('[' + params[0] + ']', 'gm')) : rUnsafe, '' );
  8485. if (temp !== value) this.setValue(temp);
  8486. }
  8487. });
  8488. /**
  8489. * Config global options
  8490. *
  8491. * @static config
  8492. * @param {Object} options
  8493. */
  8494. Validator.config = function(key, value) {
  8495. if (isObject(key)) {
  8496. $.each(key, _config);
  8497. }
  8498. else if (isString(key)) {
  8499. _config(key, value);
  8500. }
  8501. function _config(k, o) {
  8502. if (k === 'rules') {
  8503. new Rules(o);
  8504. }
  8505. else if (k === 'messages') {
  8506. new Messages(o);
  8507. }
  8508. else if (k in fieldDefaults) {
  8509. fieldDefaults[k] = o;
  8510. }
  8511. else {
  8512. defaults[k] = o;
  8513. }
  8514. }
  8515. };
  8516. /**
  8517. * Config themes
  8518. *
  8519. * @static setTheme
  8520. * @param {String|Object} name
  8521. * @param {Object} obj
  8522. * @example
  8523. .setTheme( themeName, themeOptions )
  8524. .setTheme( multiThemes )
  8525. */
  8526. Validator.setTheme = function(name, obj) {
  8527. if ( isObject(name) ) {
  8528. $.extend(true, themes, name);
  8529. }
  8530. else if ( isString(name) && isObject(obj) ) {
  8531. themes[name] = $.extend(themes[name], obj);
  8532. }
  8533. };
  8534. /**
  8535. * Resource loader
  8536. *
  8537. * @static load
  8538. * @param {String} str
  8539. * @example
  8540. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  8541. .load('local=zh-CN&css=') // load: local/zh-CN.js
  8542. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  8543. .load('local') // dito
  8544. */
  8545. Validator.load = function(str) {
  8546. if (!str) return;
  8547. var doc = document,
  8548. params = {},
  8549. node = doc.scripts[0],
  8550. dir, el, ONLOAD;
  8551. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  8552. params[key] = value;
  8553. });
  8554. dir = params.dir || Validator.dir;
  8555. if (!Validator.css && params.css !== '') {
  8556. el = doc.createElement('link');
  8557. el.rel = 'stylesheet';
  8558. el.href = Validator.css = dir + 'jquery.validator.css';
  8559. node.parentNode.insertBefore(el, node);
  8560. }
  8561. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  8562. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  8563. Validator.pending = 1;
  8564. el = doc.createElement('script');
  8565. el.src = dir + 'local/' + Validator.local + '.js';
  8566. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  8567. el[ONLOAD] = function() {
  8568. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  8569. el = el[ONLOAD] = null;
  8570. delete Validator.pending;
  8571. $(window).triggerHandler('validatorready');
  8572. }
  8573. };
  8574. node.parentNode.insertBefore(el, node);
  8575. }
  8576. };
  8577. // Auto loading resources
  8578. (function(){
  8579. var scripts = document.scripts,
  8580. i = scripts.length, node, arr,
  8581. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  8582. while (i-- && !arr) {
  8583. node = scripts[i];
  8584. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  8585. }
  8586. if (!arr) return;
  8587. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  8588. Validator.load(arr[2]);
  8589. })();
  8590. return $[NS] = Validator;
  8591. }));
  8592. /*********************************
  8593. * Themes, rules, and i18n support
  8594. * Locale: Chinese; 中文
  8595. *********************************/
  8596. (function(factory) {
  8597. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  8598. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  8599. factory(jQuery);
  8600. }(function($) {
  8601. /* Global configuration
  8602. */
  8603. $.validator.config({
  8604. //stopOnError: true,
  8605. //focusCleanup: true,
  8606. //theme: 'yellow_right',
  8607. //timely: 2,
  8608. // Custom rules
  8609. rules: {
  8610. digits: [/^\d+$/, "请填写数字"]
  8611. ,letters: [/^[a-z]+$/i, "请填写字母"]
  8612. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  8613. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  8614. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  8615. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  8616. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  8617. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  8618. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  8619. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  8620. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  8621. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  8622. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  8623. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  8624. ,accept: function (element, params){
  8625. if (!params) return true;
  8626. var ext = params[0],
  8627. value = $(element).val();
  8628. return (ext === '*') ||
  8629. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  8630. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  8631. }
  8632. },
  8633. // Default error messages
  8634. messages: {
  8635. 0: "此处",
  8636. fallback: "{0}格式不正确",
  8637. loading: "正在验证...",
  8638. error: "网络异常",
  8639. timeout: "请求超时",
  8640. required: "{0}不能为空",
  8641. remote: "{0}已被使用",
  8642. integer: {
  8643. '*': "请填写整数",
  8644. '+': "请填写正整数",
  8645. '+0': "请填写正整数或0",
  8646. '-': "请填写负整数",
  8647. '-0': "请填写负整数或0"
  8648. },
  8649. match: {
  8650. eq: "{0}与{1}不一致",
  8651. neq: "{0}与{1}不能相同",
  8652. lt: "{0}必须小于{1}",
  8653. gt: "{0}必须大于{1}",
  8654. lte: "{0}不能大于{1}",
  8655. gte: "{0}不能小于{1}"
  8656. },
  8657. range: {
  8658. rg: "请填写{1}到{2}的数",
  8659. gte: "请填写不小于{1}的数",
  8660. lte: "请填写最大{1}的数",
  8661. gtlt: "请填写{1}到{2}之间的数",
  8662. gt: "请填写大于{1}的数",
  8663. lt: "请填写小于{1}的数"
  8664. },
  8665. checked: {
  8666. eq: "请选择{1}项",
  8667. rg: "请选择{1}到{2}项",
  8668. gte: "请至少选择{1}项",
  8669. lte: "请最多选择{1}项"
  8670. },
  8671. length: {
  8672. eq: "请填写{1}个字符",
  8673. rg: "请填写{1}到{2}个字符",
  8674. gte: "请至少填写{1}个字符",
  8675. lte: "请最多填写{1}个字符",
  8676. eq_2: "",
  8677. rg_2: "",
  8678. gte_2: "",
  8679. lte_2: ""
  8680. }
  8681. }
  8682. });
  8683. /* Themes
  8684. */
  8685. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  8686. $.validator.setTheme({
  8687. 'simple_right': {
  8688. formClass: 'n-simple',
  8689. msgClass: 'n-right'
  8690. },
  8691. 'simple_bottom': {
  8692. formClass: 'n-simple',
  8693. msgClass: 'n-bottom'
  8694. },
  8695. 'yellow_top': {
  8696. formClass: 'n-yellow',
  8697. msgClass: 'n-top',
  8698. msgArrow: TPL_ARROW
  8699. },
  8700. 'yellow_right': {
  8701. formClass: 'n-yellow',
  8702. msgClass: 'n-right',
  8703. msgArrow: TPL_ARROW
  8704. },
  8705. 'yellow_right_effect': {
  8706. formClass: 'n-yellow',
  8707. msgClass: 'n-right',
  8708. msgArrow: TPL_ARROW,
  8709. msgShow: function($msgbox, type){
  8710. var $el = $msgbox.children();
  8711. if ($el.is(':animated')) return;
  8712. if (type === 'error') {
  8713. $el.css({left: '20px', opacity: 0})
  8714. .delay(100).show().stop()
  8715. .animate({left: '-4px', opacity: 1}, 150)
  8716. .animate({left: '3px'}, 80)
  8717. .animate({left: 0}, 80);
  8718. } else {
  8719. $el.css({left: 0, opacity: 1}).fadeIn(200);
  8720. }
  8721. },
  8722. msgHide: function($msgbox, type){
  8723. var $el = $msgbox.children();
  8724. $el.stop().delay(100).show()
  8725. .animate({left: '20px', opacity: 0}, 300, function(){
  8726. $msgbox.hide();
  8727. });
  8728. }
  8729. }
  8730. });
  8731. }));
  8732. define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], function ($, undefined, Upload, Validator, undefined) {
  8733. var Form = {
  8734. config: {
  8735. fieldlisttpl: '<dd class="form-inline"><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=key%>" placeholder="<%=options.keyPlaceholder||\'\'%>" size="10" /> <input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" value="<%=value%>" placeholder="<%=options.valuePlaceholder||\'\'%>" /> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></dd>'
  8736. },
  8737. events: {
  8738. validator: function (form, success, error, submit) {
  8739. if (!form.is("form"))
  8740. return;
  8741. //绑定表单事件
  8742. form.validator($.extend({
  8743. rules: {
  8744. username: [/^\w{3,30}$/, __('Username must be 3 to 30 characters')],
  8745. password: [/^[\S]{6,30}$/, __('Password must be 6 to 30 characters')]
  8746. },
  8747. validClass: 'has-success',
  8748. invalidClass: 'has-error',
  8749. bindClassTo: '.form-group',
  8750. formClass: 'n-default n-bootstrap',
  8751. msgClass: 'n-right',
  8752. stopOnError: true,
  8753. display: function (elem) {
  8754. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  8755. },
  8756. dataFilter: function (data) {
  8757. if (data.code === 1) {
  8758. return data.msg ? {"ok": data.msg} : '';
  8759. } else {
  8760. return data.msg;
  8761. }
  8762. },
  8763. target: function (input) {
  8764. var target = $(input).data("target");
  8765. if (target && $(target).size() > 0) {
  8766. return $(target);
  8767. }
  8768. var $formitem = $(input).closest('.form-group'),
  8769. $msgbox = $formitem.find('span.msg-box');
  8770. if (!$msgbox.length) {
  8771. return [];
  8772. }
  8773. return $msgbox;
  8774. },
  8775. valid: function (ret) {
  8776. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  8777. that.holdSubmit(true);
  8778. submitBtn.addClass("disabled");
  8779. //验证通过提交表单
  8780. var submitResult = Form.api.submit($(ret), function (data, ret) {
  8781. that.holdSubmit(false);
  8782. submitBtn.removeClass("disabled");
  8783. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  8784. return false;
  8785. }
  8786. if (typeof success === 'function') {
  8787. if (false === success.call($(this), data, ret)) {
  8788. return false;
  8789. }
  8790. }
  8791. //提示及关闭当前窗口
  8792. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  8793. parent.Toastr.success(msg);
  8794. parent.$(".btn-refresh").trigger("click");
  8795. var index = parent.Layer.getFrameIndex(window.name);
  8796. parent.Layer.close(index);
  8797. return false;
  8798. }, function (data, ret) {
  8799. that.holdSubmit(false);
  8800. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  8801. return false;
  8802. }
  8803. submitBtn.removeClass("disabled");
  8804. if (typeof error === 'function') {
  8805. if (false === error.call($(this), data, ret)) {
  8806. return false;
  8807. }
  8808. }
  8809. }, submit);
  8810. //如果提交失败则释放锁定
  8811. if (!submitResult) {
  8812. that.holdSubmit(false);
  8813. submitBtn.removeClass("disabled");
  8814. }
  8815. return false;
  8816. }
  8817. }, form.data("validator-options") || {}));
  8818. //移除提交按钮的disabled类
  8819. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  8820. //自定义关闭按钮事件
  8821. form.on("click", ".layer-close", function () {
  8822. var index = parent.Layer.getFrameIndex(window.name);
  8823. parent.Layer.close(index);
  8824. return false;
  8825. });
  8826. },
  8827. selectpicker: function (form) {
  8828. //绑定select元素事件
  8829. if ($(".selectpicker", form).size() > 0) {
  8830. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  8831. $('.selectpicker', form).selectpicker();
  8832. $(form).on("reset", function () {
  8833. setTimeout(function () {
  8834. $('.selectpicker').selectpicker('refresh').trigger("change");
  8835. }, 1);
  8836. });
  8837. });
  8838. }
  8839. },
  8840. selectpage: function (form) {
  8841. //绑定selectpage元素事件
  8842. if ($(".selectpage", form).size() > 0) {
  8843. require(['selectpage'], function () {
  8844. $('.selectpage', form).selectPage({
  8845. eAjaxSuccess: function (data) {
  8846. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  8847. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  8848. return data;
  8849. }
  8850. });
  8851. });
  8852. //给隐藏的元素添加上validate验证触发事件
  8853. $(document).on("change", ".sp_hidden", function () {
  8854. $(this).trigger("validate");
  8855. });
  8856. $(document).on("change", ".sp_input", function () {
  8857. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  8858. });
  8859. $(form).on("reset", function () {
  8860. setTimeout(function () {
  8861. $('.selectpage', form).selectPageClear();
  8862. }, 1);
  8863. });
  8864. }
  8865. },
  8866. cxselect: function (form) {
  8867. //绑定cxselect元素事件
  8868. if ($("[data-toggle='cxselect']", form).size() > 0) {
  8869. require(['cxselect'], function () {
  8870. $.cxSelect.defaults.jsonName = 'name';
  8871. $.cxSelect.defaults.jsonValue = 'value';
  8872. $.cxSelect.defaults.jsonSpace = 'data';
  8873. $("[data-toggle='cxselect']", form).cxSelect();
  8874. });
  8875. }
  8876. },
  8877. citypicker: function (form) {
  8878. //绑定城市远程插件
  8879. if ($("[data-toggle='city-picker']", form).size() > 0) {
  8880. require(['citypicker'], function () {
  8881. $(form).on("reset", function () {
  8882. setTimeout(function () {
  8883. $("[data-toggle='city-picker']").citypicker('refresh');
  8884. }, 1);
  8885. });
  8886. });
  8887. }
  8888. },
  8889. datetimepicker: function (form) {
  8890. //绑定日期时间元素事件
  8891. if ($(".datetimepicker", form).size() > 0) {
  8892. require(['bootstrap-datetimepicker'], function () {
  8893. var options = {
  8894. format: 'YYYY-MM-DD HH:mm:ss',
  8895. icons: {
  8896. time: 'fa fa-clock-o',
  8897. date: 'fa fa-calendar',
  8898. up: 'fa fa-chevron-up',
  8899. down: 'fa fa-chevron-down',
  8900. previous: 'fa fa-chevron-left',
  8901. next: 'fa fa-chevron-right',
  8902. today: 'fa fa-history',
  8903. clear: 'fa fa-trash',
  8904. close: 'fa fa-remove'
  8905. },
  8906. showTodayButton: true,
  8907. showClose: true
  8908. };
  8909. $('.datetimepicker', form).parent().css('position', 'relative');
  8910. $('.datetimepicker', form).datetimepicker(options).on('dp.change', function (e) {
  8911. $(this, document).trigger("changed");
  8912. });
  8913. });
  8914. }
  8915. },
  8916. daterangepicker: function (form) {
  8917. //绑定日期时间元素事件
  8918. if ($(".datetimerange", form).size() > 0) {
  8919. require(['bootstrap-daterangepicker'], function () {
  8920. var ranges = {};
  8921. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  8922. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  8923. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  8924. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  8925. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  8926. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  8927. var options = {
  8928. timePicker: false,
  8929. autoUpdateInput: false,
  8930. timePickerSeconds: true,
  8931. timePicker24Hour: true,
  8932. autoApply: true,
  8933. locale: {
  8934. format: 'YYYY-MM-DD HH:mm:ss',
  8935. customRangeLabel: __("Custom Range"),
  8936. applyLabel: __("Apply"),
  8937. cancelLabel: __("Clear"),
  8938. },
  8939. ranges: ranges,
  8940. };
  8941. var origincallback = function (start, end) {
  8942. $(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
  8943. $(this.element).trigger('blur');
  8944. };
  8945. $(".datetimerange", form).each(function () {
  8946. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  8947. $(this).on('apply.daterangepicker', function (ev, picker) {
  8948. callback.call(picker, picker.startDate, picker.endDate);
  8949. });
  8950. $(this).on('cancel.daterangepicker', function (ev, picker) {
  8951. $(this).val('').trigger('blur');
  8952. });
  8953. $(this).daterangepicker($.extend(true, options, $(this).data() || {}, $(this).data("daterangepicker-options") || {}));
  8954. });
  8955. });
  8956. }
  8957. },
  8958. /**
  8959. * 绑定上传事件
  8960. * @param form
  8961. * @deprecated Use faupload instead.
  8962. */
  8963. plupload: function (form) {
  8964. Form.events.faupload(form);
  8965. },
  8966. /**
  8967. * 绑定上传事件
  8968. * @param form
  8969. */
  8970. faupload: function (form) {
  8971. //绑定上传元素事件
  8972. if ($(".plupload,.faupload", form).size() > 0) {
  8973. Upload.api.upload($(".plupload,.faupload", form));
  8974. }
  8975. },
  8976. faselect: function (form) {
  8977. //绑定fachoose选择附件事件
  8978. if ($(".faselect,.fachoose", form).size() > 0) {
  8979. $(".faselect,.fachoose", form).off('click').on('click', function () {
  8980. var that = this;
  8981. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  8982. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  8983. var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
  8984. var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
  8985. mimetype = mimetype.replace(/\/\*/ig, '/');
  8986. var url = $(this).data("url") ? $(this).data("url") : (typeof Backend !== 'undefined' ? "general/attachment/select" : "user/attachment");
  8987. parent.Fast.api.open(url + "?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
  8988. callback: function (data) {
  8989. var button = $("#" + $(that).attr("id"));
  8990. var maxcount = $(button).data("maxcount");
  8991. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  8992. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  8993. if (input_id && data.multiple) {
  8994. var urlArr = [];
  8995. var inputObj = $("#" + input_id);
  8996. var value = $.trim(inputObj.val());
  8997. if (value !== "") {
  8998. urlArr.push(inputObj.val());
  8999. }
  9000. var nums = value === '' ? 0 : value.split(/\,/).length;
  9001. var files = data.url !== "" ? data.url.split(/\,/) : [];
  9002. $.each(files, function (i, j) {
  9003. var url = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
  9004. urlArr.push(url);
  9005. });
  9006. if (maxcount > 0) {
  9007. var remains = maxcount - nums;
  9008. if (files.length > remains) {
  9009. Toastr.error(__('You can choose up to %d file%s', remains));
  9010. return false;
  9011. }
  9012. }
  9013. var result = urlArr.join(",");
  9014. inputObj.val(result).trigger("change").trigger("validate");
  9015. } else {
  9016. var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
  9017. $("#" + input_id).val(url).trigger("change").trigger("validate");
  9018. }
  9019. }
  9020. });
  9021. return false;
  9022. });
  9023. }
  9024. },
  9025. fieldlist: function (form) {
  9026. //绑定fieldlist
  9027. if ($(".fieldlist", form).size() > 0) {
  9028. require(['dragsort', 'template'], function (undefined, Template) {
  9029. //刷新隐藏textarea的值
  9030. var refresh = function (container) {
  9031. var data = {};
  9032. var name = container.data("name");
  9033. var textarea = $("textarea[name='" + name + "']", form);
  9034. var template = container.data("template");
  9035. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  9036. var reg = /\[(\w+)\]\[(\w+)\]$/g;
  9037. var match = reg.exec(j.name);
  9038. if (!match)
  9039. return true;
  9040. match[1] = "x" + parseInt(match[1]);
  9041. if (typeof data[match[1]] == 'undefined') {
  9042. data[match[1]] = {};
  9043. }
  9044. data[match[1]][match[2]] = j.value;
  9045. });
  9046. var result = template ? [] : {};
  9047. $.each(data, function (i, j) {
  9048. if (j) {
  9049. if (!template) {
  9050. if (j.key != '') {
  9051. result[j.key] = j.value;
  9052. }
  9053. } else {
  9054. result.push(j);
  9055. }
  9056. }
  9057. });
  9058. textarea.val(JSON.stringify(result));
  9059. };
  9060. //追加一行数据
  9061. var append = function (container, row, initial) {
  9062. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9063. var index = container.data("index");
  9064. var name = container.data("name");
  9065. var template = container.data("template");
  9066. var data = container.data();
  9067. index = index ? parseInt(index) : 0;
  9068. container.data("index", index + 1);
  9069. row = row ? row : {};
  9070. row = typeof row.key === 'undefined' || typeof row.value === 'undefined' ? {key: '', value: row} : row;
  9071. var options = container.data("fieldlist-options") || {};
  9072. var vars = {index: index, name: name, data: data, options: options, key: row.key, value: row.value, row: row.value};
  9073. var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
  9074. var obj = $(html);
  9075. if ((options.deleteBtn === false || options.removeBtn === false) && initial)
  9076. obj.find(".btn-remove").remove();
  9077. if (options.dragsortBtn === false && initial)
  9078. obj.find(".btn-dragsort").remove();
  9079. if ((options.readonlyKey === true || options.disableKey === true) && initial) {
  9080. obj.find("input[name$='[key]']").prop("readonly", true);
  9081. }
  9082. obj.attr("fieldlist-item", true);
  9083. obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
  9084. if ($(".btn-append,.append", container).length > 0) {
  9085. //兼容旧版本事件
  9086. $(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
  9087. } else {
  9088. //新版本事件
  9089. container.trigger("fa.event.appendfieldlist", obj);
  9090. }
  9091. return obj;
  9092. };
  9093. var fieldlist = $(".fieldlist", form);
  9094. //监听文本框改变事件
  9095. $(document).on('change keyup changed', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
  9096. var container = $(this).closest(".fieldlist");
  9097. refresh(container);
  9098. });
  9099. //追加控制(点击按钮)
  9100. fieldlist.on("click", ".btn-append,.append", function (e, row) {
  9101. var container = $(this).closest(".fieldlist");
  9102. append(container, row);
  9103. // refresh(container);
  9104. });
  9105. //移除控制(点击按钮)
  9106. fieldlist.on("click", ".btn-remove", function () {
  9107. var container = $(this).closest(".fieldlist");
  9108. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9109. $(this).closest(tagName).remove();
  9110. refresh(container);
  9111. });
  9112. //追加控制(通过事件)
  9113. fieldlist.on("fa.event.appendtofieldlist", function (e, row) {
  9114. var container = $(this);
  9115. append(container, row);
  9116. refresh(container);
  9117. });
  9118. //根据textarea内容重新渲染
  9119. fieldlist.on("fa.event.refreshfieldlist", function () {
  9120. var container = $(this);
  9121. var textarea = $("textarea[name='" + container.data("name") + "']", form);
  9122. //先清空已有的数据
  9123. $("[fieldlist-item]", container).remove();
  9124. var json = {};
  9125. try {
  9126. json = JSON.parse(textarea.val());
  9127. } catch (e) {
  9128. }
  9129. $.each(json, function (i, j) {
  9130. append(container, {key: i, value: j}, true);
  9131. });
  9132. });
  9133. //拖拽排序
  9134. fieldlist.each(function () {
  9135. var container = $(this);
  9136. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9137. container.dragsort({
  9138. itemSelector: tagName,
  9139. dragSelector: ".btn-dragsort",
  9140. dragEnd: function () {
  9141. refresh(container);
  9142. },
  9143. placeHolderTemplate: $("<" + tagName + "/>")
  9144. });
  9145. if (typeof container.data("options") === 'object' && container.data("options").appendBtn === false) {
  9146. $(".btn-append,.append", container).hide();
  9147. }
  9148. $("textarea[name='" + container.data("name") + "']", form).on("fa.event.refreshfieldlist", function () {
  9149. //兼容旧版本事件
  9150. $(this).closest(".fieldlist").trigger("fa.event.refreshfieldlist");
  9151. });
  9152. });
  9153. fieldlist.trigger("fa.event.refreshfieldlist");
  9154. });
  9155. }
  9156. },
  9157. switcher: function (form) {
  9158. form.on("click", "[data-toggle='switcher']", function () {
  9159. if ($(this).hasClass("disabled")) {
  9160. return false;
  9161. }
  9162. var switcher = $.proxy(function () {
  9163. var input = $(this).prev("input");
  9164. input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input;
  9165. if (input.size() > 0) {
  9166. var yes = $(this).data("yes");
  9167. var no = $(this).data("no");
  9168. if (input.val() == yes) {
  9169. input.val(no);
  9170. $("i", this).addClass("fa-flip-horizontal text-gray");
  9171. } else {
  9172. input.val(yes);
  9173. $("i", this).removeClass("fa-flip-horizontal text-gray");
  9174. }
  9175. input.trigger('change');
  9176. }
  9177. }, this);
  9178. if (typeof $(this).data("confirm") !== 'undefined') {
  9179. Layer.confirm($(this).data("confirm"), function (index) {
  9180. switcher();
  9181. Layer.close(index);
  9182. });
  9183. } else {
  9184. switcher();
  9185. }
  9186. return false;
  9187. });
  9188. },
  9189. bindevent: function (form) {
  9190. },
  9191. slider: function (form) {
  9192. if ($(".slider", form).size() > 0) {
  9193. require(['bootstrap-slider'], function () {
  9194. $('.slider').removeClass('hidden').css('width', function (index, value) {
  9195. return $(this).parents('.form-control').width();
  9196. }).slider().on('slide', function (ev) {
  9197. var data = $(this).data();
  9198. if (typeof data.unit !== 'undefined') {
  9199. $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  9200. }
  9201. });
  9202. });
  9203. }
  9204. },
  9205. tagsinput: function (form) {
  9206. if ($("[data-role='tagsinput']", form).size() > 0) {
  9207. require(['tagsinput', 'autocomplete'], function () {
  9208. $("[data-role='tagsinput']").tagsinput();
  9209. });
  9210. }
  9211. },
  9212. autocomplete: function (form) {
  9213. if ($("[data-role='autocomplete']", form).size() > 0) {
  9214. require(['autocomplete'], function () {
  9215. $("[data-role='autocomplete']").autocomplete();
  9216. });
  9217. }
  9218. },
  9219. favisible: function (form) {
  9220. if ($("[data-favisible]", form).length == 0) {
  9221. return;
  9222. }
  9223. var checkCondition = function (condition) {
  9224. var conditionArr = condition.split(/&&/);
  9225. var success = 0;
  9226. var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
  9227. // @formatter:off
  9228. var operator_result = {
  9229. '>': function(a, b) { return a > b; },
  9230. '>=': function(a, b) { return a >= b; },
  9231. '<': function(a, b) { return a < b; },
  9232. '<=': function(a, b) { return a <= b; },
  9233. '==': function(a, b) { return a == b; },
  9234. '!=': function(a, b) { return a != b; },
  9235. 'in': function(a, b) { return b.split(/\,/).indexOf(a) > -1; },
  9236. 'regex': function(a, b) {
  9237. var regParts = b.match(/^\/(.*?)\/([gim]*)$/);
  9238. var regexp = regParts ? new RegExp(regParts[1], regParts[2]) : new RegExp(b);
  9239. return regexp.test(a);
  9240. }
  9241. };
  9242. // @formatter:on
  9243. var dataArr = form.serializeArray(), dataObj = {};
  9244. $(dataArr).each(function (i, field) {
  9245. dataObj[field.name] = field.value;
  9246. });
  9247. $.each(conditionArr, function (i, item) {
  9248. var basematches = baseregex.exec(item);
  9249. if (basematches) {
  9250. var name = basematches[1], operator = basematches[2], value = basematches[3].toString();
  9251. if (operator === '=') {
  9252. var strmatches = strregex.exec(value);
  9253. operator = strmatches ? '==' : 'in';
  9254. value = strmatches ? strmatches[2] : value;
  9255. }
  9256. var regmatches = regregex.exec(value);
  9257. if (regmatches) {
  9258. operator = 'regex';
  9259. value = regmatches[1];
  9260. }
  9261. var chkname = "row[" + name + "]";
  9262. if (typeof dataObj[chkname] === 'undefined') {
  9263. return false;
  9264. }
  9265. var objvalue = dataObj[chkname];
  9266. if (['>', '>=', '<', '<='].indexOf(operator) > -1) {
  9267. objvalue = parseFloat(objvalue);
  9268. value = parseFloat(value);
  9269. }
  9270. var result = operator_result[operator](objvalue, value);
  9271. success += (result ? 1 : 0);
  9272. }
  9273. });
  9274. return success === conditionArr.length;
  9275. };
  9276. form.on("keyup change click configchange", "input,select", function () {
  9277. $("[data-favisible][data-favisible!='']", form).each(function () {
  9278. var visible = $(this).data("favisible");
  9279. var groupArr = visible.split(/\|\|/);
  9280. var success = 0;
  9281. $.each(groupArr, function (i, j) {
  9282. if (checkCondition(j)) {
  9283. success++;
  9284. }
  9285. });
  9286. if (success > 0) {
  9287. $(this).removeClass("hidden");
  9288. } else {
  9289. $(this).addClass("hidden");
  9290. }
  9291. });
  9292. });
  9293. //追加上忽略元素
  9294. setTimeout(function () {
  9295. form.data('validator').options.ignore += ((form.data('validator').options.ignore ? ',' : '') + '[data-favisible] :hidden,[data-favisible]:hidden');
  9296. }, 0);
  9297. $("input,select", form).trigger("configchange");
  9298. }
  9299. },
  9300. api: {
  9301. submit: function (form, success, error, submit) {
  9302. if (form.size() === 0) {
  9303. Toastr.error("表单未初始化完成,无法提交");
  9304. return false;
  9305. }
  9306. if (typeof submit === 'function') {
  9307. if (false === submit.call(form, success, error)) {
  9308. return false;
  9309. }
  9310. }
  9311. var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
  9312. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  9313. url = form.attr("action");
  9314. url = url ? url : location.href;
  9315. //修复当存在多选项元素时提交的BUG
  9316. var params = {};
  9317. var multipleList = $("[name$='[]']", form);
  9318. if (multipleList.size() > 0) {
  9319. var postFields = form.serializeArray().map(function (obj) {
  9320. return $(obj).prop("name");
  9321. });
  9322. $.each(multipleList, function (i, j) {
  9323. if (postFields.indexOf($(this).prop("name")) < 0) {
  9324. params[$(this).prop("name")] = '';
  9325. }
  9326. });
  9327. }
  9328. //调用Ajax请求方法
  9329. Fast.api.ajax({
  9330. type: type,
  9331. url: url,
  9332. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  9333. dataType: 'json',
  9334. complete: function (xhr) {
  9335. var token = xhr.getResponseHeader('__token__');
  9336. if (token) {
  9337. $("input[name='__token__']").val(token);
  9338. }
  9339. }
  9340. }, function (data, ret) {
  9341. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9342. if (data && typeof data === 'object') {
  9343. //刷新客户端token
  9344. if (typeof data.token !== 'undefined') {
  9345. $("input[name='__token__']").val(data.token);
  9346. }
  9347. //调用客户端事件
  9348. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  9349. data.callback.call(form, data);
  9350. }
  9351. }
  9352. if (typeof success === 'function') {
  9353. if (false === success.call(form, data, ret)) {
  9354. return false;
  9355. }
  9356. }
  9357. }, function (data, ret) {
  9358. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  9359. $("input[name='__token__']").val(data.token);
  9360. }
  9361. if (typeof error === 'function') {
  9362. if (false === error.call(form, data, ret)) {
  9363. return false;
  9364. }
  9365. }
  9366. });
  9367. return true;
  9368. },
  9369. bindevent: function (form, success, error, submit) {
  9370. form = typeof form === 'object' ? form : $(form);
  9371. var events = Form.events;
  9372. events.bindevent(form);
  9373. events.validator(form, success, error, submit);
  9374. events.selectpicker(form);
  9375. events.daterangepicker(form);
  9376. events.selectpage(form);
  9377. events.cxselect(form);
  9378. events.citypicker(form);
  9379. events.datetimepicker(form);
  9380. events.faupload(form);
  9381. events.faselect(form);
  9382. events.fieldlist(form);
  9383. events.slider(form);
  9384. events.switcher(form);
  9385. events.tagsinput(form);
  9386. events.autocomplete(form);
  9387. events.favisible(form);
  9388. },
  9389. custom: {}
  9390. },
  9391. };
  9392. return Form;
  9393. });
  9394. /**
  9395. * FastAdmin通用搜索
  9396. *
  9397. * @author: pppscn <35696959@qq.com>
  9398. * @update 2017-05-07 <https://gitee.com/pp/fastadmin>
  9399. *
  9400. * @author: Karson <karson@fastadmin.net>
  9401. * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
  9402. */
  9403. !function ($) {
  9404. 'use strict';
  9405. var ColumnsForSearch = [];
  9406. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9407. var initCommonSearch = function (pColumns, that) {
  9408. var vFormCommon = createFormCommon(pColumns, that);
  9409. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  9410. vModal += vFormCommon;
  9411. vModal += "</div>";
  9412. that.$container.prepend($(vModal));
  9413. that.$commonsearch = $(".commonsearch-table", that.$container);
  9414. var form = $("form.form-commonsearch", that.$commonsearch);
  9415. require(['form'], function (Form) {
  9416. Form.api.bindevent(form);
  9417. form.validator("destroy");
  9418. });
  9419. // 表单提交
  9420. form.on("submit", function (event) {
  9421. event.preventDefault();
  9422. that.onCommonSearch();
  9423. return false;
  9424. });
  9425. // 重置搜索
  9426. form.on("click", "button[type=reset]", function (event) {
  9427. form[0].reset();
  9428. setTimeout(function () {
  9429. that.onCommonSearch();
  9430. }, 0);
  9431. });
  9432. };
  9433. var createFormCommon = function (pColumns, that) {
  9434. // 如果有使用模板则直接返回模板的内容
  9435. if (that.options.searchFormTemplate) {
  9436. return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
  9437. }
  9438. var htmlForm = [];
  9439. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
  9440. htmlForm.push('<fieldset>');
  9441. if (that.options.titleForm.length > 0)
  9442. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  9443. htmlForm.push('<div class="row">');
  9444. for (var i in pColumns) {
  9445. var vObjCol = pColumns[i];
  9446. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  9447. var query = Fast.api.query(vObjCol.field);
  9448. var operate = Fast.api.query(vObjCol.field + "-operate");
  9449. var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault);
  9450. vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  9451. vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
  9452. ColumnsForSearch.push(vObjCol);
  9453. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9454. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  9455. htmlForm.push('<div class="col-xs-8">');
  9456. vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
  9457. htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
  9458. var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
  9459. var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
  9460. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  9461. extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
  9462. extend = typeof vObjCol.autocomplete !== 'undefined' ? extend + ' autocomplete="' + (vObjCol.autocomplete === false || vObjCol.autocomplete === 'off' ? 'off' : 'on') + '"' : extend;
  9463. if (vObjCol.searchList) {
  9464. if (typeof vObjCol.searchList === 'function') {
  9465. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  9466. } else {
  9467. var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
  9468. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  9469. (function (vObjCol, that) {
  9470. $.when(vObjCol.searchList).done(function (ret) {
  9471. var searchList = [];
  9472. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  9473. searchList = ret.data.searchlist;
  9474. } else if (ret.constructor === Array || ret.constructor === Object) {
  9475. searchList = ret;
  9476. }
  9477. var optionList = createOptionList(searchList, vObjCol, that);
  9478. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join('')).trigger("change");
  9479. });
  9480. })(vObjCol, that);
  9481. } else {
  9482. optionList = createOptionList(vObjCol.searchList, vObjCol, that);
  9483. }
  9484. htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
  9485. }
  9486. } else {
  9487. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  9488. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  9489. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  9490. if (/BETWEEN$/.test(vObjCol.operate)) {
  9491. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  9492. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  9493. htmlForm.push('<div class="row row-between">');
  9494. htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s-min" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[0], placeholderArr[0], vObjCol.field, i, style, extend));
  9495. htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s-max" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[1], placeholderArr[1], vObjCol.field, i, style, extend));
  9496. htmlForm.push('</div>');
  9497. } else {
  9498. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s>', type, addClass, vObjCol.field, defaultValue, placeholder, vObjCol.field, i, style, extend));
  9499. }
  9500. }
  9501. htmlForm.push('</div>');
  9502. htmlForm.push('</div>');
  9503. }
  9504. }
  9505. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9506. htmlForm.push(createFormBtn(that).join(''));
  9507. htmlForm.push('</div>');
  9508. htmlForm.push('</div>');
  9509. htmlForm.push('</fieldset>');
  9510. htmlForm.push('</form>');
  9511. return htmlForm.join('');
  9512. };
  9513. var createFormBtn = function (that) {
  9514. var htmlBtn = [];
  9515. var searchSubmit = that.options.formatCommonSubmitButton();
  9516. var searchReset = that.options.formatCommonResetButton();
  9517. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  9518. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
  9519. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  9520. htmlBtn.push('</div>');
  9521. return htmlBtn;
  9522. };
  9523. var createOptionList = function (searchList, vObjCol, that) {
  9524. var isArray = searchList.constructor === Array;
  9525. var optionList = [];
  9526. optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  9527. $.each(searchList, function (key, value) {
  9528. if (value.constructor === Object) {
  9529. key = value.id;
  9530. value = value.name;
  9531. } else {
  9532. key = isArray ? value : key;
  9533. }
  9534. optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
  9535. });
  9536. return optionList;
  9537. };
  9538. var isSearchAvailble = function (that) {
  9539. //只支持服务端搜索
  9540. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  9541. return false;
  9542. }
  9543. return true;
  9544. };
  9545. var getSearchQuery = function (that, removeempty) {
  9546. var op = {};
  9547. var filter = {};
  9548. var value = '';
  9549. $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
  9550. var name = $(this).data("name");
  9551. var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
  9552. var obj = $("[name='" + name + "']", that.$commonsearch);
  9553. if (obj.size() == 0)
  9554. return true;
  9555. var vObjCol = ColumnsForSearch[i];
  9556. var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
  9557. if (obj.size() > 1) {
  9558. if (/BETWEEN$/.test(sym)) {
  9559. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
  9560. value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  9561. if (value_begin.length || value_end.length) {
  9562. if (process) {
  9563. value_begin = process(value_begin, 'begin');
  9564. value_end = process(value_end, 'end');
  9565. }
  9566. value = value_begin + ',' + value_end;
  9567. } else {
  9568. value = '';
  9569. }
  9570. //如果是时间筛选,将operate置为RANGE
  9571. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  9572. sym = 'RANGE';
  9573. }
  9574. } else {
  9575. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  9576. value = process ? process(value) : value;
  9577. }
  9578. } else {
  9579. value = process ? process(obj.val()) : obj.val();
  9580. }
  9581. if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
  9582. return true;
  9583. }
  9584. op[name] = sym;
  9585. filter[name] = value;
  9586. });
  9587. return {op: op, filter: filter};
  9588. };
  9589. var getQueryParams = function (params, searchQuery, removeempty) {
  9590. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  9591. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  9592. params.filter = $.extend({}, params.filter, searchQuery.filter);
  9593. params.op = $.extend({}, params.op, searchQuery.op);
  9594. //移除empty的值
  9595. if (removeempty) {
  9596. $.each(params.filter, function (i, j) {
  9597. if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
  9598. delete params.filter[i];
  9599. delete params.op[i];
  9600. }
  9601. });
  9602. }
  9603. params.filter = JSON.stringify(params.filter);
  9604. params.op = JSON.stringify(params.op);
  9605. return params;
  9606. };
  9607. $.extend($.fn.bootstrapTable.defaults, {
  9608. commonSearch: false,
  9609. titleForm: "Common search",
  9610. actionForm: "",
  9611. searchFormTemplate: "",
  9612. searchFormVisible: true,
  9613. searchClass: 'searchit',
  9614. showSearch: true,
  9615. renderDefault: true,
  9616. onCommonSearch: function (field, text) {
  9617. return false;
  9618. },
  9619. onPostCommonSearch: function (table) {
  9620. return false;
  9621. }
  9622. });
  9623. $.extend($.fn.bootstrapTable.defaults.icons, {
  9624. commonSearchIcon: 'glyphicon-search'
  9625. });
  9626. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  9627. 'common-search.bs.table': 'onCommonSearch',
  9628. 'post-common-search.bs.table': 'onPostCommonSearch'
  9629. });
  9630. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  9631. formatCommonSearch: function () {
  9632. return "Common search";
  9633. },
  9634. formatCommonSubmitButton: function () {
  9635. return "Submit";
  9636. },
  9637. formatCommonResetButton: function () {
  9638. return "Reset";
  9639. },
  9640. formatCommonCloseButton: function () {
  9641. return "Close";
  9642. },
  9643. formatCommonChoose: function () {
  9644. return "Choose";
  9645. }
  9646. });
  9647. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9648. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9649. _initHeader = BootstrapTable.prototype.initHeader,
  9650. _initToolbar = BootstrapTable.prototype.initToolbar,
  9651. _load = BootstrapTable.prototype.load,
  9652. _initSearch = BootstrapTable.prototype.initSearch;
  9653. BootstrapTable.prototype.initHeader = function () {
  9654. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  9655. this.$header.find('th[data-field]').each(function (i) {
  9656. var column = $(this).data();
  9657. if (typeof column['width'] !== 'undefined' && column['width'].toString().indexOf("%") === -1) {
  9658. $(".th-inner", this).outerWidth(column['width']);
  9659. $(this).css("max-width", column['width']);
  9660. }
  9661. });
  9662. this.options.stateField = this.header.stateField;
  9663. };
  9664. BootstrapTable.prototype.initToolbar = function () {
  9665. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  9666. if (!isSearchAvailble(this)) {
  9667. return;
  9668. }
  9669. var that = this,
  9670. html = [];
  9671. if (that.options.showSearch) {
  9672. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  9673. html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="commonSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatCommonSearch()));
  9674. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  9675. html.push('</button></div>');
  9676. }
  9677. if (that.$toolbar.find(".pull-right").size() > 0) {
  9678. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  9679. } else {
  9680. that.$toolbar.append(html.join(''));
  9681. }
  9682. initCommonSearch(that.columns, that);
  9683. that.$toolbar.find('button[name="commonSearch"]')
  9684. .off('click').on('click', function () {
  9685. that.$commonsearch.toggleClass("hidden");
  9686. return;
  9687. });
  9688. that.$container.on("click", "." + that.options.searchClass, function () {
  9689. var value = $(this).data("value");
  9690. var field = $(this).data("field");
  9691. var ul = that.$container.closest(".panel-intro").find("ul[data-field='" + field + "']");
  9692. if (ul.length > 0) {
  9693. $('li a[data-value="' + value + '"][data-toggle="tab"]', ul).trigger('click');
  9694. return;
  9695. }
  9696. var obj = $("form [name='" + field + "']", that.$commonsearch);
  9697. if (obj.size() > 0) {
  9698. if (obj.is("select")) {
  9699. $("option[value='" + value + "']", obj).prop("selected", true);
  9700. } else if (obj.size() > 1) {
  9701. $("form [name='" + field + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
  9702. } else {
  9703. obj.val(value + "");
  9704. }
  9705. obj.trigger("change");
  9706. $("form", that.$commonsearch).trigger("submit");
  9707. }
  9708. });
  9709. var queryParams = that.options.queryParams;
  9710. //匹配默认搜索值
  9711. this.options.queryParams = function (params) {
  9712. return queryParams(getQueryParams(params, getSearchQuery(that, true)));
  9713. };
  9714. this.trigger('post-common-search', that);
  9715. };
  9716. BootstrapTable.prototype.onCommonSearch = function () {
  9717. var searchQuery = getSearchQuery(this);
  9718. this.trigger('common-search', this, searchQuery);
  9719. this.options.pageNumber = 1;
  9720. //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
  9721. this.refresh({});
  9722. };
  9723. BootstrapTable.prototype.load = function (data) {
  9724. _load.apply(this, Array.prototype.slice.apply(arguments));
  9725. if (!isSearchAvailble(this)) {
  9726. return;
  9727. }
  9728. };
  9729. BootstrapTable.prototype.initSearch = function () {
  9730. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  9731. if (!isSearchAvailble(this)) {
  9732. return;
  9733. }
  9734. var that = this;
  9735. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  9736. this.data = fp ? $.grep(this.data, function (item, i) {
  9737. for (var key in fp) {
  9738. var fval = fp[key].toLowerCase();
  9739. var value = item[key];
  9740. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  9741. that.header.formatters[$.inArray(key, that.header.fields)],
  9742. [value, item, i], value);
  9743. if (!($.inArray(key, that.header.fields) !== -1 &&
  9744. (typeof value === 'string' || typeof value === 'number') &&
  9745. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  9746. return false;
  9747. }
  9748. }
  9749. return true;
  9750. }) : this.data;
  9751. };
  9752. }(jQuery);
  9753. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  9754. return function () {
  9755. var ret, fn;
  9756. return ret || global.$.fn.bootstrapTable.defaults;
  9757. };
  9758. }(this)));
  9759. /**
  9760. * 将BootstrapTable的行使用自定义的模板来渲染
  9761. *
  9762. * @author: karson
  9763. * @version: v0.0.1
  9764. *
  9765. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  9766. */
  9767. !function ($) {
  9768. 'use strict';
  9769. $.extend($.fn.bootstrapTable.defaults, {
  9770. //是否启用模板渲染
  9771. templateView: false,
  9772. //数据格式化的模板ID或格式函数
  9773. templateFormatter: "itemtpl",
  9774. //添加的父类的class
  9775. templateParentClass: "row row-flex",
  9776. //向table添加的class
  9777. templateTableClass: "table-template",
  9778. });
  9779. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9780. _initContainer = BootstrapTable.prototype.initContainer,
  9781. _initBody = BootstrapTable.prototype.initBody,
  9782. _initRow = BootstrapTable.prototype.initRow;
  9783. BootstrapTable.prototype.initContainer = function () {
  9784. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9785. var that = this;
  9786. if (!that.options.templateView) {
  9787. return;
  9788. }
  9789. that.options.cardView = true;
  9790. };
  9791. BootstrapTable.prototype.initBody = function () {
  9792. var that = this;
  9793. $.extend(that.options, {
  9794. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  9795. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  9796. });
  9797. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  9798. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9799. if (!that.options.templateView) {
  9800. return;
  9801. } else {
  9802. //由于Bootstrap是基于Table的,添加一个父类容器
  9803. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  9804. }
  9805. };
  9806. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  9807. var that = this;
  9808. //如果未启用则使用原生的initRow方法
  9809. if (!that.options.templateView) {
  9810. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  9811. }
  9812. var $content = '';
  9813. if (typeof that.options.templateFormatter === 'function') {
  9814. $content = that.options.templateFormatter.call(that, item, i, data);
  9815. } else {
  9816. var Template = require('template');
  9817. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  9818. }
  9819. return $content;
  9820. };
  9821. }(jQuery);
  9822. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  9823. return function () {
  9824. var ret, fn;
  9825. return ret || global.$.fn.bootstrapTable.defaults;
  9826. };
  9827. }(this)));
  9828. /**
  9829. * @author Jay <jwang@dizsoft.com>
  9830. */
  9831. (function ($) {
  9832. 'use strict';
  9833. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9834. $.extend($.fn.bootstrapTable.defaults, {
  9835. showJumpto: false,
  9836. exportOptions: {}
  9837. });
  9838. $.extend($.fn.bootstrapTable.locales, {
  9839. formatJumpto: function () {
  9840. return 'GO';
  9841. }
  9842. });
  9843. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9844. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9845. _initPagination = BootstrapTable.prototype.initPagination;
  9846. BootstrapTable.prototype.initPagination = function () {
  9847. this.showToolbar = this.options.showExport;
  9848. _initPagination.apply(this, Array.prototype.slice.apply(arguments));
  9849. if (this.options.showJumpto) {
  9850. var that = this,
  9851. $pageGroup = this.$pagination.find('ul.pagination'),
  9852. $jumpto = $pageGroup.find('li.jumpto');
  9853. if (!$jumpto.length) {
  9854. $jumpto = $([
  9855. '<li class="jumpto">',
  9856. '<input type="text" class="form-control">',
  9857. '<button class="btn' +
  9858. sprintf(' btn-%s', this.options.buttonsClass) +
  9859. sprintf(' btn-%s', this.options.iconSize) +
  9860. '" title="' + this.options.formatJumpto() + '" ' +
  9861. ' type="button">'+this.options.formatJumpto(),
  9862. '</button>',
  9863. '</li>'].join('')).appendTo($pageGroup);
  9864. $jumpto.find('button').click(function () {
  9865. that.selectPage(parseInt($jumpto.find('input').val()));
  9866. });
  9867. }
  9868. }
  9869. };
  9870. })(jQuery);
  9871. define("bootstrap-table-jumpto", ["bootstrap-table"], (function (global) {
  9872. return function () {
  9873. var ret, fn;
  9874. return ret || global.$.fn.bootstrapTable.defaults;
  9875. };
  9876. }(this)));
  9877. (function ($) {
  9878. 'use strict';
  9879. // Reasonable defaults
  9880. var PIXEL_STEP = 10;
  9881. var LINE_HEIGHT = 40;
  9882. var PAGE_HEIGHT = 800;
  9883. function normalizeWheel(event) {
  9884. var sX = 0; // spinX
  9885. var sY = 0; // spinY
  9886. var pX = 0; // pixelX
  9887. var pY = 0; // pixelY
  9888. // Legacy
  9889. if ('detail' in event) {
  9890. sY = event.detail;
  9891. }
  9892. if ('wheelDelta' in event) {
  9893. sY = -event.wheelDelta / 120;
  9894. }
  9895. if ('wheelDeltaY' in event) {
  9896. sY = -event.wheelDeltaY / 120;
  9897. }
  9898. if ('wheelDeltaX' in event) {
  9899. sX = -event.wheelDeltaX / 120;
  9900. }
  9901. // side scrolling on FF with DOMMouseScroll
  9902. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  9903. sX = sY;
  9904. sY = 0;
  9905. }
  9906. pX = sX * PIXEL_STEP;
  9907. pY = sY * PIXEL_STEP;
  9908. if ('deltaY' in event) {
  9909. pY = event.deltaY;
  9910. }
  9911. if ('deltaX' in event) {
  9912. pX = event.deltaX;
  9913. }
  9914. if ((pX || pY) && event.deltaMode) {
  9915. if (event.deltaMode === 1) {
  9916. // delta in LINE units
  9917. pX *= LINE_HEIGHT;
  9918. pY *= LINE_HEIGHT;
  9919. } else {
  9920. // delta in PAGE units
  9921. pX *= PAGE_HEIGHT;
  9922. pY *= PAGE_HEIGHT;
  9923. }
  9924. }
  9925. // Fall-back if spin cannot be determined
  9926. if (pX && !sX) {
  9927. sX = pX < 1 ? -1 : 1;
  9928. }
  9929. if (pY && !sY) {
  9930. sY = pY < 1 ? -1 : 1;
  9931. }
  9932. return {
  9933. spinX: sX,
  9934. spinY: sY,
  9935. pixelX: pX,
  9936. pixelY: pY
  9937. };
  9938. }
  9939. var cachedWidth = null;
  9940. var getScrollBarWidth = function getScrollBarWidth() {
  9941. if (cachedWidth === null) {
  9942. var inner = $('<p/>').addClass('fixed-table-scroll-inner'),
  9943. outer = $('<div/>').addClass('fixed-table-scroll-outer'),
  9944. w1 = void 0,
  9945. w2 = void 0;
  9946. outer.append(inner);
  9947. $('body').append(outer);
  9948. w1 = inner[0].offsetWidth;
  9949. outer.css('overflow', 'scroll');
  9950. w2 = inner[0].offsetWidth;
  9951. if (w1 === w2) {
  9952. w2 = outer[0].clientWidth;
  9953. }
  9954. outer.remove();
  9955. cachedWidth = w1 - w2;
  9956. }
  9957. return cachedWidth;
  9958. };
  9959. //获取原本表格体的滑块宽度
  9960. var getTableBodyScrollBarWidth = function getTableBodyScrollBarWidth(tableBody) {
  9961. return tableBody[0].scrollHeight > tableBody[0].clientHeight ? 15 : 0;
  9962. };
  9963. $.extend($.fn.bootstrapTable.defaults, {
  9964. fixedColumns: false,
  9965. fixedNumber: 0,
  9966. fixedRightNumber: 0
  9967. });
  9968. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9969. _initBody = BootstrapTable.prototype.initBody,
  9970. _initContainer = BootstrapTable.prototype.initContainer,
  9971. _trigger = BootstrapTable.prototype.trigger,
  9972. _hideLoading = BootstrapTable.prototype.hideLoading,
  9973. _updateSelected = BootstrapTable.prototype.updateSelected;
  9974. BootstrapTable.prototype.fixedColumnsSupported = function () {
  9975. var that = this;
  9976. return that.options.fixedColumns && !that.options.detailView && !that.options.cardView;
  9977. };
  9978. BootstrapTable.prototype.initFixedContainer = function () {
  9979. if (!this.fixedColumnsSupported()) {
  9980. return;
  9981. }
  9982. if (this.options.fixedNumber) {
  9983. this.$tableContainer.find('.fixed-columns').size() == 0 && this.$tableContainer.append('<div class="fixed-columns"></div>');
  9984. this.$fixedColumns = this.$tableContainer.find('.fixed-columns');
  9985. }
  9986. if (this.options.fixedRightNumber) {
  9987. this.$tableContainer.find('.fixed-columns-right').size() == 0 && this.$tableContainer.append('<div class="fixed-columns-right"></div>');
  9988. this.$fixedColumnsRight = this.$tableContainer.find('.fixed-columns-right');
  9989. }
  9990. };
  9991. BootstrapTable.prototype.initContainer = function () {
  9992. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9993. this.initFixedContainer();
  9994. };
  9995. BootstrapTable.prototype.initBody = function () {
  9996. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9997. if (!this.fixedColumnsSupported()) {
  9998. return;
  9999. }
  10000. if (this.options.showHeader && this.options.height) {
  10001. return;
  10002. }
  10003. this.initFixedColumnsBody();
  10004. this.initFixedColumnsEvents();
  10005. };
  10006. BootstrapTable.prototype.trigger = function () {
  10007. var that = this;
  10008. _trigger.apply(this, Array.prototype.slice.apply(arguments));
  10009. if (arguments[0] === 'pre-body') {
  10010. //如果上来就是cardView 设置表格高度为auto
  10011. if (this.options.cardView) {
  10012. this.$tableBody.css("height", "auto");
  10013. }
  10014. }
  10015. //监听cardView 显示/隐藏fixed部分
  10016. if (arguments[0] === 'toggle') {
  10017. if (arguments[1]) {
  10018. this.$tableBody.css("height", "auto");
  10019. this.$fixedColumns && this.$fixedColumns.hide();
  10020. this.$fixedColumnsRight && this.$fixedColumnsRight.hide();
  10021. } else {
  10022. this.$tableBody.css("height", "100%");
  10023. this.$fixedColumns && this.$fixedColumns.show();
  10024. this.$fixedColumnsRight && this.$fixedColumnsRight.show();
  10025. this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
  10026. this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
  10027. }
  10028. }
  10029. if (!that.fixedColumnsSupported()) {
  10030. return;
  10031. }
  10032. if (arguments[0] === 'post-header') {
  10033. this.initFixedColumnsHeader();
  10034. } else if (arguments[0] === 'scroll-body') {
  10035. if (this.needFixedColumns && this.options.fixedNumber) {
  10036. this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
  10037. }
  10038. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10039. this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
  10040. }
  10041. } else if (arguments[0] === 'load-success') {
  10042. this.hideLoading();
  10043. }
  10044. };
  10045. BootstrapTable.prototype.updateSelected = function () {
  10046. var that = this;
  10047. _updateSelected.apply(this, Array.prototype.slice.apply(arguments));
  10048. if (!this.fixedColumnsSupported()) {
  10049. return;
  10050. }
  10051. this.$tableBody.find('tr').each(function (i, el) {
  10052. var $el = $(el);
  10053. var index = $el.data('index');
  10054. var classes = $el.attr('class');
  10055. var inputSelector = '[name="' + that.options.selectItemName + '"]';
  10056. var $input = $el.find(inputSelector);
  10057. if (typeof index === 'undefined') {
  10058. return;
  10059. }
  10060. var updateFixedBody = function updateFixedBody($fixedHeader, $fixedBody) {
  10061. var $tr = $fixedBody.find('tr[data-index="' + index + '"]');
  10062. $tr.attr('class', classes);
  10063. if ($input.length) {
  10064. $tr.find(inputSelector).prop('checked', $input.prop('checked'));
  10065. }
  10066. if (that.$selectAll.length) {
  10067. $fixedHeader.add($fixedBody).find('[name="btSelectAll"]').prop('checked', that.$selectAll.prop('checked'));
  10068. }
  10069. };
  10070. if (that.$fixedBody && that.options.fixedNumber) {
  10071. updateFixedBody(that.$fixedHeader, that.$fixedBody);
  10072. }
  10073. if (that.$fixedBodyRight && that.options.fixedRightNumber) {
  10074. updateFixedBody(that.$fixedHeaderRight, that.$fixedBodyRight);
  10075. }
  10076. });
  10077. };
  10078. BootstrapTable.prototype.hideLoading = function () {
  10079. _hideLoading.apply(this, Array.prototype.slice.apply(arguments));
  10080. if (this.needFixedColumns && this.options.fixedNumber) {
  10081. this.$fixedColumns.find('.fixed-table-loading').hide();
  10082. }
  10083. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10084. this.$fixedColumnsRight.find('.fixed-table-loading').hide();
  10085. }
  10086. };
  10087. BootstrapTable.prototype.initFixedColumnsHeader = function () {
  10088. var that = this;
  10089. if (this.options.height) {
  10090. this.needFixedColumns = this.$tableHeader.outerWidth(true) < this.$tableHeader.find('table').outerWidth(true);
  10091. } else {
  10092. this.needFixedColumns = this.$tableBody.outerWidth(true) < this.$tableBody.find('table').outerWidth(true);
  10093. }
  10094. var initFixedHeader = function initFixedHeader($fixedColumns, isRight) {
  10095. $fixedColumns.find('.fixed-table-header').remove();
  10096. $fixedColumns.append(that.$tableHeader.clone(true));
  10097. $fixedColumns.find('.fixed-table-header').css('margin-right', "");
  10098. $fixedColumns.css({
  10099. width: that.getFixedColumnsWidth(isRight)
  10100. });
  10101. return $fixedColumns.find('.fixed-table-header');
  10102. };
  10103. if (this.needFixedColumns && this.options.fixedNumber) {
  10104. this.$fixedHeader = initFixedHeader(this.$fixedColumns);
  10105. this.$fixedHeader.css('margin-right', '');
  10106. } else if (this.$fixedColumns) {
  10107. this.$fixedColumns.html('').css('width', '');
  10108. }
  10109. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10110. this.$fixedHeaderRight = initFixedHeader(this.$fixedColumnsRight, true);
  10111. this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find('table').width());
  10112. } else if (this.$fixedColumnsRight) {
  10113. this.$fixedColumnsRight.html('').css('width', '');
  10114. }
  10115. this.initFixedColumnsBody();
  10116. this.initFixedColumnsEvents();
  10117. };
  10118. BootstrapTable.prototype.initFixedColumnsBody = function () {
  10119. var that = this;
  10120. var initFixedBody = function initFixedBody($fixedColumns, $fixedHeader) {
  10121. $fixedColumns.find('.fixed-table-body').remove();
  10122. $fixedColumns.append(that.$tableBody.clone(true));
  10123. var $fixedBody = $fixedColumns.find('.fixed-table-body');
  10124. var tableBody = that.$tableBody.get(0);
  10125. var scrollHeight = tableBody.scrollWidth > tableBody.clientWidth ? getScrollBarWidth() : 0;
  10126. var paginationHeight = $(".fixed-table-pagination").height();
  10127. if (typeof that.options.height !== 'undefined') paginationHeight = 0;
  10128. var height = that.$tableContainer.outerHeight(true) - scrollHeight - paginationHeight + 1;
  10129. $fixedColumns.css({
  10130. height: height,
  10131. "min-height": "calc(100% - " + (paginationHeight + scrollHeight) + "px)"
  10132. });
  10133. $fixedBody.css({
  10134. height: height - $fixedHeader.height(),
  10135. "min-height": "calc(100% - " + $fixedHeader.height() + "px)",
  10136. overflow: "hidden"
  10137. });
  10138. return $fixedBody;
  10139. };
  10140. if (this.needFixedColumns && this.options.fixedNumber) {
  10141. this.$fixedBody = initFixedBody(this.$fixedColumns, this.$fixedHeader);
  10142. }
  10143. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10144. this.$fixedBodyRight = initFixedBody(this.$fixedColumnsRight, this.$fixedHeaderRight);
  10145. this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find('table').width());
  10146. this.$fixedBodyRight.css('overflow-y', 'hidden');
  10147. }
  10148. };
  10149. BootstrapTable.prototype.getFixedColumnsWidth = function (isRight) {
  10150. var visibleFields = this.getVisibleFields();
  10151. var width = 0;
  10152. var fixedNumber = this.options.fixedNumber;
  10153. var marginRight = 0;
  10154. if (isRight) {
  10155. visibleFields = visibleFields.reverse();
  10156. fixedNumber = this.options.fixedRightNumber;
  10157. //右侧固定列距离
  10158. this.$fixedColumnsRight.css('right', getTableBodyScrollBarWidth(this.$tableBody));
  10159. }
  10160. for (var i = 0; i < fixedNumber; i++) {
  10161. width += this.$header.find('th[data-field="' + visibleFields[i] + '"]').outerWidth();
  10162. }
  10163. return width + 1;
  10164. };
  10165. BootstrapTable.prototype.initFixedColumnsEvents = function () {
  10166. var that = this;
  10167. var toggleHover = function toggleHover(e, toggle) {
  10168. var tr = 'tr[data-index="' + $(e.currentTarget).data('index') + '"]';
  10169. var $trs = that.$tableBody.find(tr);
  10170. if (that.$fixedBody) {
  10171. $trs = $trs.add(that.$fixedBody.find(tr));
  10172. }
  10173. if (that.$fixedBodyRight) {
  10174. $trs = $trs.add(that.$fixedBodyRight.find(tr));
  10175. }
  10176. $trs.css('background-color', toggle ? $(e.currentTarget).css('background-color') : '');
  10177. };
  10178. this.$tableBody.find('tr').hover(function (e) {
  10179. toggleHover(e, true);
  10180. }, function (e) {
  10181. toggleHover(e, false);
  10182. });
  10183. var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  10184. var mousewheel = isFirefox ? 'DOMMouseScroll' : 'mousewheel';
  10185. var updateScroll = function updateScroll(e, fixedBody) {
  10186. var normalized = normalizeWheel(e);
  10187. var deltaY = Math.ceil(normalized.pixelY);
  10188. var top = that.$tableBody.scrollTop() + deltaY;
  10189. if (deltaY < 0 && top > 0 || deltaY > 0 && top < fixedBody.scrollHeight - fixedBody.clientHeight) {
  10190. e.preventDefault();
  10191. }
  10192. that.$tableBody.scrollTop(top);
  10193. if (that.$fixedBody) {
  10194. that.$fixedBody.scrollTop(top);
  10195. }
  10196. if (that.$fixedBodyRight) {
  10197. that.$fixedBodyRight.scrollTop(top);
  10198. }
  10199. };
  10200. if (this.needFixedColumns && this.options.fixedNumber) {
  10201. this.$fixedBody.find('tr').hover(function (e) {
  10202. toggleHover(e, true);
  10203. }, function (e) {
  10204. toggleHover(e, false);
  10205. });
  10206. this.$fixedBody[0].addEventListener(mousewheel, function (e) {
  10207. //给鼠标滑轮绑定事件
  10208. updateScroll(e, that.$fixedBody[0]);
  10209. });
  10210. //给固定表格的checkbox绑定事件
  10211. this.$fixedBody.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10212. e.stopImmediatePropagation();
  10213. var index = $(e.target).data("index");
  10214. $(that.$selectItem[index]).trigger("click");
  10215. });
  10216. //绑定TD点击事件
  10217. this.$fixedBody.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10218. var index = $(this).closest("tr[data-index]").data("index");
  10219. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10220. });
  10221. }
  10222. //给原本表格绑定scroll事件
  10223. $('div.fixed-table-body').off('scroll'); //给所有的body解绑 scroll
  10224. this.$tableBody.off('scroll').on('scroll', function (e) {
  10225. that.$tableHeader.scrollLeft(0);
  10226. if (that.$tableBody.scrollLeft() > 0) {
  10227. that.$tableHeader.scrollLeft(that.$tableBody.scrollLeft());
  10228. if (that.options.showFooter && !that.options.cardView) {
  10229. that.$tableFooter.scrollLeft(that.$tableBody.scrollLeft());
  10230. }
  10231. }
  10232. var top = that.$tableBody.scrollTop();
  10233. if (that.$fixedBody) {
  10234. that.$fixedBody.scrollTop(top);
  10235. }
  10236. if (that.$fixedBodyRight) {
  10237. that.$fixedBodyRight.scrollTop(top);
  10238. }
  10239. });
  10240. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10241. this.$fixedBodyRight.find('tr').hover(function (e) {
  10242. toggleHover(e, true);
  10243. }, function (e) {
  10244. toggleHover(e, false);
  10245. });
  10246. this.$fixedBodyRight[0].addEventListener(mousewheel, function (e) {
  10247. //给鼠标滑轮绑定事件
  10248. updateScroll(e, that.$fixedBodyRight[0]);
  10249. });
  10250. //给固定表格的checkbox绑定事件
  10251. this.$fixedBodyRight.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10252. e.stopImmediatePropagation();
  10253. var index = $(e.target).data("index");
  10254. $(that.$selectItem[index]).trigger("click");
  10255. });
  10256. //绑定TD点击事件
  10257. this.$fixedBodyRight.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10258. var index = $(this).closest("tr[data-index]").data("index");
  10259. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10260. });
  10261. }
  10262. if (this.options.filterControl) {
  10263. $(this.$fixedColumns).off('keyup change').on('keyup change', function (e) {
  10264. var $target = $(e.target);
  10265. var value = $target.val();
  10266. var field = $target.parents('th').data('field');
  10267. var $coreTh = that.$header.find('th[data-field="' + field + '"]');
  10268. if ($target.is('input')) {
  10269. $coreTh.find('input').val(value);
  10270. } else if ($target.is('select')) {
  10271. var $select = $coreTh.find('select');
  10272. $select.find('option[selected]').removeAttr('selected');
  10273. $select.find('option[value="' + value + '"]').attr('selected', true);
  10274. }
  10275. that.triggerSearch();
  10276. });
  10277. }
  10278. };
  10279. })(jQuery);
  10280. define("bootstrap-table-fixed-columns", ["bootstrap-table"], (function (global) {
  10281. return function () {
  10282. var ret, fn;
  10283. return ret || global.$.fn.bootstrapTable.defaults;
  10284. };
  10285. }(this)));
  10286. define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template', 'bootstrap-table-jumpto', 'bootstrap-table-fixed-columns'], function ($, undefined, Moment) {
  10287. var Table = {
  10288. list: {},
  10289. // Bootstrap-table 基础配置
  10290. defaults: {
  10291. url: '',
  10292. sidePagination: 'server',
  10293. method: 'get', //请求方法
  10294. toolbar: ".toolbar", //工具栏
  10295. search: true, //是否启用快速搜索
  10296. cache: false,
  10297. commonSearch: true, //是否启用通用搜索
  10298. searchFormVisible: false, //是否始终显示搜索表单
  10299. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  10300. idTable: 'commonTable',
  10301. showExport: true,
  10302. exportDataType: "auto",
  10303. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  10304. exportOptions: {
  10305. fileName: 'export_' + Moment().format("YYYY-MM-DD"),
  10306. preventInjection: false,
  10307. mso: {
  10308. onMsoNumberFormat: function (cell, row, col) {
  10309. return !isNaN($(cell).text()) ? '\\@' : '';
  10310. },
  10311. },
  10312. ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
  10313. },
  10314. pageSize: localStorage.getItem("pagesize") || 10,
  10315. pageList: [10, 15, 20, 25, 50, 'All'],
  10316. pagination: true,
  10317. clickToSelect: true, //是否启用点击选中
  10318. dblClickToEdit: true, //是否启用双击编辑
  10319. singleSelect: false, //是否启用单选
  10320. showRefresh: false,
  10321. showJumpto: true,
  10322. locale: Config.language == 'zh-cn' ? 'zh-CN' : 'en-US',
  10323. showToggle: true,
  10324. showColumns: true,
  10325. pk: 'id',
  10326. sortName: 'id',
  10327. sortOrder: 'desc',
  10328. paginationFirstText: __("First"),
  10329. paginationPreText: __("Previous"),
  10330. paginationNextText: __("Next"),
  10331. paginationLastText: __("Last"),
  10332. cardView: false, //卡片视图
  10333. iosCardView: true, //ios卡片视图
  10334. checkOnInit: true, //是否在初始化时判断
  10335. escape: true, //是否对内容进行转义
  10336. fixDropdownPosition: true, //是否修复下拉的定位
  10337. selectedIds: [],
  10338. selectedData: [],
  10339. extend: {
  10340. index_url: '',
  10341. add_url: '',
  10342. edit_url: '',
  10343. del_url: '',
  10344. import_url: '',
  10345. multi_url: '',
  10346. dragsort_url: 'ajax/weigh',
  10347. }
  10348. },
  10349. // Bootstrap-table 列配置
  10350. columnDefaults: {
  10351. align: 'center',
  10352. valign: 'middle',
  10353. },
  10354. config: {
  10355. checkboxtd: 'tbody>tr>td.bs-checkbox',
  10356. toolbar: '.toolbar',
  10357. refreshbtn: '.btn-refresh',
  10358. addbtn: '.btn-add',
  10359. editbtn: '.btn-edit',
  10360. delbtn: '.btn-del',
  10361. importbtn: '.btn-import',
  10362. multibtn: '.btn-multi',
  10363. disabledbtn: '.btn-disabled',
  10364. editonebtn: '.btn-editone',
  10365. restoreonebtn: '.btn-restoreone',
  10366. destroyonebtn: '.btn-destroyone',
  10367. restoreallbtn: '.btn-restoreall',
  10368. destroyallbtn: '.btn-destroyall',
  10369. dragsortfield: 'weigh',
  10370. },
  10371. button: {
  10372. edit: {
  10373. name: 'edit',
  10374. icon: 'fa fa-pencil',
  10375. title: __('Edit'),
  10376. extend: 'data-toggle="tooltip"',
  10377. classname: 'btn btn-xs btn-success btn-editone'
  10378. },
  10379. del: {
  10380. name: 'del',
  10381. icon: 'fa fa-trash',
  10382. title: __('Del'),
  10383. extend: 'data-toggle="tooltip"',
  10384. classname: 'btn btn-xs btn-danger btn-delone'
  10385. },
  10386. dragsort: {
  10387. name: 'dragsort',
  10388. icon: 'fa fa-arrows',
  10389. title: __('Drag to sort'),
  10390. extend: 'data-toggle="tooltip"',
  10391. classname: 'btn btn-xs btn-primary btn-dragsort'
  10392. }
  10393. },
  10394. api: {
  10395. init: function (defaults, columnDefaults, locales) {
  10396. defaults = defaults ? defaults : {};
  10397. columnDefaults = columnDefaults ? columnDefaults : {};
  10398. locales = locales ? locales : {};
  10399. $.fn.bootstrapTable.Constructor.prototype.getSelectItem = function () {
  10400. return this.$selectItem;
  10401. };
  10402. // 写入bootstrap-table默认配置
  10403. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  10404. // 写入bootstrap-table column配置
  10405. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  10406. // 写入bootstrap-table locale配置
  10407. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  10408. formatCommonSearch: function () {
  10409. return __('Common search');
  10410. },
  10411. formatCommonSubmitButton: function () {
  10412. return __('Submit');
  10413. },
  10414. formatCommonResetButton: function () {
  10415. return __('Reset');
  10416. },
  10417. formatCommonCloseButton: function () {
  10418. return __('Close');
  10419. },
  10420. formatCommonChoose: function () {
  10421. return __('Choose');
  10422. },
  10423. formatJumpto: function () {
  10424. return __('Go');
  10425. }
  10426. }, locales);
  10427. // 如果是iOS设备则判断是否启用卡片视图
  10428. if ($.fn.bootstrapTable.defaults.iosCardView && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  10429. Table.defaults.cardView = true;
  10430. $.fn.bootstrapTable.defaults.cardView = true;
  10431. }
  10432. if (typeof defaults.exportTypes != 'undefined') {
  10433. $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
  10434. }
  10435. },
  10436. // 绑定事件
  10437. bindevent: function (table) {
  10438. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  10439. var parenttable = table.closest('.bootstrap-table');
  10440. //Bootstrap-table配置
  10441. var options = table.bootstrapTable('getOptions');
  10442. //Bootstrap操作区
  10443. var toolbar = $(options.toolbar, parenttable);
  10444. //跨页提示按钮
  10445. var tipsBtn = $(".btn-selected-tips", parenttable);
  10446. if (tipsBtn.size() === 0) {
  10447. tipsBtn = $('<a href="javascript:" class="btn btn-warning-light btn-selected-tips hide" data-animation="false" data-toggle="tooltip" data-title="' + __("Click to uncheck all") + '"><i class="fa fa-info-circle"></i> ' + __("Multiple selection mode: %s checked", "<b>0</b>") + '</a>').appendTo(toolbar);
  10448. }
  10449. //点击提示按钮
  10450. tipsBtn.off("click").on("click", function (e) {
  10451. table.trigger("uncheckbox");
  10452. table.bootstrapTable("refresh");
  10453. });
  10454. //当刷新表格时
  10455. table.on('uncheckbox', function (status, res, e) {
  10456. options.selectedIds = [];
  10457. options.selectedData = [];
  10458. tipsBtn.tooltip('hide');
  10459. tipsBtn.addClass('hide');
  10460. });
  10461. //表格加载出错时
  10462. table.on('load-error.bs.table', function (status, res, e) {
  10463. if (e.status === 0) {
  10464. return;
  10465. }
  10466. Toastr.error(__('Unknown data format'));
  10467. });
  10468. //当加载数据成功时
  10469. table.on('load-success.bs.table', function (e, data) {
  10470. if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  10471. Toastr.error(data.msg);
  10472. }
  10473. });
  10474. //当刷新表格时
  10475. table.on('refresh.bs.table', function (e, settings, data) {
  10476. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  10477. });
  10478. //当表格分页变更时
  10479. table.on('page-change.bs.table', function (e, page, pagesize) {
  10480. if (!isNaN(pagesize)) {
  10481. localStorage.setItem("pagesize", pagesize);
  10482. }
  10483. });
  10484. //当执行搜索时
  10485. table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
  10486. table.trigger("uncheckbox");
  10487. });
  10488. if (options.dblClickToEdit) {
  10489. //当双击单元格时
  10490. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  10491. $(Table.config.editonebtn, element).trigger("click");
  10492. });
  10493. }
  10494. //渲染内容前
  10495. table.on('pre-body.bs.table', function (e, data) {
  10496. if (options.maintainSelected) {
  10497. $.each(data, function (i, row) {
  10498. row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
  10499. });
  10500. }
  10501. });
  10502. //当内容渲染完成后
  10503. table.on('post-body.bs.table', function (e, data) {
  10504. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  10505. if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").size() > 0) {
  10506. // 拖拽选择,需要重新绑定事件
  10507. require(['drag', 'drop'], function () {
  10508. var checkboxtd = $(Table.config.checkboxtd, table);
  10509. checkboxtd.drag("start", function (ev, dd) {
  10510. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  10511. }).drag(function (ev, dd) {
  10512. $(dd.proxy).css({
  10513. top: Math.min(ev.pageY, dd.startY),
  10514. left: Math.min(ev.pageX, dd.startX),
  10515. height: Math.abs(ev.pageY - dd.startY),
  10516. width: Math.abs(ev.pageX - dd.startX)
  10517. });
  10518. }).drag("end", function (ev, dd) {
  10519. $(dd.proxy).remove();
  10520. });
  10521. checkboxtd.drop("start", function () {
  10522. Table.api.toggleattr(this);
  10523. }).drop(function () {
  10524. // Table.api.toggleattr(this);
  10525. }).drop("end", function (e) {
  10526. var that = this;
  10527. setTimeout(function () {
  10528. if (e.type === 'mousemove') {
  10529. Table.api.toggleattr(that);
  10530. }
  10531. }, 0);
  10532. });
  10533. $.drop({
  10534. multi: true
  10535. });
  10536. });
  10537. }
  10538. });
  10539. var exportDataType = options.exportDataType;
  10540. // 处理选中筛选框后按钮的状态统一变更
  10541. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) {
  10542. var allIds = [];
  10543. $.each(table.bootstrapTable("getData"), function (i, item) {
  10544. allIds.push(typeof item[options.pk] != 'undefined' ? item[options.pk] : '');
  10545. });
  10546. var selectedIds = Table.api.selectedids(table, true),
  10547. selectedData = Table.api.selecteddata(table, true);
  10548. //开启分页checkbox分页记忆
  10549. if (options.maintainSelected) {
  10550. options.selectedIds = options.selectedIds.filter(function (element, index, self) {
  10551. return $.inArray(element, allIds) === -1;
  10552. }).concat(selectedIds);
  10553. options.selectedData = options.selectedData.filter(function (element, index, self) {
  10554. return $.inArray(element[options.pk], allIds) === -1;
  10555. }).concat(selectedData);
  10556. if (options.selectedIds.length > selectedIds.length) {
  10557. $("b", tipsBtn).text(options.selectedIds.length);
  10558. tipsBtn.removeClass('hide');
  10559. } else {
  10560. tipsBtn.addClass('hide');
  10561. }
  10562. } else {
  10563. options.selectedIds = selectedIds;
  10564. options.selectedData = selectedData;
  10565. }
  10566. //如果导出类型为auto时则自动判断
  10567. if (exportDataType === 'auto') {
  10568. options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
  10569. }
  10570. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
  10571. });
  10572. // 绑定TAB事件
  10573. $('.panel-heading [data-field] a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
  10574. var field = $(this).closest("[data-field]").data("field");
  10575. var value = $(this).data("value");
  10576. var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
  10577. if (object.prop('tagName') == "SELECT") {
  10578. $("option[value='" + value + "']", object).prop("selected", true);
  10579. } else {
  10580. object.val(value);
  10581. }
  10582. table.trigger("uncheckbox");
  10583. table.bootstrapTable('refresh', {pageNumber: 1});
  10584. return false;
  10585. });
  10586. // 修复重置事件
  10587. $("form", table.closest(".bootstrap-table").find(".commonsearch-table")).on('reset', function () {
  10588. setTimeout(function () {
  10589. // $('.panel-heading [data-field] li.active a[data-toggle="tab"]').trigger('shown.bs.tab');
  10590. }, 0);
  10591. $('.panel-heading [data-field] li', table.closest(".panel-intro")).removeClass('active');
  10592. $('.panel-heading [data-field] li:first', table.closest(".panel-intro")).addClass('active');
  10593. });
  10594. // 刷新按钮事件
  10595. toolbar.on('click', Table.config.refreshbtn, function () {
  10596. table.bootstrapTable('refresh');
  10597. });
  10598. // 添加按钮事件
  10599. toolbar.on('click', Table.config.addbtn, function () {
  10600. var ids = Table.api.selectedids(table);
  10601. var url = options.extend.add_url;
  10602. if (url.indexOf("{ids}") !== -1) {
  10603. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  10604. }
  10605. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Add'), $(this).data() || {});
  10606. });
  10607. // 导入按钮事件
  10608. if ($(Table.config.importbtn, toolbar).size() > 0) {
  10609. require(['upload'], function (Upload) {
  10610. Upload.api.upload($(Table.config.importbtn, toolbar), function (data, ret) {
  10611. Fast.api.ajax({
  10612. url: options.extend.import_url,
  10613. data: {file: data.url},
  10614. }, function (data, ret) {
  10615. table.trigger("uncheckbox");
  10616. table.bootstrapTable('refresh');
  10617. });
  10618. });
  10619. });
  10620. }
  10621. // 批量编辑按钮事件
  10622. toolbar.on('click', Table.config.editbtn, function () {
  10623. var that = this;
  10624. var ids = Table.api.selectedids(table);
  10625. if (ids.length > 10) {
  10626. return;
  10627. }
  10628. var title = $(that).data('title') || $(that).attr("title") || __('Edit');
  10629. var data = $(that).data() || {};
  10630. delete data.title;
  10631. //循环弹出多个编辑框
  10632. $.each(Table.api.selecteddata(table), function (index, row) {
  10633. var url = options.extend.edit_url;
  10634. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  10635. url = Table.api.replaceurl(url, row, table);
  10636. Fast.api.open(url, typeof title === 'function' ? title.call(table, row) : title, data);
  10637. });
  10638. });
  10639. //清空回收站
  10640. $(document).on('click', Table.config.destroyallbtn, function () {
  10641. var that = this;
  10642. Layer.confirm(__('Are you sure you want to truncate?'), function () {
  10643. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10644. Fast.api.ajax(url, function () {
  10645. Layer.closeAll();
  10646. table.trigger("uncheckbox");
  10647. table.bootstrapTable('refresh');
  10648. }, function () {
  10649. Layer.closeAll();
  10650. });
  10651. });
  10652. return false;
  10653. });
  10654. //全部还原
  10655. $(document).on('click', Table.config.restoreallbtn, function () {
  10656. var that = this;
  10657. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10658. Fast.api.ajax(url, function () {
  10659. Layer.closeAll();
  10660. table.trigger("uncheckbox");
  10661. table.bootstrapTable('refresh');
  10662. }, function () {
  10663. Layer.closeAll();
  10664. });
  10665. return false;
  10666. });
  10667. //销毁或删除
  10668. $(document).on('click', Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () {
  10669. var that = this;
  10670. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10671. var row = Fast.api.getrowbyindex(table, $(that).data("row-index"));
  10672. Fast.api.ajax({
  10673. url: url,
  10674. data: {ids: row[options.pk]}
  10675. }, function () {
  10676. table.trigger("uncheckbox");
  10677. table.bootstrapTable('refresh');
  10678. });
  10679. return false;
  10680. });
  10681. // 批量操作按钮事件
  10682. toolbar.on('click', Table.config.multibtn, function () {
  10683. var ids = Table.api.selectedids(table);
  10684. Table.api.multi($(this).data("action"), ids, table, this);
  10685. });
  10686. // 批量删除按钮事件
  10687. toolbar.on('click', Table.config.delbtn, function () {
  10688. var that = this;
  10689. var ids = Table.api.selectedids(table);
  10690. Layer.confirm(
  10691. __('Are you sure you want to delete the %s selected item?', ids.length),
  10692. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10693. function (index) {
  10694. Table.api.multi("del", ids, table, that);
  10695. Layer.close(index);
  10696. }
  10697. );
  10698. });
  10699. // 拖拽排序
  10700. require(['dragsort'], function () {
  10701. //绑定拖动排序
  10702. $("tbody", table).dragsort({
  10703. itemSelector: 'tr:visible',
  10704. dragSelector: "a.btn-dragsort",
  10705. dragEnd: function (a, b) {
  10706. var element = $("a.btn-dragsort", this);
  10707. var data = table.bootstrapTable('getData');
  10708. var current = data[parseInt($(this).data("index"))];
  10709. var options = table.bootstrapTable('getOptions');
  10710. //改变的值和改变的ID集合
  10711. var ids = $.map($("tbody tr:visible", table), function (tr) {
  10712. return data[parseInt($(tr).data("index"))][options.pk];
  10713. });
  10714. var changeid = current[options.pk];
  10715. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  10716. var params = {
  10717. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  10718. data: {
  10719. ids: ids.join(','),
  10720. changeid: changeid,
  10721. pid: pid,
  10722. field: Table.config.dragsortfield,
  10723. orderway: options.sortOrder,
  10724. table: options.extend.table,
  10725. pk: options.pk
  10726. }
  10727. };
  10728. Fast.api.ajax(params, function (data, ret) {
  10729. var success = $(element).data("success") || $.noop;
  10730. if (typeof success === 'function') {
  10731. if (false === success.call(element, data, ret)) {
  10732. return false;
  10733. }
  10734. }
  10735. table.bootstrapTable('refresh');
  10736. }, function (data, ret) {
  10737. var error = $(element).data("error") || $.noop;
  10738. if (typeof error === 'function') {
  10739. if (false === error.call(element, data, ret)) {
  10740. return false;
  10741. }
  10742. }
  10743. table.bootstrapTable('refresh');
  10744. });
  10745. },
  10746. placeHolderTemplate: ""
  10747. });
  10748. });
  10749. table.on("click", "input[data-id][name='checkbox']", function (e) {
  10750. var ids = $(this).data("id");
  10751. table.bootstrapTable($(this).prop("checked") ? 'checkBy' : 'uncheckBy', {field: options.pk, values: [ids]});
  10752. });
  10753. table.on("click", "[data-id].btn-change", function (e) {
  10754. e.preventDefault();
  10755. var changer = $.proxy(function () {
  10756. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  10757. }, this);
  10758. if (typeof $(this).data("confirm") !== 'undefined') {
  10759. Layer.confirm($(this).data("confirm"), function (index) {
  10760. changer();
  10761. Layer.close(index);
  10762. });
  10763. } else {
  10764. changer();
  10765. }
  10766. });
  10767. table.on("click", "[data-id].btn-edit", function (e) {
  10768. e.preventDefault();
  10769. var ids = $(this).data("id");
  10770. var row = Table.api.getrowbyid(table, ids);
  10771. row.ids = ids;
  10772. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  10773. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10774. });
  10775. table.on("click", "[data-id].btn-del", function (e) {
  10776. e.preventDefault();
  10777. var id = $(this).data("id");
  10778. var that = this;
  10779. Layer.confirm(
  10780. __('Are you sure you want to delete this item?'),
  10781. {icon: 3, title: __('Warning'), shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10782. function (index) {
  10783. Table.api.multi("del", id, table, that);
  10784. Layer.close(index);
  10785. }
  10786. );
  10787. });
  10788. //修复dropdown定位溢出的情况
  10789. if (options.fixDropdownPosition) {
  10790. var tableBody = table.closest(".fixed-table-body");
  10791. table.on('show.bs.dropdown fa.event.refreshdropdown', ".btn-group", function (e) {
  10792. var dropdownMenu = $(".dropdown-menu", this);
  10793. var btnGroup = $(this);
  10794. var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
  10795. var left, top, position;
  10796. if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
  10797. position = 'fixed';
  10798. top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
  10799. if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
  10800. top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
  10801. }
  10802. left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
  10803. }
  10804. if (left || top) {
  10805. dropdownMenu.css({
  10806. position: position, left: left, top: top, right: 'inherit'
  10807. });
  10808. }
  10809. });
  10810. var checkdropdown = function () {
  10811. if ($(".btn-group.open", table).length > 0 && $(".btn-group.open .dropdown-menu", table).css("position") == 'fixed') {
  10812. $(".btn-group.open", table).trigger("fa.event.refreshdropdown");
  10813. }
  10814. };
  10815. $(window).on("scroll", function () {
  10816. checkdropdown();
  10817. });
  10818. tableBody.on("scroll", function () {
  10819. checkdropdown();
  10820. });
  10821. }
  10822. var id = table.attr("id");
  10823. Table.list[id] = table;
  10824. return table;
  10825. },
  10826. // 批量操作请求
  10827. multi: function (action, ids, table, element) {
  10828. var options = table.bootstrapTable('getOptions');
  10829. var data = element ? $(element).data() : {};
  10830. ids = ($.isArray(ids) ? ids.join(",") : ids);
  10831. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  10832. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  10833. options = {url: url, data: {action: action, ids: ids, params: params}};
  10834. Fast.api.ajax(options, function (data, ret) {
  10835. table.trigger("uncheckbox");
  10836. var success = $(element).data("success") || $.noop;
  10837. if (typeof success === 'function') {
  10838. if (false === success.call(element, data, ret)) {
  10839. return false;
  10840. }
  10841. }
  10842. table.bootstrapTable('refresh');
  10843. }, function (data, ret) {
  10844. var error = $(element).data("error") || $.noop;
  10845. if (typeof error === 'function') {
  10846. if (false === error.call(element, data, ret)) {
  10847. return false;
  10848. }
  10849. }
  10850. });
  10851. },
  10852. // 单元格元素事件
  10853. events: {
  10854. operate: {
  10855. 'click .btn-editone': function (e, value, row, index) {
  10856. e.stopPropagation();
  10857. e.preventDefault();
  10858. var table = $(this).closest('table');
  10859. var options = table.bootstrapTable('getOptions');
  10860. var ids = row[options.pk];
  10861. row = $.extend({}, row ? row : {}, {ids: ids});
  10862. var url = options.extend.edit_url;
  10863. Fast.api.open(Table.api.replaceurl(url, row, table), $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10864. },
  10865. 'click .btn-delone': function (e, value, row, index) {
  10866. e.stopPropagation();
  10867. e.preventDefault();
  10868. var that = this;
  10869. var top = $(that).offset().top - $(window).scrollTop();
  10870. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  10871. if (top + 154 > $(window).height()) {
  10872. top = top - 154;
  10873. }
  10874. if ($(window).width() < 480) {
  10875. top = left = undefined;
  10876. }
  10877. Layer.confirm(
  10878. __('Are you sure you want to delete this item?'),
  10879. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10880. function (index) {
  10881. var table = $(that).closest('table');
  10882. var options = table.bootstrapTable('getOptions');
  10883. Table.api.multi("del", row[options.pk], table, that);
  10884. Layer.close(index);
  10885. }
  10886. );
  10887. }
  10888. },//单元格图片预览
  10889. image: {
  10890. 'click .img-center': function (e, value, row, index) {
  10891. var data = [];
  10892. value = value === null ? '' : value.toString();
  10893. var arr = value != '' ? value.split(",") : [];
  10894. var url;
  10895. $.each(arr, function (index, value) {
  10896. url = Fast.api.cdnurl(value);
  10897. data.push({
  10898. src: url,
  10899. thumb: url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle
  10900. });
  10901. });
  10902. Layer.photos({
  10903. photos: {
  10904. "start": $(this).parent().index(),
  10905. "data": data
  10906. },
  10907. anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  10908. });
  10909. },
  10910. }
  10911. },
  10912. // 单元格数据格式化
  10913. formatter: {
  10914. icon: function (value, row, index) {
  10915. value = value === null ? '' : value.toString();
  10916. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  10917. //渲染fontawesome图标
  10918. return '<i class="' + value + '"></i> ' + value;
  10919. },
  10920. image: function (value, row, index) {
  10921. value = value == null || value.length === 0 ? '' : value.toString();
  10922. value = value ? value : '/assets/img/blank.gif';
  10923. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10924. var url = Fast.api.cdnurl(value, true);
  10925. url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle;
  10926. return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>';
  10927. },
  10928. images: function (value, row, index) {
  10929. value = value == null || value.length === 0 ? '' : value.toString();
  10930. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10931. var arr = value != '' ? value.split(',') : [];
  10932. var html = [];
  10933. var url;
  10934. $.each(arr, function (i, value) {
  10935. value = value ? value : '/assets/img/blank.gif';
  10936. url = Fast.api.cdnurl(value, true);
  10937. url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle;
  10938. html.push('<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>');
  10939. });
  10940. return html.join(' ');
  10941. },
  10942. file: function (value, row, index) {
  10943. value = value == null || value.length === 0 ? '' : value.toString();
  10944. value = Fast.api.cdnurl(value, true);
  10945. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10946. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value);
  10947. suffix = suffix ? suffix[1] : 'file';
  10948. var url = Fast.api.fixurl("ajax/icon?suffix=" + suffix);
  10949. return '<a href="' + value + '" target="_blank"><img src="' + url + '" class="' + classname + '"></a>';
  10950. },
  10951. files: function (value, row, index) {
  10952. value = value == null || value.length === 0 ? '' : value.toString();
  10953. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10954. var arr = value != '' ? value.split(',') : [];
  10955. var html = [];
  10956. var suffix, url;
  10957. $.each(arr, function (i, value) {
  10958. value = Fast.api.cdnurl(value, true);
  10959. suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value);
  10960. suffix = suffix ? suffix[1] : 'file';
  10961. url = Fast.api.fixurl("ajax/icon?suffix=" + suffix);
  10962. html.push('<a href="' + value + '" target="_blank"><img src="' + url + '" class="' + classname + '"></a>');
  10963. });
  10964. return html.join(' ');
  10965. },
  10966. content: function (value, row, index) {
  10967. var width = this.width != undefined ? (this.width.match(/^\d+$/) ? this.width + "px" : this.width) : "250px";
  10968. return "<div style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + value + "</div>";
  10969. },
  10970. status: function (value, row, index) {
  10971. var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
  10972. if (typeof this.custom !== 'undefined') {
  10973. custom = $.extend(custom, this.custom);
  10974. }
  10975. this.custom = custom;
  10976. this.icon = 'fa fa-circle';
  10977. return Table.api.formatter.normal.call(this, value, row, index);
  10978. },
  10979. normal: function (value, row, index) {
  10980. var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
  10981. var custom = {};
  10982. if (typeof this.custom !== 'undefined') {
  10983. custom = $.extend(custom, this.custom);
  10984. }
  10985. value = value == null || value.length === 0 ? '' : value.toString();
  10986. var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : [];
  10987. var index = keys.indexOf(value);
  10988. var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null;
  10989. var display = index > -1 ? this.searchList[value] : null;
  10990. var icon = typeof this.icon !== 'undefined' ? this.icon : null;
  10991. if (!color) {
  10992. color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary';
  10993. }
  10994. if (!display) {
  10995. display = __(value.charAt(0).toUpperCase() + value.slice(1));
  10996. }
  10997. var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
  10998. if (this.operate != false) {
  10999. html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
  11000. }
  11001. return html;
  11002. },
  11003. toggle: function (value, row, index) {
  11004. var table = this.table;
  11005. var options = table ? table.bootstrapTable('getOptions') : {};
  11006. var pk = options.pk || "id";
  11007. var color = typeof this.color !== 'undefined' ? this.color : 'success';
  11008. var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
  11009. var no = typeof this.no !== 'undefined' ? this.no : 0;
  11010. var url = typeof this.url !== 'undefined' ? this.url : '';
  11011. var confirm = '';
  11012. var disable = false;
  11013. if (typeof this.confirm !== "undefined") {
  11014. confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm;
  11015. }
  11016. if (typeof this.disable !== "undefined") {
  11017. disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
  11018. }
  11019. return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled no-padding' : '') + "' data-index='" + index + "' data-id='"
  11020. + row[pk] + "' " + (url ? "data-url='" + url + "'" : "") + (confirm ? "data-confirm='" + confirm + "'" : "") + " data-params='" + this.field + "=" + (value == yes ? no : yes) + "'><i class='fa fa-toggle-on text-success text-" + color + " " + (value == yes ? '' : 'fa-flip-horizontal text-gray') + " fa-2x'></i></a>";
  11021. },
  11022. url: function (value, row, index) {
  11023. value = value == null || value.length === 0 ? '' : value.toString();
  11024. return '<div class="input-group input-group-sm" style="width:250px;margin:0 auto;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
  11025. },
  11026. search: function (value, row, index) {
  11027. var field = this.field;
  11028. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11029. value = row[this.customField];
  11030. field = this.customField;
  11031. }
  11032. return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
  11033. },
  11034. addtabs: function (value, row, index) {
  11035. var url = Table.api.replaceurl(this.url || '', row, this.table);
  11036. var title = this.atitle ? this.atitle : __("Search %s", value);
  11037. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11038. },
  11039. dialog: function (value, row, index) {
  11040. var url = Table.api.replaceurl(this.url || '', row, this.table);
  11041. var title = this.atitle ? this.atitle : __("View %s", value);
  11042. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11043. },
  11044. flag: function (value, row, index) {
  11045. var that = this;
  11046. value = value == null || value.length === 0 ? '' : value.toString();
  11047. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  11048. //如果字段列有定义custom
  11049. if (typeof this.custom !== 'undefined') {
  11050. colorArr = $.extend(colorArr, this.custom);
  11051. }
  11052. var field = this.field;
  11053. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11054. value = row[this.customField];
  11055. field = this.customField;
  11056. }
  11057. if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
  11058. var i = 0;
  11059. var searchValues = Object.values(colorArr);
  11060. $.each(that.searchList, function (key, val) {
  11061. if (typeof colorArr[key] == 'undefined') {
  11062. colorArr[key] = searchValues[i];
  11063. i = typeof searchValues[i + 1] === 'undefined' ? 0 : i + 1;
  11064. }
  11065. });
  11066. }
  11067. //渲染Flag
  11068. var html = [];
  11069. var arr = value != '' ? value.split(',') : [];
  11070. var color, display, label;
  11071. $.each(arr, function (i, value) {
  11072. value = value == null || value.length === 0 ? '' : value.toString();
  11073. if (value == '')
  11074. return true;
  11075. color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  11076. display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1));
  11077. label = '<span class="label label-' + color + '">' + display + '</span>';
  11078. if (that.operate) {
  11079. html.push('<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + field + '" data-value="' + value + '">' + label + '</a>');
  11080. } else {
  11081. html.push(label);
  11082. }
  11083. });
  11084. return html.join(' ');
  11085. },
  11086. label: function (value, row, index) {
  11087. return Table.api.formatter.flag.call(this, value, row, index);
  11088. },
  11089. datetime: function (value, row, index) {
  11090. var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat;
  11091. if (isNaN(value)) {
  11092. return value ? Moment(value).format(datetimeFormat) : __('None');
  11093. } else {
  11094. return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
  11095. }
  11096. },
  11097. operate: function (value, row, index) {
  11098. var table = this.table;
  11099. // 操作配置
  11100. var options = table ? table.bootstrapTable('getOptions') : {};
  11101. // 默认按钮组
  11102. var buttons = $.extend([], this.buttons || []);
  11103. // 所有按钮名称
  11104. var names = [];
  11105. buttons.forEach(function (item) {
  11106. names.push(item.name);
  11107. });
  11108. if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
  11109. buttons.push(Table.button.dragsort);
  11110. }
  11111. if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
  11112. Table.button.edit.url = options.extend.edit_url;
  11113. buttons.push(Table.button.edit);
  11114. }
  11115. if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
  11116. buttons.push(Table.button.del);
  11117. }
  11118. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  11119. }
  11120. ,
  11121. buttons: function (value, row, index) {
  11122. // 默认按钮组
  11123. var buttons = $.extend([], this.buttons || []);
  11124. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  11125. }
  11126. },
  11127. buttonlink: function (column, buttons, value, row, index, type) {
  11128. var table = column.table;
  11129. column.clickToSelect = false;
  11130. type = typeof type === 'undefined' ? 'buttons' : type;
  11131. var options = table ? table.bootstrapTable('getOptions') : {};
  11132. var html = [];
  11133. var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend,
  11134. dropdown, link;
  11135. var fieldIndex = column.fieldIndex;
  11136. var dropdowns = {};
  11137. $.each(buttons, function (i, j) {
  11138. if (type === 'operate') {
  11139. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  11140. return true;
  11141. }
  11142. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  11143. return true;
  11144. }
  11145. }
  11146. var attr = table.data(type + "-" + j.name);
  11147. if (typeof attr === 'undefined' || attr) {
  11148. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false);
  11149. if (hidden) {
  11150. return true;
  11151. }
  11152. visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true);
  11153. if (!visible) {
  11154. return true;
  11155. }
  11156. dropdown = j.dropdown ? j.dropdown : '';
  11157. url = j.url ? j.url : '';
  11158. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  11159. classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
  11160. icon = j.icon ? j.icon : '';
  11161. text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
  11162. title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
  11163. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  11164. confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false);
  11165. confirm = confirm ? 'data-confirm="' + confirm + '"' : '';
  11166. extend = j.extend ? j.extend : '';
  11167. disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false);
  11168. if (disable) {
  11169. classname = classname + ' disabled';
  11170. }
  11171. link = '<a href="' + url + '" class="' + classname + '" ' + (confirm ? confirm + ' ' : '') + (refresh ? refresh + ' ' : '') + extend + ' title="' + title + '" data-table-id="' + (table ? table.attr("id") : '') + '" data-field-index="' + fieldIndex + '" data-row-index="' + index + '" data-button-index="' + i + '"><i class="' + icon + '"></i>' + (text ? ' ' + text : '') + '</a>';
  11172. if (dropdown) {
  11173. if (typeof dropdowns[dropdown] == 'undefined') {
  11174. dropdowns[dropdown] = [];
  11175. }
  11176. dropdowns[dropdown].push(link);
  11177. } else {
  11178. html.push(link);
  11179. }
  11180. }
  11181. });
  11182. if (!$.isEmptyObject(dropdowns)) {
  11183. var dropdownHtml = [];
  11184. $.each(dropdowns, function (i, j) {
  11185. dropdownHtml.push('<div class="btn-group"><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown">' + i + '</button><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown"><span class="caret"></span></button><ul class="dropdown-menu dropdown-menu-right"><li>' + j.join('</li><li>') + '</li></ul></div>');
  11186. });
  11187. html.unshift(dropdownHtml);
  11188. }
  11189. return html.join(' ');
  11190. },
  11191. //替换URL中的数据
  11192. replaceurl: function (url, row, table) {
  11193. var options = table ? table.bootstrapTable('getOptions') : null;
  11194. var ids = options ? row[options.pk] : 0;
  11195. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  11196. url = url == null || url.length === 0 ? '' : url.toString();
  11197. //自动添加ids参数
  11198. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  11199. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  11200. matched = matched.substring(1, matched.length - 1);
  11201. if (matched.indexOf(".") !== -1) {
  11202. var temp = row;
  11203. var arr = matched.split(/\./);
  11204. for (var i = 0; i < arr.length; i++) {
  11205. if (typeof temp[arr[i]] !== 'undefined') {
  11206. temp = temp[arr[i]];
  11207. }
  11208. }
  11209. return typeof temp === 'object' ? '' : temp;
  11210. }
  11211. return row[matched];
  11212. });
  11213. return url;
  11214. },
  11215. // 获取选中的条目ID集合
  11216. selectedids: function (table, current) {
  11217. var options = table.bootstrapTable('getOptions');
  11218. //如果有设置翻页记忆模式
  11219. if (!current && options.maintainSelected) {
  11220. return options.selectedIds;
  11221. }
  11222. return $.map(table.bootstrapTable('getSelections'), function (row) {
  11223. return row[options.pk];
  11224. });
  11225. },
  11226. //获取选中的数据
  11227. selecteddata: function (table, current) {
  11228. var options = table.bootstrapTable('getOptions');
  11229. //如果有设置翻页记忆模式
  11230. if (!current && options.maintainSelected) {
  11231. return options.selectedData;
  11232. }
  11233. return table.bootstrapTable('getSelections');
  11234. },
  11235. // 切换复选框状态
  11236. toggleattr: function (table) {
  11237. $("input[type='checkbox']", table).trigger('click');
  11238. },
  11239. // 根据行索引获取行数据
  11240. getrowdata: function (table, index) {
  11241. index = parseInt(index);
  11242. var data = table.bootstrapTable('getData');
  11243. return typeof data[index] !== 'undefined' ? data[index] : null;
  11244. },
  11245. // 根据行索引获取行数据
  11246. getrowbyindex: function (table, index) {
  11247. return Table.api.getrowdata(table, index);
  11248. },
  11249. // 根据主键ID获取行数据
  11250. getrowbyid: function (table, id) {
  11251. var row = {};
  11252. var options = table.bootstrapTable("getOptions");
  11253. $.each(Table.api.selecteddata(table), function (i, j) {
  11254. if (j[options.pk] == id) {
  11255. row = j;
  11256. return false;
  11257. }
  11258. });
  11259. return row;
  11260. }
  11261. },
  11262. };
  11263. return Table;
  11264. });
  11265. // jQuery List DragSort v0.5.2
  11266. // Website: http://dragsort.codeplex.com/
  11267. // License: http://dragsort.codeplex.com/license
  11268. (function($) {
  11269. $.fn.dragsort = function(options) {
  11270. if (options == "destroy") {
  11271. $(this.selector).trigger("dragsort-uninit");
  11272. return;
  11273. }
  11274. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  11275. var lists = [];
  11276. var list = null, lastPos = null;
  11277. this.each(function(i, cont) {
  11278. //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
  11279. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  11280. cont = $(cont).children().get(0);
  11281. var newList = {
  11282. draggedItem: null,
  11283. placeHolderItem: null,
  11284. pos: null,
  11285. offset: null,
  11286. offsetLimit: null,
  11287. scroll: null,
  11288. container: cont,
  11289. init: function() {
  11290. //set options to default values if not set
  11291. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  11292. if (opts.itemSelector == "")
  11293. opts.itemSelector = opts.tagName;
  11294. if (opts.dragSelector == "")
  11295. opts.dragSelector = opts.tagName;
  11296. if (opts.placeHolderTemplate == "")
  11297. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  11298. //listidx allows reference back to correct list variable instance
  11299. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  11300. this.styleDragHandlers(true);
  11301. },
  11302. uninit: function() {
  11303. var list = lists[$(this).attr("data-listidx")];
  11304. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  11305. list.styleDragHandlers(false);
  11306. },
  11307. getItems: function() {
  11308. return $(this.container).children(opts.itemSelector);
  11309. },
  11310. styleDragHandlers: function(cursor) {
  11311. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  11312. },
  11313. grabItem: function(e) {
  11314. var list = lists[$(this).attr("data-listidx")];
  11315. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  11316. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  11317. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  11318. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  11319. return;
  11320. //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,
  11321. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  11322. //e.preventDefault();
  11323. //change cursor to move while dragging
  11324. var dragHandle = e.target;
  11325. while (!$(dragHandle).is(opts.dragSelector)) {
  11326. if (dragHandle == this) return;
  11327. dragHandle = dragHandle.parentNode;
  11328. }
  11329. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  11330. $(dragHandle).css("cursor", "move");
  11331. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  11332. var listElem = this;
  11333. var trigger = function() {
  11334. list.dragStart.call(listElem, e);
  11335. $(list.container).unbind("mousemove", trigger);
  11336. };
  11337. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  11338. },
  11339. dragStart: function(e) {
  11340. if (list != null && list.draggedItem != null)
  11341. list.dropItem();
  11342. list = lists[$(this).attr("data-listidx")];
  11343. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  11344. //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
  11345. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  11346. //calculate mouse offset relative to draggedItem
  11347. var mt = parseInt(list.draggedItem.css("marginTop"));
  11348. var ml = parseInt(list.draggedItem.css("marginLeft"));
  11349. list.offset = list.draggedItem.offset();
  11350. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  11351. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  11352. //calculate box the dragged item can't be dragged outside of
  11353. if (!opts.dragBetween) {
  11354. 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();
  11355. list.offsetLimit = $(list.container).offset();
  11356. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  11357. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  11358. }
  11359. //create placeholder item
  11360. var h = list.draggedItem.height();
  11361. var w = list.draggedItem.width();
  11362. if (opts.tagName == "tr") {
  11363. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  11364. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  11365. list.draggedItem.after(list.placeHolderItem);
  11366. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  11367. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  11368. } else {
  11369. list.draggedItem.after(opts.placeHolderTemplate);
  11370. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  11371. }
  11372. if (opts.tagName == "td") {
  11373. var listTable = list.draggedItem.closest("table").get(0);
  11374. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  11375. }
  11376. //style draggedItem while dragging
  11377. var orig = list.draggedItem.attr("style");
  11378. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  11379. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  11380. //auto-scroll setup
  11381. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  11382. list.scroll.scrollY = window.setInterval(function() {
  11383. if (opts.scrollContainer != window) {
  11384. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  11385. return;
  11386. }
  11387. var t = $(opts.scrollContainer).scrollTop();
  11388. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  11389. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  11390. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  11391. }
  11392. }, 10);
  11393. list.scroll.scrollX = window.setInterval(function() {
  11394. if (opts.scrollContainer != window) {
  11395. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  11396. return;
  11397. }
  11398. var l = $(opts.scrollContainer).scrollLeft();
  11399. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  11400. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  11401. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  11402. }
  11403. }, 10);
  11404. //misc
  11405. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11406. list.setPos(e.pageX, e.pageY);
  11407. $(document).bind("mousemove", list.swapItems);
  11408. $(document).bind("mouseup", list.dropItem);
  11409. if (opts.scrollContainer != window)
  11410. $(window).bind("wheel", list.wheel);
  11411. },
  11412. //set position of draggedItem
  11413. setPos: function(x, y) {
  11414. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  11415. var top = y - this.offset.top;
  11416. var left = x - this.offset.left;
  11417. //limit top, left to within box draggedItem can't be dragged outside of
  11418. if (!opts.dragBetween) {
  11419. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  11420. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  11421. }
  11422. //adjust top & left calculations to parent offset
  11423. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  11424. if (parent != null) {
  11425. top -= parent.top;
  11426. left -= parent.left;
  11427. }
  11428. //set x or y auto-scroll amount
  11429. if (opts.scrollContainer == window) {
  11430. y -= $(window).scrollTop();
  11431. x -= $(window).scrollLeft();
  11432. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  11433. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  11434. } else {
  11435. var cont = $(opts.scrollContainer);
  11436. var offset = cont.offset();
  11437. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  11438. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  11439. }
  11440. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  11441. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  11442. //move draggedItem to new mouse cursor location
  11443. this.draggedItem.css({ top: top, left: left });
  11444. },
  11445. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  11446. wheel: function(e) {
  11447. if (list && opts.scrollContainer != window) {
  11448. var cont = $(opts.scrollContainer);
  11449. var offset = cont.offset();
  11450. e = e.originalEvent;
  11451. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  11452. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  11453. cont.scrollTop(cont.scrollTop() + deltaY);
  11454. e.preventDefault();
  11455. }
  11456. }
  11457. },
  11458. //build a table recording all the positions of the moveable list items
  11459. buildPositionTable: function() {
  11460. var pos = [];
  11461. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  11462. var loc = $(this).offset();
  11463. loc.right = loc.left + $(this).outerWidth();
  11464. loc.bottom = loc.top + $(this).outerHeight();
  11465. loc.elm = this;
  11466. pos[i] = loc;
  11467. });
  11468. this.pos = pos;
  11469. },
  11470. dropItem: function() {
  11471. if (list.draggedItem == null)
  11472. return;
  11473. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  11474. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  11475. var orig = list.draggedItem.attr("data-origstyle");
  11476. list.draggedItem.attr("style", orig);
  11477. if (orig == "")
  11478. list.draggedItem.removeAttr("style");
  11479. list.draggedItem.removeAttr("data-origstyle");
  11480. list.styleDragHandlers(true);
  11481. list.placeHolderItem.before(list.draggedItem);
  11482. list.placeHolderItem.remove();
  11483. $("[data-droptarget], .dragSortItem").remove();
  11484. window.clearInterval(list.scroll.scrollY);
  11485. window.clearInterval(list.scroll.scrollX);
  11486. //if position changed call dragEnd
  11487. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  11488. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  11489. var pos = list.draggedItem.attr("data-origpos").split('-');
  11490. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  11491. if (nextItem.size() > 0)
  11492. nextItem.before(list.draggedItem);
  11493. else if (pos[1] == 0) //was the only item in list
  11494. $(lists[pos[0]].container).prepend(list.draggedItem);
  11495. else //was the last item in list
  11496. $(lists[pos[0]].container).append(list.draggedItem);
  11497. }
  11498. list.draggedItem.removeAttr("data-origpos");
  11499. list.draggedItem = null;
  11500. $(document).unbind("mousemove", list.swapItems);
  11501. $(document).unbind("mouseup", list.dropItem);
  11502. if (opts.scrollContainer != window)
  11503. $(window).unbind("wheel", list.wheel);
  11504. return false;
  11505. },
  11506. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  11507. swapItems: function(e) {
  11508. if (list.draggedItem == null)
  11509. return false;
  11510. //move draggedItem to mouse location
  11511. list.setPos(e.pageX, e.pageY);
  11512. //retrieve list and item position mouse cursor is over
  11513. var ei = list.findPos(e.pageX, e.pageY);
  11514. var nlist = list;
  11515. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  11516. ei = lists[i].findPos(e.pageX, e.pageY);
  11517. nlist = lists[i];
  11518. }
  11519. //if not over another moveable list item return
  11520. if (ei == -1)
  11521. return false;
  11522. //save fixed items locations
  11523. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  11524. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  11525. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  11526. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  11527. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  11528. else
  11529. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  11530. //restore fixed items location
  11531. fixed.each(function() {
  11532. var elm = children().eq(this.idx).get(0);
  11533. if (this != elm && children().index(this) < this.idx)
  11534. $(this).insertAfter(elm);
  11535. else if (this != elm)
  11536. $(this).insertBefore(elm);
  11537. });
  11538. //misc
  11539. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11540. lastPos = list.draggedItem.offset();
  11541. return false;
  11542. },
  11543. //returns the index of the list item the mouse is over
  11544. findPos: function(x, y) {
  11545. for (var i = 0; i < this.pos.length; i++) {
  11546. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  11547. return i;
  11548. }
  11549. return -1;
  11550. },
  11551. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  11552. createDropTargets: function() {
  11553. if (!opts.dragBetween)
  11554. return;
  11555. $(lists).each(function() {
  11556. var ph = $(this.container).find("[data-placeholder]");
  11557. var dt = $(this.container).find("[data-droptarget]");
  11558. if (ph.size() > 0 && dt.size() > 0)
  11559. dt.remove();
  11560. else if (ph.size() == 0 && dt.size() == 0) {
  11561. if (opts.tagName == "td")
  11562. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  11563. else
  11564. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  11565. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  11566. list.placeHolderItem.attr("data-placeholder", true);
  11567. }
  11568. });
  11569. }
  11570. };
  11571. newList.init();
  11572. lists.push(newList);
  11573. });
  11574. return this;
  11575. };
  11576. $.fn.dragsort.defaults = {
  11577. tagName:"",
  11578. itemSelector: "",
  11579. dragSelector: "",
  11580. dragSelectorExclude: "input, textarea",
  11581. dragEnd: function() { },
  11582. dragBetween: false,
  11583. placeHolderTemplate: "",
  11584. scrollContainer: window,
  11585. scrollSpeed: 5
  11586. };
  11587. })(jQuery);
  11588. define("dragsort", function(){});
  11589. /*!
  11590. * jquery.event.drag - v 2.2
  11591. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11592. * Open Source MIT License - http://threedubmedia.com/code/license
  11593. */
  11594. ;(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);
  11595. define("drag", function(){});
  11596. /*!
  11597. * jquery.event.drop - v 2.2
  11598. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11599. * Open Source MIT License - http://threedubmedia.com/code/license
  11600. */
  11601. ;(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);
  11602. define("drop", function(){});
  11603. /**
  11604. * @summary SelectPage
  11605. * @desc Simple and powerful selection plugin
  11606. * @file selectpage.js
  11607. * @version 2.19
  11608. * @author TerryZeng
  11609. * @contact https://terryz.github.io/
  11610. * @license MIT License
  11611. *
  11612. */
  11613. ;(function ($) {
  11614. "use strict";
  11615. /**
  11616. * Default options
  11617. */
  11618. var defaults = {
  11619. /**
  11620. * Data source
  11621. * @type {string|Object}
  11622. *
  11623. * string:server side request url address
  11624. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  11625. */
  11626. data: undefined,
  11627. /**
  11628. * Language ('cn', 'en')
  11629. * @type string
  11630. * @default 'cn'
  11631. */
  11632. lang: 'cn',
  11633. /**
  11634. * Multiple select mode(tags)
  11635. * @type boolean
  11636. * @default false
  11637. */
  11638. multiple: false,
  11639. /**
  11640. * pagination or not
  11641. * @type boolean
  11642. * @default true
  11643. */
  11644. pagination: true,
  11645. /**
  11646. * Show up menu button
  11647. * @type boolean
  11648. * @default true
  11649. */
  11650. dropButton: true,
  11651. /**
  11652. * Result list visible size in pagination bar close
  11653. * @type number
  11654. * @default 10
  11655. */
  11656. listSize: 10,
  11657. /**
  11658. * Show control bar in multiple select mode
  11659. * @type boolean
  11660. * @default true
  11661. */
  11662. multipleControlbar: true,
  11663. /**
  11664. * Max selected item limited in multiple select mode
  11665. * @type number
  11666. * @default 0(unlimited)
  11667. */
  11668. maxSelectLimit: 0,
  11669. /**
  11670. * Select result item to close list, work on multiple select mode
  11671. * @type boolean
  11672. * @default false
  11673. */
  11674. selectToCloseList: false,
  11675. /**
  11676. * Init selected item key, the result will match to option.keyField option
  11677. * @type string
  11678. */
  11679. initRecord: undefined,
  11680. /**
  11681. * The table parameter in server side mode
  11682. * @type string
  11683. */
  11684. dbTable: 'tbl',
  11685. /**
  11686. * The value field, the value will fill to hidden element
  11687. * @type string
  11688. * @default 'id'
  11689. */
  11690. keyField: 'id',
  11691. /**
  11692. * The show text field, the text will show to input element or tags(multiple mode)
  11693. * @type string
  11694. * @default 'name'
  11695. */
  11696. showField: 'name',
  11697. /**
  11698. * Actually used to search field
  11699. * @type string
  11700. */
  11701. searchField: undefined,
  11702. /**
  11703. * Search type ('AND' or 'OR')
  11704. * @type string
  11705. * @default 'AND'
  11706. */
  11707. andOr: 'OR',
  11708. /**
  11709. * Result sort type
  11710. * @type array|boolean - if not set, will default used showField field
  11711. * @example
  11712. * orderBy : ['id desc']
  11713. */
  11714. orderBy: undefined,
  11715. /**
  11716. * Page size
  11717. * @type number
  11718. * @default 10
  11719. */
  11720. pageSize: 10,
  11721. /**
  11722. * Server side request parameters
  11723. * @type function
  11724. * @return object
  11725. * @example params : function(){return {'name':'aa','sex':1};}
  11726. */
  11727. params: undefined,
  11728. /**
  11729. * Custom result list item show text
  11730. * @type function
  11731. * @param data {object} row data
  11732. * @return string
  11733. */
  11734. formatItem: undefined,
  11735. /**
  11736. * Have some highlight item and lost focus, auto select the highlight item
  11737. * @type boolean
  11738. * @default false
  11739. */
  11740. autoFillResult: false,
  11741. /**
  11742. * Auto select first item in show up result list or search result
  11743. * depend on `autoFillResult` option set to true
  11744. * @type boolean
  11745. * @default false
  11746. */
  11747. autoSelectFirst: false,
  11748. /**
  11749. * Whether clear input element text when enter some keywords to search and no result return
  11750. * @type boolean
  11751. * @default true
  11752. */
  11753. noResultClean: true,
  11754. /**
  11755. * Select only mode
  11756. * @type boolean
  11757. */
  11758. selectOnly: false,
  11759. /**
  11760. * Input to search delay time, work on ajax data source
  11761. * @type number
  11762. * @default 0.5
  11763. */
  11764. inputDelay: 0.5,
  11765. /**
  11766. * -----------------------------------------Callback--------------------------------------------
  11767. */
  11768. /**
  11769. * Result list item selected callback
  11770. * @type function
  11771. * @param object - selected item json data
  11772. * @param self - plugin object
  11773. */
  11774. eSelect: undefined,
  11775. /**
  11776. * Before result list show up callback, you can do anything prepared
  11777. * @param self - plugin object
  11778. */
  11779. eOpen: undefined,
  11780. /**
  11781. * Server side return data convert callback
  11782. * @type function
  11783. * @param data {object} server side return data
  11784. * @param self {object} plugin object
  11785. * @return {object} return data format:
  11786. * @example
  11787. * {
  11788. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  11789. * totalRow : 100
  11790. * }
  11791. */
  11792. eAjaxSuccess: undefined,
  11793. /**
  11794. * Close selected item tag callback (multiple mode)
  11795. * @type function
  11796. * @param removeCount {number} remove item count
  11797. * @param self {object} plugin object
  11798. */
  11799. eTagRemove: undefined,
  11800. /**
  11801. * Clear selected item callback(single select mode)
  11802. * @type function
  11803. * @param self {object} plugin object
  11804. */
  11805. eClear: undefined
  11806. };
  11807. /**
  11808. * SelectPage class definition
  11809. * @constructor
  11810. * @param {Object} input - input element
  11811. * @param {Object} option
  11812. */
  11813. var SelectPage = function (input, option) {
  11814. //特殊字段处理
  11815. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  11816. if (typeof option[j] !== 'undefined') {
  11817. option[i] = option[j];
  11818. delete option[j];
  11819. }
  11820. });
  11821. this.setOption(option);
  11822. this.setLanguage();
  11823. this.setCssClass();
  11824. this.setProp();
  11825. this.setElem(input);
  11826. this.setButtonAttrDefault();
  11827. this.setInitRecord();
  11828. this.eDropdownButton();
  11829. this.eInput();
  11830. this.eWhole();
  11831. };
  11832. /**
  11833. * Plugin version number
  11834. */
  11835. SelectPage.version = '2.19';
  11836. /**
  11837. * Plugin object cache key
  11838. */
  11839. SelectPage.dataKey = 'selectPageObject';
  11840. /**
  11841. * Options set
  11842. * @param {Object} option
  11843. */
  11844. SelectPage.prototype.setOption = function (option) {
  11845. //use showField to default
  11846. option.searchField = option.searchField || option.showField;
  11847. option.andOr = option.andOr.toUpperCase();
  11848. if (option.andOr !== 'AND' && option.andOr !== 'OR') option.andOr = 'AND';
  11849. //support multiple field set
  11850. var arr = ['searchField'];
  11851. for (var i = 0; i < arr.length; i++) {
  11852. option[arr[i]] = this.strToArray(option[arr[i]]);
  11853. }
  11854. //set default order field
  11855. option.orderBy = option.orderBy || option.showField;
  11856. //set multiple order field
  11857. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  11858. if (option.orderBy !== false) option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  11859. //close auto fill result and auto select first in multiple mode and select item not close list
  11860. if (option.multiple && !option.selectToCloseList) {
  11861. option.autoFillResult = false;
  11862. option.autoSelectFirst = false;
  11863. }
  11864. //show all item when pagination bar close, limited 200
  11865. if (!option.pagination) option.pageSize = 200;
  11866. if ($.type(option.listSize) !== 'number' || option.listSize < 0) option.listSize = 10;
  11867. if (typeof option.formatItem === 'string') {
  11868. var _formatItem = option.formatItem;
  11869. option.formatItem = function (row) {
  11870. if (typeof Template === 'function' && _formatItem.match(/\#([a-zA-Z0-9_\-]+)$/)) {
  11871. return Template(_formatItem.substring(1), row);
  11872. } else {
  11873. return _formatItem.replace(/\{(.*?)\}/gi, function (matched) {
  11874. matched = matched.substring(1, matched.length - 1);
  11875. return typeof row[matched] !== 'undefined' ? row[matched] : '';
  11876. });
  11877. }
  11878. };
  11879. }
  11880. this.option = option;
  11881. };
  11882. /**
  11883. * String convert to array
  11884. * @param str {string}
  11885. * @return {Array}
  11886. */
  11887. SelectPage.prototype.strToArray = function (str) {
  11888. return str ? str.replace(/[\s ]+/g, '').split(',') : '';
  11889. };
  11890. /**
  11891. * Set order field
  11892. * @param {Array} arg_order
  11893. * @param {string} arg_field - default sort field
  11894. * @return {Array}
  11895. */
  11896. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  11897. var arr = [], orders = [];
  11898. if (typeof arg_order === 'object') {
  11899. for (var i = 0; i < arg_order.length; i++) {
  11900. orders = $.trim(arg_order[i]).split(' ');
  11901. if (orders.length)
  11902. arr.push((orders.length === 2) ? orders.concat() : [orders[0], 'ASC']);
  11903. }
  11904. } else {
  11905. orders = $.trim(arg_order).split(' ');
  11906. arr[0] = (orders.length === 2) ? orders.concat() : (orders[0].toUpperCase().match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0].toUpperCase()] : [orders[0], 'ASC'];
  11907. }
  11908. return arr;
  11909. };
  11910. /**
  11911. * i18n
  11912. */
  11913. SelectPage.prototype.setLanguage = function () {
  11914. var message, p = this.option;
  11915. switch (p.lang) {
  11916. // English
  11917. case 'en':
  11918. message = {
  11919. add_btn: 'Add button',
  11920. add_title: 'add a box',
  11921. del_btn: 'Del button',
  11922. del_title: 'delete a box',
  11923. next: 'Next',
  11924. next_title: 'Next' + p.pageSize + ' (Right key)',
  11925. prev: 'Prev',
  11926. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  11927. first_title: 'First (Shift + Left key)',
  11928. last_title: 'Last (Shift + Right key)',
  11929. get_all_btn: 'Get All (Down key)',
  11930. get_all_alt: '(button)',
  11931. close_btn: 'Close (Tab key)',
  11932. close_alt: '(button)',
  11933. loading: 'loading...',
  11934. loading_alt: '(loading)',
  11935. page_info: 'page_num of page_count',
  11936. select_ng: 'Attention : Please choose from among the list.',
  11937. select_ok: 'OK : Correctly selected.',
  11938. not_found: 'not found',
  11939. ajax_error: 'An error occurred while connecting to server.',
  11940. clear: 'Clear content',
  11941. select_all: 'Select current page',
  11942. unselect_all: 'Clear current page',
  11943. clear_all: 'Clear all selected',
  11944. max_selected: 'You can only select up to max_selected_limit items'
  11945. };
  11946. break;
  11947. // 中文
  11948. case 'cn':
  11949. default:
  11950. message = {
  11951. add_btn: '添加按钮',
  11952. add_title: '添加区域',
  11953. del_btn: '删除按钮',
  11954. del_title: '删除区域',
  11955. next: '下一页',
  11956. next_title: '下' + p.pageSize + ' (→)',
  11957. prev: '上一页',
  11958. prev_title: '上' + p.pageSize + ' (←)',
  11959. first_title: '首页 (Shift + ←)',
  11960. last_title: '尾页 (Shift + →)',
  11961. get_all_btn: '获得全部 (↓)',
  11962. get_all_alt: '(按钮)',
  11963. close_btn: '关闭 (Tab键)',
  11964. close_alt: '(按钮)',
  11965. loading: '读取中...',
  11966. loading_alt: '(读取中)',
  11967. page_info: '第 page_num 页(共page_count页)',
  11968. select_ng: '请注意:请从列表中选择.',
  11969. select_ok: 'OK : 已经选择.',
  11970. not_found: '无查询结果',
  11971. ajax_error: '连接到服务器时发生错误!',
  11972. clear: '清除内容',
  11973. select_all: '选择当前页项目',
  11974. unselect_all: '取消选择当前页项目',
  11975. clear_all: '清除全部已选择项目',
  11976. max_selected: '最多只能选择 max_selected_limit 个项目'
  11977. };
  11978. break;
  11979. }
  11980. this.message = message;
  11981. };
  11982. /**
  11983. * Css classname defined
  11984. */
  11985. SelectPage.prototype.setCssClass = function () {
  11986. var css_class = {
  11987. container: 'sp_container',
  11988. container_open: 'sp_container_open',
  11989. re_area: 'sp_result_area',
  11990. result_open: 'sp_result_area_open',
  11991. control_box: 'sp_control_box',
  11992. //multiple select mode
  11993. element_box: 'sp_element_box',
  11994. navi: 'sp_navi',
  11995. //result list
  11996. results: 'sp_results',
  11997. re_off: 'sp_results_off',
  11998. select: 'sp_over',
  11999. select_ok: 'sp_select_ok',
  12000. select_ng: 'sp_select_ng',
  12001. selected: 'sp_selected',
  12002. input_off: 'sp_input_off',
  12003. message_box: 'sp_message_box',
  12004. disabled: 'sp_disabled',
  12005. button: 'sp_button',
  12006. caret_open: 'sp_caret_open',
  12007. btn_on: 'sp_btn_on',
  12008. btn_out: 'sp_btn_out',
  12009. input: 'sp_input',
  12010. clear_btn: 'sp_clear_btn',
  12011. align_right: 'sp_align_right'
  12012. };
  12013. this.css_class = css_class;
  12014. };
  12015. /**
  12016. * Plugin inner properties
  12017. */
  12018. SelectPage.prototype.setProp = function () {
  12019. this.prop = {
  12020. //input disabled status
  12021. disabled: false,
  12022. current_page: 1,
  12023. //total page
  12024. max_page: 1,
  12025. //ajax data loading status
  12026. is_loading: false,
  12027. xhr: false,
  12028. key_paging: false,
  12029. key_select: false,
  12030. //last selected item value
  12031. prev_value: '',
  12032. //last selected item text
  12033. selected_text: '',
  12034. last_input_time: undefined,
  12035. init_set: false
  12036. };
  12037. this.template = {
  12038. tag: {
  12039. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  12040. textKey: '#item_text#',
  12041. valueKey: '#item_value#'
  12042. },
  12043. page: {
  12044. current: 'page_num',
  12045. total: 'page_count'
  12046. },
  12047. msg: {
  12048. maxSelectLimit: 'max_selected_limit'
  12049. }
  12050. };
  12051. };
  12052. /**
  12053. * Get the actual width/height of invisible DOM elements with jQuery.
  12054. * Source code come from dreamerslab/jquery.actual
  12055. * @param element
  12056. * @param method
  12057. * @returns {*}
  12058. */
  12059. SelectPage.prototype.elementRealSize = function (element, method) {
  12060. var defaults = {
  12061. absolute: false,
  12062. clone: false,
  12063. includeMargin: false,
  12064. display: 'block'
  12065. };
  12066. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  12067. fix = function () {
  12068. // get all hidden parents
  12069. $hidden = $target.parents().addBack().filter(':hidden');
  12070. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  12071. if (configs.absolute === true) style += 'position: absolute !important;';
  12072. // save the origin style props
  12073. // set the hidden el css to be got the actual value later
  12074. $hidden.each(function () {
  12075. // Save original style. If no style was set, attr() returns undefined
  12076. var $this = $(this), thisStyle = $this.attr('style');
  12077. tmp.push(thisStyle);
  12078. // Retain as much of the original style as possible, if there is one
  12079. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  12080. });
  12081. };
  12082. restore = function () {
  12083. // restore origin style values
  12084. $hidden.each(function (i) {
  12085. var $this = $(this), _tmp = tmp[i];
  12086. if (_tmp === undefined) $this.removeAttr('style');
  12087. else $this.attr('style', _tmp);
  12088. });
  12089. };
  12090. fix();
  12091. // get the actual value with user specific methed
  12092. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  12093. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  12094. var actual = /(outer)/.test(method) ?
  12095. $target[method](configs.includeMargin) :
  12096. $target[method]();
  12097. restore();
  12098. // IMPORTANT, this plugin only return the value of the first element
  12099. return actual;
  12100. };
  12101. /**
  12102. * Dom building
  12103. * @param {Object} combo_input - original input element
  12104. */
  12105. SelectPage.prototype.setElem = function (combo_input) {
  12106. // 1. build Dom object
  12107. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  12108. var cssWidth = input.css("width");
  12109. var orgWidth = input.outerWidth();
  12110. if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
  12111. orgWidth = "100%";
  12112. } else {
  12113. // fix input width in hidden situation
  12114. if (orgWidth <= 0) orgWidth = this.elementRealSize(input, 'outerWidth');
  12115. if (orgWidth < 150) orgWidth = 150;
  12116. }
  12117. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  12118. if (p.selectOnly) elem.combo_input.prop('readonly', true);
  12119. elem.container = elem.combo_input.parent().addClass(css.container);
  12120. if (elem.combo_input.prop('disabled')) {
  12121. if (p.multiple) elem.container.addClass(css.disabled);
  12122. else elem.combo_input.addClass(css.input_off);
  12123. }
  12124. // set outer box width
  12125. elem.container.width(orgWidth);
  12126. elem.button = $('<div>').addClass(css.button);
  12127. //drop down button
  12128. elem.dropdown = $('<span class="sp_caret"></span>');
  12129. //clear button 'X' in single mode
  12130. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  12131. if (!p.dropButton) elem.clear_btn.addClass(css.align_right);
  12132. //main box in multiple mode
  12133. elem.element_box = $('<ul>').addClass(css.element_box);
  12134. if (p.multiple && p.multipleControlbar)
  12135. elem.control = $('<div>').addClass(css.control_box);
  12136. //result list box
  12137. elem.result_area = $('<div>').addClass(css.re_area);
  12138. //pagination bar
  12139. if (p.pagination) elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  12140. elem.results = $('<ul>').addClass(css.results);
  12141. var namePrefix = '_text',
  12142. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  12143. input_name = elem.combo_input.attr('name') || 'selectPage',
  12144. hidden_name = input_name,
  12145. hidden_id = input_id;
  12146. //switch the id and name attributes of input/hidden element
  12147. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  12148. name: hidden_name,
  12149. id: hidden_id
  12150. }).val('');
  12151. elem.combo_input.attr({
  12152. name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
  12153. id: input_id + namePrefix
  12154. });
  12155. // 2. DOM element put
  12156. elem.container.append(elem.hidden);
  12157. if (p.dropButton) {
  12158. elem.container.append(elem.button)
  12159. elem.button.append(elem.dropdown);
  12160. }
  12161. $(document.body).append(elem.result_area);
  12162. elem.result_area.append(elem.results);
  12163. if (p.pagination) elem.result_area.append(elem.navi);
  12164. //Multiple select mode
  12165. if (p.multiple) {
  12166. if (p.multipleControlbar) {
  12167. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  12168. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  12169. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  12170. elem.control_text = $('<p>');
  12171. elem.control.append(elem.control_text);
  12172. elem.result_area.prepend(elem.control);
  12173. }
  12174. elem.container.addClass('sp_container_combo');
  12175. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  12176. var li = $('<li>').addClass('input_box');
  12177. li.append(elem.combo_input);
  12178. elem.element_box.append(li);
  12179. if (elem.combo_input.attr('placeholder')) elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  12180. }
  12181. this.elem = elem;
  12182. };
  12183. /**
  12184. * Drop down button set to default
  12185. */
  12186. SelectPage.prototype.setButtonAttrDefault = function () {
  12187. /*
  12188. if (this.option.selectOnly) {
  12189. if ($(this.elem.combo_input).val() !== '') {
  12190. if ($(this.elem.hidden).val() !== '') {
  12191. //选择条件
  12192. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  12193. } else {
  12194. //输入方式
  12195. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  12196. }
  12197. } else {
  12198. $(this.elem.hidden).val('');
  12199. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  12200. }
  12201. }
  12202. */
  12203. //this.elem.button.attr('title', this.message.get_all_btn);
  12204. if (this.option.dropButton)
  12205. this.elem.button.attr('title', this.message.close_btn);
  12206. };
  12207. /**
  12208. * Set item need selected after init
  12209. * set selected item ways:
  12210. * <input value="key">
  12211. * <input data-init="key">
  12212. */
  12213. SelectPage.prototype.setInitRecord = function (refresh) {
  12214. var self = this, p = self.option, el = self.elem, key = '';
  12215. if ($.type(el.combo_input.data('init')) != 'undefined')
  12216. p.initRecord = String(el.combo_input.data('init'));
  12217. //data-init and value attribute can be init plugin selected item
  12218. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  12219. if (!refresh && !p.initRecord && el.combo_input.val())
  12220. p.initRecord = el.combo_input.val();
  12221. el.combo_input.val('');
  12222. if (!refresh) el.hidden.val(p.initRecord);
  12223. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  12224. if (key) {
  12225. if (typeof p.data === 'object') {
  12226. var data = new Array();
  12227. var keyarr = key.split(',');
  12228. $.each(keyarr, function (index, row) {
  12229. for (var i = 0; i < p.data.length; i++) {
  12230. if (p.data[i][p.keyField] == row) {
  12231. data.push(p.data[i]);
  12232. break;
  12233. }
  12234. }
  12235. });
  12236. if (!p.multiple && data.length > 1) data = [data[0]];
  12237. self.afterInit(self, data);
  12238. } else {//ajax data source mode to init selected item
  12239. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12240. var _orgParams = {
  12241. searchTable: p.dbTable,
  12242. searchKey: p.keyField,
  12243. searchValue: key,
  12244. orderBy: p.orderBy,
  12245. showField: p.showField,
  12246. keyField: p.keyField,
  12247. keyValue: key,
  12248. searchField: p.searchField
  12249. };
  12250. if (_paramsFunc) {
  12251. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12252. if (result && $.isPlainObject(result)) {
  12253. _params = $.extend({}, _orgParams, result);
  12254. } else {
  12255. _params = _orgParams;
  12256. }
  12257. } else {
  12258. _params = _orgParams;
  12259. }
  12260. $.ajax({
  12261. dataType: 'json',
  12262. type: 'POST',
  12263. url: p.data,
  12264. data: _params,
  12265. success: function (json) {
  12266. var d = null;
  12267. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  12268. d = p.eAjaxSuccess(json);
  12269. self.afterInit(self, d.list);
  12270. },
  12271. error: function (jqXHR, textStatus, errorThrown) {
  12272. self.ajaxErrorNotify(self, errorThrown);
  12273. }
  12274. });
  12275. }
  12276. }
  12277. };
  12278. /**
  12279. * Selected item set to plugin
  12280. * @param {Object} self
  12281. * @param {Object} data - selected item data
  12282. */
  12283. SelectPage.prototype.afterInit = function (self, data) {
  12284. if (!data || ($.isArray(data) && data.length === 0)) return;
  12285. if (!$.isArray(data)) data = [data];
  12286. var p = self.option, css = self.css_class;
  12287. self.data = data;
  12288. if (p.multiple) {
  12289. self.prop.init_set = true;
  12290. self.clearAll(self);
  12291. $.each(data, function (i, row) {
  12292. var value = row[p.keyField];
  12293. var text = row[p.showField];
  12294. var item = {text: text, value: value};
  12295. if (!self.isAlreadySelected(self, item)) self.addNewTag(self, row, item);
  12296. });
  12297. self.tagValuesSet(self);
  12298. self.inputResize(self);
  12299. self.elem.hidden.blur();
  12300. self.prop.init_set = false;
  12301. } else {
  12302. var row = data[0];
  12303. var value = row[p.keyField];
  12304. var text = row[p.showField];
  12305. self.elem.combo_input.val(text);
  12306. self.elem.hidden.val(value);
  12307. self.prop.prev_value = text;
  12308. self.prop.selected_text = text;
  12309. if (p.selectOnly) {
  12310. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  12311. }
  12312. self.putClearButton();
  12313. }
  12314. };
  12315. /**
  12316. * Drop down button event bind
  12317. */
  12318. SelectPage.prototype.eDropdownButton = function () {
  12319. var self = this;
  12320. if (self.option.dropButton) {
  12321. self.elem.button.mouseup(function (ev) {
  12322. ev.stopPropagation();
  12323. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  12324. self.elem.combo_input.focus();
  12325. } else self.hideResults(self);
  12326. });
  12327. }
  12328. };
  12329. /**
  12330. * Events bind
  12331. */
  12332. SelectPage.prototype.eInput = function () {
  12333. var self = this, p = self.option, el = self.elem, msg = self.message;
  12334. var showList = function () {
  12335. self.prop.page_move = false;
  12336. self.suggest(self);
  12337. self.setCssFocusedInput(self);
  12338. };
  12339. el.combo_input.keyup(function (e) {
  12340. self.processKey(self, e);
  12341. }).keydown(function (e) {
  12342. self.processControl(self, e);
  12343. }).focus(function (e) {
  12344. //When focus on input, show the result list
  12345. if (el.result_area.is(':hidden')) {
  12346. e.stopPropagation();
  12347. self.prop.first_show = true;
  12348. showList();
  12349. }
  12350. });
  12351. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  12352. e.stopPropagation();
  12353. if (!self.disabled(self)) {
  12354. self.clearAll(self, true);
  12355. self.elem.hidden.change();
  12356. if (p.eClear && $.isFunction(p.eClear)) p.eClear(self);
  12357. }
  12358. });
  12359. el.result_area.on('mousedown.SelectPage', function (e) {
  12360. e.stopPropagation();
  12361. });
  12362. if (p.multiple) {
  12363. if (p.multipleControlbar) {
  12364. //Select all item of current page
  12365. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  12366. self.selectAllLine(self);
  12367. }).hover(function () {
  12368. el.control_text.html(msg.select_all);
  12369. }, function () {
  12370. el.control_text.html('');
  12371. });
  12372. //Cancel select all item of current page
  12373. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  12374. self.unSelectAllLine(self);
  12375. }).hover(function () {
  12376. el.control_text.html(msg.unselect_all);
  12377. }, function () {
  12378. el.control_text.html('');
  12379. });
  12380. //Clear all selected item
  12381. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  12382. self.clearAll(self, true);
  12383. }).hover(function () {
  12384. el.control_text.html(msg.clear_all);
  12385. }, function () {
  12386. el.control_text.html('');
  12387. });
  12388. }
  12389. el.element_box.on('click.SelectPage', function (e) {
  12390. var srcEl = e.target || e.srcElement;
  12391. if ($(srcEl).is('ul')) el.combo_input.focus();
  12392. });
  12393. //Tag close
  12394. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  12395. var li = $(this).closest('li'), data = li.data('dataObj');
  12396. self.removeTag(self, li);
  12397. showList();
  12398. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove([data]);
  12399. });
  12400. self.inputResize(self);
  12401. }
  12402. };
  12403. /**
  12404. * Out of plugin area click event handler
  12405. */
  12406. SelectPage.prototype.eWhole = function () {
  12407. var self = this, css = self.css_class;
  12408. var cleanContent = function (obj) {
  12409. obj.elem.combo_input.val('');
  12410. if (!obj.option.multiple) obj.elem.hidden.val('');
  12411. obj.prop.selected_text = '';
  12412. };
  12413. //Out of plugin area
  12414. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  12415. var ele = e.target || e.srcElement;
  12416. var sp = $(ele).closest('div.' + css.container);
  12417. //Open status result list
  12418. $('div.' + css.container + '.' + css.container_open).each(function () {
  12419. if (this == sp[0]) return;
  12420. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  12421. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  12422. d.prop.current_page = 1;//reset page to 1
  12423. cleanContent(d);
  12424. d.hideResults(d);
  12425. return true;
  12426. }
  12427. if (d.elem.results.find('li').not('.' + css.message_box).length) {
  12428. if (d.option.autoFillResult) {
  12429. //have selected item, then hide result list
  12430. if (d.elem.hidden.val()) d.hideResults(d);
  12431. else if (d.elem.results.find('li.sp_over').length) {
  12432. //no one selected and have highlight item, select the highlight item
  12433. d.selectCurrentLine(d, true);
  12434. } else if (d.option.autoSelectFirst) {
  12435. //no one selected, no one highlight, select the first item
  12436. d.nextLine(d);
  12437. d.selectCurrentLine(d, true);
  12438. } else d.hideResults(d);
  12439. } else d.hideResults(d);
  12440. } else {
  12441. //when no one item match, clear search keywords
  12442. if (d.option.noResultClean) cleanContent(d);
  12443. else {
  12444. if (!d.option.multiple) d.elem.hidden.val('');
  12445. }
  12446. d.hideResults(d);
  12447. }
  12448. });
  12449. });
  12450. };
  12451. /**
  12452. * Result list event bind
  12453. */
  12454. SelectPage.prototype.eResultList = function () {
  12455. var self = this, css = this.css_class;
  12456. self.elem.results.children('li').hover(function () {
  12457. if (self.prop.key_select) {
  12458. self.prop.key_select = false;
  12459. return;
  12460. }
  12461. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  12462. $(this).addClass(css.select);
  12463. self.setCssFocusedResults(self);
  12464. }
  12465. }, function () {
  12466. $(this).removeClass(css.select);
  12467. }).click(function (e) {
  12468. if (self.prop.key_select) {
  12469. self.prop.key_select = false;
  12470. return;
  12471. }
  12472. e.preventDefault();
  12473. e.stopPropagation();
  12474. if (!$(this).hasClass(css.selected)) self.selectCurrentLine(self, false);
  12475. });
  12476. };
  12477. /**
  12478. * Reposition result list when list beyond the visible area
  12479. */
  12480. SelectPage.prototype.eScroll = function () {
  12481. var self = this, css = this.css_class;
  12482. $(window).on('scroll.SelectPage', function (e) {
  12483. $('div.' + css.container + '.' + css.container_open).each(function () {
  12484. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  12485. offset = d.elem.result_area.offset(),
  12486. screenScrollTop = $(window).scrollTop(),
  12487. docHeight = $(document).height(),
  12488. viewHeight = $(window).height(),
  12489. listHeight = d.elem.result_area.outerHeight(),
  12490. listBottom = offset.top + listHeight,
  12491. hasOverflow = docHeight > viewHeight,
  12492. down = d.elem.result_area.hasClass('shadowDown');
  12493. if (hasOverflow) {
  12494. if (down) {//open down
  12495. if (listBottom > (viewHeight + screenScrollTop)) d.calcResultsSize(d);
  12496. } else {//open up
  12497. if (offset.top < screenScrollTop) d.calcResultsSize(d);
  12498. }
  12499. }
  12500. });
  12501. });
  12502. };
  12503. /**
  12504. * Page bar button event bind
  12505. */
  12506. SelectPage.prototype.ePaging = function () {
  12507. var self = this;
  12508. if (!self.option.pagination) return;
  12509. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  12510. //$(self.elem.combo_input).focus();
  12511. ev.preventDefault();
  12512. self.firstPage(self);
  12513. });
  12514. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  12515. //$(self.elem.combo_input).focus();
  12516. ev.preventDefault();
  12517. self.prevPage(self);
  12518. });
  12519. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  12520. //$(self.elem.combo_input).focus();
  12521. ev.preventDefault();
  12522. self.nextPage(self);
  12523. });
  12524. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  12525. //$(self.elem.combo_input).focus();
  12526. ev.preventDefault();
  12527. self.lastPage(self);
  12528. });
  12529. };
  12530. /**
  12531. * Ajax request fail
  12532. * @param {Object} self
  12533. * @param {string} errorThrown
  12534. */
  12535. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  12536. self.showMessage(self.message.ajax_error);
  12537. };
  12538. /**
  12539. * Message box
  12540. * @param {Object} self
  12541. * @param msg {string} the text need to show
  12542. */
  12543. SelectPage.prototype.showMessage = function (self, msg) {
  12544. if (!msg) return;
  12545. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  12546. self.elem.results.empty().append(msgLi).show();
  12547. self.calcResultsSize(self);
  12548. self.setOpenStatus(self, true);
  12549. self.elem.control.hide();
  12550. if (self.option.pagination) self.elem.navi.hide();
  12551. };
  12552. /**
  12553. * @desc Scroll
  12554. * @param {Object} self
  12555. * @param {boolean} enforce
  12556. */
  12557. SelectPage.prototype.scrollWindow = function (self, enforce) {
  12558. var current_result = self.getCurrentLine(self),
  12559. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  12560. target_size;
  12561. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  12562. target_size = self.prop.size_li;
  12563. var gap, client_height = $(window).height(),
  12564. scroll_top = $(window).scrollTop(),
  12565. scroll_bottom = scroll_top + client_height - target_size;
  12566. if (current_result.length) {
  12567. if (target_top < scroll_top || target_size > client_height) {
  12568. //scroll to top
  12569. gap = target_top - scroll_top;
  12570. } else if (target_top > scroll_bottom) {
  12571. //scroll down
  12572. gap = target_top - scroll_bottom;
  12573. } else return; //do not scroll
  12574. } else if (target_top < scroll_top) gap = target_top - scroll_top;
  12575. window.scrollBy(0, gap);
  12576. };
  12577. /**
  12578. * change css class by status
  12579. * @param self
  12580. * @param status {boolean} true: open, false: close
  12581. */
  12582. SelectPage.prototype.setOpenStatus = function (self, status) {
  12583. var el = self.elem, css = self.css_class;
  12584. if (status) {
  12585. el.container.addClass(css.container_open);
  12586. el.result_area.addClass(css.result_open);
  12587. } else {
  12588. el.container.removeClass(css.container_open);
  12589. el.result_area.removeClass(css.result_open);
  12590. }
  12591. };
  12592. /**
  12593. * input element in focus css class set
  12594. * @param {Object} self
  12595. */
  12596. SelectPage.prototype.setCssFocusedInput = function (self) {
  12597. //$(self.elem.results).addClass(self.css_class.re_off);
  12598. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  12599. };
  12600. /**
  12601. * set result list get focus and input element lost focus
  12602. * @param {Object} self
  12603. */
  12604. SelectPage.prototype.setCssFocusedResults = function (self) {
  12605. //$(self.elem.results).removeClass(self.css_class.re_off);
  12606. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  12607. };
  12608. /**
  12609. * Quick search input keywords listener
  12610. * @param {Object} self
  12611. */
  12612. SelectPage.prototype.checkValue = function (self) {
  12613. var now_value = self.elem.combo_input.val();
  12614. if (now_value != self.prop.prev_value) {
  12615. self.prop.prev_value = now_value;
  12616. self.prop.first_show = false;
  12617. if (self.option.selectOnly) self.setButtonAttrDefault();
  12618. if (!self.option.multiple && !now_value) {
  12619. self.elem.combo_input.val('');
  12620. self.elem.hidden.val('');
  12621. self.elem.clear_btn.remove();
  12622. }
  12623. self.suggest(self);
  12624. }
  12625. };
  12626. /**
  12627. * Input handle(regular input)
  12628. * @param {Object} self
  12629. * @param {Object} e - event object
  12630. */
  12631. SelectPage.prototype.processKey = function (self, e) {
  12632. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  12633. if (e.keyCode != 16) self.setCssFocusedInput(self); // except Shift(16)
  12634. self.inputResize(self);
  12635. if ($.type(self.option.data) === 'string') {
  12636. self.prop.last_input_time = e.timeStamp;
  12637. setTimeout(function () {
  12638. if ((e.timeStamp - self.prop.last_input_time) === 0)
  12639. self.checkValue(self);
  12640. }, self.option.inputDelay * 1000);
  12641. } else {
  12642. self.checkValue(self);
  12643. }
  12644. }
  12645. }
  12646. /**
  12647. * Input handle(control key)
  12648. * @param {Object} self
  12649. * @param {Object} e - event object
  12650. */
  12651. SelectPage.prototype.processControl = function (self, e) {
  12652. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  12653. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  12654. e.preventDefault();
  12655. e.stopPropagation();
  12656. e.cancelBubble = true;
  12657. e.returnValue = false;
  12658. switch (e.keyCode) {
  12659. case 37:// left
  12660. if (e.shiftKey) self.firstPage(self);
  12661. else self.prevPage(self);
  12662. break;
  12663. case 38:// up
  12664. self.prop.key_select = true;
  12665. self.prevLine(self);
  12666. break;
  12667. case 39:// right
  12668. if (e.shiftKey) self.lastPage(self);
  12669. else self.nextPage(self);
  12670. break;
  12671. case 40:// down
  12672. if (self.elem.results.children('li').length) {
  12673. self.prop.key_select = true;
  12674. self.nextLine(self);
  12675. } else self.suggest(self);
  12676. break;
  12677. case 9:// tab
  12678. self.prop.key_paging = true;
  12679. self.selectCurrentLine(self, true);
  12680. //self.hideResults(self);
  12681. break;
  12682. case 13:// return
  12683. self.selectCurrentLine(self, true);
  12684. break;
  12685. case 27:// escape
  12686. self.prop.key_paging = true;
  12687. self.hideResults(self);
  12688. break;
  12689. }
  12690. }
  12691. };
  12692. /**
  12693. * Abort Ajax request
  12694. * @param {Object} self
  12695. */
  12696. SelectPage.prototype.abortAjax = function (self) {
  12697. if (self.prop.xhr) {
  12698. self.prop.xhr.abort();
  12699. self.prop.xhr = false;
  12700. }
  12701. };
  12702. /**
  12703. * Suggest result of search keywords
  12704. * @param {Object} self
  12705. */
  12706. SelectPage.prototype.suggest = function (self) {
  12707. var q_word, val = $.trim(self.elem.combo_input.val());
  12708. if (self.option.multiple) q_word = val;
  12709. else {
  12710. if (val && val === self.prop.selected_text) q_word = '';
  12711. else q_word = val;
  12712. }
  12713. q_word = q_word.split(/[\s ]+/);
  12714. //Before show up result list callback
  12715. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  12716. self.option.eOpen.call(self);
  12717. self.abortAjax(self);
  12718. //self.setLoading(self);
  12719. var which_page_num = self.prop.current_page || 1;
  12720. if (typeof self.option.data == 'object') self.searchForJson(self, q_word, which_page_num);
  12721. else self.searchForDb(self, q_word, which_page_num);
  12722. };
  12723. /**
  12724. * Loading
  12725. * @param {Object} self
  12726. */
  12727. SelectPage.prototype.setLoading = function (self) {
  12728. if (self.elem.results.html() === '') {
  12729. //self.calcResultsSize(self);
  12730. self.setOpenStatus(self, true);
  12731. }
  12732. };
  12733. /**
  12734. * Search for ajax
  12735. * @param {Object} self
  12736. * @param {Array} q_word - query keyword
  12737. * @param {number} which_page_num - target page number
  12738. */
  12739. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  12740. var p = self.option;
  12741. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess)) self.hideResults(self);
  12742. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12743. //when have new query keyword, then reset page number to 1.
  12744. if (q_word.length && q_word[0] && q_word[0] !== self.prop.prev_value) which_page_num = 1;
  12745. var _orgParams = {
  12746. q_word: q_word,
  12747. pageNumber: which_page_num,
  12748. pageSize: p.pageSize,
  12749. andOr: p.andOr,
  12750. orderBy: p.orderBy,
  12751. searchTable: p.dbTable,
  12752. showField: self.option.showField,
  12753. keyField: self.option.keyField,
  12754. searchField: self.option.searchField
  12755. };
  12756. if (p.orderBy !== false) _orgParams.orderBy = p.orderBy;
  12757. _orgParams[searchKey] = q_word[0];
  12758. if (_paramsFunc) {
  12759. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12760. if (result && $.isPlainObject(result)) {
  12761. _params = $.extend({}, _orgParams, result);
  12762. } else {
  12763. _params = _orgParams;
  12764. }
  12765. } else {
  12766. _params = _orgParams;
  12767. }
  12768. self.prop.xhr = $.ajax({
  12769. dataType: 'json',
  12770. url: p.data,
  12771. type: 'POST',
  12772. data: _params,
  12773. success: function (returnData) {
  12774. if (!returnData || !$.isPlainObject(returnData)) {
  12775. self.hideResults(self);
  12776. self.ajaxErrorNotify(self, errorThrown);
  12777. return;
  12778. }
  12779. var data = {}, json = {};
  12780. try {
  12781. data = p.eAjaxSuccess(returnData);
  12782. json.originalResult = data.list;
  12783. json.cnt_whole = data.totalRow;
  12784. } catch (e) {
  12785. self.showMessage(self, self.message.ajax_error);
  12786. return;
  12787. }
  12788. if (self.elem.navi) {
  12789. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  12790. }
  12791. json.candidate = [];
  12792. json.keyField = [];
  12793. if (typeof json.originalResult != 'object') {
  12794. self.prop.xhr = null;
  12795. self.notFoundSearch(self);
  12796. return;
  12797. }
  12798. json.cnt_page = json.originalResult.length;
  12799. for (var i = 0; i < json.cnt_page; i++) {
  12800. for (var key in json.originalResult[i]) {
  12801. if (key == p.keyField) {
  12802. json.keyField.push(json.originalResult[i][key]);
  12803. }
  12804. if (key == p.showField) {
  12805. json.candidate.push(json.originalResult[i][key]);
  12806. }
  12807. }
  12808. }
  12809. self.prepareResults(self, json, q_word, which_page_num);
  12810. },
  12811. error: function (jqXHR, textStatus, errorThrown) {
  12812. if (textStatus != 'abort') {
  12813. self.hideResults(self);
  12814. self.ajaxErrorNotify(self, errorThrown);
  12815. }
  12816. },
  12817. complete: function () {
  12818. self.prop.xhr = null;
  12819. }
  12820. });
  12821. };
  12822. /**
  12823. * Search for json data source
  12824. * @param {Object} self
  12825. * @param {Array} q_word
  12826. * @param {number} which_page_num
  12827. */
  12828. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  12829. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  12830. //query keyword filter
  12831. do {
  12832. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  12833. //将非法字符进行转义
  12834. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  12835. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  12836. i++;
  12837. } while (i < q_word.length);
  12838. // SELECT * FROM data WHERE field LIKE q_word;
  12839. for (var i = 0; i < p.data.length; i++) {
  12840. var flag = false, row = p.data[i], itemText;
  12841. for (var j = 0; j < arr_reg.length; j++) {
  12842. itemText = row[p.searchField];
  12843. if (p.formatItem && $.isFunction(p.formatItem))
  12844. itemText = p.formatItem(row);
  12845. if (itemText.match(arr_reg[j])) {
  12846. flag = true;
  12847. if (p.andOr == 'OR') break;
  12848. } else {
  12849. flag = false;
  12850. if (p.andOr == 'AND') break;
  12851. }
  12852. }
  12853. if (flag) matched.push(row);
  12854. }
  12855. // (CASE WHEN ...) then く order some column
  12856. if (p.orderBy === false) sorted = matched.concat();
  12857. else {
  12858. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  12859. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  12860. matched1 = [], matched2 = [], matched3 = [];
  12861. for (var i = 0; i < matched.length; i++) {
  12862. var orderField = p.orderBy[0][0];
  12863. var orderValue = String(matched[i][orderField]);
  12864. if (orderValue.match(reg1)) {
  12865. matched1.push(matched[i]);
  12866. } else if (orderValue.match(reg2)) {
  12867. matched2.push(matched[i]);
  12868. } else {
  12869. matched3.push(matched[i]);
  12870. }
  12871. }
  12872. if (p.orderBy[0][1].match(/^asc$/i)) {
  12873. matched1 = self.sortAsc(self, matched1);
  12874. matched2 = self.sortAsc(self, matched2);
  12875. matched3 = self.sortAsc(self, matched3);
  12876. } else {
  12877. matched1 = self.sortDesc(self, matched1);
  12878. matched2 = self.sortDesc(self, matched2);
  12879. matched3 = self.sortDesc(self, matched3);
  12880. }
  12881. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  12882. }
  12883. /*
  12884. if (sorted.length === undefined || sorted.length === 0 ) {
  12885. self.notFoundSearch(self);
  12886. return;
  12887. }
  12888. */
  12889. json.cnt_whole = sorted.length;
  12890. //page_move used to distinguish between init plugin or page moving
  12891. if (!self.prop.page_move) {
  12892. //only single mode can be used page number relocation
  12893. if (!p.multiple) {
  12894. //get selected item belong page number
  12895. var currentValue = self.elem.hidden.val();
  12896. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  12897. var index = 0;
  12898. $.each(sorted, function (i, row) {
  12899. if (row[p.keyField] == currentValue) {
  12900. index = i + 1;
  12901. return false;
  12902. }
  12903. });
  12904. which_page_num = Math.ceil(index / p.pageSize);
  12905. if (which_page_num < 1) which_page_num = 1;
  12906. self.prop.current_page = which_page_num;
  12907. }
  12908. }
  12909. } else {
  12910. //set page number to 1 when result number less then page size
  12911. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  12912. which_page_num = 1;
  12913. self.prop.current_page = 1;
  12914. }
  12915. }
  12916. //LIMIT xx OFFSET xx
  12917. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  12918. //save original data
  12919. json.originalResult = [];
  12920. //after data filter handle
  12921. for (var i = start; i < end; i++) {
  12922. if (sorted[i] === undefined) break;
  12923. json.originalResult.push(sorted[i]);
  12924. for (var key in sorted[i]) {
  12925. if (key == p.keyField) {
  12926. if (json.keyField === undefined) json.keyField = [];
  12927. json.keyField.push(sorted[i][key]);
  12928. }
  12929. if (key == p.showField) {
  12930. if (json.candidate === undefined) json.candidate = [];
  12931. json.candidate.push(sorted[i][key]);
  12932. }
  12933. }
  12934. }
  12935. if (json.candidate === undefined) json.candidate = [];
  12936. json.cnt_page = json.candidate.length;
  12937. self.prepareResults(self, json, q_word, which_page_num);
  12938. };
  12939. /**
  12940. * Set order asc
  12941. * @param {Object} self
  12942. * @param {Array} arr - result array
  12943. */
  12944. SelectPage.prototype.sortAsc = function (self, arr) {
  12945. arr.sort(function (a, b) {
  12946. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  12947. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  12948. });
  12949. return arr;
  12950. };
  12951. /**
  12952. * Set order desc
  12953. * @param {Object} self
  12954. * @param {Array} arr - result array
  12955. */
  12956. SelectPage.prototype.sortDesc = function (self, arr) {
  12957. arr.sort(function (a, b) {
  12958. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  12959. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  12960. });
  12961. return arr;
  12962. };
  12963. /**
  12964. * Not result found handle
  12965. * @param {Object} self
  12966. */
  12967. SelectPage.prototype.notFoundSearch = function (self) {
  12968. self.elem.results.empty();
  12969. self.calcResultsSize(self);
  12970. self.setOpenStatus(self, true);
  12971. self.setCssFocusedInput(self);
  12972. };
  12973. /**
  12974. * Prepare data to show
  12975. * @param {Object} self
  12976. * @param {Object} json - data result
  12977. * @param {Array} q_word - query keyword
  12978. * @param {number} which_page_num - target page number
  12979. */
  12980. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  12981. self.data = json.originalResult;
  12982. if (self.option.pagination) self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  12983. if (!json.keyField) json.keyField = false;
  12984. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  12985. self.elem.hidden.val(json.keyField[0]);
  12986. this.setButtonAttrDefault();
  12987. }
  12988. var is_query = false;
  12989. if (q_word && q_word.length && q_word[0]) is_query = true;
  12990. self.displayResults(self, json, is_query);
  12991. };
  12992. /**
  12993. * Build page bar
  12994. * @param {Object} self
  12995. * @param {number} cnt_whole - total record count
  12996. * @param {number} cnt_page
  12997. * @param {number} page_num - current page number
  12998. */
  12999. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  13000. var msg = self.message;
  13001. /**
  13002. * build pagination bar
  13003. */
  13004. var buildPageNav = function (self, pagebar, page_num, last_page) {
  13005. var updatePageInfo = function () {
  13006. var pageInfo = msg.page_info;
  13007. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  13008. };
  13009. if (pagebar.find('li').length === 0) {
  13010. pagebar.hide().empty();
  13011. var iconFist = 'spfont sp-first',
  13012. iconPrev = 'spfont sp-previous',
  13013. iconNext = 'spfont sp-next',
  13014. iconLast = 'spfont sp-last';
  13015. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  13016. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  13017. //pagination information
  13018. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  13019. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  13020. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  13021. pagebar.show();
  13022. } else {
  13023. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  13024. }
  13025. };
  13026. var pagebar = self.elem.navi.find('ul'),
  13027. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  13028. if (last_page === 0) page_num = 0;
  13029. else {
  13030. if (last_page < page_num) page_num = last_page;
  13031. else if (page_num === 0) page_num = 1;
  13032. }
  13033. self.prop.current_page = page_num;//update current page number
  13034. self.prop.max_page = last_page;//update page count
  13035. buildPageNav(self, pagebar, page_num, last_page);
  13036. //update paging status
  13037. var dClass = 'disabled',
  13038. first = pagebar.find('li.csFirstPage'),
  13039. previous = pagebar.find('li.csPreviousPage'),
  13040. next = pagebar.find('li.csNextPage'),
  13041. last = pagebar.find('li.csLastPage');
  13042. //first and previous
  13043. if (page_num === 1 || page_num === 0) {
  13044. if (!first.hasClass(dClass)) first.addClass(dClass);
  13045. if (!previous.hasClass(dClass)) previous.addClass(dClass);
  13046. } else {
  13047. if (first.hasClass(dClass)) first.removeClass(dClass);
  13048. if (previous.hasClass(dClass)) previous.removeClass(dClass);
  13049. }
  13050. //next and last
  13051. if (page_num === last_page || last_page === 0) {
  13052. if (!next.hasClass(dClass)) next.addClass(dClass);
  13053. if (!last.hasClass(dClass)) last.addClass(dClass);
  13054. } else {
  13055. if (next.hasClass(dClass)) next.removeClass(dClass);
  13056. if (last.hasClass(dClass)) last.removeClass(dClass);
  13057. }
  13058. if (last_page > 1) self.ePaging(); //pagination event bind
  13059. };
  13060. /**
  13061. * Render result list
  13062. * @param {Object} self
  13063. * @param {Object} json - result data
  13064. * @param {boolean} is_query - used to different from search to open and just click to open
  13065. */
  13066. SelectPage.prototype.displayResults = function (self, json, is_query) {
  13067. var p = self.option, el = self.elem;
  13068. el.results.hide().empty();
  13069. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  13070. var selectedSize = el.element_box.find('li.selected_tag').length;
  13071. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  13072. var msg = self.message.max_selected;
  13073. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  13074. return;
  13075. }
  13076. }
  13077. if (json.candidate.length) {
  13078. var arr_candidate = json.candidate,
  13079. arr_primary_key = json.keyField,
  13080. keystr = el.hidden.val(),
  13081. keyArr = keystr ? keystr.split(',') : new Array(),
  13082. itemText = '';
  13083. for (var i = 0; i < arr_candidate.length; i++) {
  13084. if (p.formatItem && $.isFunction(p.formatItem)) {
  13085. try {
  13086. itemText = p.formatItem(json.originalResult[i]);
  13087. } catch (e) {
  13088. console.error('formatItem内容格式化函数内容设置不正确!');
  13089. itemText = arr_candidate[i];
  13090. }
  13091. } else itemText = arr_candidate[i];
  13092. var list = $('<li>').html(itemText).attr({
  13093. pkey: arr_primary_key[i],
  13094. index: i
  13095. });
  13096. if (!p.formatItem) list.attr('title', itemText);
  13097. //Set selected item highlight
  13098. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  13099. list.addClass(self.css_class.selected);
  13100. }
  13101. //cache item data
  13102. list.data('dataObj', json.originalResult[i]);
  13103. el.results.append(list);
  13104. }
  13105. } else {
  13106. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  13107. self.message.not_found + '</li>';
  13108. el.results.append(li);
  13109. }
  13110. el.results.show();
  13111. if (p.multiple && p.multipleControlbar) el.control.show();
  13112. if (p.pagination) el.navi.show();
  13113. self.calcResultsSize(self);
  13114. self.setOpenStatus(self, true);
  13115. //Result item event bind
  13116. self.eResultList();
  13117. //scrolling listen
  13118. self.eScroll();
  13119. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  13120. if (is_query && json.candidate.length && p.autoSelectFirst) self.nextLine(self);
  13121. };
  13122. /**
  13123. * Calculate result list size and position
  13124. * @param {Object} self
  13125. */
  13126. SelectPage.prototype.calcResultsSize = function (self) {
  13127. var p = self.option, el = self.elem;
  13128. var rePosition = function () {
  13129. if (el.container.css('position') === 'static') {
  13130. // position: static
  13131. var offset = el.combo_input.offset();
  13132. el.result_area.css({
  13133. top: offset.top + el.combo_input.outerHeight() + 'px',
  13134. left: offset.left + 'px'
  13135. });
  13136. } else {
  13137. if (!p.pagination) {
  13138. var itemHeight = el.results.find('li:first').outerHeight(true),
  13139. listHeight = itemHeight * p.listSize;
  13140. el.results.css({
  13141. 'max-height': listHeight,
  13142. 'overflow-y': 'auto'
  13143. });
  13144. }
  13145. //handle result list show up side(left, right, up or down)
  13146. var docWidth = $(document).width(),
  13147. docHeight = $(document).height(), //the document full height
  13148. viewHeight = $(window).height(), //browser visible area height
  13149. offset = el.container.offset(),
  13150. screenScrollTop = $(window).scrollTop(),
  13151. listWidth = el.result_area.outerWidth(),
  13152. //result list height
  13153. listHeight = el.result_area.outerHeight(),
  13154. //default left used input element left
  13155. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  13156. //input element height
  13157. inputHeight = el.container.outerHeight(),
  13158. left = (offset.left + listWidth) > docWidth ?
  13159. defaultLeft - (listWidth - el.container.outerWidth()) :
  13160. defaultLeft,
  13161. //the actual top coordinate of input element(outer div)
  13162. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  13163. top = 0, dist = 5, //set distance between input element and result list
  13164. //the actual top coordinate of result list
  13165. listBottom = screenTop + inputHeight + listHeight + dist,
  13166. listTop = screenTop + listHeight + dist,
  13167. hasOverflow = docHeight > viewHeight;
  13168. if ((screenTop - screenScrollTop - dist > listHeight) &&
  13169. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  13170. (!hasOverflow && listBottom > viewHeight && screenTop >= listTop)) {
  13171. //open up
  13172. top = offset.top - listHeight - dist;
  13173. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  13174. } else {
  13175. //open down
  13176. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  13177. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  13178. top += dist;
  13179. }
  13180. return {
  13181. top: top + 'px', left: left + 'px'
  13182. };
  13183. }
  13184. };
  13185. if (el.result_area.is(':visible')) {
  13186. el.result_area.css(rePosition());
  13187. } else {
  13188. var pss = rePosition();
  13189. el.result_area.css(pss).show(1, function () {
  13190. var repss = rePosition();
  13191. if (pss.top !== repss.top || pss.left !== repss.left) el.result_area.css(repss);
  13192. });
  13193. }
  13194. };
  13195. /**
  13196. * hide result list
  13197. * @param {Object} self
  13198. */
  13199. SelectPage.prototype.hideResults = function (self) {
  13200. if (self.prop.key_paging) {
  13201. self.scrollWindow(self, true);
  13202. self.prop.key_paging = false;
  13203. }
  13204. self.setCssFocusedInput(self);
  13205. if (self.option.autoFillResult) {
  13206. //self.selectCurrentLine(self, true);
  13207. }
  13208. self.elem.results.empty();
  13209. self.elem.result_area.hide();
  13210. self.setOpenStatus(self, false);
  13211. //unbind window scroll listen
  13212. $(window).off('scroll.SelectPage');
  13213. self.abortAjax(self);
  13214. self.setButtonAttrDefault();
  13215. };
  13216. /**
  13217. * set plugin to disabled / enabled
  13218. * @param self
  13219. * @param disabled
  13220. */
  13221. SelectPage.prototype.disabled = function (self, disabled) {
  13222. var p = self.option, el = self.elem;
  13223. if ($.type(disabled) === 'undefined') return el.combo_input.prop('disabled');
  13224. if ($.type(disabled) === 'boolean') {
  13225. el.combo_input.prop('disabled', disabled);
  13226. if (disabled) el.container.addClass(self.css_class.disabled);
  13227. else el.container.removeClass(self.css_class.disabled);
  13228. }
  13229. };
  13230. /**
  13231. * Go fist page
  13232. * @param {Object} self
  13233. */
  13234. SelectPage.prototype.firstPage = function (self) {
  13235. if (self.prop.current_page > 1) {
  13236. self.prop.current_page = 1;
  13237. self.prop.page_move = true;
  13238. self.suggest(self);
  13239. }
  13240. };
  13241. /**
  13242. * Go previous page
  13243. * @param {Object} self
  13244. */
  13245. SelectPage.prototype.prevPage = function (self) {
  13246. if (self.prop.current_page > 1) {
  13247. self.prop.current_page--;
  13248. self.prop.page_move = true;
  13249. self.suggest(self);
  13250. }
  13251. };
  13252. /**
  13253. * Go next page
  13254. * @param {Object} self
  13255. */
  13256. SelectPage.prototype.nextPage = function (self) {
  13257. if (self.prop.current_page < self.prop.max_page) {
  13258. self.prop.current_page++;
  13259. self.prop.page_move = true;
  13260. self.suggest(self);
  13261. }
  13262. };
  13263. /**
  13264. * Go last page
  13265. * @param {Object} self
  13266. */
  13267. SelectPage.prototype.lastPage = function (self) {
  13268. if (self.prop.current_page < self.prop.max_page) {
  13269. self.prop.current_page = self.prop.max_page;
  13270. self.prop.page_move = true;
  13271. self.suggest(self);
  13272. }
  13273. };
  13274. /**
  13275. * do something after select/unSelect action
  13276. * @param {Object} self
  13277. * @param {boolean} reOpen
  13278. */
  13279. SelectPage.prototype.afterAction = function (self, reOpen) {
  13280. self.inputResize(self);
  13281. self.elem.combo_input.change();
  13282. self.setCssFocusedInput(self);
  13283. if (self.prop.init_set) return;
  13284. if (self.option.multiple) {
  13285. if (self.option.selectToCloseList) {
  13286. self.hideResults(self);
  13287. self.elem.combo_input.blur();
  13288. }
  13289. if (!self.option.selectToCloseList && reOpen) {
  13290. self.suggest(self);
  13291. self.elem.combo_input.focus();
  13292. }
  13293. } else {
  13294. self.hideResults(self);
  13295. self.elem.combo_input.blur();
  13296. }
  13297. };
  13298. /**
  13299. * Select current list item
  13300. * @param {Object} self
  13301. * @param {boolean} is_enter_key
  13302. */
  13303. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  13304. self.scrollWindow(self, true);
  13305. var p = self.option, current = self.getCurrentLine(self);
  13306. if (current) {
  13307. var data = current.data('dataObj');
  13308. var text = data[p.showField] || current.text();
  13309. var value = current.attr('pkey');
  13310. if (!p.multiple) {
  13311. self.elem.combo_input.val(text);
  13312. self.elem.hidden.val(value);
  13313. } else {
  13314. //build tags in multiple selection mode
  13315. self.elem.combo_input.val('');
  13316. var item = {text: text, value: value};
  13317. if (!self.isAlreadySelected(self, item)) {
  13318. self.addNewTag(self, data, item);
  13319. self.tagValuesSet(self);
  13320. }
  13321. }
  13322. if (p.selectOnly) self.setButtonAttrDefault();
  13323. //Select item callback
  13324. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(data, self);
  13325. self.prop.prev_value = self.elem.combo_input.val();
  13326. self.prop.selected_text = self.elem.combo_input.val();
  13327. self.putClearButton();
  13328. }
  13329. self.afterAction(self, true);
  13330. };
  13331. /**
  13332. * Show clear button when item selected in single selection mode
  13333. */
  13334. SelectPage.prototype.putClearButton = function () {
  13335. if (!this.option.multiple && !this.elem.combo_input.prop('disabled')) this.elem.container.append(this.elem.clear_btn);
  13336. };
  13337. /**
  13338. * Select all list item
  13339. * @param {Object} self
  13340. */
  13341. SelectPage.prototype.selectAllLine = function (self) {
  13342. var p = self.option, jsonarr = new Array();
  13343. self.elem.results.find('li').each(function (i, row) {
  13344. var $row = $(row), data = $row.data('dataObj');
  13345. var text = data[p.showField] || $row.text();
  13346. var value = $row.attr('pkey');
  13347. var item = {text: text, value: value};
  13348. if (!self.isAlreadySelected(self, item)) {
  13349. self.addNewTag(self, data, item);
  13350. self.tagValuesSet(self);
  13351. }
  13352. jsonarr.push(data);
  13353. //limited max selected items
  13354. if ($.type(p.maxSelectLimit) === 'number' &&
  13355. p.maxSelectLimit > 0 &&
  13356. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').length) {
  13357. return false;
  13358. }
  13359. });
  13360. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(jsonarr, self);
  13361. self.afterAction(self, true);
  13362. };
  13363. /**
  13364. * Cancel select all item in current page
  13365. * @param {Object} self
  13366. */
  13367. SelectPage.prototype.unSelectAllLine = function (self) {
  13368. var p = self.option, size = self.elem.results.find('li').length, ds = [];
  13369. self.elem.results.find('li').each(function (i, row) {
  13370. var key = $(row).attr('pkey');
  13371. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  13372. if (tag.length) ds.push(tag.data('dataObj'));
  13373. self.removeTag(self, tag);
  13374. });
  13375. self.afterAction(self, true);
  13376. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13377. };
  13378. /**
  13379. * Clear all selected items
  13380. * @param {Object} self
  13381. * @param {boolean} open - open list after clear selected item
  13382. */
  13383. SelectPage.prototype.clearAll = function (self, open) {
  13384. var p = self.option, ds = [];
  13385. if (p.multiple) {
  13386. self.elem.element_box.find('li.selected_tag').each(function (i, row) {
  13387. ds.push($(row).data('dataObj'));
  13388. row.remove();
  13389. });
  13390. self.elem.element_box.find('li.selected_tag').remove();
  13391. }
  13392. self.reset(self);
  13393. self.afterAction(self, open);
  13394. if (p.multiple) {
  13395. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13396. } else self.elem.clear_btn.remove();
  13397. };
  13398. /**
  13399. * reset
  13400. */
  13401. SelectPage.prototype.reset = function (self) {
  13402. self.elem.combo_input.val('');
  13403. self.elem.hidden.val('');
  13404. self.prop.prev_value = '';
  13405. self.prop.selected_text = '';
  13406. self.prop.current_page = 1;
  13407. };
  13408. /**
  13409. * Get current highlight item
  13410. * @param {Object} self
  13411. */
  13412. SelectPage.prototype.getCurrentLine = function (self) {
  13413. if (self.elem.result_area.is(':hidden')) return false;
  13414. var obj = self.elem.results.find('li.' + self.css_class.select);
  13415. if (obj.length) return obj;
  13416. else return false;
  13417. };
  13418. /**
  13419. * Check the result item is already selected or not
  13420. * @param {Object} self
  13421. * @param {Object} item - item info
  13422. */
  13423. SelectPage.prototype.isAlreadySelected = function (self, item) {
  13424. var isExist = false;
  13425. if (item.value) {
  13426. var keys = self.elem.hidden.val();
  13427. if (keys) {
  13428. var karr = keys.split(',');
  13429. if (karr && karr.length && $.inArray(item.value, karr) != -1) isExist = true;
  13430. }
  13431. }
  13432. return isExist;
  13433. };
  13434. /**
  13435. * Add a new tag in multiple selection mode
  13436. * @param {Object} self
  13437. * @param {object} data - raw row data
  13438. * @param {Object} item
  13439. */
  13440. SelectPage.prototype.addNewTag = function (self, data, item) {
  13441. if (!self.option.multiple || !data || !item) return;
  13442. var tmp = self.template.tag.content, tag;
  13443. tmp = tmp.replace(self.template.tag.textKey, item.text);
  13444. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  13445. tag = $(tmp);
  13446. tag.data('dataObj', data);
  13447. if (self.elem.combo_input.prop('disabled')) tag.find('span.tag_close').hide();
  13448. self.elem.combo_input.closest('li').before(tag);
  13449. };
  13450. /**
  13451. * Remove a tag in multiple selection mode
  13452. * @param {Object} self
  13453. * @param {Object} item
  13454. */
  13455. SelectPage.prototype.removeTag = function (self, item) {
  13456. var key = $(item).attr('itemvalue');
  13457. var keys = self.elem.hidden.val();
  13458. if ($.type(key) != 'undefined' && keys) {
  13459. var keyarr = keys.split(','),
  13460. index = $.inArray(key.toString(), keyarr);
  13461. if (index != -1) {
  13462. keyarr.splice(index, 1);
  13463. self.elem.hidden.val(keyarr.toString()).trigger("change");
  13464. }
  13465. }
  13466. $(item).remove();
  13467. self.inputResize(self);
  13468. };
  13469. /**
  13470. * Selected item value(keyField) put in to hidden element
  13471. * @param {Object} self
  13472. */
  13473. SelectPage.prototype.tagValuesSet = function (self) {
  13474. if (!self.option.multiple) return;
  13475. var tags = self.elem.element_box.find('li.selected_tag');
  13476. if (tags && tags.length) {
  13477. var result = new Array();
  13478. $.each(tags, function (i, li) {
  13479. var v = $(li).attr('itemvalue');
  13480. if ($.type(v) !== 'undefined') result.push(v);
  13481. });
  13482. if (result.length) {
  13483. self.elem.hidden.val(result.join(',')).trigger("change");
  13484. }
  13485. }
  13486. };
  13487. /**
  13488. * auto resize input element width in multiple select mode
  13489. * @param {Object} self
  13490. */
  13491. SelectPage.prototype.inputResize = function (self) {
  13492. if (!self.option.multiple) return;
  13493. var width = '',
  13494. inputLi = self.elem.combo_input.closest('li');
  13495. var setDefaultSize = function (self, inputLi) {
  13496. inputLi.removeClass('full_width');
  13497. var minimumWidth = self.elem.combo_input.val().length + 1,
  13498. width = (minimumWidth * 0.75) + 'em';
  13499. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  13500. };
  13501. if (self.elem.element_box.find('li.selected_tag').length === 0) {
  13502. if (!inputLi.hasClass('full_width')) inputLi.addClass('full_width');
  13503. if (self.elem.combo_input.attr('placeholder_bak')) {
  13504. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  13505. }
  13506. } else setDefaultSize(self, inputLi);
  13507. };
  13508. /**
  13509. * Move to next line
  13510. * @param {Object} self
  13511. */
  13512. SelectPage.prototype.nextLine = function (self) {
  13513. var obj = self.getCurrentLine(self), idx;
  13514. if (!obj) idx = -1;
  13515. else {
  13516. idx = self.elem.results.children('li').index(obj);
  13517. obj.removeClass(self.css_class.select);
  13518. }
  13519. idx++;
  13520. if (idx < self.elem.results.children('li').length) {
  13521. var next = self.elem.results.children('li').eq(idx);
  13522. next.addClass(self.css_class.select);
  13523. self.setCssFocusedResults(self);
  13524. } else self.setCssFocusedInput(self);
  13525. self.scrollWindow(self, false);
  13526. };
  13527. /**
  13528. * Move to previous line
  13529. * @param {Object} self
  13530. */
  13531. SelectPage.prototype.prevLine = function (self) {
  13532. var obj = self.getCurrentLine(self), idx;
  13533. if (!obj) idx = self.elem.results.children('li').length;
  13534. else {
  13535. idx = self.elem.results.children('li').index(obj);
  13536. obj.removeClass(self.css_class.select);
  13537. }
  13538. idx--;
  13539. if (idx > -1) {
  13540. var prev = self.elem.results.children('li').eq(idx);
  13541. prev.addClass(self.css_class.select);
  13542. self.setCssFocusedResults(self);
  13543. } else self.setCssFocusedInput(self);
  13544. self.scrollWindow(self, false);
  13545. };
  13546. /**
  13547. * SelectPage plugin definition
  13548. * @global
  13549. * @param option {Object} init plugin option
  13550. */
  13551. function Plugin(option) {
  13552. return this.each(function () {
  13553. var $this = $(this),
  13554. data = $this.data(SelectPage.dataKey),
  13555. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  13556. if (!data) $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  13557. });
  13558. }
  13559. /**
  13560. * Get plugin object
  13561. * @param {object} obj
  13562. * @returns
  13563. */
  13564. function getPlugin(obj) {
  13565. return $(obj).closest('div.sp_container').find('input.sp_input');
  13566. }
  13567. /**
  13568. * Clear all selected item
  13569. */
  13570. function ClearSelected() {
  13571. return this.each(function () {
  13572. var $this = getPlugin(this),
  13573. data = $this.data(SelectPage.dataKey);
  13574. if (data) {
  13575. data.prop.init_set = true;
  13576. data.clearAll(data);
  13577. data.prop.init_set = false;
  13578. }
  13579. });
  13580. }
  13581. /**
  13582. * Refresh result list
  13583. * use case:
  13584. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  13585. * 2.refresh selected item show content/tag text
  13586. */
  13587. function SelectedRefresh() {
  13588. return this.each(function () {
  13589. var $this = getPlugin(this),
  13590. data = $this.data(SelectPage.dataKey);
  13591. if (data && data.elem.hidden.val())
  13592. data.setInitRecord(true);
  13593. });
  13594. }
  13595. /**
  13596. * Modify plugin datasource, only work on json datasource mode
  13597. * @param {array} data - new datasource
  13598. * @example
  13599. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  13600. */
  13601. function ModifyDataSource(data) {
  13602. return this.each(function () {
  13603. if (data && $.isArray(data)) {
  13604. var $this = getPlugin(this),
  13605. plugin = $this.data(SelectPage.dataKey);
  13606. if (plugin) {
  13607. plugin.clearAll(plugin);
  13608. plugin.option.data = data;
  13609. }
  13610. }
  13611. });
  13612. }
  13613. /**
  13614. * Get plugin disabled status or Modify plugin disabled status
  13615. * @param disabled {boolean} set disabled status
  13616. */
  13617. function PluginDisabled(disabled) {
  13618. var status = false;
  13619. this.each(function () {
  13620. var $this = getPlugin(this),
  13621. plugin = $this.data(SelectPage.dataKey);
  13622. if (plugin) {
  13623. if ($.type(disabled) !== 'undefined')
  13624. plugin.disabled(plugin, disabled);
  13625. else
  13626. status = plugin.disabled(plugin);
  13627. }
  13628. });
  13629. return status;
  13630. }
  13631. /**
  13632. * Get selected item text
  13633. * @returns {string}
  13634. */
  13635. function GetInputText() {
  13636. var str = '';
  13637. this.each(function () {
  13638. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  13639. if (data) {
  13640. if (data.option.multiple) {
  13641. var tags = [];
  13642. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  13643. tags.push($(tag).text());
  13644. });
  13645. str += tags.toString();
  13646. } else {
  13647. str += data.elem.combo_input.val();
  13648. }
  13649. }
  13650. });
  13651. return str;
  13652. }
  13653. var old = $.fn.selectPage;
  13654. $.fn.selectPage = Plugin;
  13655. $.fn.selectPage.Constructor = SelectPage;
  13656. $.fn.selectPageClear = ClearSelected;
  13657. $.fn.selectPageRefresh = SelectedRefresh;
  13658. $.fn.selectPageData = ModifyDataSource;
  13659. $.fn.selectPageDisabled = PluginDisabled;
  13660. $.fn.selectPageText = GetInputText;
  13661. // SelectPage no conflict
  13662. // =================
  13663. $.fn.selectPage.noConflict = function () {
  13664. $.fn.selectPage = old;
  13665. return this;
  13666. };
  13667. })(window.jQuery);
  13668. define("selectpage", function(){});